V2.0.1 : 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
This commit is contained in:
1 parent
68f0bc2807
commit
71822823f2
9 files changed
+189
-497
No files matched your search
@@ -76,65 +76,32 @@ export default function ClassiquesDepartsQuais() {
|
||||
const [perturbations, setPerturbations] = useState([]);
|
||||
const [, setTravaux] = useState([]);
|
||||
|
||||
const weekdayNameForColumn = useCallback((d) => {
|
||||
const i = d.getDay();
|
||||
switch(i) {
|
||||
case 1: return 'circule_lundi';
|
||||
case 2: return 'circule_mardi';
|
||||
case 3: return 'circule_mercredi';
|
||||
case 4: return 'circule_jeudi';
|
||||
case 5: return 'circule_vendredi';
|
||||
case 6: return 'circule_samedi';
|
||||
case 0: return 'circule_dimanche';
|
||||
default: return null;
|
||||
}
|
||||
}, []);
|
||||
|
||||
const isPublicHoliday = useCallback((d) => {
|
||||
const y = d.getFullYear();
|
||||
const m = d.getMonth() + 1;
|
||||
const day = d.getDate();
|
||||
const s = `${y}-${String(m).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
||||
const holidays = [
|
||||
`${y}-01-01`,
|
||||
`${y}-05-01`,
|
||||
`${y}-05-08`,
|
||||
`${y}-07-14`,
|
||||
`${y}-08-15`,
|
||||
`${y}-11-01`,
|
||||
`${y}-11-11`,
|
||||
`${y}-12-25`,
|
||||
];
|
||||
if (y === 2026) {
|
||||
holidays.push('2026-04-06');
|
||||
holidays.push('2026-05-14');
|
||||
holidays.push('2026-05-25');
|
||||
}
|
||||
return holidays.includes(s);
|
||||
}, []);
|
||||
|
||||
const circulatesOn = useCallback((h, d) => {
|
||||
if (isPublicHoliday(d)) {
|
||||
const v = h['circule_jours_feries'];
|
||||
if (typeof v === 'boolean') return v;
|
||||
if (typeof v === 'number') return v === 1;
|
||||
if (typeof v === 'string') {
|
||||
const s = v.trim().toLowerCase();
|
||||
return s === 'true' || s === '1' || s === 't' || s === 'y' || s === 'yes';
|
||||
const pad = (n) => String(n).padStart(2, '0');
|
||||
const targetDateStr = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
||||
|
||||
const customDaysRaw = h.jours_personnalises;
|
||||
if (!customDaysRaw) return false;
|
||||
|
||||
let customDays = [];
|
||||
if (Array.isArray(customDaysRaw)) {
|
||||
customDays = customDaysRaw;
|
||||
} else if (typeof customDaysRaw === 'string') {
|
||||
try {
|
||||
customDays = JSON.parse(customDaysRaw);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return (typeof v === 'undefined' || v === null) ? false : Boolean(v);
|
||||
}
|
||||
const col = weekdayNameForColumn(d);
|
||||
if (!col) return true;
|
||||
const v = h[col];
|
||||
if (typeof v === 'boolean') return v;
|
||||
if (typeof v === 'number') return v === 1;
|
||||
if (typeof v === 'string') {
|
||||
const s = v.trim().toLowerCase();
|
||||
return s === 'true' || s === '1' || s === 't' || s === 'y' || s === 'yes';
|
||||
|
||||
if (Array.isArray(customDays)) {
|
||||
const match = customDays.find(item => item.date === targetDateStr);
|
||||
if (match) {
|
||||
return Boolean(match.circule);
|
||||
}
|
||||
}
|
||||
return (typeof v === 'undefined' || v === null) ? true : Boolean(v);
|
||||
}, [isPublicHoliday, weekdayNameForColumn]);
|
||||
return false;
|
||||
}, []);
|
||||
|
||||
const normalizeName = useCallback((s) => {
|
||||
if (!s) return '';
|
||||
|
||||
Reference in new issue
Block a user