diff --git a/src/lib/components/SpaceCard.svelte b/src/lib/components/SpaceCard.svelte index f8c9f3e..163e7c4 100644 --- a/src/lib/components/SpaceCard.svelte +++ b/src/lib/components/SpaceCard.svelte @@ -1,6 +1,5 @@ diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 7c7920a..40e3446 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -148,12 +148,15 @@ } else { const opensFor = timeUntilClosing(timing.opens_at, timing.closes_at, time); if (opensFor) { - return { isOpen: true, message: `Open now for: ${minsToReadableHours}` }; + return { + isOpen: true, + message: `Open now for: ${minsToReadableHours(timeToMins(time))}` + }; } } } - return { isOpen: false, message: "Closed today" }; + return { isOpen: false, message: "Closed right now" }; } function timeUntilClosing(openingTime: string, closingTime: string, currentTime: string) { diff --git a/src/routes/space/[id]/+page.svelte b/src/routes/space/[id]/+page.svelte index 514e43a..1c124fa 100644 --- a/src/routes/space/[id]/+page.svelte +++ b/src/routes/space/[id]/+page.svelte @@ -7,7 +7,7 @@ import Report from "$lib/components/Report.svelte"; import Feedback from "$lib/components/Feedback.svelte"; import { onMount } from "svelte"; - import { gmapsLoader, daysOfWeek, formatTime, collectTimings, type Table } from "$lib"; + import { gmapsLoader, daysOfWeek, formatTime, collectTimings } from "$lib"; import Button from "$lib/components/Button.svelte"; import Favourite from "$lib/components/Favourite.svelte"; diff --git a/src/routes/space/[id]/edit/+page.svelte b/src/routes/space/[id]/edit/+page.svelte index eaf435d..7ebf6a9 100644 --- a/src/routes/space/[id]/edit/+page.svelte +++ b/src/routes/space/[id]/edit/+page.svelte @@ -101,8 +101,8 @@ return fullDayOfWeek.map((day) => ({ study_space_id: studySpaceId, day_of_week: day, - opens_at: allDays.open_today_status == null ? allDays.opens_at : "00:00", - closes_at: allDays.open_today_status == null ? allDays.closes_at : "00:00", + opens_at: allDays.open_today_status !== null ? allDays.opens_at : "00:00", + closes_at: allDays.open_today_status !== null ? allDays.closes_at : "00:01", open_today_status: allDays.open_today_status })); } @@ -114,16 +114,16 @@ .map((h) => ({ study_space_id: studySpaceId, day_of_week: h.day_of_week, - opens_at: h.opens_at, - closes_at: h.closes_at, + opens_at: h.open_today_status === null ? h.opens_at : "00:00", + closes_at: h.open_today_status === null ? h.closes_at : "00:01", open_today_status: h.open_today_status })) .concat( nonDefinedDays.map((day) => ({ study_space_id: studySpaceId, day_of_week: day, - opens_at: allDays.opens_at, - closes_at: allDays.closes_at, + opens_at: allDays.open_today_status === null ? allDays.opens_at : "00:00", + closes_at: allDays.open_today_status === null ? allDays.closes_at : "00:01", open_today_status: allDays.open_today_status })) ); @@ -134,10 +134,8 @@ if (!spaceImgs || spaceImgs.length < 1) return alert("Please select an image file."); if (!studySpaceData.building_location) return alert("Please select a building location."); - const { opening_times, ...spacePayload } = studySpaceData; - - // explicitly mark opening_times as used to avoid unused warning - void opening_times; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { opening_times: _, ...spacePayload } = studySpaceData; const { data: studySpaceInsert, error: studySpaceError } = await supabase .from("study_spaces")