feat: calendar diary view on profile (#15)
Some checks failed
CI / Check / Test (push) Failing after 8m29s

This commit is contained in:
2026-07-10 22:32:47 +02:00
parent 0a8b52514d
commit 41bed3583d
2 changed files with 194 additions and 81 deletions

View File

@@ -199,7 +199,6 @@ function CalendarTab({ userId }: { userId?: string }) {
const { data, isPending, hasNextPage, fetchNextPage } =
useInfiniteDiary({ sort_by: "date_desc", user_id: userId })
const items = data?.pages.flatMap((p) => p.items) ?? []
const [detailEntries, setDetailEntries] = useState<DiaryEntryDto[] | null>(null)
const [detailEntry, setDetailEntry] = useState<DiaryEntryDto | null>(null)
if (isPending) return <Skeleton className="h-80 w-full rounded-xl" />
@@ -209,10 +208,7 @@ function CalendarTab({ userId }: { userId?: string }) {
<>
<DiaryCalendar
entries={items}
onSelectDate={(entries) => {
if (entries.length === 1) setDetailEntry(entries[0]!)
else setDetailEntries(entries)
}}
onSelectEntry={setDetailEntry}
/>
{detailEntry && (
<ReviewDetailSheet
@@ -222,14 +218,6 @@ function CalendarTab({ userId }: { userId?: string }) {
review={detailEntry.review}
/>
)}
{detailEntries && (
<ReviewDetailSheet
open={!!detailEntries}
onOpenChange={(open) => !open && setDetailEntries(null)}
movie={detailEntries[0]!.movie}
review={detailEntries[0]!.review}
/>
)}
</>
)
}