import { Widget, WidgetBody } from '@/components/widget'; import { cn } from '@/utils/cn'; import { addMonths, eachDayOfInterval, endOfMonth, format, formatISO, isSameMonth, startOfMonth, subMonths, } from 'date-fns'; import { ActivityIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'; import { useState } from 'react'; import { WidgetAbsoluteButtons, WidgetHead, WidgetTitle, } from '../overview/overview-widget'; import { Button } from '../ui/button'; type Props = { data: { count: number; date: string }[]; }; const MonthCalendar = ({ month, data, }: { month: Date; data: Props['data'] }) => (
{format(month, 'MMMM yyyy')}
{eachDayOfInterval({ start: startOfMonth(month), end: endOfMonth(month), }).map((date) => { const hit = data.find((item) => item.date.includes(formatISO(date, { representation: 'date' })), ); return (
); })}
); export const ProfileActivity = ({ data }: Props) => { const [startDate, setStartDate] = useState(startOfMonth(new Date())); return ( Activity
{[3, 2, 1, 0].map((offset) => ( ))}
); };