Skip to content

Commit

Permalink
Add docs button on the annotation screen
Browse files Browse the repository at this point in the history
  • Loading branch information
linyers authored and sumn2u committed Jun 9, 2024
1 parent ef279c2 commit a639141
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions client/src/Annotator/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const Annotator = ({
onPrevImage,
keypointDefinitions,
onSelectJump,
openDocs,
hideHeader,
hideHeaderText,
hideNext,
Expand Down Expand Up @@ -169,6 +170,8 @@ export const Annotator = ({
} else if (action.buttonName === "Prev" && onPrevImage) {
saveCurrentData(getActiveImage(state).activeImage);
return onPrevImage(without(state, "history"));
} else if (action.buttonName === "Docs" ) {
return openDocs();
}
}
dispatchToReducer(action);
Expand Down Expand Up @@ -247,6 +250,7 @@ Annotator.propTypes = {
onExit: PropTypes.func.isRequired,
onNextImage: PropTypes.func,
onPrevImage: PropTypes.func,
openDocs: PropTypes.func.isRequired,
keypointDefinitions: PropTypes.object,
hideHeader: PropTypes.bool,
hideHeaderText: PropTypes.bool,
Expand Down
1 change: 1 addition & 0 deletions client/src/DemoSite/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export default () => {
const updatedIndex = (selectedImageIndex - 1 + imageNames.length) % imageNames.length
changeSelectedImageIndex(isNaN(updatedIndex ) ? 0 : updatedIndex)
}}
openDocs={() => window.open("https://annotate-docs.dwaste.live/", '_blank')}
hideSettings={true}
disabledNextAndPrev={settings.images.length <= 1}
selectedImageIndex={selectedImageIndex}
Expand Down
3 changes: 2 additions & 1 deletion client/src/Localization/translation-en-EN.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const translationEnEN = {
"btn.download": "Download",
"btn.upload_images": "Upload Images",
"btn.open_lab": "Open Lab",
"btn.docs": "Docs",
"region.no.name" : "Enter a Name",
"setup.tabs.taskinfo": "Task Info",
"setup.tabs.configure": "Configure",
Expand Down Expand Up @@ -66,4 +67,4 @@ const translationEnEN = {
"more_info": "More information can be found in our documentation",
};

export default translationEnEN;
export default translationEnEN;
5 changes: 3 additions & 2 deletions client/src/MainLayout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ export const MainLayout = ({
const onClickHeaderItem = useEventCallback((item) => {
if(item.name === "Exit"){
logout()
}else {
dispatch({type: "HEADER_BUTTON_CLICKED", buttonName: item.name})
} else {
dispatch({type: "HEADER_BUTTON_CLICKED", buttonName: item.name})
}
})
const debugModeOn = Boolean(window.localStorage.$ANNOTATE_DEBUG_MODE && state)
Expand Down Expand Up @@ -236,6 +236,7 @@ export const MainLayout = ({
!nextImageHasRegions &&
activeImage.regions && {name: "Clone", label: t("btn.clone")},
!hideSave && {name: "Save", label:t("btn.save"), disabled: !state.hasNewChange, icon: <Save />},
{name: "Docs", label: t("btn.docs")},
!hideSettings && {name: "Settings", label: t("btn.settings")},
{name: "Exit", label:t("btn.exit"), icon: <ExitToApp />}
].filter(Boolean)}
Expand Down
2 changes: 2 additions & 0 deletions client/src/workspace/icon-mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import HelpIcon from "@mui/icons-material/Help"
import ExitIcon from "@mui/icons-material/ExitToApp"
import QueuePlayNextIcon from "@mui/icons-material/QueuePlayNext"
import HotkeysIcon from "@mui/icons-material/Keyboard"
import DescriptionIcon from "@mui/icons-material/Description"

export const iconMapping = {
back: BackIcon,
Expand All @@ -26,6 +27,7 @@ export const iconMapping = {
clone: QueuePlayNextIcon,
hotkeys: HotkeysIcon,
shortcuts: HotkeysIcon,
docs: DescriptionIcon,
}

export default iconMapping

0 comments on commit a639141

Please sign in to comment.