2026-08-07 10:44:03 +07:00
|
|
|
/**
|
|
|
|
|
* Dashboard page — Server Component.
|
|
|
|
|
*
|
|
|
|
|
* Fetches y the initial stats + activity on the server (no client round-trip
|
|
|
|
|
* for first paint) and hands them to the hydrated client view. This is the
|
|
|
|
|
* "data on the server" leg of the reworked data flow.
|
|
|
|
|
*/
|
|
|
|
|
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([
|
|
|
|
|
getDashboardStats(),
|
|
|
|
|
getActivity(14),
|
|
|
|
|
]);
|
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
|
|
|
|
|
initialStats={stats.status === "fulfilled" ? stats.value : undefined}
|
|
|
|
|
initialActivity={
|
|
|
|
|
activity.status === "fulfilled" ? activity.value : undefined
|
|
|
|
|
}
|
|
|
|
|
/>
|
2026-07-26 11:27:21 +07:00
|
|
|
);
|
|
|
|
|
}
|