Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix – Corrige les boutons du menu de gauche #3658

Merged
merged 2 commits into from
Sep 17, 2024
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
49 changes: 23 additions & 26 deletions frontend/src/features/LayersSidebar/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { AdministrativeZones } from '../../AdministrativeZone/components/Adminis
import { BaseMaps } from '../../BaseMap/components/BaseMaps'
import { MapComponent } from '../../commonStyles/MapComponent'
import { CustomZones } from '../../CustomZone/components/CustomZones'
import { MapButton } from '../../MainWindow/components/MapButtons/MapButton'
import { RegulationSearch } from '../../Regulation/components/RegulationSearch'
import { RegulatoryZoneMetadata } from '../../Regulation/components/RegulatoryZoneMetadata'
import { RegulatoryZones } from '../../Regulation/components/RegulatoryZones'
Expand All @@ -35,20 +36,19 @@ export function LayersSidebar() {
<NamespaceContext.Consumer>
{namespace => (
<>
<SidebarLayersIcon
$hasHealthcheckTextWarning={!!healthcheckTextWarning.length}
$isActive={leftMapBoxOpened === MapBox.REGULATIONS || regulatoryZoneMetadataPanelIsOpen}
$isHidden={!!previewFilteredVesselsMode}
accent={Accent.PRIMARY}
aria-label="Arbre des couches"
Icon={Icon.MapLayers}
onClick={() =>
dispatch(setLeftMapBoxOpened(leftMapBoxOpened === MapBox.REGULATIONS ? undefined : MapBox.REGULATIONS))
}
size={Size.LARGE}
title="Arbre des couches"
/>

<SidebarLayersButton isHidden={!!previewFilteredVesselsMode}>
<SidebarLayersIcon
$isActive={leftMapBoxOpened === MapBox.REGULATIONS || regulatoryZoneMetadataPanelIsOpen}
accent={Accent.PRIMARY}
aria-label="Arbre des couches"
Icon={Icon.MapLayers}
onClick={() =>
dispatch(setLeftMapBoxOpened(leftMapBoxOpened === MapBox.REGULATIONS ? undefined : MapBox.REGULATIONS))
}
size={Size.LARGE}
title="Arbre des couches"
/>
</SidebarLayersButton>
<Sidebar
$isOpen={leftMapBoxOpened === MapBox.REGULATIONS}
$isVisible={leftMapBoxOpened === MapBox.REGULATIONS || regulatoryZoneMetadataPanelIsOpen}
Expand Down Expand Up @@ -117,19 +117,16 @@ const Layers = styled.div<{
max-height: calc(100vh - ${p => (p.$hasHealthcheckTextWarning ? '210px' : '160px')});
`

const SidebarLayersIcon = styled(IconButton)<{
$hasHealthcheckTextWarning: boolean
$isActive: boolean
$isHidden: boolean
}>`
${p => (p.$isActive ? `background: ${p.theme.color.blueGray};` : '')}
${p => (p.$isActive ? `border-color: ${p.theme.color.blueGray};` : '')}
border-radius: 2px;
height: 40px;
left: 10px;
margin-top: ${p => (p.$hasHealthcheckTextWarning ? 50 : 0)}px;
const SidebarLayersButton = styled(MapButton)`
position: absolute;
top: 10px;
visibility: ${p => (p.$isHidden ? 'hidden' : 'visible')};
left: 10px;
`

const SidebarLayersIcon = styled(IconButton)<{ $isActive: boolean }>`
border-radius: 2px;
width: 40px;
height: 40px;
${p => (p.$isActive ? `background: ${p.theme.color.blueGray};` : '')}
${p => (p.$isActive ? `border-color: ${p.theme.color.blueGray};` : '')}
`
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { RTK_FORCE_REFETCH_QUERY_OPTIONS, RTK_THIRTY_SECONDS_POLLING_QUERY_OPTIONS } from '@api/constants'
import { ALL_SEAFRONT_GROUP } from '@constants/seafront'
import { MapButton } from '@features/MainWindow/components/MapButtons/MapButton'
import { useGetPriorNotificationsToVerifyQuery } from '@features/PriorNotification/priorNotificationApi'
import { sideWindowActions } from '@features/SideWindow/slice'
import { openSideWindowPath } from '@features/SideWindow/useCases/openSideWindowPath'
Expand Down Expand Up @@ -43,40 +44,31 @@ export function PriorNotificationListButton() {
}

return (
<PriorNotificationListIcon
$isActive={isActive}
$isHidden={!!previewFilteredVesselsMode}
$isSuperUser={isSuperUser}
accent={Accent.PRIMARY}
aria-label="Afficher la liste des préavis"
badgeNumber={data?.perSeafrontGroupCount && data?.perSeafrontGroupCount[ALL_SEAFRONT_GROUP]}
Icon={Icon.Fishery}
onClick={toggleSideWindow}
size={Size.LARGE}
title="Afficher la liste des préavis"
/>
<Wrapper $isSuperUser={isSuperUser} isHidden={!!previewFilteredVesselsMode}>
<PriorNotificationListIcon
$isActive={isActive}
accent={Accent.PRIMARY}
aria-label="Afficher la liste des préavis"
badgeNumber={data?.perSeafrontGroupCount && data?.perSeafrontGroupCount[ALL_SEAFRONT_GROUP]}
Icon={Icon.Fishery}
onClick={toggleSideWindow}
size={Size.LARGE}
title="Afficher la liste des préavis"
/>
</Wrapper>
)
}

const PriorNotificationListIcon = styled(IconButton)<{
$hasHealthcheckTextWarning?: boolean | undefined
$isActive: boolean
$isHidden?: boolean | undefined
$isSuperUser: boolean
}>`
${p => (p.$isActive ? `background: ${p.theme.color.blueGray};` : '')}
${p => (p.$isActive ? `border-color: ${p.theme.color.blueGray};` : '')}
border-radius: 2px;
height: 40px;
left: 10px;
margin-top: ${p => (p.$hasHealthcheckTextWarning ? 50 : 0)}px;
const Wrapper = styled(MapButton)<{ $isSuperUser: boolean }>`
position: absolute;
top: ${p => (p.$isSuperUser ? 282 : 170)}px;
visibility: ${p => (p.$isHidden ? 'hidden' : 'visible')};
width: 40px;
top: ${p => (p.$isSuperUser ? 232 : 120)}px;
left: 10px;
`

> button {
height: 40px;
width: 40px;
}
const PriorNotificationListIcon = styled(IconButton)<{ $isActive: boolean }>`
border-radius: 2px;
width: 40px;
height: 40px;
${p => (p.$isActive ? `background: ${p.theme.color.blueGray};` : '')}
${p => (p.$isActive ? `border-color: ${p.theme.color.blueGray};` : '')}
`
Loading