import { lazy, Suspense, useState } from 'react' import { CreditCard, Landmark } from 'lucide-react' import { Link } from 'react-router' import { paths } from '@/components/layout/nav-items' import { PageError, PageHeader, PageLoading } from '@/components/page' import { Skeleton } from '@/components/skeleton' import { Button } from '@/components/ui/button' import { Section } from '@/features/planning/plan-read' import { useDebt } from '@/lib/debt' import { t } from '@/lib/strings' import type { DebtSnapshot } from '@/types/DebtSnapshot' import { DebtCard } from './debt-card' import { History } from './history' import { ImportSection } from './import-section' import { SnapshotForm } from './snapshot-form' import { TargetsEditor } from './targets-editor' const DebtChart = lazy(() => import('./debt-chart')) const s = t.debt /** /borc: toplam borç, gerçek + hedef grafiği, ölçümler, yeni ölçüm, yol haritası, içe aktarma */ export function DebtPage() { const debt = useDebt() const [editing, setEditing] = useState(null) const d = debt.data return ( <> {s.toInstallments} } /> {debt.isError ? ( ) : !d ? ( ) : (
{d.latest ? ( ) : (

{s.emptyTitle}

{s.emptyText}

)} {d.snapshots.length > 0 && (
}>
)} {d.snapshots.length > 0 && (
{ setEditing(sn) document .getElementById('debt-form') ?.scrollIntoView({ behavior: 'smooth', block: 'start' }) }} />
)}
`${p.id}:${p.version}`).join()}` } plans={d.installments} editing={editing ?? undefined} onDone={() => setEditing(null)} />
`${x.month}:${x.closing_target}`).join()} targets={d.targets} thisMonth={d.this_month} />
)} ) }