From 056339318645db6195a7e22f7ac704fcf9cee7ee Mon Sep 17 00:00:00 2001 From: Diego Temkin <65834932+dtemkin1@users.noreply.github.com> Date: Tue, 27 Jan 2026 22:23:08 -0500 Subject: [PATCH 1/2] slightly better? --- src/components/Calendar.tsx | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/components/Calendar.tsx b/src/components/Calendar.tsx index 58f295e7..bbf31873 100644 --- a/src/components/Calendar.tsx +++ b/src/components/Calendar.tsx @@ -61,9 +61,9 @@ export function Calendar() { * is more than half a mile, return an appropriate warning message. Otherwise, * return undefined. */ - const getDistanceWarning = (currentEvent: EventApi) => { - const room1 = currentEvent.extendedProps.room as string | undefined; - if (!currentEvent.start || !room1) { + const getDistanceWarning = (thisEvent: EventApi) => { + const thisRoom = thisEvent.extendedProps.room as string | undefined; + if (!thisEvent.start || !thisRoom) { return undefined; } @@ -71,16 +71,15 @@ export function Calendar() { if (!eventBefore.start || !eventBefore.room) { continue; } - if (currentEvent.start.getTime() != eventBefore.end.getTime()) { + if (thisEvent.start.getTime() != eventBefore.end.getTime()) { continue; } - const building1 = getBuildingNumber(room1); - const building2 = getBuildingNumber(eventBefore.room); + const thisBuilding = getBuildingNumber(thisRoom); + const beforeBuilding = getBuildingNumber(eventBefore.room); // Approximate distance (in feet) between the two buildings - const distance = getDistance(building1, building2); - + const distance = getDistance(thisBuilding, beforeBuilding); if (distance === undefined || distance < DISTANCE_WARNING_THRESHOLD) { continue; } @@ -90,7 +89,7 @@ export function Calendar() { return ( - Warning: distance from {building1} to {building2} is{" "} + Warning: distance from {beforeBuilding} to {thisBuilding} is{" "} {formattedDistance}
(about a {mins}-minute walk) @@ -118,15 +117,20 @@ export function Calendar() { const distanceWarning = getDistanceWarning(event); return ( - <> + {!(activity instanceof CustomActivity) ? ( {distanceWarning ? ( - + ! ) : null} - + ); }; From 81852fd7ad788792b2343ccbf07d0343ee51ec76 Mon Sep 17 00:00:00 2001 From: Diego Temkin <65834932+dtemkin1@users.noreply.github.com> Date: Tue, 27 Jan 2026 22:25:57 -0500 Subject: [PATCH 2/2] consistency --- src/components/Calendar.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Calendar.tsx b/src/components/Calendar.tsx index bbf31873..40fc64a3 100644 --- a/src/components/Calendar.tsx +++ b/src/components/Calendar.tsx @@ -67,16 +67,16 @@ export function Calendar() { return undefined; } - for (const eventBefore of events) { - if (!eventBefore.start || !eventBefore.room) { + for (const beforeEvent of events) { + if (!beforeEvent.start || !beforeEvent.room) { continue; } - if (thisEvent.start.getTime() != eventBefore.end.getTime()) { + if (thisEvent.start.getTime() != beforeEvent.end.getTime()) { continue; } const thisBuilding = getBuildingNumber(thisRoom); - const beforeBuilding = getBuildingNumber(eventBefore.room); + const beforeBuilding = getBuildingNumber(beforeEvent.room); // Approximate distance (in feet) between the two buildings const distance = getDistance(thisBuilding, beforeBuilding);