diff --git a/app/(dashboard)/my-rooms/my-rooms-client.tsx b/app/(dashboard)/my-rooms/my-rooms-client.tsx index 4589c12..eb7a797 100644 --- a/app/(dashboard)/my-rooms/my-rooms-client.tsx +++ b/app/(dashboard)/my-rooms/my-rooms-client.tsx @@ -7,6 +7,7 @@ import BookingDetailModal from './booking-detail-modal' import NotificationBell from './notification-bell' import CalendarView from './calendar-view' import { Skeleton } from '@/app/_components/skeleton' +import { wantsSenateSession } from '@/lib/senate-types' import { type FlatBooking, type MyRoomsResponse, @@ -136,8 +137,10 @@ export default function MyRoomsClient({ return () => window.removeEventListener('chambers:senate-prefs-updated', fetchBookings) }, [fetchBookings]) + // The same rule the update emails and dashboard alerts now apply, so what this + // page hides and what Chambers stops sending you cannot drift apart (#92, #93). const passesSenateFilter = (b: FlatBooking) => - b.bodyName !== 'Senate' || !b.senateType || (senateTypePreferences[b.senateType] ?? true) + wantsSenateSession(senateTypePreferences, b.bodyName, b.senateType) const filteredUpcoming = all.filter(b => isWithinDays(b.date, filter, today) && passesSenateFilter(b)) diff --git a/app/(dashboard)/my-rooms/shared.ts b/app/(dashboard)/my-rooms/shared.ts index d05bfce..bf2681c 100644 --- a/app/(dashboard)/my-rooms/shared.ts +++ b/app/(dashboard)/my-rooms/shared.ts @@ -99,8 +99,6 @@ export function bookingTitle(b: FlatBooking): string { return b.purpose?.trim() || b.scopeLabel } -export const SENATE_TYPES = ['Full Body', 'Weekly', 'Office Hours'] as const - export const statusColors: Record = { 'Reserved': 'bg-[#0f3d20] border-[#22c55e]', 'Alternate Room': 'bg-[#0e2f4f] border-[#4285f4]', diff --git a/app/(dashboard)/settings-modal.tsx b/app/(dashboard)/settings-modal.tsx index c3d53b5..a3ff2ce 100644 --- a/app/(dashboard)/settings-modal.tsx +++ b/app/(dashboard)/settings-modal.tsx @@ -4,6 +4,7 @@ import { useEffect, useState } from 'react' import { getJson } from '@/lib/fetch-json' import { Skeleton } from '@/app/_components/skeleton' import { getPrefsForRole, EMAIL_PREF_LABELS, EmailPrefKey } from '@/lib/email-preferences' +import { SENATE_TYPES } from '@/lib/senate-types' interface Membership { id: string @@ -34,7 +35,7 @@ export interface Settings { available_bodies: AvailableBody[] } -export const SENATE_TYPES = ['Full Body', 'Weekly', 'Office Hours'] as const +export { SENATE_TYPES } from '@/lib/senate-types' interface SettingsModalProps { onClose: () => void @@ -273,7 +274,12 @@ export default function SettingsModal({ onClose, cachedSettings, onSettingsLoade {/* Senate Session Types */} {!loading && isSenateMember && (
-

Senate Session Types Shown in My Rooms

+
+

Senate Session Types You Follow

+

+ Deselected types are hidden from My Rooms, and Chambers stops emailing and alerting you about them. +

+
{SENATE_TYPES.map(type => (