feat(calendar): add calendar to home page
This commit is contained in:
parent
758afb36b9
commit
a3e7224087
6 changed files with 39 additions and 24 deletions
|
@ -1,22 +1,17 @@
|
|||
'use client';
|
||||
|
||||
import { RedirectButton } from '@/components/buttons/redirect-button';
|
||||
import Calendar from '@/components/calendar';
|
||||
import { useGetApiUserMe } from '@/generated/api/user/user';
|
||||
|
||||
export default function Home() {
|
||||
const { data, isLoading } = useGetApiUserMe();
|
||||
const { data } = useGetApiUserMe();
|
||||
|
||||
return (
|
||||
<div className='flex flex-col items-center justify-center h-full'>
|
||||
<div>
|
||||
<h1>
|
||||
Hello{' '}
|
||||
{isLoading ? 'Loading...' : data?.data.user?.name || 'Unknown User'}
|
||||
</h1>
|
||||
<RedirectButton redirectUrl='/logout' buttonText='Logout' />
|
||||
<RedirectButton redirectUrl='/settings' buttonText='Settings' />
|
||||
<RedirectButton redirectUrl='/events/new' buttonText='New Event' />
|
||||
</div>
|
||||
<div className='max-h-full'>
|
||||
<Calendar
|
||||
userId={data?.data.user?.id}
|
||||
height='calc(100svh - 50px - (var(--spacing) * 2 * 5))'
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -217,6 +217,10 @@ export const GET = auth(async function GET(req, { params }) {
|
|||
|
||||
return returnZodTypeCheckedResponse(UserCalendarResponseSchema, {
|
||||
success: true,
|
||||
calendar,
|
||||
calendar: calendar.filter(
|
||||
(event, index, self) =>
|
||||
self.findIndex((e) => e.id === event.id && e.type === event.type) ===
|
||||
index,
|
||||
),
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue