diff --git a/frontend/cypress/e2e/external_monitorfish.spec.ts b/frontend/cypress/e2e/external_monitorfish.spec.ts index cfad8285c2..75840c0cb2 100644 --- a/frontend/cypress/e2e/external_monitorfish.spec.ts +++ b/frontend/cypress/e2e/external_monitorfish.spec.ts @@ -27,6 +27,7 @@ context('External MonitorFish', () => { // Vessel sidebar menus cy.get('*[data-cy="vessel-menu-identity"]').should('be.visible') + cy.get('*[data-cy="vessel-menu-summary"]').should('be.visible') cy.get('*[data-cy="vessel-menu-fishing"]').should('be.visible') cy.get('*[data-cy="vessel-menu-controls"]').should('be.visible') @@ -39,7 +40,6 @@ context('External MonitorFish', () => { .click({ timeout: 10000 }) cy.get('*[data-cy="vessel-control"]').should('not.contain', 'Ouvrir le contrôle') - cy.get('*[data-cy="vessel-menu-resume"]').should('not.exist') cy.get('*[data-cy="vessel-menu-reporting"]').should('not.exist') cy.get('*[data-cy="vessel-menu-ers-vms"]').should('not.exist') diff --git a/frontend/cypress/e2e/nav_monitorfish.spec.ts b/frontend/cypress/e2e/nav_monitorfish.spec.ts index db88f5fc72..65d8f9ec36 100644 --- a/frontend/cypress/e2e/nav_monitorfish.spec.ts +++ b/frontend/cypress/e2e/nav_monitorfish.spec.ts @@ -18,6 +18,7 @@ context('Light MonitorFish', () => { // Vessel sidebar menus cy.get('*[data-cy="vessel-menu-identity"]').should('be.visible') + cy.get('*[data-cy="vessel-menu-summary"]').should('be.visible') cy.get('*[data-cy="vessel-menu-fishing"]').should('be.visible') cy.get('*[data-cy="vessel-menu-controls"]').should('be.visible') @@ -30,7 +31,6 @@ context('Light MonitorFish', () => { .click({ timeout: 10000 }) cy.get('*[data-cy="vessel-control"]').should('not.contain', 'Ouvrir le contrôle') - cy.get('*[data-cy="vessel-menu-resume"]').should('not.exist') cy.get('*[data-cy="vessel-menu-reporting"]').should('not.exist') cy.get('*[data-cy="vessel-menu-ers-vms"]').should('not.exist') diff --git a/frontend/cypress/e2e/vessel_sidebar/offline_management.spec.ts b/frontend/cypress/e2e/vessel_sidebar/offline_management.spec.ts index 61f1437a19..edb4e5443b 100644 --- a/frontend/cypress/e2e/vessel_sidebar/offline_management.spec.ts +++ b/frontend/cypress/e2e/vessel_sidebar/offline_management.spec.ts @@ -24,7 +24,7 @@ context('Offline management', () => { cy.get('*[data-cy="vessel-sidebar-error"]').contains("Nous n'avons pas pu récupérer les informations du navire") // When clicking on Resume tab - cy.get('*[data-cy="vessel-menu-resume"').click() + cy.get('*[data-cy="vessel-menu-summary"').click() cy.wait('@openVessel') cy.get('*[data-cy="vessel-sidebar-error"]').contains("Nous n'avons pas pu récupérer les informations du navire") cy.clickButton('Réessayer') @@ -107,7 +107,7 @@ context('Offline management', () => { '&IRCS=CALLME&vesselIdentifier=INTERNAL_REFERENCE_NUMBER&trackDepth=TWELVE_HOURS&afterDateTime=&beforeDateTime=', cy.spy().as('openVesselSpyed') ) - cy.get('*[data-cy="vessel-menu-resume"').click() + cy.get('*[data-cy="vessel-menu-summary"').click() cy.get('@openVesselSpyed').should('not.have.been.called') cy.get('*[data-cy="vessel-sidebar-error"]').should('not.exist') diff --git a/frontend/src/domain/entities/authorization/constants.ts b/frontend/src/domain/entities/authorization/constants.ts index c6022bc047..668709a6a5 100644 --- a/frontend/src/domain/entities/authorization/constants.ts +++ b/frontend/src/domain/entities/authorization/constants.ts @@ -1,7 +1,3 @@ import { VesselSidebarTab } from '../vessel/vessel' -export const forbiddenVesselSidebarPaths = [ - VesselSidebarTab.SUMMARY, - VesselSidebarTab.REPORTING, - VesselSidebarTab.ERSVMS -] +export const forbiddenVesselSidebarPaths = [VesselSidebarTab.REPORTING, VesselSidebarTab.ERSVMS] diff --git a/frontend/src/features/VesselSidebar/Body.tsx b/frontend/src/features/VesselSidebar/Body.tsx index 3918eef50a..3871efc941 100644 --- a/frontend/src/features/VesselSidebar/Body.tsx +++ b/frontend/src/features/VesselSidebar/Body.tsx @@ -46,7 +46,7 @@ export function Body() { {isSuperUser && } {isSuperUser && } - {isSuperUser && vesselSidebarTab === VesselSidebarTab.SUMMARY && } + {vesselSidebarTab === VesselSidebarTab.SUMMARY && } {vesselSidebarTab === VesselSidebarTab.IDENTITY && } {vesselSidebarTab === VesselSidebarTab.VOYAGES && } {vesselSidebarTab === VesselSidebarTab.CONTROLS && } diff --git a/frontend/src/features/VesselSidebar/Summary/index.tsx b/frontend/src/features/VesselSidebar/Summary/index.tsx index 8462a91704..6b69a4746e 100644 --- a/frontend/src/features/VesselSidebar/Summary/index.tsx +++ b/frontend/src/features/VesselSidebar/Summary/index.tsx @@ -1,3 +1,6 @@ +import { useIsSuperUser } from '@hooks/authorization/useIsSuperUser' +import { useMainAppDispatch } from '@hooks/useMainAppDispatch' +import { useMainAppSelector } from '@hooks/useMainAppSelector' import { useEffect, useState } from 'react' import { FingerprintSpinner } from 'react-epic-spinners' import styled from 'styled-components' @@ -7,8 +10,6 @@ import { COLORS } from '../../../constants/constants' import { getCoordinates } from '../../../coordinates' import { WSG84_PROJECTION } from '../../../domain/entities/map/constants' import { showVessel } from '../../../domain/use_cases/vessel/showVessel' -import { useMainAppDispatch } from '../../../hooks/useMainAppDispatch' -import { useMainAppSelector } from '../../../hooks/useMainAppSelector' import { getDateTime, timeagoFrenchLocale } from '../../../utils' import InfoSVG from '../../icons/Information.svg?react' import NoVesselSVG from '../../icons/Picto_photo_navire_manquante.svg?react' @@ -19,6 +20,7 @@ timeago.register('fr', timeagoFrenchLocale) export function VesselSummary() { const dispatch = useMainAppDispatch() + const isSuperUser = useIsSuperUser() const coordinatesFormat = useMainAppSelector(state => state.map.coordinatesFormat) const { loadingVessel, selectedVessel, selectedVesselIdentity, selectedVesselPositions } = useMainAppSelector( state => state.vessel @@ -149,7 +151,7 @@ export function VesselSummary() { - + {isSuperUser && } ) : ( diff --git a/frontend/src/features/VesselSidebar/Tabs.tsx b/frontend/src/features/VesselSidebar/Tabs.tsx index 1480fd53c7..3caca76cb4 100644 --- a/frontend/src/features/VesselSidebar/Tabs.tsx +++ b/frontend/src/features/VesselSidebar/Tabs.tsx @@ -37,15 +37,13 @@ export function Tabs() { return ( - {isSuperUser && ( - showTab(VesselSidebarTab.SUMMARY)} - > -
Résumé -
- )} + showTab(VesselSidebarTab.SUMMARY)} + > +
Résumé +