Skip to content

Commit

Permalink
remove prev and next from top header
Browse files Browse the repository at this point in the history
  • Loading branch information
sumn2u committed Jun 18, 2024
1 parent bc1fa16 commit 5655439
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 65 deletions.
9 changes: 0 additions & 9 deletions client/src/Annotation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,8 @@ export default () => {
onSelectJump={onSelectJumpHandle}
showTags={true}
selectedTool= {getToolSelectionType(settings.configuration.regions)}
onNextImage={() => {
const updatedIndex = (selectedImageIndex + 1) % imageNames.length
changeSelectedImageIndex(isNaN(updatedIndex ) ? 0 : updatedIndex)
}}
onPrevImage={() => {
const updatedIndex = (selectedImageIndex - 1 + imageNames.length) % imageNames.length
changeSelectedImageIndex(isNaN(updatedIndex ) ? 0 : updatedIndex)
}}
openDocs={() => window.open(config.DOCS_URL, '_blank')}
hideSettings={true}
disabledNextAndPrev={settings.images.length <= 1}
selectedImageIndex={selectedImageIndex}
/>)}
</>
Expand Down
20 changes: 0 additions & 20 deletions client/src/Annotator/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import videoReducer from "./reducers/video-reducer.js"
import PropTypes from "prop-types"
import noopReducer from "./reducers/noop-reducer.js"
import {useTranslation} from "react-i18next"
import getActiveImage from "./reducers/get-active-image.js"
import { saveActiveImage, saveData, splitRegionData, getImageData} from "../utils/send-data-to-server"
import { useSnackbar} from "../SnackbarContext/index.jsx"
export const Annotator = ({
Expand Down Expand Up @@ -46,18 +45,13 @@ export const Annotator = ({
videoTime = 0,
videoName,
onExit,
onNextImage,
showMask,
settings,
onPrevImage,
keypointDefinitions,
onSelectJump,
openDocs,
hideHeader,
hideHeaderText,
hideNext,
hidePrev,
disabledNextAndPrev,
hideClone,
hideSettings,
hideSave,
Expand Down Expand Up @@ -164,10 +158,6 @@ export const Annotator = ({
} else {
return onExit(without(state, "history"));
}
} else if (action.buttonName === "Next" && onNextImage) {
return onNextImage(without(state, "history"));
} else if (action.buttonName === "Prev" && onPrevImage) {
return onPrevImage(without(state, "history"));
} else if (action.buttonName === "Docs" ) {
return openDocs();
}
Expand Down Expand Up @@ -198,16 +188,11 @@ export const Annotator = ({
return (
<MainLayout
RegionEditLabel={RegionEditLabel}
alwaysShowNextButton={Boolean(onNextImage)}
alwaysShowPrevButton={Boolean(onPrevImage)}
state={state}
dispatch={dispatch}
onRegionClassAdded={onRegionClassAdded}
hideHeader={hideHeader}
hideHeaderText={hideHeaderText}
hideNext={hideNext}
hidePrev={hidePrev}
disabledNextAndPrev={disabledNextAndPrev}
hideClone={hideClone}
hideSettings={hideSettings}
hideSave={hideSave}
Expand Down Expand Up @@ -246,15 +231,10 @@ Annotator.propTypes = {
videoTime: PropTypes.number,
videoName: PropTypes.string,
onExit: PropTypes.func.isRequired,
onNextImage: PropTypes.func,
onPrevImage: PropTypes.func,
openDocs: PropTypes.func.isRequired,
keypointDefinitions: PropTypes.object,
hideHeader: PropTypes.bool,
hideHeaderText: PropTypes.bool,
hideNext: PropTypes.bool,
hidePrev: PropTypes.bool,
disabledNextAndPrev: PropTypes.bool,
hideClone: PropTypes.bool,
hideSettings: PropTypes.bool,
settings: PropTypes.object,
Expand Down
16 changes: 0 additions & 16 deletions client/src/Annotator/reducers/general-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,22 +855,6 @@ export default (state, action) => {
case "HEADER_BUTTON_CLICKED": {
const buttonName = action.buttonName.toLowerCase()
switch (buttonName) {
case "prev": {
if (currentImageIndex === null) return state
if (currentImageIndex === 0) return state
return setNewImage(
state.images[currentImageIndex - 1],
currentImageIndex - 1
)
}
case "next": {
if (currentImageIndex === null) return state
if (currentImageIndex === state.images.length - 1) return state
return setNewImage(
state.images[currentImageIndex + 1],
currentImageIndex + 1
)
}
case "clone": {
if (currentImageIndex === null) return state
if (currentImageIndex === state.images.length - 1) return state
Expand Down
9 changes: 1 addition & 8 deletions client/src/MainLayout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,9 @@ export const MainLayout = ({
onRegionClassAdded,
hideHeader,
hideHeaderText,
hideNext = false,
hidePrev = false,
disabledNextAndPrev,
hideClone = false,
hideClone = true,
hideSettings = false,
downloadImage = false,
hideSave = false,
allImages = [],
onSelectJump,
saveActiveImage,
enabledRegionProps,
Expand Down Expand Up @@ -240,8 +235,6 @@ export const MainLayout = ({
].filter(Boolean)}
headerItems={[
{ name: "Download", label:t("btn.download"), disabled: !state.enabledDownload, hasInnerMenu: true},
!hidePrev && {name: "Prev", label: t("btn.previous"), disabled: disabledNextAndPrev},
!hideNext && {name: "Next", label: t("btn.next"), disabled: disabledNextAndPrev},
state.annotationType !== "video"
? null
: !state.videoPlaying
Expand Down
12 changes: 0 additions & 12 deletions client/src/ShortcutsManager/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,6 @@ export const useDispatchHotkeyHandlers = ({ dispatch }) => {
selectedTool: "create-pixel",
})
},
save_and_previous_sample: () => {
dispatch({
type: "HEADER_BUTTON_CLICKED",
buttonName: "Prev",
})
},
save_and_next_sample: () => {
dispatch({
type: "HEADER_BUTTON_CLICKED",
buttonName: "Next",
})
},
save_and_exit_sample: () => {
dispatch({
type: "HEADER_BUTTON_CLICKED",
Expand Down
Binary file modified sample_images/configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample_images/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5655439

Please sign in to comment.