Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
## Upcoming release

- Demo: period labels now group the per-day-of-week entries of a hint and
condense consecutive weekdays into a range, e.g. « Vacances scolaires
(lun-sam) : du lundi au samedi + samedis » instead of one « … — lundis »
entry per weekday. Applies to the period cards and the calendar legend.
condense consecutive weekdays into a range, days first and hint name in
parentheses: « Du lundi au samedi (Vacances scolaires) + samedis » instead
of one « … — lundis » entry per weekday. Applies to the period cards and
the calendar legend. The built-in school-vacation hint drops its
« (lun-sam) » suffix, redundant now that the labels spell the days out.

- Demo: new « Sous le capot » section under the results with two collapsible,
syntax-highlighted (Prism) snippets: the exact `findCalendarPeriods` call of
Expand All @@ -15,10 +17,9 @@
with a copy button.

- Demo: the built-in school-vacation hint now covers Monday to Saturday
instead of Monday to Friday, and is renamed « Vacances scolaires
(lun-sam) ». Saturdays inside a vacation period therefore get their own
per-day-of-week group, matching what the calendar grid already
highlighted (every vacation day except Sundays).
instead of Monday to Friday. Saturdays inside a vacation period therefore
get their own per-day-of-week group, matching what the calendar grid
already highlighted (every vacation day except Sundays).

- Demo: the calendar grid now underlines school-vacation days (Sundays
excluded) and marks public holidays with an asterisk next to the day
Expand Down
12 changes: 7 additions & 5 deletions website/src/day-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ export function frLabel(label: string): string {
}

// Libellé d'une période : les labels « Hint — Mondays + Hint — Tuesdays + … »
// issus de la politique per-day-of-week sont regroupés par hint, et les jours
// consécutifs condensés en « du lundi au samedi ». Semaine à la française,
// lundi en tête.
// issus de la politique per-day-of-week sont regroupés par hint — les jours
// d'abord, le nom du hint entre parenthèses : « Du lundi au samedi (Vacances
// scolaires) » — et les jours consécutifs condensés en « du … au … ».
// Semaine à la française, lundi en tête.
const WEEKDAYS_EN = ['Mondays', 'Tuesdays', 'Wednesdays', 'Thursdays', 'Fridays', 'Saturdays', 'Sundays']
const WEEKDAYS_FR = ['lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche']

Expand Down Expand Up @@ -69,13 +70,14 @@ export function periodLabel(labels: string[]): string {
}
group.weekdays.push(weekday)
}
return groups
const label = groups
.map(g => {
if (g.weekdays.length === 0) return g.prefix
const days = frWeekdays(g.weekdays)
return g.prefix === null ? days : `${g.prefix} : ${days}`
return g.prefix === null ? days : `${days} (${g.prefix})`
})
.join(' + ')
return label.charAt(0).toUpperCase() + label.slice(1)
}

// Palette stable ; quand elle boucle, le motif change — 12 × 4 = 48 styles
Expand Down
2 changes: 1 addition & 1 deletion website/src/hints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export interface HintConfig {

export const DEFAULT_HINT_CONFIGS: HintConfig[] = [
{ id: 'holidays', source: 'holidays', name: 'Jours fériés', policy: 'match-all', enabled: true, daysText: '' },
{ id: 'school-vacations', source: 'school-vacations', name: 'Vacances scolaires (lun-sam)', policy: 'per-day-of-week', enabled: true, daysText: '' },
{ id: 'school-vacations', source: 'school-vacations', name: 'Vacances scolaires', policy: 'per-day-of-week', enabled: true, daysText: '' },
]

const DATE_RE = /^\d{4}-\d{2}-\d{2}$/
Expand Down
Loading