V2.0.0 : VOICI LES MODIFICATIONS MAJEURS APPRTÉES DANS CETTE VERSION :

-> REFONTE DU DESIGN DES AFFICHEURS CLASSIQUES (GÉNÉRAL + QUAIS)
-> IMPLÉMENTATION DU DESIGN AFL : GÉNÉRAL ET QUAIS

-> CHOIX DE LA SÉLECTION DES TYPES D'AFFICHEURS (GÉNÉRAL / QUAIS) UNE FOIS LE TYPE D'AFFICHEUR SÉLECTIONNÉS

EN COURS DE DÉVELOPPEMENT :

-> IMPLÉMENTATION DES PERTURBATION DU LANDEMAIN POUR LES HORAIRES DU LANDEMAIN AFFICHÉS AVANT MINUIT.
-> IMPLÉMENTATION DES AFFICHEURS D'INFORMATIONS / INFOS TRAVAUX, etc... (AFFICHEURS AFL)
This commit is contained in:
Ferrovia committed 2026-06-14 22:02:08 +02:00
1 parent f0d9ed9ee7
commit f06ebbaf48
43 files changed
+10519 -3813

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
import { useState, useEffect } from 'react';
export default function useTypeLogos(isQuai = false) {
const [map, setMap] = useState({ default: '/type/sncf-voyageurs-logo.png' });
useEffect(() => {
let mounted = true;
const load = async () => {
const candidates = isQuai ? ['/type/quais/data-color.json', '/type/data.json'] : ['/type/data.json'];
for (const url of candidates) {
try {
const res = await fetch(url);
if (!res.ok) continue;
const data = await res.json();
if (!mounted) return;
const logos = {};
if (Array.isArray(data.logos)) {
data.logos.forEach(item => {
if (!item.name || !item.path) return;
const key = String(item.name).toUpperCase().replace(/[^A-Z0-9]+/g, '-').replace(/-$/, '');
let path = item.path.replace('/img', '');
logos[key] = path;
if (item.slug) {
const slugKey = item.slug.toUpperCase().replace(/[^A-Z0-9]+/g, '-').replace(/-$/, '');
if (!logos[slugKey]) {
logos[slugKey] = path;
}
}
});
}
logos.default = logos['SNCF'] || logos['TER'] || '/type/sncf-voyageurs-logo.png';
setMap(logos);
return; // Stop after first successful fetch
} catch (e) {
console.error(`Failed to load logos data from ${url}`, e);
}
}
};
load();
return () => { mounted = false; };
}, [isQuai]);
return map;
}