Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- Introduced turbopack alias for canvas in next.config.mjs. - Updated package.json scripts for development and branding tasks. - Added new dependencies for Tiptap extensions. - Implemented new demo layouts for agenda, contacts, drive, and mail applications. - Enhanced globals.css for improved theming and splash screen animations. - Added OAuth callback handling for drive mounts. - Updated layout components to integrate new demo shells and improve structure.
37 lines
1000 B
TypeScript
37 lines
1000 B
TypeScript
import { dateKey, parseDateKey } from "./agenda-date.ts"
|
|
|
|
export type AgendaView = "day" | "week" | "month"
|
|
|
|
export const AGENDA_VIEWS: AgendaView[] = ["day", "week", "month"]
|
|
|
|
export const AGENDA_VIEW_LABELS: Record<AgendaView, string> = {
|
|
day: "Jour",
|
|
week: "Semaine",
|
|
month: "Mois",
|
|
}
|
|
|
|
export interface AgendaRoute {
|
|
view: AgendaView | null
|
|
date: Date
|
|
}
|
|
|
|
function isAgendaView(value: string): value is AgendaView {
|
|
return (AGENDA_VIEWS as string[]).includes(value)
|
|
}
|
|
|
|
/** `/agenda[/{view}[/{yyyy-MM-dd}]]` — view null = laisser le choix au client. */
|
|
export function parseAgendaSegments(segments?: string[]): AgendaRoute {
|
|
const [rawView, rawDate] = segments ?? []
|
|
const view = rawView && isAgendaView(rawView) ? rawView : null
|
|
const date = (rawDate ? parseDateKey(rawDate) : null) ?? new Date()
|
|
return { view, date }
|
|
}
|
|
|
|
export function buildAgendaPath(
|
|
view: AgendaView,
|
|
date: Date,
|
|
routeRoot = "agenda"
|
|
): string {
|
|
return `/${routeRoot}/${view}/${dateKey(date)}`
|
|
}
|