diff --git a/.gitignore b/.gitignore index b1e30e0..92e7b25 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,10 @@ next-env.d.ts # Supabase CLI scratch supabase/.temp/ + +# `supabase db dump` output, written to the repo root. Never commit these: a real +# roles.sql can contain role passwords, and data.sql is a full copy of production. +# Schema history belongs in supabase/migrations/ instead. +/data.sql +/roles.sql +/schema.sql diff --git a/app/(dashboard)/administrator/bookings-tab.tsx b/app/(dashboard)/administrator/bookings-tab.tsx index 9d364f8..26a8f31 100644 --- a/app/(dashboard)/administrator/bookings-tab.tsx +++ b/app/(dashboard)/administrator/bookings-tab.tsx @@ -11,12 +11,15 @@ import EditWeeklyForm from './edit-weekly-form' import EditTablingForm from './edit-tabling-form' import WeeklyBookingGrid from './weekly-booking-grid' import { Skeleton } from '@/app/_components/skeleton' +import ScopeLabel from '@/app/_components/scope-label' +import type { Division, BookingScope } from '@/lib/booking-scope' type BookingSubTab = 'One-Time Rooms' | 'Weekly Rooms' | 'Tables' interface Body { id: string name: string + division: Division } interface Semester { @@ -25,7 +28,12 @@ interface Semester { is_active: boolean } -interface OneTimeBooking { +/** Flattens the embedded booking_bodies rows into the shape ScopeLabel expects. */ +const linkedBodiesOf = (b: BookingBase) => + (b.booking_bodies ?? []).map(x => ({ id: x.body_id, name: x.bodies?.name ?? '' })) + +/** The columns every booking row carries, regardless of type. */ +interface BookingBase { id: string body_id: string purpose: string @@ -33,6 +41,12 @@ interface OneTimeBooking { hidden: boolean bodies: { name: string } | null creator_role: string | null + scope: BookingScope + division: Division | null + booking_bodies: { body_id: string; bodies: { name: string } | null }[] | null +} + +interface OneTimeBooking extends BookingBase { one_time_room_bookings: { id: string room_name: string @@ -44,14 +58,7 @@ interface OneTimeBooking { }[] | null } -interface WeeklyBooking { - id: string - body_id: string - purpose: string - is_event: boolean - hidden: boolean - bodies: { name: string } | null - creator_role: string | null +interface WeeklyBooking extends BookingBase { weekly_room_bookings: { id: string room_name: string @@ -74,14 +81,7 @@ interface WeeklyBooking { }[] | null } -interface TablingBooking { - id: string - body_id: string - purpose: string - is_event: boolean - hidden: boolean - bodies: { name: string } | null - creator_role: string | null +interface TablingBooking extends BookingBase { tabling_bookings: { id: string reservation_code: string | null @@ -401,7 +401,7 @@ export default function BookingsTab() {
{b.bodies?.name}
+{b.purpose}
{b.bodies?.name}
+{b.purpose}
{b.bodies?.name}
+NU Student Gov. Association
-v1.12.4
+v1.13.0
{userName && ({getGreeting()},
{userName}
{booking.bodyName}
+{booking.scopeLabel}
{booking.senateType && ( {booking.senateType} )} diff --git a/app/(dashboard)/my-rooms/calendar-view.tsx b/app/(dashboard)/my-rooms/calendar-view.tsx index b2ea09b..82c166d 100644 --- a/app/(dashboard)/my-rooms/calendar-view.tsx +++ b/app/(dashboard)/my-rooms/calendar-view.tsx @@ -126,7 +126,7 @@ export default function CalendarView({ bookings, onSelect }: CalendarViewProps) {dayBookings.slice(0, MAX_VISIBLE_PER_DAY).map(b => ({b.bodyName}
+{b.scopeLabel}
{b.location} · {formatTime(b.startTime)} – {formatTime(b.endTime)}
{b.bodyName}
+{b.scopeLabel}
{b.location}
{formatDate(b.date)}