2026-08-07 10:44:03 +07:00
|
|
|
/**
|
2026-08-14 10:49:44 +07:00
|
|
|
* Dashboard — Server Component.
|
|
|
|
|
* Fetches initial stats + activity on the server (SSR first paint), hands to
|
|
|
|
|
* the hydrated client View. Keeps the documented server-seed data flow.
|
2026-08-07 10:44:03 +07:00
|
|
|
*/
|
|
|
|
|
import { getActivity, getDashboardStats } from "@/lib/api/server";
|
|
|
|
|
import DashboardView from "./view";
|
2026-07-26 11:27:21 +07:00
|
|
|
|
2026-08-07 10:44:03 +07:00
|
|
|
export default async function DashboardPage() {
|
|
|
|
|
const [stats, activity] = await Promise.allSettled([
|
2026-08-14 10:49:44 +07:00
|
|
|
getDashboardStats().catch(() => undefined),
|
|
|
|
|
getActivity(14).catch(() => undefined),
|
2026-08-07 10:44:03 +07:00
|
|
|
]);
|
2026-08-01 23:06:00 +07:00
|
|
|
|
2026-07-26 11:27:21 +07:00
|
|
|
return (
|
2026-08-07 10:44:03 +07:00
|
|
|
<DashboardView
|
2026-08-14 10:49:44 +07:00
|
|
|
initialStats={
|
|
|
|
|
stats.status === "fulfilled" && stats.value ? stats.value : undefined
|
|
|
|
|
}
|
2026-08-07 10:44:03 +07:00
|
|
|
initialActivity={
|
2026-08-14 10:49:44 +07:00
|
|
|
activity.status === "fulfilled" && activity.value
|
|
|
|
|
? activity.value
|
|
|
|
|
: undefined
|
2026-08-07 10:44:03 +07:00
|
|
|
}
|
|
|
|
|
/>
|
2026-07-26 11:27:21 +07:00
|
|
|
);
|
|
|
|
|
}
|