From ce3c7598f98e5631211aafab2e4f9af00eced1bb Mon Sep 17 00:00:00 2001 From: Dominik Stahl Date: Mon, 30 Jun 2025 20:45:29 +0200 Subject: [PATCH] feat(slot blocking): add buttons to sidebar --- .../[slotId]/page.tsx | 0 .../{blocked_slots => blocker}/new/page.tsx | 0 .../{blocked_slots => blocker}/page.tsx | 8 +++--- src/components/custom-ui/app-sidebar.tsx | 26 +++++++++++++++---- .../custom-ui/blocked-slot-list-entry.tsx | 2 +- src/components/forms/blocked-slot-form.tsx | 14 ++++------ src/components/forms/event-form.tsx | 1 - 7 files changed, 31 insertions(+), 20 deletions(-) rename src/app/(main)/{blocked_slots => blocker}/[slotId]/page.tsx (100%) rename src/app/(main)/{blocked_slots => blocker}/new/page.tsx (100%) rename src/app/(main)/{blocked_slots => blocker}/page.tsx (90%) diff --git a/src/app/(main)/blocked_slots/[slotId]/page.tsx b/src/app/(main)/blocker/[slotId]/page.tsx similarity index 100% rename from src/app/(main)/blocked_slots/[slotId]/page.tsx rename to src/app/(main)/blocker/[slotId]/page.tsx diff --git a/src/app/(main)/blocked_slots/new/page.tsx b/src/app/(main)/blocker/new/page.tsx similarity index 100% rename from src/app/(main)/blocked_slots/new/page.tsx rename to src/app/(main)/blocker/new/page.tsx diff --git a/src/app/(main)/blocked_slots/page.tsx b/src/app/(main)/blocker/page.tsx similarity index 90% rename from src/app/(main)/blocked_slots/page.tsx rename to src/app/(main)/blocker/page.tsx index 2331737..1acf660 100644 --- a/src/app/(main)/blocked_slots/page.tsx +++ b/src/app/(main)/blocker/page.tsx @@ -22,7 +22,7 @@ export default function BlockedSlots() {
{/* Heading */}

- My Blocked Slots + My Blockers

{/* Scrollable blocked slot list */} @@ -40,11 +40,11 @@ export default function BlockedSlots() { ) : (
diff --git a/src/components/custom-ui/app-sidebar.tsx b/src/components/custom-ui/app-sidebar.tsx index 50e88c2..721adf7 100644 --- a/src/components/custom-ui/app-sidebar.tsx +++ b/src/components/custom-ui/app-sidebar.tsx @@ -14,7 +14,7 @@ import { SidebarMenuItem, } from '@/components/custom-ui/sidebar'; -import { ChevronDown } from 'lucide-react'; +import { CalendarMinus, CalendarMinus2, ChevronDown } from 'lucide-react'; import { Collapsible, CollapsibleContent, @@ -28,8 +28,8 @@ import Link from 'next/link'; import { Star, CalendarDays, - User, - Users, + //User, + //Users, CalendarClock, CalendarPlus, } from 'lucide-react'; @@ -40,7 +40,7 @@ const items = [ url: '/home', icon: CalendarDays, }, - { + /*{ title: 'Friends', url: '#', icon: User, @@ -49,12 +49,17 @@ const items = [ title: 'Groups', url: '#', icon: Users, - }, + },*/ { title: 'Events', url: '/events', icon: CalendarClock, }, + { + title: 'Blockers', + url: '/blocker', + icon: CalendarMinus, + }, ]; export function AppSidebar() { @@ -123,6 +128,17 @@ export function AppSidebar() { + + + + + New Blocker + + + diff --git a/src/components/custom-ui/blocked-slot-list-entry.tsx b/src/components/custom-ui/blocked-slot-list-entry.tsx index 4690eea..9d1acdf 100644 --- a/src/components/custom-ui/blocked-slot-list-entry.tsx +++ b/src/components/custom-ui/blocked-slot-list-entry.tsx @@ -22,7 +22,7 @@ export default function BlockedSlotListEntry(slot: BlockedSlotListEntryProps) { }); }; return ( - +
diff --git a/src/components/forms/blocked-slot-form.tsx b/src/components/forms/blocked-slot-form.tsx index c6ed109..1293e58 100644 --- a/src/components/forms/blocked-slot-form.tsx +++ b/src/components/forms/blocked-slot-form.tsx @@ -71,7 +71,7 @@ export default function BlockedSlotForm({ const { mutateAsync: deleteBlockedSlot } = useDeleteApiBlockedSlotsSlotID({ mutation: { onSuccess: () => { - router.push('/blocked_slots'); + router.push('/blocker'); }, }, }); @@ -80,7 +80,7 @@ export default function BlockedSlotForm({ mutation: { onSuccess: () => { resetCreate(); - router.push('/blocked_slots'); + router.push('/blocker'); }, }, }); @@ -155,9 +155,7 @@ export default function BlockedSlotForm({

- {existingBlockedSlotId - ? 'Update Blocked Slot' - : 'Create Blocked Slot'} + {existingBlockedSlotId ? 'Update Blocker' : 'Create Blocker'}

@@ -216,9 +214,7 @@ export default function BlockedSlotForm({ formStateCreate.isSubmitting || formStateUpdate.isSubmitting } > - {existingBlockedSlotId - ? 'Update Blocked Slot' - : 'Create Blocked Slot'} + {existingBlockedSlotId ? 'Update Blocker' : 'Create Blocker'} {existingBlockedSlotId && ( )}
diff --git a/src/components/forms/event-form.tsx b/src/components/forms/event-form.tsx index d4fb216..11bf820 100644 --- a/src/components/forms/event-form.tsx +++ b/src/components/forms/event-form.tsx @@ -175,7 +175,6 @@ const EventForm: React.FC = (props) => { console.log('Creating event'); const mutationResult = await createEvent({ data }); eventID = mutationResult.data.event.id; - createEvent({ data }); } toast.custom((t) => (