mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:46:29 +00:00
46 lines
1.8 KiB
TypeScript
46 lines
1.8 KiB
TypeScript
import { type Metadata } from 'next';
|
|
import { FC, Suspense, lazy } from 'react';
|
|
import { Separator } from '@/components/ui/separator';
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
import PageLoading from '@/components/loader/PageLoading';
|
|
import fetchData from '@/lib/fetchData';
|
|
|
|
const FormComponent = lazy(() => import('./components/FormComponent'))
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Presence",
|
|
description: "Employee presence page.",
|
|
}
|
|
|
|
type Props = {
|
|
searchParams?: Promise<{ [key: string]: string | string[] | undefined }>
|
|
};
|
|
|
|
const PresencePage: FC<Props> = async ({ searchParams }) => {
|
|
const checkout = (await searchParams)?.checkout
|
|
|
|
const res = await fetchData('/presence/list-status')
|
|
|
|
return (
|
|
<>
|
|
<div className='flex-1 w-full md:w-[800px] mx-auto px-5 py-10 md:p-10 pb-40 md:pb-10'>
|
|
<Card>
|
|
<CardHeader>
|
|
<div className='flex justify-center items-center flex-col'>
|
|
<CardTitle className="text-lg font-medium">{checkout === 'true' ? 'Check-out Presence' : 'Check-in Presence'}</CardTitle>
|
|
<p className="text-sm text-muted-foreground">This is how others will see you on the site.</p>
|
|
</div>
|
|
</CardHeader>
|
|
<Separator className='w-10/12 xl:w-11/12 mx-auto' />
|
|
<CardContent className='mt-6'>
|
|
<Suspense fallback={<PageLoading />}>
|
|
<FormComponent workingStatusList={res.working_status} isCheckout={checkout === 'true'} />
|
|
</Suspense>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default PresencePage; |