Skip to content

Commit

Permalink
Missions - Correction de l'ouverture d'une mission (#2935)
Browse files Browse the repository at this point in the history
## Linked issues


----

- [ ] Tests E2E (Cypress)
  • Loading branch information
louptheron authored Feb 15, 2024
2 parents f6f8344 + 0a45613 commit f0f54ad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/src/features/VesselSidebar/Controls/Control.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useMainAppSelector } from '@hooks/useMainAppSelector'
import { Accent, Button, Tag, TagBullet, TagGroup, THEME } from '@mtes-mct/monitor-ui'
import { useCallback, useMemo } from 'react'
import styled from 'styled-components'
Expand All @@ -23,6 +24,7 @@ type ControlProps = {
export function Control({ control, isLastItem }: ControlProps) {
const isSuperUser = useIsSuperUser()
const dispatch = useMainAppDispatch()
const openedMissionDraft = useMainAppSelector(store => store.mission.draft)
const numberOfInfractions = useMemo(() => getNumberOfInfractions(control), [control])
const gearAndSpeciesInfractionsLength = useMemo(
() => control.gearInfractions.length + control.speciesInfractions.length,
Expand Down Expand Up @@ -140,7 +142,7 @@ export function Control({ control, isLastItem }: ControlProps) {
</OtherComments>
)}
{isSuperUser && (
<ModifyButton accent={Accent.SECONDARY} onClick={openMission}>
<ModifyButton accent={Accent.SECONDARY} disabled={!!openedMissionDraft} onClick={openMission}>
Ouvrir le contrôle
</ModifyButton>
)}
Expand Down

0 comments on commit f0f54ad

Please sign in to comment.