Skip to content

Commit eb84a39

Browse files
Caracol3RomainValls
authored andcommitted
lmr: add messages during pathfinding and when its done
Signed-off-by: Mathieu <[email protected]>
1 parent 9109fb7 commit eb84a39

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

front/src/applications/stdcm/components/StdcmForm/StdcmConfig.tsx

+26
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const StdcmConfig = ({
110110
maxSpeed: validateMaxSpeed(maxSpeed, rollingStock?.max_speed),
111111
};
112112
}, [rollingStock, towedRollingStock, totalMass, totalLength, maxSpeed]);
113+
const [validationMessage, setValidationMessage] = useState<string | null>(null);
113114

114115
const disabled = isPending || retainedSimulationIndex > -1;
115116

@@ -173,6 +174,24 @@ const StdcmConfig = ({
173174
}
174175
}, []);
175176

177+
useEffect(() => {
178+
if (origin.location && destination.location) {
179+
setValidationMessage("validation de l'itinéraire en cours");
180+
} else {
181+
setValidationMessage(null);
182+
}
183+
}, [origin, destination]);
184+
185+
useEffect(() => {
186+
if (pathfinding?.status === 'success') {
187+
setValidationMessage("l'itinéraire demandé est valide");
188+
const timer = setTimeout(() => {
189+
setValidationMessage(null);
190+
}, 2000);
191+
return () => clearTimeout(timer);
192+
}
193+
}, [pathfinding?.status]);
194+
176195
return (
177196
<div className="stdcm__body">
178197
{isDebugMode && (
@@ -208,6 +227,13 @@ const StdcmConfig = ({
208227
})}
209228
ref={launchButtonRef}
210229
>
230+
<div className="simulation-status-banner">
231+
<div className="banner-content">
232+
{validationMessage && (
233+
<div className="validation-message">{validationMessage}</div>
234+
)}
235+
</div>
236+
</div>
211237
<Button
212238
data-testid="launch-simulation-button"
213239
className={cx({

front/src/styles/scss/applications/stdcm/_home.scss

+11
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,17 @@
294294
line-height: 24px;
295295
text-align: center;
296296
}
297+
298+
.validation-message {
299+
@extend .status;
300+
color: rgb(33, 100, 130);
301+
background-color: rgb(230, 247, 255);
302+
margin-top: 20px;
303+
box-shadow:
304+
0 0 0 4px rgba(255, 255, 255, 1) inset,
305+
0 0 0 5px rgba(104, 159, 255, 1) inset,
306+
0 3px 7px -3px rgba(28, 28, 217, 0.4);
307+
}
297308
}
298309
}
299310
}

0 commit comments

Comments
 (0)