Skip to content

Commit a639141

Browse files
linyerssumn2u
authored andcommitted
Add docs button on the annotation screen
1 parent ef279c2 commit a639141

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

client/src/Annotator/index.jsx

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const Annotator = ({
5252
onPrevImage,
5353
keypointDefinitions,
5454
onSelectJump,
55+
openDocs,
5556
hideHeader,
5657
hideHeaderText,
5758
hideNext,
@@ -169,6 +170,8 @@ export const Annotator = ({
169170
} else if (action.buttonName === "Prev" && onPrevImage) {
170171
saveCurrentData(getActiveImage(state).activeImage);
171172
return onPrevImage(without(state, "history"));
173+
} else if (action.buttonName === "Docs" ) {
174+
return openDocs();
172175
}
173176
}
174177
dispatchToReducer(action);
@@ -247,6 +250,7 @@ Annotator.propTypes = {
247250
onExit: PropTypes.func.isRequired,
248251
onNextImage: PropTypes.func,
249252
onPrevImage: PropTypes.func,
253+
openDocs: PropTypes.func.isRequired,
250254
keypointDefinitions: PropTypes.object,
251255
hideHeader: PropTypes.bool,
252256
hideHeaderText: PropTypes.bool,

client/src/DemoSite/index.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export default () => {
160160
const updatedIndex = (selectedImageIndex - 1 + imageNames.length) % imageNames.length
161161
changeSelectedImageIndex(isNaN(updatedIndex ) ? 0 : updatedIndex)
162162
}}
163+
openDocs={() => window.open("https://annotate-docs.dwaste.live/", '_blank')}
163164
hideSettings={true}
164165
disabledNextAndPrev={settings.images.length <= 1}
165166
selectedImageIndex={selectedImageIndex}

client/src/Localization/translation-en-EN.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const translationEnEN = {
2525
"btn.download": "Download",
2626
"btn.upload_images": "Upload Images",
2727
"btn.open_lab": "Open Lab",
28+
"btn.docs": "Docs",
2829
"region.no.name" : "Enter a Name",
2930
"setup.tabs.taskinfo": "Task Info",
3031
"setup.tabs.configure": "Configure",
@@ -66,4 +67,4 @@ const translationEnEN = {
6667
"more_info": "More information can be found in our documentation",
6768
};
6869

69-
export default translationEnEN;
70+
export default translationEnEN;

client/src/MainLayout/index.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ export const MainLayout = ({
185185
const onClickHeaderItem = useEventCallback((item) => {
186186
if(item.name === "Exit"){
187187
logout()
188-
}else {
189-
dispatch({type: "HEADER_BUTTON_CLICKED", buttonName: item.name})
188+
} else {
189+
dispatch({type: "HEADER_BUTTON_CLICKED", buttonName: item.name})
190190
}
191191
})
192192
const debugModeOn = Boolean(window.localStorage.$ANNOTATE_DEBUG_MODE && state)
@@ -236,6 +236,7 @@ export const MainLayout = ({
236236
!nextImageHasRegions &&
237237
activeImage.regions && {name: "Clone", label: t("btn.clone")},
238238
!hideSave && {name: "Save", label:t("btn.save"), disabled: !state.hasNewChange, icon: <Save />},
239+
{name: "Docs", label: t("btn.docs")},
239240
!hideSettings && {name: "Settings", label: t("btn.settings")},
240241
{name: "Exit", label:t("btn.exit"), icon: <ExitToApp />}
241242
].filter(Boolean)}

client/src/workspace/icon-mapping.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import HelpIcon from "@mui/icons-material/Help"
77
import ExitIcon from "@mui/icons-material/ExitToApp"
88
import QueuePlayNextIcon from "@mui/icons-material/QueuePlayNext"
99
import HotkeysIcon from "@mui/icons-material/Keyboard"
10+
import DescriptionIcon from "@mui/icons-material/Description"
1011

1112
export const iconMapping = {
1213
back: BackIcon,
@@ -26,6 +27,7 @@ export const iconMapping = {
2627
clone: QueuePlayNextIcon,
2728
hotkeys: HotkeysIcon,
2829
shortcuts: HotkeysIcon,
30+
docs: DescriptionIcon,
2931
}
3032

3133
export default iconMapping

0 commit comments

Comments
 (0)