Skip to content

Commit 0a724fd

Browse files
committed
front: remove confirm and cancel buttons in layersmodal component
1 parent dad9c1c commit 0a724fd

File tree

5 files changed

+69
-77
lines changed

5 files changed

+69
-77
lines changed

front/public/locales/en/translation.json

+23-23
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"entities": {
4040
"track_section": "Track section",
4141
"track_section-length": "Length",
42-
"errors-linked" : "Linked issues"
42+
"errors-linked": "Linked issues"
4343
},
4444
"directions": {
4545
"START_TO_STOP": "Start to stop",
@@ -74,63 +74,63 @@
7474
"description": "Switch type « {{obj_id}} » contains a duplicate configuration « {{original_group_path}} »"
7575
},
7676
"empty_object": {
77-
"name": "Empty object",
77+
"name": "Empty object",
7878
"description": "Object « {{obj_id}} » has the field « {{field}} » empty"
7979
},
8080
"invalid_group": {
81-
"name": "Position de l'aiguille invalide",
81+
"name": "Position de l'aiguille invalide",
8282
"description": "The switch « {{obj_id}} » of the route « {{group}} » is in the configuration « {{switch_type}} » which does not exist"
8383
},
84-
"invalid_reference":{
85-
"name": "Invalid reference",
84+
"invalid_reference": {
85+
"name": "Invalid reference",
8686
"description": "The object « {{obj_id}} » references the object « {{reference.obj_id}} » which does not exist"
8787
},
88-
"invalid_route":{
89-
"name": "Invalid route",
88+
"invalid_route": {
89+
"name": "Invalid route",
9090
"description": "Route « {{obj_id}} » is invalid, requested path is not consistent"
9191
},
9292
"invalid_switch_ports": {
93-
"name": "Invalid switch pattern",
93+
"name": "Invalid switch pattern",
9494
"description": "Switch « {{obj_id}} » has a branch which is not compatible with its type"
9595
},
9696
"missing_route": {
97-
"name": "Missing route",
97+
"name": "Missing route",
9898
"description": "Track « {{obj_id}} » has no associated route"
9999
},
100100
"missing_buffer_stop": {
101-
"name": "Missing buffer stop",
102-
"description":"Endpoint « {{endpoint}} » of track « {{obj_id}} » has no buffer stop"
101+
"name": "Missing buffer stop",
102+
"description": "Endpoint « {{endpoint}} » of track « {{obj_id}} » has no buffer stop"
103103
},
104104
"object_out_of_path": {
105-
"name": "Object out of path",
105+
"name": "Object out of path",
106106
"description": "Object « {{obj_id}} » of track « {{reference.obj_id}} » is not contained in the corresponding path"
107107
},
108108
"odd_buffer_stop_location": {
109-
"name": "Strange buffer stop position",
109+
"name": "Strange buffer stop position",
110110
"description": "Buffer stop « {{obj_id}} » has a strange position"
111111
},
112-
"out_of_range":{
113-
"name": "Invalid value",
112+
"out_of_range": {
113+
"name": "Invalid value",
114114
"description": "Object « {{obj_id}} » has the field « {{field}} » with an invalid value. Value must be in the following range {{expected_range}}."
115115
},
116-
"overlapping_speed_sections": {
117-
"name": "Overlapping of speed limits",
116+
"overlapping_speed_sections": {
117+
"name": "Overlapping of speed limits",
118118
"description": "Speed limit « {{obj_id}} » overlaps « {{reference.obj_id}} »"
119119
},
120120
"overlapping_switches": {
121-
"name": "Overlapping of switches",
121+
"name": "Overlapping of switches",
122122
"description": "Switches « {{obj_id}} » and « {{reference.obj_id}} » have the same extremeties"
123123
},
124124
"overlapping_catenaries": {
125-
"name": "Overlapping of catenaries",
125+
"name": "Overlapping of catenaries",
126126
"description": "Catenary « {{obj_id}} » overlaps catenary « {{reference.obj_id}} »"
127127
},
128128
"unknown_port_name": {
129-
"name": "Unknown branch name",
129+
"name": "Unknown branch name",
130130
"description": "Switch « {{obj_id}} » has the branch « {{port_name}} » which does not exist"
131131
},
132132
"unused_port": {
133-
"name": "Unused branch",
133+
"name": "Unused branch",
134134
"description": "Branch « {{port_name}} » of switch type « {{obj_id}} » is nerver used"
135135
}
136136
},
@@ -167,8 +167,8 @@
167167
"frozen-layer": "needed for the active tool",
168168
"layer-selected-items_one": "One item selected",
169169
"layer-selected-items_other": "{{count}} items selected",
170-
"selection-warning_one": "An element will be deselected during confirmation.",
171-
"selection-warning_other": "{{count}} elements will be deselected during confirmation.",
170+
"selection-warning_one": "An element has been deselected.",
171+
"selection-warning_other": "{{count}} elements have been deselected.",
172172
"no-speed-limit-tag": "No composition code"
173173
},
174174
"linear-metadata": {

front/public/locales/fr/translation.json

+23-23
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"entities": {
4040
"track_section": "Track section",
4141
"track_section-length": "Taille",
42-
"errors-linked" : "Anomalies liées"
42+
"errors-linked": "Anomalies liées"
4343
},
4444
"directions": {
4545
"START_TO_STOP": "Départ vers arrivée",
@@ -74,63 +74,63 @@
7474
"description": "Le type d’aiguille « {{obj_id}} » contient un doublon de configuration « {{original_group_path}} »"
7575
},
7676
"empty_object": {
77-
"name": "Object vide",
77+
"name": "Object vide",
7878
"description": "L’objet « {{obj_id}} » a le champ « {{field}} » vide"
7979
},
8080
"invalid_group": {
81-
"name": "Position de l'aiguille invalide",
81+
"name": "Position de l'aiguille invalide",
8282
"description": "L’aiguille « {{obj_id}} » de la route « {{group}} » est dans la configuration « {{switch_type}} » qui n’existe pas"
8383
},
84-
"invalid_reference":{
85-
"name": "Référence invalide",
84+
"invalid_reference": {
85+
"name": "Référence invalide",
8686
"description": "L’object « {{obj_id}} » référence l’objet « {{reference.obj_id}} » qui n’existe pas"
8787
},
88-
"invalid_route":{
89-
"name": "Itinéraire invalide",
88+
"invalid_route": {
89+
"name": "Itinéraire invalide",
9090
"description": "La route « {{obj_id}} » est invalide, le chemin demandé n’est pas consistant"
9191
},
9292
"invalid_switch_ports": {
93-
"name": "Branche d’aiguille ou de nœud invalide",
93+
"name": "Branche d’aiguille ou de nœud invalide",
9494
"description": "L’aiguille/le nœud « {{obj_id}} » présente une branche qui n’est pas compatible avec son type d’aiguille/nœud (qui n’existe pas dans son type d’aiguille/nœud)"
9595
},
9696
"missing_route": {
97-
"name": "Itinéraire manquant",
97+
"name": "Itinéraire manquant",
9898
"description": "La voie « {{obj_id}} » n’a aucun itinéraire associé"
9999
},
100100
"missing_buffer_stop": {
101-
"name": "Heurtoir manquant",
102-
"description":"L'extrémité « {{endpoint}} » de la voie « {{obj_id}} » n'a pas de heurtoir"
101+
"name": "Heurtoir manquant",
102+
"description": "L'extrémité « {{endpoint}} » de la voie « {{obj_id}} » n'a pas de heurtoir"
103103
},
104104
"object_out_of_path": {
105-
"name": "Objet en dehors de l'itinéraire",
105+
"name": "Objet en dehors de l'itinéraire",
106106
"description": "L’aiguille/le nœud ou le détecteur « {{obj_id}} » de l’itineraire « {{reference.obj_id}} » n’est pas contenu/contenue dans le chemin correspondant"
107107
},
108108
"odd_buffer_stop_location": {
109-
"name": "Position d'heurtoir étrange",
109+
"name": "Position d'heurtoir étrange",
110110
"description": "L'heurtoir « {{obj_id}} » se trouve à une position étrange"
111111
},
112-
"out_of_range":{
113-
"name": "Valeur invalide",
112+
"out_of_range": {
113+
"name": "Valeur invalide",
114114
"description": "L’objet « {{obj_id}} » a le champ « {{field}} » avec une valeur invalide. La valeur doit être comprise dans l'intervalle {{expected_range}}."
115115
},
116-
"overlapping_speed_sections": {
117-
"name": "Superposition de limites de vitesse",
116+
"overlapping_speed_sections": {
117+
"name": "Superposition de limites de vitesse",
118118
"description": "La limite « {{obj_id}} » se superpose à la limite « {{reference.obj_id}} »"
119119
},
120120
"overlapping_switches": {
121-
"name": "Superposition d’aiguilles/nœuds",
121+
"name": "Superposition d’aiguilles/nœuds",
122122
"description": "L’aiguille/le noeud « {{obj_id}} » et l’aiguille/le noeud « {{reference.obj_id}} » connectent les mêmes extrémités des voies"
123123
},
124124
"overlapping_catenaries": {
125-
"name": "Superposition de catenaires",
125+
"name": "Superposition de catenaires",
126126
"description": "La catenaire « {{obj_id}} » se superpose à la catenaire « {{reference.obj_id}} »"
127127
},
128128
"unknown_port_name": {
129-
"name": "Nom de branche inconnu",
129+
"name": "Nom de branche inconnu",
130130
"description": "L’aiguille/le noeud « {{obj_id}} » présente la branche « {{port_name}} » qui n’est pas existante"
131131
},
132132
"unused_port": {
133-
"name": "Branche non utilisée",
133+
"name": "Branche non utilisée",
134134
"description": "La branche « {{port_name}} » déclarée dans le type d’aiguille/nœud « {{obj_id}} » n’est pas utilisée dans les configurations de ce type"
135135
}
136136
},
@@ -167,8 +167,8 @@
167167
"frozen-layer": "nécessaire pour l'outil actif",
168168
"layer-selected-items_one": "Un élément sélectionné",
169169
"layer-selected-items_other": "{{count}} éléments sélectionnés",
170-
"selection-warning_one": "Un élément sera désélectionné lors de la confirmation.",
171-
"selection-warning_other": "{{count}} éléments seront désélectionnés lors de la confirmation.",
170+
"selection-warning_one": "Un élément a été désélectionné.",
171+
"selection-warning_other": "{{count}} éléments ont été désélectionnés.",
172172
"no-speed-limit-tag": "Aucun code de composition"
173173
},
174174
"linear-metadata": {

front/src/applications/editor/components/LayersModal.tsx

+11-23
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import signalsIcon from 'assets/pictures/layersicons/layer_signal.svg';
1212
import pslsIcon from 'assets/pictures/layersicons/layer_tivs.svg';
1313

1414
import SwitchSNCF from 'common/BootstrapSNCF/SwitchSNCF/SwitchSNCF';
15-
import { useModal, Modal } from 'common/BootstrapSNCF/ModalSNCF';
15+
import { Modal } from 'common/BootstrapSNCF/ModalSNCF';
1616
import MapSettingsBackgroundSwitches from 'common/Map/Settings/MapSettingsBackgroundSwitches';
1717
import { GiElectric } from 'react-icons/gi';
18-
import { LayerType, EDITOAST_TO_LAYER_DICT, EditoastType } from '../tools/types';
19-
import { selectLayers } from '../../../reducers/editor';
20-
import { EditorEntity } from '../../../types';
21-
import { getMap } from '../../../reducers/map/selectors';
22-
import { getInfraID } from '../../../reducers/osrdconf/selectors';
23-
import { osrdEditoastApi } from '../../../common/api/osrdEditoastApi';
24-
import { updateLayersSettings } from '../../../reducers/map';
18+
import { LayerType, EDITOAST_TO_LAYER_DICT, EditoastType } from 'applications/editor/tools/types';
19+
import { selectLayers } from 'reducers/editor';
20+
import { EditorEntity } from 'types';
21+
import { getMap } from 'reducers/map/selectors';
22+
import { getInfraID } from 'reducers/osrdconf/selectors';
23+
import { osrdEditoastApi } from 'common/api/osrdEditoastApi';
24+
import { updateLayersSettings } from 'reducers/map';
2525

2626
export const LAYERS: Array<{ layers: LayerType[]; icon: string | JSX.Element }> = [
2727
{ layers: ['track_sections'], icon: trackSectionsIcon },
@@ -50,7 +50,6 @@ const LayersModal: FC<LayersModalProps> = ({
5050
}) => {
5151
const dispatch = useDispatch();
5252
const { t } = useTranslation();
53-
const { closeModal } = useModal();
5453
const { layersSettings } = useSelector(getMap);
5554
const [selectedLayers, setSelectedLayers] = useState<Set<LayerType>>(initialLayers);
5655
const [speedLimitTag, setSpeedLimitTag] = useState<string | undefined>(
@@ -123,6 +122,7 @@ const LayersModal: FC<LayersModalProps> = ({
123122
const layerKey = layers.join('-');
124123
const count = sum(layers.map((id) => selectionCounts[id] || 0));
125124
const disabled = frozenLayers && layers.some((id) => frozenLayers.has(id));
125+
const checked = layers.every((id) => selectedLayers.has(id));
126126
return (
127127
<div className="col-lg-6" key={`${layerKey}-${count}-${disabled}`}>
128128
<div className="d-flex align-items-center mt-2">
@@ -149,7 +149,7 @@ const LayersModal: FC<LayersModalProps> = ({
149149
}}
150150
name={`editor-layer-${layerKey}`}
151151
id={`editor-layer-${layerKey}`}
152-
checked={layers.every((id) => selectedLayers.has(id))}
152+
checked={checked}
153153
disabled={disabled}
154154
/>
155155
{isString(icon) ? (
@@ -159,7 +159,7 @@ const LayersModal: FC<LayersModalProps> = ({
159159
)}
160160
<div className="d-flex flex-column">
161161
<div>{t(`Editor.layers.${layerKey}`)}</div>
162-
{!!count && (
162+
{!!count && checked && (
163163
<div className="small text-muted font-italic">
164164
{t('Editor.layers-modal.layer-selected-items', {
165165
count,
@@ -207,18 +207,6 @@ const LayersModal: FC<LayersModalProps> = ({
207207
{t('Editor.layers-modal.selection-warning', { count: unselectCount })}
208208
</div>
209209
)}
210-
<button type="button" className="btn btn-danger mr-2" onClick={closeModal}>
211-
{t('common.cancel')}
212-
</button>
213-
<button
214-
type="button"
215-
className="btn btn-primary"
216-
onClick={() => {
217-
closeModal();
218-
}}
219-
>
220-
{t('common.confirm')}
221-
</button>
222210
</div>
223211
</Modal>
224212
);

front/src/applications/editor/tools/rangeEdition/catenary/CatenaryEditionLayers.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import GeoJSONs, { SourcesDefinitionsIndex } from 'common/Map/Layers/GeoJSONs';
1313
import { getEntities, getEntity } from 'applications/editor/data/api';
1414
import { mapValues } from 'lodash';
1515
import { Layer, Popup, Source } from 'react-map-gl/maplibre';
16-
import { getTrackRangeFeatures, isOnModeMove } from '../utils';
17-
import { RangeEditionState, TrackState } from '../types';
18-
import { ExtendedEditorContextType } from '../../editorContextTypes';
19-
import EntitySumUp from '../../../components/EntitySumUp';
16+
import EntitySumUp from 'applications/editor/components/EntitySumUp';
17+
import { getTrackRangeFeatures, isOnModeMove } from 'applications/editor/tools/rangeEdition/utils';
18+
import { RangeEditionState, TrackState } from 'applications/editor/tools/rangeEdition/types';
19+
import { ExtendedEditorContextType } from 'applications/editor/tools/editorContextTypes';
2020

2121
export const CatenaryEditionLayers: FC = () => {
2222
const dispatch = useDispatch();

front/src/applications/editor/tools/rangeEdition/speedSection/SpeedSectionEditionLayers.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ import {
1818
getTrackRangeFeatures,
1919
isOnModeMove,
2020
speedSectionIsPsl,
21-
} from '../utils';
22-
import { PslSignFeature, RangeEditionState, TrackState } from '../types';
23-
import { ExtendedEditorContextType } from '../../editorContextTypes';
24-
import EntitySumUp from '../../../components/EntitySumUp';
21+
} from 'applications/editor/tools/rangeEdition/utils';
22+
import {
23+
PslSignFeature,
24+
RangeEditionState,
25+
TrackState,
26+
} from 'applications/editor/tools/rangeEdition/types';
27+
import { ExtendedEditorContextType } from 'applications/editor/tools/editorContextTypes';
28+
import EntitySumUp from 'applications/editor/components/EntitySumUp';
2529

2630
export const SpeedSectionEditionLayers: FC = () => {
2731
const dispatch = useDispatch();

0 commit comments

Comments
 (0)