feat(ui): dashboard ana grafiği ve rapor sayfaları
- dashboard: periyot seçici ve kümülatif/dönemsel görünüm, tablo; günlük plan kartı sadeleşti - /raporlar özet ve kategori, trend, kişi/hesap, bütçe sayfaları; ay seçici ve CSV indirme Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { OVERVIEW_PERIODS, type OverviewPeriod } from "@/shared/overview";
|
||||
import { getOverview } from "../service";
|
||||
import { OverviewChart } from "./overview-chart";
|
||||
|
||||
type Search = Record<string, string | string[] | undefined>;
|
||||
|
||||
const periodOf = (x: unknown): OverviewPeriod =>
|
||||
OVERVIEW_PERIODS.includes(x as OverviewPeriod) ? (x as OverviewPeriod) : "month";
|
||||
|
||||
/** Dashboard ana grafiği (sunucu): ?periyot=week|month|half|year&gorunum=kumulatif|donemsel. */
|
||||
export async function OverviewCard({
|
||||
userId,
|
||||
householdId,
|
||||
searchParams,
|
||||
}: {
|
||||
userId: string;
|
||||
householdId: string;
|
||||
searchParams: Promise<Search>;
|
||||
}) {
|
||||
const q = await searchParams;
|
||||
const data = await getOverview(userId, householdId, periodOf(q.periyot));
|
||||
if (!data) return null;
|
||||
return <OverviewChart data={data} view={q.gorunum === "donemsel" ? "periodic" : "cumulative"} />;
|
||||
}
|
||||
Reference in New Issue
Block a user