diff --git a/frontend/src/features/SideWindow/Menu/index.tsx b/frontend/src/features/SideWindow/Menu/index.tsx index 7ea5530837..352461a712 100644 --- a/frontend/src/features/SideWindow/Menu/index.tsx +++ b/frontend/src/features/SideWindow/Menu/index.tsx @@ -20,7 +20,7 @@ export function Menu({ selectedMenu }: MenuProps) { data-cy="side-window-menu-mission-list" Icon={Icon.MissionAction} iconSize={26} - onClick={() => dispatch(openSideWindowPath({ menu: SideWindowMenuKey.MISSION_LIST }, false, true))} + onClick={() => dispatch(openSideWindowPath({ menu: SideWindowMenuKey.MISSION_LIST }))} role="menuitem" selected={selectedMenu === SideWindowMenuKey.MISSION_LIST} title={SideWindowMenuLabel.MISSION_LIST} @@ -29,9 +29,7 @@ export function Menu({ selectedMenu }: MenuProps) { data-cy="side-window-menu-alerts" Icon={Icon.Alert} iconSize={26} - onClick={() => - dispatch(openSideWindowPath({ menu: SideWindowMenuKey.ALERT_LIST_AND_REPORTING_LIST }, false, true)) - } + onClick={() => dispatch(openSideWindowPath({ menu: SideWindowMenuKey.ALERT_LIST_AND_REPORTING_LIST }))} role="menuitem" selected={selectedMenu === SideWindowMenuKey.ALERT_LIST_AND_REPORTING_LIST} title={SideWindowMenuLabel.ALERT_LIST_AND_REPORTING_LIST} @@ -41,7 +39,7 @@ export function Menu({ selectedMenu }: MenuProps) { aria-label={SideWindowMenuKey.PRIOR_NOTIFICATION_LIST} Icon={Icon.Fishery} iconSize={26} - onClick={() => dispatch(openSideWindowPath({ menu: SideWindowMenuKey.PRIOR_NOTIFICATION_LIST }, false, true))} + onClick={() => dispatch(openSideWindowPath({ menu: SideWindowMenuKey.PRIOR_NOTIFICATION_LIST }))} role="menuitem" selected={selectedMenu === SideWindowMenuKey.PRIOR_NOTIFICATION_LIST} title={SideWindowMenuLabel.PRIOR_NOTIFICATION_LIST} @@ -51,7 +49,7 @@ export function Menu({ selectedMenu }: MenuProps) { data-cy="side-window-menu-beacon-malfunctions" Icon={Icon.Vms} iconSize={26} - onClick={() => dispatch(openSideWindowPath({ menu: SideWindowMenuKey.BEACON_MALFUNCTION_BOARD }, false, true))} + onClick={() => dispatch(openSideWindowPath({ menu: SideWindowMenuKey.BEACON_MALFUNCTION_BOARD }))} role="menuitem" selected={selectedMenu === SideWindowMenuKey.BEACON_MALFUNCTION_BOARD} title={SideWindowMenuLabel.BEACON_MALFUNCTION_BOARD} diff --git a/frontend/src/features/SideWindow/useCases/openSideWindowPath.ts b/frontend/src/features/SideWindow/useCases/openSideWindowPath.ts index fbc5c80925..c30928a743 100644 --- a/frontend/src/features/SideWindow/useCases/openSideWindowPath.ts +++ b/frontend/src/features/SideWindow/useCases/openSideWindowPath.ts @@ -7,12 +7,8 @@ import type { MainAppThunk } from '../../../store' import type { SideWindow } from '../SideWindow.types' export const openSideWindowPath = - ( - path: SideWindow.Path, - withoutConfirmation: boolean = false, - isSameWindow: boolean = false - ): MainAppThunk> => - async (dispatch, getState) => { + (path: SideWindow.Path, withoutConfirmation: boolean = false): MainAppThunk => + (dispatch, getState) => { const { missionForm, sideWindow } = getState() if ( @@ -21,14 +17,14 @@ export const openSideWindowPath = sideWindow.status !== SideWindowStatus.CLOSED && missionForm.isDraftDirty ) { - await dispatch(askForSideWindowDraftCancellationConfirmation(path)) + dispatch(askForSideWindowDraftCancellationConfirmation(path)) return false } - await dispatch(sideWindowActions.openOrFocusAndGoTo(getFullPathFromPath(path))) + dispatch(sideWindowActions.openOrFocusAndGoTo(getFullPathFromPath(path))) - if (!isSameWindow) { + if (sideWindow.status === SideWindowStatus.CLOSED && !window.location.href.includes('side_window')) { window.open('/side_window', 'MonitorFish', `height=1200,width=${window.innerWidth}`) }