import React from 'react';
import { usePlanning } from '@/context/PlanningContext';
import { format } from 'date-fns';
import { fr } from 'date-fns/locale';
import { getMonthEventCount } from '@/utils/events';
import { isSameMonth } from 'date-fns';
const MonthCard = ({ month, eventCount, onClick }) => (
{format(month, 'MMMM', { locale: fr })}
{eventCount} événements
);
const YearView = ({ onDateClick }) => {
const { currentDate, events, setViewType, setCurrentDate } = usePlanning();
const months = Array.from(
{ length: 12 },
(_, i) => new Date(currentDate.getFullYear(), i, 1)
);
const handleMonthClick = (month) => {
setCurrentDate(month);
setViewType('month');
};
return (
{months.map((month) => (
handleMonthClick(month)}
/>
))}
);
};
export default YearView;