Compare commits

..

1 commit

Author SHA1 Message Date
e0d57329c9 feat(calendar): add calendar to home page
All checks were successful
container-scan / Container Scan (pull_request) Successful in 3m56s
docker-build / docker (pull_request) Successful in 11m19s
tests / Tests (pull_request) Successful in 7m11s
2025-06-26 12:31:21 +02:00
3 changed files with 20 additions and 4 deletions

View file

@ -8,7 +8,10 @@ export default function Home() {
return ( return (
<div className='max-h-full'> <div className='max-h-full'>
<Calendar userId={data?.data.user?.id} height='calc(100svh - 50px - (var(--spacing) * 2 * 5))' /> <Calendar
userId={data?.data.user?.id}
height='calc(100svh - 50px - (var(--spacing) * 2 * 5))'
/>
</div> </div>
); );
} }

View file

@ -219,7 +219,8 @@ export const GET = auth(async function GET(req, { params }) {
success: true, success: true,
calendar: calendar.filter( calendar: calendar.filter(
(event, index, self) => (event, index, self) =>
self.findIndex((e) => e.id === event.id && e.type === event.type) === index, self.findIndex((e) => e.id === event.id && e.type === event.type) ===
index,
), ),
}); });
}); });

View file

@ -41,7 +41,13 @@ const DaDRBCalendar = withDragAndDrop<
const localizer = momentLocalizer(moment); const localizer = momentLocalizer(moment);
export default function Calendar({ userId, height }: { userId?: string; height: string }) { export default function Calendar({
userId,
height,
}: {
userId?: string;
height: string;
}) {
return ( return (
<QueryErrorResetBoundary> <QueryErrorResetBoundary>
{({ reset }) => ( {({ reset }) => (
@ -72,7 +78,13 @@ export default function Calendar({ userId, height }: { userId?: string; height:
); );
} }
function CalendarWithUserEvents({ userId, height }: { userId: string; height: string }) { function CalendarWithUserEvents({
userId,
height,
}: {
userId: string;
height: string;
}) {
const sesstion = useSession(); const sesstion = useSession();
const [currentView, setCurrentView] = React.useState< const [currentView, setCurrentView] = React.useState<
'month' | 'week' | 'day' | 'agenda' | 'work_week' 'month' | 'week' | 'day' | 'agenda' | 'work_week'