import dayjs from "dayjs"; import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react"; import { useState } from "react"; import { YearCalendar } from "@/components/ActivityCalendar"; import { Dialog, DialogContent, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; import i18n from "@/i18n"; import { addMonths, formatMonth, getMonthFromDate, getYearFromDate, setYearAndMonth } from "@/lib/calendar-utils"; import type { MonthNavigatorProps } from "@/types/statistics"; export const MonthNavigator = ({ visibleMonth, onMonthChange, activityStats }: MonthNavigatorProps) => { const [isOpen, setIsOpen] = useState(false); const currentMonth = dayjs(visibleMonth).toDate(); const currentYear = getYearFromDate(visibleMonth); const currentMonthNum = getMonthFromDate(visibleMonth); const handlePrevMonth = () => { onMonthChange(addMonths(visibleMonth, -1)); }; const handleNextMonth = () => { onMonthChange(addMonths(visibleMonth, 1)); }; const handleDateClick = (date: string) => { onMonthChange(formatMonth(date)); setIsOpen(false); }; const handleYearChange = (year: number) => { onMonthChange(setYearAndMonth(year, currentMonthNum)); }; return (