/** * Calendar header: month title, prev/next navigation, weekday labels. * Replaces the header from webapp index.html and calendar.js month title. */ "use client"; import { Button } from "@/components/ui/button"; import { useTranslation } from "@/i18n/use-translation"; import { cn } from "@/lib/utils"; import { ChevronLeft as ChevronLeftIcon, ChevronRight as ChevronRightIcon, } from "lucide-react"; export interface CalendarHeaderProps { /** Currently displayed month (used for title). */ month: Date; /** Whether month navigation is disabled (e.g. during loading). */ disabled?: boolean; onPrevMonth: () => void; onNextMonth: () => void; className?: string; } export function CalendarHeader({ month, disabled = false, onPrevMonth, onNextMonth, className, }: CalendarHeaderProps) { const { t, monthName, weekdayLabels } = useTranslation(); const year = month.getFullYear(); const monthIndex = month.getMonth(); const labels = weekdayLabels(); return (

{monthName(monthIndex)} {year}

{labels.map((label, i) => ( {label} ))}
); }