-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Missions] Nouveau tableau de missions pour régler le souci de scroll (…
…#474) - Resolve #230 - Ajout d'une librairie eslint pour éviter de commiter les tests cypress en `it.only`
- Loading branch information
Showing
22 changed files
with
425 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 6 additions & 23 deletions
29
frontend/src/features/missions/MissionsList/CellEditMission.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,15 @@ | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
import { Button, Icon, Size } from '@mtes-mct/monitor-ui' | ||
import { useDispatch } from 'react-redux' | ||
import { IconButton, Table } from 'rsuite' | ||
import styled from 'styled-components' | ||
|
||
import { editMission } from '../../../domain/use_cases/missions/editMission' | ||
import { ReactComponent as EditIconSVG } from '../../../uiMonitor/icons/Edit.svg' | ||
|
||
export function CellEditMission({ dataKey, rowData, ...props }: { dataKey?: any; rowData?: any }) { | ||
export function CellEditMission({ id }: { id: number }) { | ||
const dispatch = useDispatch() | ||
const setMission = () => dispatch(editMission(rowData.id)) | ||
const setMission = () => dispatch(editMission(id)) | ||
|
||
return ( | ||
<CustomCell {...props}> | ||
<IconButton | ||
appearance="primary" | ||
data-cy="edit-mission" | ||
icon={<EditIconSVG className="rs-icon" />} | ||
onClick={setMission} | ||
size="sm" | ||
> | ||
Editer | ||
</IconButton> | ||
</CustomCell> | ||
<Button data-cy="edit-mission" Icon={Icon.Edit} onClick={setMission} size={Size.SMALL}> | ||
Editer | ||
</Button> | ||
) | ||
} | ||
|
||
const CustomCell = styled(Table.Cell)` | ||
.rs-table-cell-content { | ||
padding-top: 10px; | ||
} | ||
` |
28 changes: 6 additions & 22 deletions
28
frontend/src/features/missions/MissionsList/CellLocalizeMission.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,24 @@ | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
import { Accent, Icon, IconButton } from '@mtes-mct/monitor-ui' | ||
import GeoJSON from 'ol/format/GeoJSON' | ||
import { useDispatch } from 'react-redux' | ||
import { IconButton, Table } from 'rsuite' | ||
import styled from 'styled-components' | ||
|
||
import { OPENLAYERS_PROJECTION } from '../../../domain/entities/map/constants' | ||
import { setFitToExtent } from '../../../domain/shared_slices/Map' | ||
import { ReactComponent as LocalizeIconSVG } from '../../../uiMonitor/icons/Focus_zones.svg' | ||
|
||
export function CellLocalizeMission({ dataKey, rowData, ...props }: { dataKey?: any; rowData?: any }) { | ||
export function CellLocalizeMission({ geom }: { geom: any }) { | ||
const dispatch = useDispatch() | ||
|
||
if (!rowData.geom) { | ||
return <CustomCell {...props}>-</CustomCell> | ||
if (!geom) { | ||
return <span>-</span> | ||
} | ||
const handleZoomToMission = () => { | ||
const feature = new GeoJSON({ | ||
featureProjection: OPENLAYERS_PROJECTION | ||
}).readFeature(rowData.geom) | ||
}).readFeature(geom) | ||
|
||
const extent = feature?.getGeometry()?.getExtent() | ||
dispatch(setFitToExtent(extent)) | ||
} | ||
|
||
return ( | ||
<CustomCell {...props}> | ||
<IconButton icon={<LocalizeIcon className="rs-icon" />} onClick={handleZoomToMission} size="md" /> | ||
</CustomCell> | ||
) | ||
return <IconButton accent={Accent.TERTIARY} Icon={Icon.FocusZones} onClick={handleZoomToMission} /> | ||
} | ||
|
||
const LocalizeIcon = styled(LocalizeIconSVG)` | ||
width: 20px; | ||
` | ||
const CustomCell = styled(Table.Cell)` | ||
.rs-table-cell-content { | ||
padding-top: 7px; | ||
} | ||
` |
14 changes: 0 additions & 14 deletions
14
frontend/src/features/missions/MissionsList/CellMissionSource.tsx
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
frontend/src/features/missions/MissionsList/CellMissionType.tsx
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
frontend/src/features/missions/MissionsList/CellNumberOfControls.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.