feat: calendar diary view on profile (#15)
Some checks failed
CI / Check / Test (push) Failing after 8m29s
Some checks failed
CI / Check / Test (push) Failing after 8m29s
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user