diff --git a/src/containers/PersonalSchedule/Assignments.tsx b/src/containers/PersonalSchedule/Assignments.tsx index da559d5..63df975 100644 --- a/src/containers/PersonalSchedule/Assignments.tsx +++ b/src/containers/PersonalSchedule/Assignments.tsx @@ -6,7 +6,7 @@ import { useNow } from '@/hooks/useNow/useNow'; import { parseActivityCodeFlexible } from '@/lib/activityCodes'; import { isActivityWithRoomOrParent } from '@/lib/typeguards'; import { byDate, roundTime } from '@/lib/utils'; -import { getRoomData, getRooms } from '../../lib/activities'; +import { getRoomData, hasMultipleScheduleLocations } from '../../lib/activities'; import { ExtraAssignment } from './PersonalExtraAssignment'; import { PersonalNormalAssignment } from './PersonalNormalAssignment'; import { getGroupedAssignmentsByDate } from './utils'; @@ -21,7 +21,7 @@ const key = (compId: string, id) => `${compId}-${id}`; export function Assignments({ wcif, person, showStationNumber }: AssignmentsProps) { const { t } = useTranslation(); - const showRoom = useMemo(() => wcif && getRooms(wcif).length > 1, [wcif]); + const showRoom = useMemo(() => hasMultipleScheduleLocations(wcif), [wcif]); const { collapsedDates, setCollapsedDates, toggleDate } = useCollapse( key(wcif.id, person.registrantId), diff --git a/src/containers/Schedule/Schedule.tsx b/src/containers/Schedule/Schedule.tsx index 2c37f38..542f95c 100644 --- a/src/containers/Schedule/Schedule.tsx +++ b/src/containers/Schedule/Schedule.tsx @@ -2,7 +2,12 @@ import { Competition } from '@wca/helpers'; import { useCallback, useEffect, useMemo } from 'react'; import { ActivityRow } from '@/components'; import { useCollapse } from '@/hooks/UseCollapse'; -import { getRoomData, getRooms, getScheduledDays, getVenueForActivity } from '@/lib/activities'; +import { + getRoomData, + getScheduledDays, + getVenueForActivity, + hasMultipleScheduleLocations, +} from '@/lib/activities'; import { ActivityWithRoomOrParent } from '@/lib/types'; const key = (compId: string) => `${compId}-schedule`; @@ -85,7 +90,7 @@ export const ScheduleContainer = ({ wcif }: ScheduleContainerProps) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [scheduleDays]); - const showRoom = useMemo(() => wcif && getRooms(wcif).length > 1, [wcif]); + const showRoom = useMemo(() => hasMultipleScheduleLocations(wcif), [wcif]); return (