mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 11:06:29 +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.8 KiB
TypeScript
48 lines
1.8 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 | Audit Trail",
|
|
}
|
|
|
|
export default async function AuditTrailPage() {
|
|
const actions = await getAccessPagePermission('/audit-trail')
|
|
const data = await fetchData('/log-name', 'no-cache', { tags: ['log-name'] })
|
|
|
|
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>Log Name</CardTitle>
|
|
<CardDescription>Here's a list of log audit name!</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.log_name}
|
|
actions={actions}
|
|
/>
|
|
</Suspense>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</>
|
|
);
|
|
} |