Skip to content

Commit 0cbf0ea

Browse files
front: add toasts to update the user on the copy/cut/paste actions
Signed-off-by: Martin Bourbier <[email protected]>
1 parent 272c48b commit 0cbf0ea

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

front/public/locales/en/operational-studies.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@
6666
"otherTrains": "+{{count}} others",
6767
"trainsInConflictTitle": "TRAIN(S) IN CONFLICT"
6868
},
69+
"copyTimetable": {
70+
"title": "Timetables export",
71+
"text_one": "Successfuly exported the timetable to the clipboard",
72+
"text_other": "Successfuly exported the timetables to the clipboard"
73+
},
74+
"cutTimetable": {
75+
"title": "Timetables deletion",
76+
"text_one": "Deleted the timetable and exported it to the clipboard",
77+
"text_other": "Deleted the timetables and exported them to the clipboard"
78+
},
6979
"description": {
7080
"electricalProfileWithId": "Electrical profiles : ID{{id}}",
7181
"electricalProfileWithName": "Electrical profiles : {{name}} | ID{{id}}"
@@ -152,6 +162,11 @@
152162
"pacedTrain_one": "1 service",
153163
"pacedTrain_other": "{{count}} services",
154164
"pacedTrain_zero": "0 service",
165+
"pasteTimetable": {
166+
"title": "Timetables import",
167+
"text_one": "Imported the timetable from the clipboard",
168+
"text_other": "Imported the timetables from the clipboard"
169+
},
155170
"requestedDestination": "requested destination",
156171
"requestedOrigin": "requested origin",
157172
"requestedPoint": "requested point ({{ count }})",

front/public/locales/fr/operational-studies.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@
6666
"otherTrains": "+{{count}} autres",
6767
"trainsInConflictTitle": "TRAIN(S) EN CONFLIT"
6868
},
69+
"copyTimetable": {
70+
"title": "Export de circulations",
71+
"text_one": "Circulation exportée dans le presse-papiers",
72+
"text_other": "Circulations exportées dans le presse-papiers"
73+
},
74+
"cutTimetable": {
75+
"title": "Supression de circulations",
76+
"text_one": "Circulation supprimée et exportée dans le presse-papiers",
77+
"text_other": "Circulations supprimées et exportées dans le presse-papiers"
78+
},
6979
"description": {
7080
"electricalProfileWithId": "Profils électriques : ID{{id}}",
7181
"electricalProfileWithName": "Profils électriques : {{name}} | ID{{id}}"
@@ -152,6 +162,11 @@
152162
"pacedTrain_one": "1 mission",
153163
"pacedTrain_other": "{{count}} missions",
154164
"pacedTrain_zero": "0 mission",
165+
"pasteTimetable": {
166+
"title": "Import de circulations",
167+
"text_one": "Circulation du presse-papiers importée",
168+
"text_other": "Circulations du presse-papiers importées"
169+
},
155170
"requestedDestination": "destination demandée",
156171
"requestedOrigin": "origine demandée",
157172
"requestedPoint": "point demandé ({{ count }})",

front/src/applications/operationalStudies/views/Scenario/components/Timetable/TimetableBoardWrapper.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ const TimetableBoardWrapper = ({
131131

132132
event.preventDefault();
133133
copyTimetableItemsToClipboard(selectedTimetableItemIds, timetableItems);
134+
dispatch(
135+
setSuccess({
136+
title: t('main.copyTimetable.title'),
137+
text: t('main.copyTimetable.text', { count: selectedTimetableItemIds.length }),
138+
})
139+
);
134140
},
135141
[selectedTimetableItemIds, timetableItems]
136142
);
@@ -147,6 +153,12 @@ const TimetableBoardWrapper = ({
147153
const newTimetableItems = [...trainSchedules, ...pacedTrains];
148154
upsertTimetableItems(newTimetableItems);
149155
setSelectedTimetableItemIds(newTimetableItems.map((item) => item.id));
156+
dispatch(
157+
setSuccess({
158+
title: t('main.pasteTimetable.title'),
159+
text: t('main.pasteTimetable.text', { count: newTimetableItems.length }),
160+
})
161+
);
150162
}, [navigator.clipboard, timetableId]);
151163

152164
const ctrlX = useCallback(
@@ -158,6 +170,12 @@ const TimetableBoardWrapper = ({
158170
event.preventDefault();
159171
copyTimetableItemsToClipboard(selectedTimetableItemIds, timetableItems);
160172
removeAndUnselectTrains(selectedTimetableItemIds);
173+
dispatch(
174+
setSuccess({
175+
title: t('main.cutTimetable.title'),
176+
text: t('main.cutTimetable.text', { count: selectedTimetableItemIds.length }),
177+
})
178+
);
161179
},
162180
[selectedTimetableItemIds, timetableItems]
163181
);

0 commit comments

Comments
 (0)