import React from 'react'; import { WcsCard, WcsCardBody, WcsButton, WcsBadge, WcsHorizontalStepper } from 'wcs-react'; import sessionMemory from '../lib/sessionMemory'; import { getSourceFromPath } from '../services/railwayService'; export default function Displays({ onBack, navigate }) { const source = getSourceFromPath(window.location.pathname); const prefix = source === 'supabase' ? '/ferrovia' : ''; const types = [ { id: 'afl', label: 'AFL', sublabel: 'Afficheurs Fluides & Lumineux', tag: 'Recommandé / Moderne', tagType: 'modern', icon: '🖥️', desc: 'Écrans modernes haute lisibilité avec cycles Départs / Arrivées, Informations trafic, Sécurité et Correspondances.' }, { id: 'classiques', label: 'Classiques', sublabel: 'Téléaffichage Historique', tag: 'Rétro / Vintage', tagType: 'retro', icon: '📺', desc: 'Reproduction des moniteurs cathodiques et écrans à palettes historiques des gares SNCF.' }, { id: 'eva', label: 'EVA', sublabel: 'Écrans Vidéo Voyageurs', tag: 'Gares Connectées', tagType: 'modern', icon: '📱', desc: "Écrans d'information enrichis avec multimédia, infogare et dessertes complètes." }, { id: 'transilien', label: 'Transilien', sublabel: 'Réseau Île-de-France', tag: 'Régional IDF', tagType: 'retro', icon: '🚊', desc: 'Afficheurs dédiés aux lignes RER et Transilien SNCF (lignes C, D, E, H, J, L, N, P, R, U).' } ]; const cleanPath = (typeof window !== 'undefined' ? window.location.pathname : '').replace(/ferrovia/, ''); const parts = cleanPath.split('/').filter(Boolean); const typeIds = types.map(t => t.id); let gare = null; if (parts[0] === 'afficheurs' && parts[1] && !typeIds.includes(parts[1])) { try { gare = decodeURIComponent(parts.slice(1).join('/')); } catch (e) { gare = parts.slice(1).join('/'); } } else { const paramsForGare = new URLSearchParams(window.location.search || ''); const g = paramsForGare.get('gare'); if (g) { try { gare = decodeURIComponent(String(g).replace(/\\+/g, ' ')).replace(/-/g, ' '); } catch (e) { gare = String(g).replace(/-/g, ' '); } } } const params = new URLSearchParams(window.location.search || ''); let mode = params.get('mode'); if (!mode) { try { const stored = sessionMemory.get('afficheurMode'); if (stored) mode = stored; } catch (e) {} } if (!mode) mode = 'departs'; const formattedGareName = gare ? gare.replace(/-/g, ' ') : 'Non sélectionnée'; const steps = [ { text: formattedGareName, button: { kind: 'Icon', iconName: 'check' }, complete: true }, { text: "Type d'afficheur", button: { kind: 'Text', text: '2' }, complete: false }, { text: 'Options & Affichage', button: { kind: 'Text', text: '3' }, disable: true } ]; return (
Gare : {formattedGareName} • Mode : {mode === 'arrivees' ? '🏁 Arrivées' : '🚆 Départs'}
{t.desc}