32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { AdminDashboardPageQuery } from '@/lib/page-queries/AdminDashboardPageQuery';
|
|
import { AdminDashboardTemplate } from '@/templates/AdminDashboardTemplate';
|
|
|
|
export default async function AdminPage() {
|
|
const result = await AdminDashboardPageQuery.execute();
|
|
|
|
if (result.isErr()) {
|
|
const error = result.getError();
|
|
if (error === 'notFound') {
|
|
return (
|
|
<div className="container mx-auto p-6">
|
|
<div className="bg-racing-red/10 border border-racing-red text-racing-red px-4 py-3 rounded-lg">
|
|
Access denied - You must be logged in as an Owner or Admin
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
return (
|
|
<div className="container mx-auto p-6">
|
|
<div className="bg-racing-red/10 border border-racing-red text-racing-red px-4 py-3 rounded-lg">
|
|
Failed to load dashboard: {error}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const viewData = result.unwrap();
|
|
|
|
// For now, use empty callbacks. In a real app, these would be Server Actions
|
|
// that trigger revalidation or navigation
|
|
return <AdminDashboardTemplate adminDashboardViewData={viewData} onRefresh={() => {}} isLoading={false} />;
|
|
} |