Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

関数とパラメーターに説明のリンク追加 #534

Open
wants to merge 5 commits into
base: develop-main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { memo, useContext, useEffect } from "react"
import { useSelector, useDispatch } from "react-redux"

import { Launch } from "@mui/icons-material"
import { Tooltip } from "@mui/material"

import { createParamFormItemComponent } from "components/common/ParamFormItemCreator"
import { SectionTitle } from "components/common/ParamSection"
import { ParamFormContext } from "components/Workspace/FlowChart/RightDrawer/ParamFormContents"
Expand All @@ -26,14 +29,31 @@ export const AlgorithmParamForm = memo(function AlgorithmParamForm() {
selectAlgorithmParamsKeyList(nodeId),
arrayEqualityFn,
)
const parameterUrl = `https://github.com/arayabrain/barebone-studio/blob/develop-main/docs/specifications/algorithm_nodes.md#${algoName.toLowerCase()}`
useEffect(() => {
if (!algoParamIsLoaded) {
dispatch(getAlgoParams({ nodeId, algoName }))
}
}, [dispatch, nodeId, algoName, algoParamIsLoaded])
return (
<div style={{ padding: 24 }}>
<SectionTitle>{algoName}</SectionTitle>
<div style={{ display: "flex" }}>
<SectionTitle>{algoName}</SectionTitle>
<a
href={parameterUrl}
target="_blank"
rel="noopener noreferrer"
style={{
textDecoration: "underline",
color: "inherit",
cursor: "pointer",
}}
>
<Tooltip title="Check Documentation">
<Launch style={{ fontSize: "16px" }} />
</Tooltip>
</a>
</div>
{paramKeyList.map((paramKey) => (
<ParamItem key={paramKey} paramKey={paramKey} />
))}
Expand Down
35 changes: 35 additions & 0 deletions frontend/src/components/Workspace/FlowChart/RightDrawer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { FC } from "react"
import { useSelector, useDispatch } from "react-redux"

import { Launch } from "@mui/icons-material"
import ChevronRightIcon from "@mui/icons-material/ChevronRight"
import { Tooltip } from "@mui/material"
import Box from "@mui/material/Box"
import Divider from "@mui/material/Divider"
import Drawer, { drawerClasses } from "@mui/material/Drawer"
Expand Down Expand Up @@ -41,6 +43,24 @@ const RightDrawer: FC = () => {
return "none"
}
})
const readTheDocsUrl =
itutu-tienday marked this conversation as resolved.
Show resolved Hide resolved
"https://optinist.readthedocs.io/en/latest/gui/workflow.html"
const useRightDrawerSettings = () => {
const mode = useSelector((state: RootState) => selectRightDrawerMode(state))

const titleLink =
mode === RIGHT_DRAWER_MODE.NWB
? `${readTheDocsUrl}#nwb-setting`
: mode === RIGHT_DRAWER_MODE.SNAKEMAKE
? `${readTheDocsUrl}#snakemane-settings`
: ""

const showLaunch =
mode === RIGHT_DRAWER_MODE.NWB || mode === RIGHT_DRAWER_MODE.SNAKEMAKE

return { titleLink, showLaunch }
}
const { titleLink, showLaunch } = useRightDrawerSettings()
return (
<StyledDrawer open={open} anchor="right" variant="persistent">
<Toolbar />
Expand All @@ -49,6 +69,21 @@ const RightDrawer: FC = () => {
<ChevronRightIcon />
</IconButton>
<Typography variant="h6">{title}</Typography>
{showLaunch && (
<a
href={titleLink}
target="_blank"
rel="noopener noreferrer"
style={{
marginLeft: "5px",
marginRight: "10px",
}}
>
<Tooltip title="Check Documentation">
<Launch style={{ fontSize: "16px" }} />
</Tooltip>
</a>
)}
</Box>
<Divider />
<MainContents>
Expand Down
Loading