import { useState } from 'react' import { Info } from 'lucide-react' import { Link } from 'react-router' import { paths } from '@/components/layout/nav-items' import { PageError, PageHeader, PageLoading } from '@/components/page' import { Button } from '@/components/ui/button' import { NotesSection } from '@/features/notes/notes-section' import { NoPeriodCard } from '@/features/period-wizard/no-period-card' import { PeriodHeading } from '@/features/planning/plan-read' import { useCategories } from '@/lib/catalog' import { formatDate, toIsoDate } from '@/lib/format' import { useCurrentPeriod, useReview } from '@/lib/periods' import { t } from '@/lib/strings' import type { Period } from '@/types/Period' import { GroupComparison, TopCategories, WeeklyDistribution } from './breakdowns' import { Questions } from './questions' import { Reflection } from './reflection' export function ReviewPage() { const current = useCurrentPeriod() return ( <> {current.isPending ? ( ) : current.isError ? ( ) : current.data ? ( ) : ( )} ) } /** * Hesaplar sorgu anında backend'de yapılır (`GET /periods/{id}/review`); defterde * bir kayıt değişince bu sayfa da yenilenir. Kapalı dönem: salt okunur (Adım 5'te seçilebilir). */ function ReviewView({ period }: { period: Period }) { const review = useReview(period.id) const categories = useCategories(true) const [today] = useState(() => toIsoDate(new Date())) const readOnly = period.status === 'closed' if (review.isError) return if (!review.data) return return (
{!readOnly && today <= period.last_date && (

{t.review.ongoing(formatDate(period.last_date))}

)}
{!readOnly && (

{t.review.closeTitle}

{t.review.closeHint}

)}
) }