V1.1.1 //

-> Patch du bug du logo de l'horaire pas affiché. Corrigé.
This commit is contained in:
AdminGit committed 2026-10-07 19:49:58 +02:00
1 parent eb198cc727
commit 23828a54ef
10 files changed
+662 -428

No files matched your search

@@ -696,12 +696,17 @@ export default function ClassiquesDeparts({ defilement = null } = {}){
useEffect(() => {
let mounted = true;
let inFlight = false; // empêche les fetchs concurrents
let pendingRefresh = false;
const source = getSourceFromPath(window.location.pathname);
const fetchData = async () => {
if (!mounted) return;
if (inFlight) return;
if (inFlight) {
pendingRefresh = true;
return;
}
inFlight = true;
pendingRefresh = false;
if (source === 'sncf') {
setLoading(true);
@@ -741,6 +746,10 @@ export default function ClassiquesDeparts({ defilement = null } = {}){
} finally {
if (mounted) setLoading(false);
inFlight = false;
if (pendingRefresh && mounted) {
pendingRefresh = false;
fetchData();
}
}
return;
}
@@ -1169,7 +1178,18 @@ export default function ClassiquesDeparts({ defilement = null } = {}){
const intervalMs = 15000; // 15 secondes par défaut
const intervalId = setInterval(fetchData, intervalMs);
return () => { mounted = false; clearInterval(intervalId); };
const onRtUpdate = () => { if (mounted) fetchData(); };
if (typeof window !== 'undefined') {
window.addEventListener('sncf-realtime-updated', onRtUpdate);
}
return () => {
mounted = false;
clearInterval(intervalId);
if (typeof window !== 'undefined') {
window.removeEventListener('sncf-realtime-updated', onRtUpdate);
}
};
}, [gareDisplay, gareParam, gareIdParam, parseTimeHM, buildPerturbMap, computeStatusForHoraireAtStop, findPerturbsForHoraireAndStop, normalizeName, formatTimeFromHM, applyPerturbationsToHoraires, debug, getStops, getPerturbationJours, defilementMode]);
// Helpers pour perturbations (memoized plus haut)
@@ -1253,7 +1273,7 @@ export default function ClassiquesDeparts({ defilement = null } = {}){
}
const horaire = h || {};
const { logoSrc, typeLabel, numTrain, isCar: metaIsCar, isSubstitution: metaIsSubstitution, brand: metaBrand } = getTrainLogoAndMeta(horaire);
const { logoSrc, typeLabel, numTrain, isCar: metaIsCar, isSubstitution: metaIsSubstitution, brand: metaBrand, brandClass } = getTrainLogoAndMeta(horaire, gareDisplay || gareParam);
const time = horaire._displayTime || formatTimeNoSeconds(horaire.heure_depart || horaire.departure_time || horaire.time || horaire.heure || '');
const destination = horaire.gare_arrivee_nom || horaire.gare_arrivee || horaire.destination || '';
const formattedDestination = formatStationName(destination);
@@ -1274,7 +1294,7 @@ export default function ClassiquesDeparts({ defilement = null } = {}){
const status = horaire._status || computeStatusForHoraireAtStop(horaire, stationId, stationName, buildPerturbMap(perturbations));
const isSuppressed = status && status.label === 'supprimé';
const isDelayed = status && status.label && String(status.label).startsWith('retardé');
const isCar = (
const isCar = metaIsCar || (
(horaire.type_train && (horaire.type_train.toUpperCase().includes('AUTOCAR') || horaire.type_train.toUpperCase().includes('CAR TER') || horaire.type_train.toUpperCase() === 'BUS')) ||
(horaire.op && (horaire.op.toUpperCase().includes('AUTOCAR') || horaire.op.toUpperCase().includes('CAR TER') || horaire.op.toUpperCase() === 'BUS')) ||
(horaire.type && (horaire.type.toUpperCase().includes('AUTOCAR') || horaire.type.toUpperCase().includes('CAR TER') || horaire.type.toUpperCase() === 'BUS')) ||
@@ -1288,6 +1308,7 @@ export default function ClassiquesDeparts({ defilement = null } = {}){
cleanPlatform === 'CAR' ||
cleanPlatform === 'BUS'
);
const isSub = metaIsSubstitution || Boolean(horaire.is_substitution);
const showPlatform = !isSuppressed && (isCar || Boolean(cleanPlatform));
const stopsList = isExtended ? getStopsListForDeparts(horaire, gareDisplay || gareParam, normalizeName) : [];
@@ -1334,7 +1355,7 @@ export default function ClassiquesDeparts({ defilement = null } = {}){
</div>
<div className="aff-classiques-departs__col-destination">
<MarqueeText text={formattedDestination} className="aff-classiques-departs__destination" />
<MarqueeText text={isSub ? `[CAR DE REMPLACEMENT] ${formattedDestination}` : formattedDestination} className="aff-classiques-departs__destination" />
</div>
<div className="aff-classiques-departs__col-platform">
@@ -1358,7 +1379,12 @@ export default function ClassiquesDeparts({ defilement = null } = {}){
speed={50}
text={
<span className="aff-classiques-departs__stops-chain">
{stopsList.map((stopName, sIdx) => (
{isSub && (
<span className="aff-classiques-departs__stop-item" style={{ color: '#ffd200', fontWeight: 'bold' }}>
CAR DE REMPLACEMENT
<span className="aff-classiques-departs__stop-bullet">•</span>
</span>
)}{stopsList.map((stopName, sIdx) => (
<span key={sIdx} className="aff-classiques-departs__stop-item">
{sIdx > 0 && <span className="aff-classiques-departs__stop-bullet">•</span>}
<span className="aff-classiques-departs__stop-name">{stopName}</span>