Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion frontend/src/components/layout/Navigation/Annotator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export const Annotator: React.FC<{ className?: string, children: ReactNode, load
<NavigationMenu.Item>
<Link to="/annotation-campaign/$campaignID/phase/$phaseType"
params={ { campaignID: campaign.id, phaseType } }
search={ search }>
search={ search }
replace>
Back to campaign
</Link>
</NavigationMenu.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export const NavigationButtons: React.FC = () => {
const navPrevious = useCallback(async () => {
if (isPending) return;
if (!info?.previousSpectrogramId) return;
if (await canNavigate()) openAnnotator(info.previousSpectrogramId, { replace: true })
if (await canNavigate()) openAnnotator(info.previousSpectrogramId)
}, [ openAnnotator, isPending, info, canNavigate ])
const navNext = useCallback(async () => {
if (isPending) return;
if (!info?.nextSpectrogramId) return;
if (await canNavigate()) openAnnotator(info.nextSpectrogramId, { replace: true })
if (await canNavigate()) openAnnotator(info.nextSpectrogramId)
}, [ canNavigate, openAnnotator, isPending, info ])

useHotkey('ArrowLeft', navPrevious)
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/Annotator/Navigation/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ export const useOpenAnnotator = () => {
const search: any = useSearch({ strict: false });
const navigate = useNavigate()

return useCallback((spectrogramID: string, options?: { resume?: boolean, replace?: boolean }) => {
return useCallback((spectrogramID: string, options?: { resume?: boolean }) => {
const _search = { ...search }
if (options?.resume) _search.onlyAssigned = true
navigate({
to: '/annotation-campaign/$campaignID/phase/$phaseType/spectrogram/$spectrogramID',
params: { ...routeParams, spectrogramID },
search: _search,
replace: options?.replace,
replace: true,
});
}, [ routeParams, search, navigate ])
}
4 changes: 2 additions & 2 deletions frontend/src/features/Annotator/submit.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ export const useAnnotatorSubmit = () => {
useEffect(() => {
if (!isSuccess) return;
if (info?.nextSpectrogramId) {
openAnnotator(info.nextSpectrogramId, { replace: true });
openAnnotator(info.nextSpectrogramId);
} else {
navigate({
to: '/annotation-campaign/$campaignID/phase/$phaseType',
params, search,
params, search, replace: true
})
}
}, [ isSuccess, navigate ]);
Expand Down
Loading