From cb78a63b71827452acc2dc355a4382060d71f809 Mon Sep 17 00:00:00 2001 From: nncluzu Date: Mon, 4 Sep 2023 11:24:26 +0200 Subject: [PATCH] front: rename panel to sign and LPV to PSL --- front/public/locales/en/map-settings.json | 2 +- front/public/locales/en/translation.json | 30 ++-- front/public/locales/fr/map-settings.json | 2 +- front/public/locales/fr/translation.json | 30 ++-- .../editor/components/LayersModal.tsx | 6 +- .../editor/tools/rangeEdition/components.tsx | 26 +-- .../speedSection/EditLPVSection.tsx | 143 --------------- .../speedSection/EditPSLSection.tsx | 141 +++++++++++++++ .../speedSection/LpvPanelSubSection.tsx | 53 ------ .../{LpvPanelCard.tsx => PslSignCard.tsx} | 112 ++++++------ .../speedSection/PslSignSubSection.tsx | 53 ++++++ .../SpeedSectionEditionLayers.tsx | 38 ++-- .../editor/tools/rangeEdition/tool-factory.ts | 50 +++--- .../editor/tools/rangeEdition/tools.ts | 4 +- .../editor/tools/rangeEdition/types.ts | 30 ++-- .../editor/tools/rangeEdition/utils.ts | 169 +++++++++--------- front/src/applications/editor/tools/types.ts | 6 +- front/src/applications/referenceMap/Map.tsx | 6 +- front/src/common/Map/Consts/SignalsNames.ts | 6 +- front/src/common/Map/Consts/colors.ts | 12 +- front/src/common/Map/Layers/GeoJSONs.tsx | 45 +++-- front/src/common/Map/Layers/Signals.tsx | 10 +- .../SNCF/{SNCF_LPV.tsx => SNCF_PSL.tsx} | 46 ++--- ...SNCF_LPV_PANELS.tsx => SNCF_PSL_SIGNS.tsx} | 24 +-- .../src/common/Map/Layers/geoSignalsLayers.ts | 13 +- .../Map/Settings/MapSettingsSpeedLimits.tsx | 4 +- front/src/common/Map/WarpedMap/WarpedMap.tsx | 4 +- .../components/SimulationResultsMap.tsx | 6 +- .../components/ManageTrainSchedule/Map.tsx | 6 +- front/src/reducers/map/index.ts | 4 +- front/src/reducers/osrdconf/infra_schema.json | 144 +++++++-------- front/src/types/editor.ts | 16 +- front/tests/pages/home-page-model.ts | 2 +- front/tests/pages/project-page-model.ts | 2 +- 34 files changed, 619 insertions(+), 626 deletions(-) delete mode 100644 front/src/applications/editor/tools/rangeEdition/speedSection/EditLPVSection.tsx create mode 100644 front/src/applications/editor/tools/rangeEdition/speedSection/EditPSLSection.tsx delete mode 100644 front/src/applications/editor/tools/rangeEdition/speedSection/LpvPanelSubSection.tsx rename front/src/applications/editor/tools/rangeEdition/speedSection/{LpvPanelCard.tsx => PslSignCard.tsx} (53%) create mode 100644 front/src/applications/editor/tools/rangeEdition/speedSection/PslSignSubSection.tsx rename front/src/common/Map/Layers/extensions/SNCF/{SNCF_LPV.tsx => SNCF_PSL.tsx} (82%) rename front/src/common/Map/Layers/extensions/SNCF/{SNCF_LPV_PANELS.tsx => SNCF_PSL_SIGNS.tsx} (84%) diff --git a/front/public/locales/en/map-settings.json b/front/public/locales/en/map-settings.json index 5adc7d4e28e..38063d2b302 100644 --- a/front/public/locales/en/map-settings.json +++ b/front/public/locales/en/map-settings.json @@ -23,7 +23,7 @@ "showIGNCadastre": "Cadastre ©IGN", "showOSM": "Map background OSM", "showOSMtracksections": "OSM tracks", - "sncf_lpv": "Permanent speed limits", + "sncf_psl": "Permanent speed limits", "speedlimits": "Speed limits", "stops": "Stop signs", "switches": "Switch", diff --git a/front/public/locales/en/translation.json b/front/public/locales/en/translation.json index 63cc91361cd..02eea5677e0 100644 --- a/front/public/locales/en/translation.json +++ b/front/public/locales/en/translation.json @@ -97,7 +97,7 @@ "catenaries": "Catenaries", "detectors": "Detectors", "errors": "Errors", - "lpv-lpv_panels": "Permanent speed limits", + "psl-psl_signs": "Permanent speed limits", "routes": "Routes", "signals": "Signals", "switches": "Switches", @@ -327,30 +327,30 @@ "reset-speed-section": "Cancel the current modifications" }, "add-new-speed-limit": "Add new speed limit", - "add-panel": "Add a panel from {{panelType}} type", + "add-sign": "Add a sign from {{signType}} type", "add-track-range": "Click to link to:", "additional-speed-limit": "Additional speed limits", - "hovered-panel": "Panel {{panelType}}", + "hovered-sign": "Sign {{signType}}", "label": "Speed section tool", "main-speed-limit": "Default speed limit", "move-range-extremity": "Click to move the end:", "new-tag": "Composition code", - "panel-angle-geo": "Angle Geo", - "panel-angle-sch": "Angle Sch", - "panel-category": "Panel(s) {{panelType}}", - "panel-select": "Select", - "panel-remove": "Remove panel", - "panel-position": "Position", - "panel-track-id": "Track section id", - "panel-type": "Type", - "panel-side": "Side", - "panel-value": "Speed", - "panels-section-list": "Section panels list", + "sign-angle-geo": "Angle Geo", + "sign-angle-sch": "Angle Sch", + "sign-category": "Sign(s) {{signType}}", + "sign-select": "Select", + "sign-remove": "Remove sign", + "sign-position": "Position", + "sign-track-id": "Track section id", + "sign-type": "Type", + "sign-side": "Side", + "sign-value": "Speed", + "signs-section-list": "Section signs list", "remove-track-range": "Click to detatch from:", "save-existing-speed-section": "Save modifications", "save-new-speed-section": "Save the new speed limit", "speed-limits": "Speed limits", - "toggle-lpv": "Permanent speed limit" + "toggle-psl": "Permanent speed limit" }, "range-edition": { "edit-track-range-start": "Edit departure point", diff --git a/front/public/locales/fr/map-settings.json b/front/public/locales/fr/map-settings.json index faf13ac664f..88c76b8a726 100644 --- a/front/public/locales/fr/map-settings.json +++ b/front/public/locales/fr/map-settings.json @@ -23,7 +23,7 @@ "showIGNCadastre": "Cadastre ©IGN", "showOSM": "Fond de carte OSM", "showOSMtracksections": "Voies OSM", - "sncf_lpv": "Limites permanentes de vitesse", + "sncf_psl": "Limites permanentes de vitesse", "speedlimits": "Vitesses limites", "stops": "Pancartes d'arrêt", "switches": "Appareils de voie", diff --git a/front/public/locales/fr/translation.json b/front/public/locales/fr/translation.json index dc6325a70ea..bbdd79ee815 100644 --- a/front/public/locales/fr/translation.json +++ b/front/public/locales/fr/translation.json @@ -97,7 +97,7 @@ "catenaries": "Électrifications", "detectors": "Détecteurs", "errors": "Erreurs", - "lpv-lpv_panels": "Limites permanentes de vitesse", + "psl-psl_signs": "Limites permanentes de vitesse", "routes": "Itinéraires", "signals": "Signaux", "switches": "Aiguillages", @@ -327,30 +327,30 @@ "reset-speed-section": "Annuler les modifications en cours" }, "add-new-speed-limit": "Ajouter une nouvelle limitation", - "add-panel": "Ajouter un panneau de type {{panelType}}", + "add-sign": "Ajouter un panneau de type {{signType}}", "add-track-range": "Cliquer pour lier à :", "additional-speed-limit": "Limitation de vitesse additionnelles", - "hovered-panel": "Panneau {{panelType}}", + "hovered-sign": "Panneau {{signType}}", "label": "Outil \"Vitesse limite\"", "main-speed-limit": "Limitation de vitesse par défaut", "move-range-extremity": "Cliquer pour déplacer l'extrémité :", "new-tag": "Code de composition", - "panel-angle-geo": "Angle Geo", - "panel-angle-sch": "Angle Sch", - "panel-category": "Panneau(x) {{panelType}}", - "panel-select": "Sélectionner", - "panel-remove": "Supprimer le panneau", - "panel-position": "Position", - "panel-track-id": "Track section id", - "panel-type": "Type", - "panel-side": "Côté", - "panel-value": "Vitesse", - "panels-section-list": "Liste des panneaux de la section", + "sign-angle-geo": "Angle Geo", + "sign-angle-sch": "Angle Sch", + "sign-category": "Panneau(x) {{signType}}", + "sign-select": "Sélectionner", + "sign-remove": "Supprimer le panneau", + "sign-position": "Position", + "sign-track-id": "Track section id", + "sign-type": "Type", + "sign-side": "Côté", + "sign-value": "Vitesse", + "signs-section-list": "Liste des panneaux de la section", "remove-track-range": "Cliquer pour détacher de :", "save-existing-speed-section": "Sauvegarder les modifications", "save-new-speed-section": "Sauvegarder la nouvelle limite de vitesse", "speed-limits": "Limitations de vitesses", - "toggle-lpv": "Limite permanente de vitesse" + "toggle-psl": "Limite permanente de vitesse" }, "range-edition": { "edit-track-range-start": "Modifier le point de départ", diff --git a/front/src/applications/editor/components/LayersModal.tsx b/front/src/applications/editor/components/LayersModal.tsx index 57f19f073db..c9d5641a8b8 100644 --- a/front/src/applications/editor/components/LayersModal.tsx +++ b/front/src/applications/editor/components/LayersModal.tsx @@ -10,7 +10,7 @@ import switchesIcon from 'assets/pictures/layersicons/switches.svg'; import detectorsIcon from 'assets/pictures/layersicons/detectors.svg'; import trackSectionsIcon from 'assets/pictures/layersicons/layer_adv.svg'; import signalsIcon from 'assets/pictures/layersicons/layer_signal.svg'; -import lpvsIcon from 'assets/pictures/layersicons/layer_tivs.svg'; +import pslsIcon from 'assets/pictures/layersicons/layer_tivs.svg'; import SwitchSNCF from 'common/BootstrapSNCF/SwitchSNCF/SwitchSNCF'; import { useModal, Modal } from 'common/BootstrapSNCF/ModalSNCF'; @@ -31,7 +31,7 @@ const LAYERS: Array<{ layers: LayerType[]; icon: string | JSX.Element }> = [ { layers: ['detectors'], icon: detectorsIcon }, { layers: ['switches'], icon: switchesIcon }, { layers: ['speed_sections'], icon: }, - { layers: ['lpv', 'lpv_panels'], icon: lpvsIcon }, + { layers: ['psl', 'psl_signs'], icon: pslsIcon }, { layers: ['catenaries'], icon: }, { layers: ['errors'], @@ -69,7 +69,7 @@ const LayersModal: FC = ({ () => selection ? mapKeys( - // TODO: ATM we don't know if a selected speed section should be considered as SpeedSection or LPV, + // TODO: ATM we don't know if a selected speed section should be considered as SpeedSection or PSL, // which are two different layers. mapValues(groupBy(selection, 'objType'), (values) => values.length), (_values, key) => EDITOAST_TO_LAYER_DICT[key as EditoastType] diff --git a/front/src/applications/editor/tools/rangeEdition/components.tsx b/front/src/applications/editor/tools/rangeEdition/components.tsx index 44df6f7f715..a2dde23eb8e 100644 --- a/front/src/applications/editor/tools/rangeEdition/components.tsx +++ b/front/src/applications/editor/tools/rangeEdition/components.tsx @@ -17,15 +17,15 @@ import { CatenaryEntity, EntityObjectOperationResult, SpeedSectionEntity, - SpeedSectionLpvEntity, + SpeedSectionPslEntity, } from '../../../../types'; import { NEW_ENTITY_ID } from '../../data/utils'; import { LoaderFill } from '../../../../common/Loader'; import EntitySumUp from '../../components/EntitySumUp'; import { save } from '../../../../reducers/editor'; -import EditLPVSection from './speedSection/EditLPVSection'; +import EditPSLSection from './speedSection/EditPSLSection'; import { ExtendedEditorContextType, PartialOrReducer } from '../editorContextTypes'; -import { getPointAt, speedSectionIsLpv } from './utils'; +import { getPointAt, speedSectionIsPsl } from './utils'; import SpeedSectionMetadataForm from './speedSection/SpeedSectionMetadataForm'; import CatenaryMetadataForm from './catenary/CatenaryMetadataForm'; @@ -211,7 +211,7 @@ export const RangeEditionLeftPanel: FC = () => { >; const isNew = entity.properties.id === NEW_ENTITY_ID; const [isLoading, setIsLoading] = useState(false); - const isLPV = speedSectionIsLpv(entity as SpeedSectionEntity); + const isPSL = speedSectionIsPsl(entity as SpeedSectionEntity); const infraID = useSelector(getInfraID); @@ -308,19 +308,19 @@ export const RangeEditionLeftPanel: FC = () => {
) => { let newExtension: SpeedSectionEntity['properties']['extensions'] = { - lpv_sncf: null, + psl_sncf: null, }; if (e.target.checked) { const firstRange = (entity.properties?.track_ranges || [])[0]; if (!firstRange) return; newExtension = { - lpv_sncf: initialEntity.properties?.extensions?.lpv_sncf || { + psl_sncf: initialEntity.properties?.extensions?.psl_sncf || { announcement: [], r: [], z: { @@ -339,9 +339,9 @@ export const RangeEditionLeftPanel: FC = () => { }} />
- {isLPV && ( - > diff --git a/front/src/applications/editor/tools/rangeEdition/speedSection/EditLPVSection.tsx b/front/src/applications/editor/tools/rangeEdition/speedSection/EditLPVSection.tsx deleted file mode 100644 index 2f48dc29f84..00000000000 --- a/front/src/applications/editor/tools/rangeEdition/speedSection/EditLPVSection.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import React from 'react'; -import { cloneDeep } from 'lodash'; -import { LPVExtension, LPVPanel, SpeedSectionEntity, SpeedSectionLpvEntity } from 'types'; -import { useTranslation } from 'react-i18next'; -import { LpvPanelInformation, LPV_PANEL_TYPES, RangeEditionState } from '../types'; -import LpvPanelCard from './LpvPanelCard'; -import LpvPanelSubSection from './LpvPanelSubSection'; -import { msToKmh, selectLpvPanel } from '../utils'; -import { PartialOrReducer } from '../../editorContextTypes'; - -const getNewAnnouncementPanel = ( - trackRanges: NonNullable, - speedLimit: number -) => { - const firstRange = trackRanges[0]; - const speedInKmH = msToKmh(speedLimit); - const speedMultipleOfFive = Math.ceil(speedInKmH / 5) * 5; - return { - angle_geo: 0, - angle_sch: 0, - position: firstRange.end, - side: 'RIGHT', - track: firstRange.track, - type: 'TIV_D', - value: `${speedMultipleOfFive}`, - } as LPVPanel; -}; - -const getNewRPanel = ( - trackRanges: NonNullable -) => { - const lastRange = trackRanges[trackRanges.length - 1]; - return { - angle_geo: 0, - angle_sch: 0, - position: lastRange.end, - side: 'LEFT', - track: lastRange.track, - type: 'R', - value: null, - } as LPVPanel; -}; - -const EditLPVSection = ({ - entity, - setState, -}: { - entity: SpeedSectionLpvEntity; - setState: (stateOrReducer: PartialOrReducer>) => void; -}) => { - const { t } = useTranslation(); - const lpvExtension = entity.properties.extensions.lpv_sncf; - - const selectPanel = (panelInformation: LpvPanelInformation) => { - selectLpvPanel(panelInformation, setState); - }; - - const updateEntity = (newLpvExtension: LPVExtension) => { - const newEntity = cloneDeep(entity); - newEntity.properties.extensions.lpv_sncf = newLpvExtension; - setState({ entity: newEntity }); - }; - - const addPanel = (panelType: LPV_PANEL_TYPES.ANNOUNCEMENT | LPV_PANEL_TYPES.R) => { - const newLpvExtension = cloneDeep(lpvExtension); - const trackRanges = entity.properties.track_ranges || []; - if (panelType === LPV_PANEL_TYPES.ANNOUNCEMENT) { - const speedLimit = entity.properties.speed_limit || 30; - newLpvExtension.announcement = [ - ...lpvExtension.announcement, - getNewAnnouncementPanel(trackRanges, speedLimit), - ]; - } else { - newLpvExtension.r = [...lpvExtension.r, getNewRPanel(trackRanges)]; - } - updateEntity(newLpvExtension); - }; - - const updatePanel = (panelInfo: LpvPanelInformation, panel: LPVPanel) => { - const newLpvExtension = cloneDeep(lpvExtension); - const { panelType } = panelInfo; - if (panelType === LPV_PANEL_TYPES.Z) { - newLpvExtension.z = panel; - } else { - const { panelIndex } = panelInfo; - if (panelType === LPV_PANEL_TYPES.ANNOUNCEMENT) { - newLpvExtension.announcement[panelIndex] = panel; - } else { - newLpvExtension.r[panelIndex] = panel; - } - } - updateEntity(newLpvExtension); - }; - - const removePanel = ({ - panelType, - panelIndex, - }: Exclude) => { - const newLpvExtension = cloneDeep(lpvExtension); - if (panelType === LPV_PANEL_TYPES.ANNOUNCEMENT) { - newLpvExtension.announcement = newLpvExtension.announcement.filter( - (_, i) => i !== panelIndex - ); - } - if (panelType === LPV_PANEL_TYPES.R) { - newLpvExtension.r = newLpvExtension.r.filter((_, i) => i !== panelIndex); - } - updateEntity(newLpvExtension); - }; - - return ( -
-

{t('Editor.tools.speed-edition.panels-section-list')}

- - - -
- ); -}; - -export default EditLPVSection; diff --git a/front/src/applications/editor/tools/rangeEdition/speedSection/EditPSLSection.tsx b/front/src/applications/editor/tools/rangeEdition/speedSection/EditPSLSection.tsx new file mode 100644 index 00000000000..79c9fa098a7 --- /dev/null +++ b/front/src/applications/editor/tools/rangeEdition/speedSection/EditPSLSection.tsx @@ -0,0 +1,141 @@ +import React from 'react'; +import { cloneDeep } from 'lodash'; +import { PSLExtension, PSLSign, SpeedSectionEntity, SpeedSectionPslEntity } from 'types'; +import { useTranslation } from 'react-i18next'; +import { PslSignInformation, PSL_SIGN_TYPES, RangeEditionState } from '../types'; +import PslSignCard from './PslSignCard'; +import PslSignSubSection from './PslSignSubSection'; +import { msToKmh, selectPslSign } from '../utils'; +import { PartialOrReducer } from '../../editorContextTypes'; + +const getNewAnnouncementSign = ( + trackRanges: NonNullable, + speedLimit: number +) => { + const firstRange = trackRanges[0]; + const speedInKmH = msToKmh(speedLimit); + const speedMultipleOfFive = Math.ceil(speedInKmH / 5) * 5; + return { + angle_geo: 0, + angle_sch: 0, + position: firstRange.end, + side: 'RIGHT', + track: firstRange.track, + type: 'TIV_D', + value: `${speedMultipleOfFive}`, + } as PSLSign; +}; + +const getNewRSign = ( + trackRanges: NonNullable +) => { + const lastRange = trackRanges[trackRanges.length - 1]; + return { + angle_geo: 0, + angle_sch: 0, + position: lastRange.end, + side: 'LEFT', + track: lastRange.track, + type: 'R', + value: null, + } as PSLSign; +}; + +const EditPSLSection = ({ + entity, + setState, +}: { + entity: SpeedSectionPslEntity; + setState: (stateOrReducer: PartialOrReducer>) => void; +}) => { + const { t } = useTranslation(); + const pslExtension = entity.properties.extensions.psl_sncf; + + const selectSign = (signInformation: PslSignInformation) => { + selectPslSign(signInformation, setState); + }; + + const updateEntity = (newPslExtension: PSLExtension) => { + const newEntity = cloneDeep(entity); + newEntity.properties.extensions.psl_sncf = newPslExtension; + setState({ entity: newEntity }); + }; + + const addSign = (signType: PSL_SIGN_TYPES.ANNOUNCEMENT | PSL_SIGN_TYPES.R) => { + const newPslExtension = cloneDeep(pslExtension); + const trackRanges = entity.properties.track_ranges || []; + if (signType === PSL_SIGN_TYPES.ANNOUNCEMENT) { + const speedLimit = entity.properties.speed_limit || 30; + newPslExtension.announcement = [ + ...pslExtension.announcement, + getNewAnnouncementSign(trackRanges, speedLimit), + ]; + } else { + newPslExtension.r = [...pslExtension.r, getNewRSign(trackRanges)]; + } + updateEntity(newPslExtension); + }; + + const updateSign = (signInfo: PslSignInformation, sign: PSLSign) => { + const newPslExtension = cloneDeep(pslExtension); + const { signType } = signInfo; + if (signType === PSL_SIGN_TYPES.Z) { + newPslExtension.z = sign; + } else { + const { signIndex } = signInfo; + if (signType === PSL_SIGN_TYPES.ANNOUNCEMENT) { + newPslExtension.announcement[signIndex] = sign; + } else { + newPslExtension.r[signIndex] = sign; + } + } + updateEntity(newPslExtension); + }; + + const removeSign = ({ + signType, + signIndex, + }: Exclude) => { + const newPslExtension = cloneDeep(pslExtension); + if (signType === PSL_SIGN_TYPES.ANNOUNCEMENT) { + newPslExtension.announcement = newPslExtension.announcement.filter((_, i) => i !== signIndex); + } + if (signType === PSL_SIGN_TYPES.R) { + newPslExtension.r = newPslExtension.r.filter((_, i) => i !== signIndex); + } + updateEntity(newPslExtension); + }; + + return ( +
+

{t('Editor.tools.speed-edition.signs-section-list')}

+ + + +
+ ); +}; + +export default EditPSLSection; diff --git a/front/src/applications/editor/tools/rangeEdition/speedSection/LpvPanelSubSection.tsx b/front/src/applications/editor/tools/rangeEdition/speedSection/LpvPanelSubSection.tsx deleted file mode 100644 index 4eae719c2d5..00000000000 --- a/front/src/applications/editor/tools/rangeEdition/speedSection/LpvPanelSubSection.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import React from 'react'; -import { LPVPanel } from 'types'; -import { TFunction } from 'i18next'; -import { FaPlus } from 'react-icons/fa'; -import { LPV_PANEL_TYPES, LpvPanelInformation } from '../types'; -import LpvPanelCard from './LpvPanelCard'; - -const LpvPanelSubSection = ({ - panelType, - panels, - addPanel, - removePanel, - selectPanel, - t, - updatePanel, -}: { - panelType: LPV_PANEL_TYPES.ANNOUNCEMENT | LPV_PANEL_TYPES.R; - panels: LPVPanel[]; - addPanel: (panelType: LPV_PANEL_TYPES.ANNOUNCEMENT | LPV_PANEL_TYPES.R) => void; - updatePanel: (panelInfo: LpvPanelInformation, panel: LPVPanel) => void; - removePanel?: (panelInfo: Exclude) => void; - selectPanel: (panelInfo: LpvPanelInformation) => void; - t: TFunction; -}) => ( -
-
-

{t('Editor.tools.speed-edition.panel-category', { panelType }).toString()}

-
- - {panels.map((panel, panelIndex) => ( - - ))} -
-); - -export default LpvPanelSubSection; diff --git a/front/src/applications/editor/tools/rangeEdition/speedSection/LpvPanelCard.tsx b/front/src/applications/editor/tools/rangeEdition/speedSection/PslSignCard.tsx similarity index 53% rename from front/src/applications/editor/tools/rangeEdition/speedSection/LpvPanelCard.tsx rename to front/src/applications/editor/tools/rangeEdition/speedSection/PslSignCard.tsx index 80ea50b5cfd..8277e6f5dab 100644 --- a/front/src/applications/editor/tools/rangeEdition/speedSection/LpvPanelCard.tsx +++ b/front/src/applications/editor/tools/rangeEdition/speedSection/PslSignCard.tsx @@ -1,48 +1,48 @@ import React from 'react'; import { TFunction } from 'i18next'; -import { LPVPanel } from 'types'; +import { PSLSign } from 'types'; import SelectImprovedSNCF from 'common/BootstrapSNCF/SelectImprovedSNCF'; import { FaTrash } from 'react-icons/fa'; import { isNil } from 'lodash'; import { RiDragMoveLine } from 'react-icons/ri'; import InputSNCF from 'common/BootstrapSNCF/InputSNCF'; -import { LPV_PANEL_TYPES, LpvPanelInformation } from '../types'; +import { PSL_SIGN_TYPES, PslSignInformation } from '../types'; -const LpvPanelCard = ({ - panel, - panelInfo, +const PslSignCard = ({ + sign, + signInfo, t, - removePanel, - selectPanel, - updatePanel, + removeSign, + selectSign, + updateSign, }: { - panel: LPVPanel; - panelInfo: LpvPanelInformation; + sign: PSLSign; + signInfo: PslSignInformation; t: TFunction; - removePanel?: (panelInfo: Exclude) => void; - selectPanel: (panelInfo: LpvPanelInformation) => void; - updatePanel: (panelInfo: LpvPanelInformation, panel: LPVPanel) => void; + removeSign?: (signInfo: Exclude) => void; + selectSign: (signInfo: PslSignInformation) => void; + updateSign: (signInfo: PslSignInformation, sign: PSLSign) => void; }) => { - const { panelType } = panelInfo; - const roundedPosition = Math.round(panel.position); + const { signType } = signInfo; + const roundedPosition = Math.round(sign.position); return ( <> - {panelType === LPV_PANEL_TYPES.Z && ( + {signType === PSL_SIGN_TYPES.Z && (

- {t('Editor.tools.speed-edition.panel-category', { - panelType, + {t('Editor.tools.speed-edition.sign-category', { + signType, }).toString()}

)}
- updatePanel(panelInfo, { - ...panel, + updateSign(signInfo, { + ...sign, angle_geo: Number(e.target.value), }) } @@ -51,12 +51,12 @@ const LpvPanelCard = ({
- updatePanel(panelInfo, { - ...panel, + updateSign(signInfo, { + ...sign, angle_sch: Number(e.target.value), }) } @@ -67,11 +67,11 @@ const LpvPanelCard = ({ - updatePanel(panelInfo, { - ...panel, + updateSign(signInfo, { + ...sign, track: String(e.target.value), }) } @@ -81,31 +81,31 @@ const LpvPanelCard = ({
{ const newPosition = Number(e.target.value); const updatedPosition = newPosition >= 0 ? newPosition : 0; - updatePanel(panelInfo, { - ...panel, + updateSign(signInfo, { + ...sign, position: updatedPosition, }); }} sm />
- {panelType === LPV_PANEL_TYPES.ANNOUNCEMENT && ( + {signType === PSL_SIGN_TYPES.ANNOUNCEMENT && ( <>
- updatePanel(panelInfo, { - ...panel, + updateSign(signInfo, { + ...sign, value: e.target.value, }) } @@ -115,13 +115,13 @@ const LpvPanelCard = ({
- updatePanel(panelInfo, { - ...panel, - type: panel.type === 'TIV_B' ? 'TIV_D' : 'TIV_B', + updateSign(signInfo, { + ...sign, + type: sign.type === 'TIV_B' ? 'TIV_D' : 'TIV_B', }) } /> @@ -134,28 +134,30 @@ const LpvPanelCard = ({ sm options={['LEFT', 'RIGHT', 'CENTER']} onChange={(selectedValue) => { - if (selectedValue) updatePanel(panelInfo, { ...panel, side: selectedValue }); + if (selectedValue) updateSign(signInfo, { ...sign, side: selectedValue }); }} - value={panel.side} + value={sign.side} />
- {t('Editor.tools.speed-edition.panel-select').toString()} + {t('Editor.tools.speed-edition.sign-select').toString()}
- {panelType !== LPV_PANEL_TYPES.Z && removePanel && ( + {signType !== PSL_SIGN_TYPES.Z && removeSign && (
- {t('Editor.tools.speed-edition.panel-remove').toString()} + {t('Editor.tools.speed-edition.sign-remove').toString()} @@ -166,4 +168,4 @@ const LpvPanelCard = ({ ); }; -export default LpvPanelCard; +export default PslSignCard; diff --git a/front/src/applications/editor/tools/rangeEdition/speedSection/PslSignSubSection.tsx b/front/src/applications/editor/tools/rangeEdition/speedSection/PslSignSubSection.tsx new file mode 100644 index 00000000000..ea196b28a1b --- /dev/null +++ b/front/src/applications/editor/tools/rangeEdition/speedSection/PslSignSubSection.tsx @@ -0,0 +1,53 @@ +import React from 'react'; +import { PSLSign } from 'types'; +import { TFunction } from 'i18next'; +import { FaPlus } from 'react-icons/fa'; +import { PSL_SIGN_TYPES, PslSignInformation } from '../types'; +import PslSignCard from './PslSignCard'; + +const PslSignSubSection = ({ + signType, + signs, + addSign, + removeSign, + selectSign, + t, + updateSign, +}: { + signType: PSL_SIGN_TYPES.ANNOUNCEMENT | PSL_SIGN_TYPES.R; + signs: PSLSign[]; + addSign: (signType: PSL_SIGN_TYPES.ANNOUNCEMENT | PSL_SIGN_TYPES.R) => void; + updateSign: (signInfo: PslSignInformation, sign: PSLSign) => void; + removeSign?: (signInfo: Exclude) => void; + selectSign: (signInfo: PslSignInformation) => void; + t: TFunction; +}) => ( +
+
+

{t('Editor.tools.speed-edition.sign-category', { signType }).toString()}

+
+ + {signs.map((sign, signIndex) => ( + + ))} +
+); + +export default PslSignSubSection; diff --git a/front/src/applications/editor/tools/rangeEdition/speedSection/SpeedSectionEditionLayers.tsx b/front/src/applications/editor/tools/rangeEdition/speedSection/SpeedSectionEditionLayers.tsx index 864ebe35b85..20c7efa0c57 100644 --- a/front/src/applications/editor/tools/rangeEdition/speedSection/SpeedSectionEditionLayers.tsx +++ b/front/src/applications/editor/tools/rangeEdition/speedSection/SpeedSectionEditionLayers.tsx @@ -14,12 +14,12 @@ import { getEntities, getEntity } from 'applications/editor/data/api'; import { mapValues } from 'lodash'; import { Layer, Popup, Source } from 'react-map-gl/maplibre'; import { - generateLpvPanelFeatures, + generatePslSignFeatures, getTrackRangeFeatures, isOnModeMove, - speedSectionIsLpv, + speedSectionIsPsl, } from '../utils'; -import { LpvPanelFeature, RangeEditionState, TrackState } from '../types'; +import { PslSignFeature, RangeEditionState, TrackState } from '../types'; import { ExtendedEditorContextType } from '../../editorContextTypes'; import EntitySumUp from '../../../components/EntitySumUp'; import { LayerType } from '../../types'; @@ -31,7 +31,7 @@ export const SpeedSectionEditionLayers: FC = () => { state: { entity, trackSectionsCache, hoveredItem, interactionState, mousePosition }, setState, } = useContext(EditorContext) as ExtendedEditorContextType>; - const isLPV = speedSectionIsLpv(entity); + const isPSL = speedSectionIsPsl(entity); const { mapStyle, layersSettings, showIGNBDORTHO } = useSelector(getMap); const infraId = useSelector(getInfraID); const selection = useMemo(() => { @@ -63,15 +63,15 @@ export const SpeedSectionEditionLayers: FC = () => { : []; }) as Feature[]; - // generate lpvPanelFeatures - let lpvPanelFeatures = [] as LpvPanelFeature[]; - if (entity.properties?.extensions?.lpv_sncf) { - lpvPanelFeatures = generateLpvPanelFeatures( - entity.properties?.extensions?.lpv_sncf, + // generate pslSignFeatures + let pslSignFeatures = [] as PslSignFeature[]; + if (entity.properties?.extensions?.psl_sncf) { + pslSignFeatures = generatePslSignFeatures( + entity.properties?.extensions?.psl_sncf, trackSectionsCache ); } - return featureCollection([...trackRangeFeatures, ...lpvPanelFeatures]); + return featureCollection([...trackRangeFeatures, ...pslSignFeatures]); }, [entity, trackSectionsCache]); const layersProps = useMemo(() => { @@ -85,16 +85,16 @@ export const SpeedSectionEditionLayers: FC = () => { showIGNBDORTHO, layersSettings, }; - if (!isLPV) { + if (!isPSL) { return SourcesDefinitionsIndex.speed_sections(context, 'speedSectionsEditor/speedSection/'); } - const lpvLayers = SourcesDefinitionsIndex.lpv(context, 'speedSectionsEditor/lpv/'); - const lpvPanelLayers = SourcesDefinitionsIndex.lpv_panels( + const pslLayers = SourcesDefinitionsIndex.psl(context, 'speedSectionsEditor/psl/'); + const pslSignLayers = SourcesDefinitionsIndex.psl_signs( context, - 'speedSectionsEditor/lpv_panels/' + 'speedSectionsEditor/psl_signs/' ); - return [...lpvLayers, ...lpvPanelLayers]; - }, [isLPV, mapStyle, showIGNBDORTHO, layersSettings]); + return [...pslLayers, ...pslSignLayers]; + }, [isPSL, mapStyle, showIGNBDORTHO, layersSettings]); const layers = useMemo(() => new Set(['track_sections']) as Set, []); @@ -177,7 +177,7 @@ export const SpeedSectionEditionLayers: FC = () => { )} - {hoveredItem?.speedSectionItemType === 'LPVPanel' && ( + {hoveredItem?.speedSectionItemType === 'PSLSign' && ( { latitude={hoveredItem.position[1]} closeButton={false} > - {t('Editor.tools.speed-edition.hovered-panel', { panelType: hoveredItem.panelType })} + {t('Editor.tools.speed-edition.hovered-sign', { signType: hoveredItem.signType })} )} {interactionState.type !== 'moveRangeExtremity' && @@ -216,7 +216,7 @@ export const SpeedSectionEditionLayers: FC = () => { layersSettings={layersSettings} isEmphasized={false} /> - + {layersProps.map((props, i) => ( ))} diff --git a/front/src/applications/editor/tools/rangeEdition/tool-factory.ts b/front/src/applications/editor/tools/rangeEdition/tool-factory.ts index ce3e0a4877d..972a5035d35 100644 --- a/front/src/applications/editor/tools/rangeEdition/tool-factory.ts +++ b/front/src/applications/editor/tools/rangeEdition/tool-factory.ts @@ -8,24 +8,24 @@ import { ComponentType } from 'react'; import { LAYER_TO_EDITOAST_DICT, LAYERS_SET, LayerType } from '../types'; import { HoveredExtremityState, - HoveredPanelState, + HoveredSignState, HoveredRangeState, - LpvPanelFeature, + PslSignFeature, RangeEditionState, TrackRangeExtremityFeature, TrackRangeFeature, } from './types'; import { - getLpvPanelNewPosition, - getMovedLpvEntity, - getPanelInformationFromInteractionState, + getPslSignNewPosition, + getMovedPslEntity, + getSignInformationFromInteractionState, isOnModeMove, - selectLpvPanel, + selectPslSign, } from './utils'; import { CatenaryEntity, SpeedSectionEntity, - SpeedSectionLpvEntity, + SpeedSectionPslEntity, TrackSectionEntity, } from '../../../../types'; import { getNearestPoint } from '../../../../utils/mapHelper'; @@ -73,7 +73,7 @@ function getRangeEditionTool({ : 'Editor.tools.catenary-edition.label', requiredLayers: new Set( layersEntity.objType === 'SpeedSection' - ? ['speed_sections', 'lpv', 'lpv_panels'] + ? ['speed_sections', 'psl', 'psl_signs'] : ['catenaries'] ), getInitialState, @@ -148,12 +148,12 @@ function getRangeEditionTool({ extremity: hoveredExtremity.properties.extremity, }, }); - } else if (feature.properties?.speedSectionItemType === 'LPVPanel') { + } else if (feature.properties?.speedSectionItemType === 'PSLSign') { const { - properties: { speedSectionPanelType, speedSectionPanelIndex }, - } = feature as unknown as LpvPanelFeature; - selectLpvPanel( - { panelType: speedSectionPanelType, panelIndex: speedSectionPanelIndex }, + properties: { speedSectionSignType, speedSectionSignIndex }, + } = feature as unknown as PslSignFeature; + selectPslSign( + { signType: speedSectionSignType, signIndex: speedSectionSignIndex }, setState as ( stateOrReducer: PartialOrReducer> ) => void @@ -233,17 +233,17 @@ function getRangeEditionTool({ setState({ hoveredItem: newHoveredItem, }); - } else if (feature.properties?.speedSectionItemType === 'LPVPanel') { + } else if (feature.properties?.speedSectionItemType === 'PSLSign') { const hoveredExtremity = feature as unknown as TrackRangeExtremityFeature; const trackState = trackSectionsCache[hoveredExtremity.properties.track]; if (trackState?.type !== 'success') return; - const newHoveredItem: HoveredPanelState = { - speedSectionItemType: 'LPVPanel', + const newHoveredItem: HoveredSignState = { + speedSectionItemType: 'PSLSign', position: hoveredExtremity.geometry.coordinates, track: trackState.track, - panelIndex: feature.properties?.speedSectionPanelIndex as number, - panelType: feature.properties?.speedSectionPanelType as string, + signIndex: feature.properties?.speedSectionSignIndex as number, + signType: feature.properties?.speedSectionSignType as string, }; if (!isEqual(newHoveredItem, hoveredItem)) setState({ @@ -291,14 +291,14 @@ function getRangeEditionTool({ setState({ entity: newEntity, }); - } else if (interactionState.type === 'movePanel') { - if (entity.objType === 'SpeedSection' && entity.properties.extensions?.lpv_sncf) { - const newPosition = getLpvPanelNewPosition(e, trackSectionsCache); + } else if (interactionState.type === 'moveSign') { + if (entity.objType === 'SpeedSection' && entity.properties.extensions?.psl_sncf) { + const newPosition = getPslSignNewPosition(e, trackSectionsCache); if (newPosition) { - const panelInfo = getPanelInformationFromInteractionState(interactionState); - const updatedEntity = getMovedLpvEntity( - entity as SpeedSectionLpvEntity, - panelInfo, + const signInfo = getSignInformationFromInteractionState(interactionState); + const updatedEntity = getMovedPslEntity( + entity as SpeedSectionPslEntity, + signInfo, newPosition ) as T; setState({ entity: updatedEntity }); diff --git a/front/src/applications/editor/tools/rangeEdition/tools.ts b/front/src/applications/editor/tools/rangeEdition/tools.ts index eaba612931d..773e06178a5 100644 --- a/front/src/applications/editor/tools/rangeEdition/tools.ts +++ b/front/src/applications/editor/tools/rangeEdition/tools.ts @@ -1,5 +1,5 @@ import { MdSpeed } from 'react-icons/md'; -import { CatenaryEntity, SpeedSectionEntity, SpeedSectionLpvEntity } from 'types'; +import { CatenaryEntity, SpeedSectionEntity, SpeedSectionPslEntity } from 'types'; import { GiElectric } from 'react-icons/gi'; import getRangeEditionTool from './tool-factory'; import { getNewCatenary, getNewSpeedSection } from './utils'; @@ -10,7 +10,7 @@ import { } from './speedSection/SpeedSectionEditionLayers'; import { CatenaryEditionLayers, CatenaryMessages } from './catenary/CatenaryEditionLayers'; -export const SpeedEditionTool = getRangeEditionTool({ +export const SpeedEditionTool = getRangeEditionTool({ id: 'SpeedSection', icon: MdSpeed, getNewEntity: getNewSpeedSection, diff --git a/front/src/applications/editor/tools/rangeEdition/types.ts b/front/src/applications/editor/tools/rangeEdition/types.ts index 93459e13d0f..8851f4c03de 100644 --- a/front/src/applications/editor/tools/rangeEdition/types.ts +++ b/front/src/applications/editor/tools/rangeEdition/types.ts @@ -21,7 +21,7 @@ export type TrackRangeExtremityFeature = Feature< speedSectionRangeIndex: number; } >; -export type LpvPanelFeature = Feature< +export type PslSignFeature = Feature< Point, { angle_sch: number; @@ -31,9 +31,9 @@ export type LpvPanelFeature = Feature< track: string; type: string; value: string | null; - speedSectionItemType: 'LPVPanel'; - speedSectionPanelIndex: number; - speedSectionPanelType: LPV_PANEL_TYPE; + speedSectionItemType: 'PSLSign'; + speedSectionSignIndex: number; + speedSectionSignType: PSL_SIGN_TYPE; } >; @@ -54,12 +54,12 @@ export type HoveredRangeState = { type?: undefined; id?: undefined; }; -export type HoveredPanelState = { - speedSectionItemType: 'LPVPanel'; +export type HoveredSignState = { + speedSectionItemType: 'PSLSign'; track: TrackSectionEntity; position: Position; - panelIndex: number; - panelType: string; + signIndex: number; + signType: string; // (trick to help dealing with heterogeneous types) type?: undefined; id?: undefined; @@ -70,16 +70,16 @@ export type TrackState = | { type: 'error' } | { type: 'success'; track: TrackSectionEntity }; -export enum LPV_PANEL_TYPES { +export enum PSL_SIGN_TYPES { Z = 'z', R = 'r', ANNOUNCEMENT = 'announcement', } -export type LPV_PANEL_TYPE = LPV_PANEL_TYPES.Z | LPV_PANEL_TYPES.R | LPV_PANEL_TYPES.ANNOUNCEMENT; +export type PSL_SIGN_TYPE = PSL_SIGN_TYPES.Z | PSL_SIGN_TYPES.R | PSL_SIGN_TYPES.ANNOUNCEMENT; -export type LpvPanelInformation = - | { panelType: LPV_PANEL_TYPES.ANNOUNCEMENT | LPV_PANEL_TYPES.R; panelIndex: number } - | { panelType: LPV_PANEL_TYPES.Z }; +export type PslSignInformation = + | { signType: PSL_SIGN_TYPES.ANNOUNCEMENT | PSL_SIGN_TYPES.R; signIndex: number } + | { signType: PSL_SIGN_TYPES.Z }; export type RangeEditionState = CommonToolState & { initialEntity: E; @@ -88,11 +88,11 @@ export type RangeEditionState = CommonToolState & { | null | HoveredExtremityState | HoveredRangeState - | HoveredPanelState + | HoveredSignState | (NonNullable & { speedSectionItemType?: undefined }); interactionState: | { type: 'idle' } | { type: 'moveRangeExtremity'; rangeIndex: number; extremity: 'BEGIN' | 'END' } - | ({ type: 'movePanel' } & LpvPanelInformation); + | ({ type: 'moveSign' } & PslSignInformation); trackSectionsCache: Record; }; diff --git a/front/src/applications/editor/tools/rangeEdition/utils.ts b/front/src/applications/editor/tools/rangeEdition/utils.ts index 6561d49220b..1333af35a59 100644 --- a/front/src/applications/editor/tools/rangeEdition/utils.ts +++ b/front/src/applications/editor/tools/rangeEdition/utils.ts @@ -10,18 +10,18 @@ import { getNearestPoint } from 'utils/mapHelper'; import { NEW_ENTITY_ID } from '../../data/utils'; import { CatenaryEntity, - LPVExtension, - LPVPanel, + PSLExtension, + PSLSign, SpeedSectionEntity, - SpeedSectionLpvEntity, + SpeedSectionPslEntity, TrackRange, TrackSectionEntity, } from '../../../../types'; import { - LPV_PANEL_TYPE, - LPV_PANEL_TYPES, - LpvPanelFeature, - LpvPanelInformation, + PSL_SIGN_TYPE, + PSL_SIGN_TYPES, + PslSignFeature, + PslSignInformation, RangeEditionState, TrackRangeExtremityFeature, TrackRangeFeature, @@ -54,12 +54,13 @@ export function getNewCatenary(): CatenaryEntity { } /** - * Given a hover event and a trackSectionCache when moving a LpvPanel, return the new position of the panel, with the trackRange's id on which the panel is and its distance from the beginning of the trackRange. + * Given a hover event and a trackSectionCache when moving a PslSign, return the new position of the sign, with the trackRange's id on which the sign is and its distance from the beginning of the trackRange. * - retrieve the trackRanges around the mouse * - retrieve the nearest point of the mouse (and the trackRange it belongs to) * - compute the distance between the beginning of the track and the nearest point (with approximation because of Editoast data) */ -export function getLpvPanelNewPosition( + +export function getPslSignNewPosition( e: MapLayerMouseEvent, trackSectionsCache: Record ) { @@ -90,7 +91,7 @@ export function getNewSpeedSection(): SpeedSectionEntity { properties: { id: NEW_ENTITY_ID, extensions: { - lpv_sncf: null, + psl_sncf: null, }, track_ranges: [], speed_limit_by_tag: {}, @@ -102,58 +103,58 @@ export function getNewSpeedSection(): SpeedSectionEntity { }; } -/** return the LPV panel type and its index (if the panel is not a Z panel) */ -export function getPanelInformationFromInteractionState( - interactionState: { type: 'movePanel' } & LpvPanelInformation +/** return the PSL sign type and its index (if the sign is not a Z sign) */ +export function getSignInformationFromInteractionState( + interactionState: { type: 'moveSign' } & PslSignInformation ) { - const { panelType } = interactionState; + const { signType } = interactionState; return ( - panelType === LPV_PANEL_TYPES.Z - ? { panelType: LPV_PANEL_TYPES.Z } - : { panelType, panelIndex: interactionState.panelIndex } - ) as LpvPanelInformation; + signType === PSL_SIGN_TYPES.Z + ? { signType: PSL_SIGN_TYPES.Z } + : { signType, signIndex: interactionState.signIndex } + ) as PslSignInformation; } -export function getNewLpvExtension( - newLpvExtension: LPVExtension, - panelInformation: LpvPanelInformation, +export function getNewPslExtension( + newPslExtension: PSLExtension, + signInformation: PslSignInformation, newPosition: { track: string; position: number } ) { - const { panelType } = panelInformation; - if (panelType === LPV_PANEL_TYPES.Z) { - newLpvExtension.z = { - ...newLpvExtension.z, + const { signType } = signInformation; + if (signType === PSL_SIGN_TYPES.Z) { + newPslExtension.z = { + ...newPslExtension.z, ...newPosition, }; } else { - const { panelIndex } = panelInformation; - if (panelType === LPV_PANEL_TYPES.ANNOUNCEMENT) { - newLpvExtension.announcement[panelIndex] = { - ...newLpvExtension.announcement[panelIndex], + const { signIndex } = signInformation; + if (signType === PSL_SIGN_TYPES.ANNOUNCEMENT) { + newPslExtension.announcement[signIndex] = { + ...newPslExtension.announcement[signIndex], ...newPosition, }; } else { - newLpvExtension.r[panelIndex] = { - ...newLpvExtension.r[panelIndex], + newPslExtension.r[signIndex] = { + ...newPslExtension.r[signIndex], ...newPosition, }; } } - return newLpvExtension; + return newPslExtension; } -export function getMovedLpvEntity( - entity: SpeedSectionLpvEntity, - panelInfo: LpvPanelInformation, +export function getMovedPslEntity( + entity: SpeedSectionPslEntity, + signInfo: PslSignInformation, newPosition: { track: string; position: number } ) { - const newLpvExtension = getNewLpvExtension( - cloneDeep(entity.properties.extensions.lpv_sncf), - panelInfo, + const newPslExtension = getNewPslExtension( + cloneDeep(entity.properties.extensions.psl_sncf), + signInfo, newPosition ); const updatedEntity = cloneDeep(entity); - updatedEntity.properties.extensions.lpv_sncf = newLpvExtension; + updatedEntity.properties.extensions.psl_sncf = newPslExtension; return updatedEntity; } @@ -272,46 +273,46 @@ export function getTrackRangeFeatures( } /** - * Given a LPV panel and the cached trackSections, generate a point feature to represent a SpeedSection Lpv Panel. - * If the panel's track is not in the trackSectionsCache object, then return null. - * This feature will be used to display the panel on the map. + * Given a PSL sign and the cached trackSections, generate a point feature to represent a SpeedSection Psl Sign. + * If the sign's track is not in the trackSectionsCache object, then return null. + * This feature will be used to display the sign on the map. */ -function generatePointFromLPVPanel( - panel: LPVPanel, - panelIndex: number, - panelType: LPV_PANEL_TYPE, +function generatePointFromPSLSign( + sign: PSLSign, + signIndex: number, + signType: PSL_SIGN_TYPE, trackSectionsCache: Record -): LpvPanelFeature | null { - const trackState = trackSectionsCache[panel.track]; +): PslSignFeature | null { + const trackState = trackSectionsCache[sign.track]; if (trackState?.type !== 'success') { return null; } - const panelPoint = along(trackState.track, panel.position, { units: 'meters' }); - panelPoint.properties = { - ...panel, - speedSectionItemType: 'LPVPanel', - speedSectionPanelIndex: panelIndex, - speedSectionPanelType: panelType, + const signPoint = along(trackState.track, sign.position, { units: 'meters' }); + signPoint.properties = { + ...sign, + speedSectionItemType: 'PSLSign', + speedSectionSignIndex: signIndex, + speedSectionSignType: signType, }; - return panelPoint as LpvPanelFeature; + return signPoint as PslSignFeature; } /** - * Given a LPV extension and cached trackSections, generate an array of Point Features to display the LPV panels on the map. + * Given a PSL extension and cached trackSections, generate an array of Point Features to display the PSL signs on the map. */ -export function generateLpvPanelFeatures( - lpv: LPVExtension, +export function generatePslSignFeatures( + psl: PSLExtension, trackSectionsCache: Record ) { - const panelsLists = [ - { type: LPV_PANEL_TYPES.Z, panels: lpv.z ? [lpv.z] : [] }, - { type: LPV_PANEL_TYPES.R, panels: lpv.r }, - { type: LPV_PANEL_TYPES.ANNOUNCEMENT, panels: lpv.announcement }, + const signsLists = [ + { type: PSL_SIGN_TYPES.Z, signs: psl.z ? [psl.z] : [] }, + { type: PSL_SIGN_TYPES.R, signs: psl.r }, + { type: PSL_SIGN_TYPES.ANNOUNCEMENT, signs: psl.announcement }, ]; - const panelPoints = panelsLists.flatMap(({ type, panels }) => - panels.map((panel, i) => generatePointFromLPVPanel(panel, i, type, trackSectionsCache)) + const signPoints = signsLists.flatMap(({ type, signs }) => + signs.map((sign, i) => generatePointFromPSLSign(sign, i, type, trackSectionsCache)) ); - return compact(panelPoints); + return compact(signPoints); } export function getPointAt(track: TrackSectionEntity, at: number): Position { @@ -331,29 +332,29 @@ export function kmhToMs(v: number): number { } /** - * Given a lpvPanel information, update the state to notify that the user is moving the panel. - * - set the interaction state on 'movePanel' - * - store in the interaction state the panel informations + * Given a pslSign information, update the state to notify that the user is moving the sign. + * - set the interaction state on 'moveSign' + * - store in the interaction state the sign informations */ -export function selectLpvPanel( - lpvPanel: LpvPanelInformation, +export function selectPslSign( + pslSign: PslSignInformation, setState: (stateOrReducer: PartialOrReducer>) => void ) { - const { panelType } = lpvPanel; + const { signType } = pslSign; const interactionState = - panelType === LPV_PANEL_TYPES.Z - ? ({ type: 'movePanel', panelType: LPV_PANEL_TYPES.Z } as { - type: 'movePanel'; - panelType: LPV_PANEL_TYPES.Z; + signType === PSL_SIGN_TYPES.Z + ? ({ type: 'moveSign', signType: PSL_SIGN_TYPES.Z } as { + type: 'moveSign'; + signType: PSL_SIGN_TYPES.Z; }) : ({ - type: 'movePanel', - panelType, - panelIndex: lpvPanel.panelIndex, + type: 'moveSign', + signType, + signIndex: pslSign.signIndex, } as { - type: 'movePanel'; - panelType: LPV_PANEL_TYPES.ANNOUNCEMENT | LPV_PANEL_TYPES.R; - panelIndex: number; + type: 'moveSign'; + signType: PSL_SIGN_TYPES.ANNOUNCEMENT | PSL_SIGN_TYPES.R; + signIndex: number; }); setState({ hoveredItem: null, @@ -361,10 +362,10 @@ export function selectLpvPanel( }); } -export function speedSectionIsLpv(entity: SpeedSectionEntity): boolean { - return !!entity.properties?.extensions?.lpv_sncf; +export function speedSectionIsPsl(entity: SpeedSectionEntity): boolean { + return !!entity.properties?.extensions?.psl_sncf; } export function isOnModeMove(interactionStateType: string): boolean { - return ['moveRangeExtremity', 'movePanel'].includes(interactionStateType); + return ['moveRangeExtremity', 'moveSign'].includes(interactionStateType); } diff --git a/front/src/applications/editor/tools/types.ts b/front/src/applications/editor/tools/types.ts index a000a5a8d1d..28998a15a62 100644 --- a/front/src/applications/editor/tools/types.ts +++ b/front/src/applications/editor/tools/types.ts @@ -12,8 +12,8 @@ export const LAYERS = [ 'catenaries', 'detectors', 'errors', - 'lpv', - 'lpv_panels', + 'psl', + 'psl_signs', 'routes', 'signals', 'speed_sections', @@ -42,7 +42,7 @@ export const EDITOAST_TO_LAYER_DICT: Record = { Detector: ['detectors'], Route: ['routes'], Signal: ['signals'], - SpeedSection: ['speed_sections', 'lpv', 'lpv_panels'], + SpeedSection: ['speed_sections', 'psl', 'psl_signs'], Switch: ['switches'], TrackSection: ['track_sections'], }; diff --git a/front/src/applications/referenceMap/Map.tsx b/front/src/applications/referenceMap/Map.tsx index 0540857b2af..422ed3c01a7 100644 --- a/front/src/applications/referenceMap/Map.tsx +++ b/front/src/applications/referenceMap/Map.tsx @@ -32,7 +32,7 @@ import Routes from 'common/Map/Layers/Routes'; import SearchMarker from 'common/Map/Layers/SearchMarker'; import Signals from 'common/Map/Layers/Signals'; import SpeedLimits from 'common/Map/Layers/SpeedLimits'; -import SNCF_LPV from 'common/Map/Layers/extensions/SNCF/SNCF_LPV'; +import SNCF_PSL from 'common/Map/Layers/extensions/SNCF/SNCF_PSL'; import Switches from 'common/Map/Layers/Switches'; import TracksGeographic from 'common/Map/Layers/TracksGeographic'; import TracksOSM from 'common/Map/Layers/TracksOSM'; @@ -217,7 +217,7 @@ function Map() { colors={colors[mapStyle]} layerOrder={LAYER_GROUPS_ORDER[LAYERS.SPEED_LIMITS.GROUP]} /> - - = ALL_SIGNAL_LAYE {} ); -export const PANELS_STOPS: SignalType[] = [ +export const SIGNS_STOPS: SignalType[] = [ 'ARRET VOY', 'ARRET', 'CHEVRON', @@ -216,7 +216,7 @@ export const DYNAMIC_LIGHTS_ATT: SignalType[] = ['CARRE A', 'S A']; export const DYNAMIC_LIGHTS_STOP: SignalType[] = ['CARRE STOP', 'S STOP']; -export const PANELS_TIVS: SignalType[] = [ +export const SIGNS_TIVS: SignalType[] = [ 'TIV A TRAM', 'TIV D FIXE', 'TIV D MOB', diff --git a/front/src/common/Map/Consts/colors.ts b/front/src/common/Map/Consts/colors.ts index 5b6eafe02cb..0b738609dbf 100644 --- a/front/src/common/Map/Consts/colors.ts +++ b/front/src/common/Map/Consts/colors.ts @@ -36,7 +36,7 @@ const colors: Record = { text: '#555555', halo: '#eee', }, - lpv: { + psl: { pointtext: '#5b5b5b', pointhalo: '#ffffff', detailtext: '#555555', @@ -52,7 +52,7 @@ const colors: Record = { text: '#202258', halo: '#eee', }, - panel: { + sign: { text: '#333333', halo: '#ffffff', }, @@ -185,7 +185,7 @@ const colors: Record = { text: '#4895ef', halo: '#0b011d', }, - lpv: { + psl: { pointtext: '#eeeeee', pointhalo: '#3a86ff', detailtext: '#3a86ff', @@ -201,7 +201,7 @@ const colors: Record = { text: '#4895ef', halo: '#0b011d', }, - panel: { + sign: { text: '#eeeeee', halo: '#333333', }, @@ -326,7 +326,7 @@ const colors: Record = { text: bpLight, halo: bpBg, }, - lpv: { + psl: { pointtext: bpLight, pointhalo: bpBg, detailtext: bpLight, @@ -342,7 +342,7 @@ const colors: Record = { text: bpLight, halo: bpBg, }, - panel: { + sign: { text: bpLight, halo: bpBg, }, diff --git a/front/src/common/Map/Layers/GeoJSONs.tsx b/front/src/common/Map/Layers/GeoJSONs.tsx index 9e677e7f2d3..fa97119a3aa 100644 --- a/front/src/common/Map/Layers/GeoJSONs.tsx +++ b/front/src/common/Map/Layers/GeoJSONs.tsx @@ -36,15 +36,12 @@ import { } from './SpeedLimits'; import { MapState } from '../../../reducers/map'; import { - getLPVFilter, - getLPVSpeedLineBGLayerProps, - getLPVSpeedLineLayerProps, - getLPVSpeedValueLayerProps, -} from './extensions/SNCF/SNCF_LPV'; -import { - getLPVPanelsLayerProps, - getLPVPanelsMastLayerProps, -} from './extensions/SNCF/SNCF_LPV_PANELS'; + getPSLFilter, + getPSLSpeedLineBGLayerProps, + getPSLSpeedLineLayerProps, + getPSLSpeedValueLayerProps, +} from './extensions/SNCF/SNCF_PSL'; +import { getPSLSignsLayerProps, getPSLSignsMastLayerProps } from './extensions/SNCF/SNCF_PSL_SIGNS'; import { LayerContext } from './types'; import { getCatenariesProps, getCatenariesTextParams } from './Catenaries'; import OrderedLayer from './OrderedLayer'; @@ -203,37 +200,37 @@ function getDetectorsLayers(context: LayerContext, prefix: string): LayerProps[] ]; } -function getLPVPanelsLayers(context: LayerContext, prefix: string): LayerProps[] { +function getPSLSignsLayers(context: LayerContext, prefix: string): LayerProps[] { return [ { - ...getLPVPanelsLayerProps(context), - id: `${prefix}geo/lpv-panels`, + ...getPSLSignsLayerProps(context), + id: `${prefix}geo/psl-signs`, minzoom: POINT_ENTITIES_MIN_ZOOM, }, { - ...getLPVPanelsMastLayerProps(context), - id: `${prefix}geo/lpv-panels-mast`, + ...getPSLSignsMastLayerProps(context), + id: `${prefix}geo/psl-signs-mast`, minzoom: POINT_ENTITIES_MIN_ZOOM, }, ]; } -function getLPVLayers(context: LayerContext, prefix: string): LayerProps[] { - const filter = getLPVFilter(context.layersSettings); +function getPSLLayers(context: LayerContext, prefix: string): LayerProps[] { + const filter = getPSLFilter(context.layersSettings); return [ { - ...getLPVSpeedValueLayerProps(context), - id: `${prefix}geo/lpv-value`, + ...getPSLSpeedValueLayerProps(context), + id: `${prefix}geo/psl-value`, filter, }, { - ...getLPVSpeedLineBGLayerProps(context), - id: `${prefix}geo/lpv-line-bg`, + ...getPSLSpeedLineBGLayerProps(context), + id: `${prefix}geo/psl-line-bg`, filter, }, { - ...getLPVSpeedLineLayerProps(context), - id: `${prefix}geo/lpv-line`, + ...getPSLSpeedLineLayerProps(context), + id: `${prefix}geo/psl-line`, filter, }, ]; @@ -308,8 +305,8 @@ const SOURCES_DEFINITION: { { entityType: 'detectors', getLayers: getDetectorsLayers }, { entityType: 'switches', getLayers: getSwitchesLayers }, { entityType: 'speed_sections', getLayers: getSpeedSectionLayers }, - { entityType: 'lpv', getLayers: getLPVLayers }, - { entityType: 'lpv_panels', getLayers: getLPVPanelsLayers }, + { entityType: 'psl', getLayers: getPSLLayers }, + { entityType: 'psl_signs', getLayers: getPSLSignsLayers }, { entityType: 'catenaries', getLayers: getCatenariesLayers }, { entityType: 'errors', getLayers: getErrorsLayers }, ]; diff --git a/front/src/common/Map/Layers/Signals.tsx b/front/src/common/Map/Layers/Signals.tsx index 6f40b1b4b2d..59e0202055e 100644 --- a/front/src/common/Map/Layers/Signals.tsx +++ b/front/src/common/Map/Layers/Signals.tsx @@ -10,8 +10,8 @@ import { MAP_URL } from 'common/Map/const'; import { ALL_SIGNAL_LAYERS, LIGHT_SIGNALS, - PANELS_STOPS, - PANELS_TIVS, + SIGNS_STOPS, + SIGNS_TIVS, } from 'common/Map/Consts/SignalsNames'; import OrderedLayer from 'common/Map/Layers/OrderedLayer'; @@ -54,7 +54,7 @@ function Signals(props: PlatformProps) { const [greenSignalsIds, setGreenSignalsIds] = useState([]); const dynamicLayersIds = LIGHT_SIGNALS.map( - (panel) => `chartis/signal/${sourceLayer}/${panel}` + (sign) => `chartis/signal/${sourceLayer}/${sign}` ).filter((dynamicLayerId) => mapRef?.current?.getMap().getLayer(dynamicLayerId)); // We need the layers concerned by eventual changes of signals /* EveryTime the viewPort change or the timePosition or the simulation change, @@ -122,10 +122,10 @@ function Signals(props: PlatformProps) { return ALL_SIGNAL_LAYERS; } if (signalsSettings.stops) { - signalsList = signalsList.concat(PANELS_STOPS); + signalsList = signalsList.concat(SIGNS_STOPS); } if (signalsSettings.tivs) { - signalsList = signalsList.concat(PANELS_TIVS); + signalsList = signalsList.concat(SIGNS_TIVS); } if (signalsSettings.lights) { signalsList = signalsList.concat(LIGHT_SIGNALS); diff --git a/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV.tsx b/front/src/common/Map/Layers/extensions/SNCF/SNCF_PSL.tsx similarity index 82% rename from front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV.tsx rename to front/src/common/Map/Layers/extensions/SNCF/SNCF_PSL.tsx index 70ebb617e3e..26b9a41b0e2 100644 --- a/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV.tsx +++ b/front/src/common/Map/Layers/extensions/SNCF/SNCF_PSL.tsx @@ -12,21 +12,21 @@ import { MAP_URL } from 'common/Map/const'; import OrderedLayer from 'common/Map/Layers/OrderedLayer'; import { getInfraID } from 'reducers/osrdconf/selectors'; import { MapState } from 'reducers/map'; -import SNCF_LPV_Panels from './SNCF_LPV_PANELS'; import { getSpeedSectionsTag, getSpeedSectionsName } from '../../SpeedLimits'; import { Theme, SourceLayer, OmitLayer } from '../../../../../types'; +import SNCF_PSL_Signs from './SNCF_PSL_SIGNS'; -interface SNCF_LPVProps { +interface SNCF_PSLProps { geomType: SourceLayer; colors: Theme; layerOrder?: number; } -export function getLPVFilter(layersSettings: MapState['layersSettings']): FilterSpecification { +export function getPSLFilter(layersSettings: MapState['layersSettings']): FilterSpecification { return ['any', ['has', 'speed_limit'], ['has', getSpeedSectionsTag(layersSettings)]]; } -export function getLPVSpeedValueLayerProps({ +export function getPSLSpeedValueLayerProps({ colors, sourceTable, layersSettings, @@ -59,8 +59,8 @@ export function getLPVSpeedValueLayerProps({ 'text-offset': [0, -1], }, paint: { - 'text-color': colors.lpv.text, - 'text-halo-color': colors.lpv.halo, + 'text-color': colors.psl.text, + 'text-halo-color': colors.psl.halo, 'text-halo-width': 1, 'text-opacity': 1, }, @@ -71,7 +71,7 @@ export function getLPVSpeedValueLayerProps({ return res; } -export function getLPVSpeedLineBGLayerProps({ +export function getPSLSpeedLineBGLayerProps({ sourceTable, }: { colors?: Theme; @@ -100,7 +100,7 @@ export function getLPVSpeedLineBGLayerProps({ return res; } -export function getLPVSpeedLineLayerProps({ +export function getPSLSpeedLineLayerProps({ sourceTable, layersSettings, }: { @@ -153,67 +153,67 @@ export function getLPVSpeedLineLayerProps({ return res; } -export default function SNCF_LPV(props: SNCF_LPVProps) { +export default function SNCF_PSL(props: SNCF_PSLProps) { const { t } = useTranslation('map-settings'); const { layersSettings } = useSelector((state: RootState) => state.map); const infraID = useSelector(getInfraID); const { geomType, colors, layerOrder } = props; - const speedSectionFilter = getLPVFilter(layersSettings); + const speedSectionFilter = getPSLFilter(layersSettings); const speedValueParams = { - ...getLPVSpeedValueLayerProps({ + ...getPSLSpeedValueLayerProps({ t, colors, layersSettings, - sourceTable: 'lpv', + sourceTable: 'psl', }), filter: speedSectionFilter, }; const speedLineBGParams = { - ...getLPVSpeedLineBGLayerProps({ + ...getPSLSpeedLineBGLayerProps({ colors, layersSettings, - sourceTable: 'lpv', + sourceTable: 'psl', }), filter: speedSectionFilter, }; const speedLineParams = { - ...getLPVSpeedLineLayerProps({ + ...getPSLSpeedLineLayerProps({ colors, layersSettings, - sourceTable: 'lpv', + sourceTable: 'psl', }), filter: speedSectionFilter, }; - if (layersSettings.sncf_lpv) { + if (layersSettings.sncf_psl) { return ( <> - + ); } diff --git a/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV_PANELS.tsx b/front/src/common/Map/Layers/extensions/SNCF/SNCF_PSL_SIGNS.tsx similarity index 84% rename from front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV_PANELS.tsx rename to front/src/common/Map/Layers/extensions/SNCF/SNCF_PSL_SIGNS.tsx index 5bf406b7ca9..7907a2069c5 100644 --- a/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV_PANELS.tsx +++ b/front/src/common/Map/Layers/extensions/SNCF/SNCF_PSL_SIGNS.tsx @@ -9,19 +9,19 @@ import { getMap } from 'reducers/map/selectors'; import OrderedLayer from '../../OrderedLayer'; import { LayerContext } from '../../types'; -interface SNCF_LPV_PanelsProps { +interface SNCF_PSL_SignsProps { geomType: SourceLayer; layerOrder?: number; } -export function getLPVPanelsLayerProps({ +export function getPSLSignsLayerProps({ sourceTable, prefix, sourceLayer, }: Pick): Omit { const angleName = sourceLayer === 'sch' ? 'angle_sch' : 'angle_geo'; const res: Omit = { - id: 'panelParams', + id: 'signParams', type: 'symbol', minzoom: 11, paint: {}, @@ -65,7 +65,7 @@ export function getLPVPanelsLayerProps({ return res; } -export function getLPVPanelsMastLayerProps({ +export function getPSLSignsMastLayerProps({ sourceTable, sourceLayer, }: Pick): OmitLayer { @@ -98,7 +98,7 @@ export function getLPVPanelsMastLayerProps({ return res; } -export default function SNCF_LPV_Panels(props: SNCF_LPV_PanelsProps) { +export default function SNCF_PSL_Signs(props: SNCF_PSL_SignsProps) { const infraID = useSelector(getInfraID); const { geomType, layerOrder } = props; @@ -110,25 +110,25 @@ export default function SNCF_LPV_Panels(props: SNCF_LPV_PanelsProps) { prefix = geomType === 'sch' ? 'SCH ' : ''; } - const panelsParams: LayerProps = getLPVPanelsLayerProps({ - sourceTable: 'lpv_panels', + const signsParams: LayerProps = getPSLSignsLayerProps({ + sourceTable: 'psl_signs', sourceLayer: geomType, prefix, }); - const mastsParams: LayerProps = getLPVPanelsMastLayerProps({ - sourceTable: 'lpv_panels', + const mastsParams: LayerProps = getPSLSignsMastLayerProps({ + sourceTable: 'psl_signs', sourceLayer: geomType, }); return ( - + ); } diff --git a/front/src/common/Map/Layers/geoSignalsLayers.ts b/front/src/common/Map/Layers/geoSignalsLayers.ts index 7fea208dd95..cf89f785bae 100644 --- a/front/src/common/Map/Layers/geoSignalsLayers.ts +++ b/front/src/common/Map/Layers/geoSignalsLayers.ts @@ -4,9 +4,9 @@ import { ALL_SIGNAL_LAYERS, ALL_SIGNAL_LAYERS_SET, LIGHT_SIGNALS, - PANELS_STOPS, + SIGNS_STOPS, } from 'common/Map/Consts/SignalsNames'; -import { SIGNALS_PANELS } from 'common/Map/const'; +import { SIGNALS_SIGNS } from 'common/Map/const'; import { SourceLayer, Theme, OmitLayer } from '../../../types'; const signalTextOffsetX = 5; @@ -46,7 +46,7 @@ export function getSignalsList(signalsSettings: SignalsSettings) { return ALL_SIGNAL_LAYERS; } if (signalsSettings.stops) { - signalsList = signalsList.concat(PANELS_STOPS); + signalsList = signalsList.concat(SIGNS_STOPS); } if (signalsSettings.lights) { signalsList = signalsList.concat(LIGHT_SIGNALS); @@ -408,7 +408,7 @@ export function getSignalLayerProps( let textOffsetX = 30; const textOffsetY = 5; let isSignal = true; - if (SIGNALS_PANELS.indexOf(type) !== -1 && SIGNALS_PANELS.indexOf(type) === -1) { + if (SIGNALS_SIGNS.indexOf(type) !== -1 && SIGNALS_SIGNS.indexOf(type) === -1) { size = 0.4; iconOffsetX = 55; textOffsetX = 3; @@ -419,11 +419,6 @@ export function getSignalLayerProps( iconOffsetX = 30; offsetY = -80; } - /* - if (SIGNALS_PANELS.indexOf(type) !== -1) { - offsetY = -105; - } - */ const minZoom = 14; diff --git a/front/src/common/Map/Settings/MapSettingsSpeedLimits.tsx b/front/src/common/Map/Settings/MapSettingsSpeedLimits.tsx index 86e621aee9d..d994d86b680 100644 --- a/front/src/common/Map/Settings/MapSettingsSpeedLimits.tsx +++ b/front/src/common/Map/Settings/MapSettingsSpeedLimits.tsx @@ -122,8 +122,8 @@ export default function MapSettingsLayers() {
} + name="sncf_psl" + icon={} />
diff --git a/front/src/common/Map/WarpedMap/WarpedMap.tsx b/front/src/common/Map/WarpedMap/WarpedMap.tsx index 776acc50977..11996e72851 100644 --- a/front/src/common/Map/WarpedMap/WarpedMap.tsx +++ b/front/src/common/Map/WarpedMap/WarpedMap.tsx @@ -32,8 +32,8 @@ const OSRD_LAYER_ORDERS: Record = { track_sections: LAYER_GROUPS_ORDER[LAYERS.TRACKS_SCHEMATIC.GROUP], // Unused: catenaries: 0, - lpv: 0, - lpv_panels: 0, + psl: 0, + psl_signs: 0, routes: 0, speed_sections: 0, errors: 0, diff --git a/front/src/modules/simulationResult/components/SimulationResultsMap.tsx b/front/src/modules/simulationResult/components/SimulationResultsMap.tsx index 0f7fe48dc04..58d80c86f51 100644 --- a/front/src/modules/simulationResult/components/SimulationResultsMap.tsx +++ b/front/src/modules/simulationResult/components/SimulationResultsMap.tsx @@ -53,7 +53,7 @@ import { import { LAYER_GROUPS_ORDER, LAYERS } from 'config/layerOrder'; import 'common/Map/Map.scss'; -import SNCF_LPV from 'common/Map/Layers/extensions/SNCF/SNCF_LPV'; +import SNCF_PSL from 'common/Map/Layers/extensions/SNCF/SNCF_PSL'; import IGN_BD_ORTHO from 'common/Map/Layers/IGN_BD_ORTHO'; import IGN_SCAN25 from 'common/Map/Layers/IGN_SCAN25'; import IGN_CADASTRE from 'common/Map/Layers/IGN_CADASTRE'; @@ -342,7 +342,7 @@ const Map: FC = ({ setExtViewport }) => { colors={colors[mapStyle]} layerOrder={LAYER_GROUPS_ORDER[LAYERS.SPEED_LIMITS.GROUP]} /> - = ({ setExtViewport }) => { colors={colors[mapStyle]} layerOrder={LAYER_GROUPS_ORDER[LAYERS.SPEED_LIMITS.GROUP]} /> - - - & { extensions: { lpv_sncf: LPVExtension } } + Omit & { extensions: { psl_sncf: PSLExtension } } > { objType: 'SpeedSection'; } diff --git a/front/tests/pages/home-page-model.ts b/front/tests/pages/home-page-model.ts index ee32967cf06..3df9a24e67e 100644 --- a/front/tests/pages/home-page-model.ts +++ b/front/tests/pages/home-page-model.ts @@ -47,7 +47,7 @@ export class PlaywrightHomePage { this.getViteOverlay = page.locator('vite-plugin-checker-error-overlay'); } - // Completly remove VITE button & panel + // Completly remove VITE button & sign async removeViteOverlay() { if ((await this.getViteOverlay.count()) > 0) { await this.getViteOverlay.evaluate((node) => node.setAttribute('style', 'display:none;')); diff --git a/front/tests/pages/project-page-model.ts b/front/tests/pages/project-page-model.ts index 92dfab624fe..a9135a08fa2 100644 --- a/front/tests/pages/project-page-model.ts +++ b/front/tests/pages/project-page-model.ts @@ -74,7 +74,7 @@ export class ProjectPage { .getByText('Supprimer', { exact: true }); } - // Completly remove VITE button & panel + // Completly remove VITE button & sign async removeViteOverlay() { if ((await this.getViteOverlay.count()) > 0) { await this.getViteOverlay.evaluate((node) => node.setAttribute('style', 'display:none;'));