'use client'; import { usePuzzles } from '@/lib/hooks/use-puzzles'; import { type Chapter } from '@/lib/puzzles'; import { cn } from '@/lib/utils'; import AppLink from './AppLink'; import Icon from './Icon'; export default function Puzzles({ token }: { token: string }) { const { data, isLoading } = usePuzzles({ token }); // SOme chapters have a start date and a end date (for example, the first chapter is only available for 2 weeks), I want to want to lock the chapter if the current date is not between the start and end date // I want to display a message to the user if the chapter is locked function isChapterLocked(chapter: Chapter) { return ( chapter.startDay && chapter.endDay && new Date() > new Date(chapter.startDay) && new Date() < new Date(chapter.endDay) ); } return ( <> {(!isLoading && data?.map((chapter) => (