mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 20:06:28 +00:00
279b642a7a
Enforce page access and action-level permissions across admin and task views, including exports and record actions. Move user creation to a client component behind server-side permission checks, standardize data fetching, and remove the deprecated user-role route.
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
import { type Metadata } from 'next';
|
|
import { Suspense, lazy } from 'react';
|
|
import { Download } from 'lucide-react'
|
|
import { Button } from '@/components/ui/button';
|
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
|
import LazyLoading from '@/components/loader/LazyLoading';
|
|
import fetchData from '@/lib/fetchData';
|
|
import { getAccessPagePermission } from '@/lib/get-access-data';
|
|
|
|
const ComponentPage = lazy(() => import('./component'));
|
|
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Admin | Global Parameter",
|
|
}
|
|
|
|
export default async function GlobalParameterPage() {
|
|
const actions = await getAccessPagePermission('/global-parameter')
|
|
const data = await fetchData('/global-parameter', 'no-cache', { tags: ['global-parameter'] })
|
|
|
|
return (
|
|
<>
|
|
<div className="flex flex-col">
|
|
<Card>
|
|
<CardHeader className='flex flex-row items-center justify-between space-y-2 sm:space-y-0'>
|
|
<div>
|
|
<CardTitle>Global Parameter</CardTitle>
|
|
<CardDescription>Here's a list of parameters that have been registered!</CardDescription>
|
|
</div>
|
|
{actions.includes('EXPORT') &&
|
|
<div>
|
|
<Button className="sm:hidden" size={'icon'}><Download size={20} /></Button>
|
|
</div>
|
|
}
|
|
</CardHeader>
|
|
<CardContent>
|
|
<Suspense fallback={<LazyLoading />}>
|
|
<ComponentPage
|
|
data={data.global_parameter}
|
|
actions={actions}
|
|
/>
|
|
</Suspense>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</>
|
|
);
|
|
} |