diff --git a/src/lib/assets/arrow_right.svg b/src/lib/assets/arrow_right.svg new file mode 100644 index 0000000..874ecb6 --- /dev/null +++ b/src/lib/assets/arrow_right.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/lib/components/Carousel.svelte b/src/lib/components/Carousel.svelte new file mode 100644 index 0000000..b26229c --- /dev/null +++ b/src/lib/components/Carousel.svelte @@ -0,0 +1,134 @@ + + +
+ + {#if scrollPosition > clientWidth / 2} + + {/if} + {#if scrollPosition < scrollWidth - clientWidth * 1.5} + + {/if} + + {Math.round(scrollPosition / clientWidth) + 1} / {urls.length} + +
+ + diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index ff8bd72..7cb89ea 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -29,6 +29,7 @@ box-shadow: 0rem 0rem 0.5rem #182125; align-items: center; overflow: hidden; + z-index: 100; } .logo { diff --git a/src/lib/index.ts b/src/lib/index.ts index b2b0920..72ed306 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -3,3 +3,25 @@ import type { Database } from "./database.d.ts"; export type Table = Database["public"]["Tables"][T]["Row"]; export type Enum = Database["public"]["Enums"][T]; + +export const availableStudySpaceTags = [ + "Quiet", + "Loud", + "Silent", + "Group study", + "Individual study", + "Power outlets", + "No power outlets", + "24/7", + "Food allowed", + "No food allowed", + "Good wifi", + "Bad wifi", + "No wifi", + "Whiteboard", + "Restricted access", + "Hot", + "Air conditioned", + "Cold", + "Cringe" +]; diff --git a/src/routes/space/[id]/+page.svelte b/src/routes/space/[id]/+page.svelte index fde6d34..b8121e6 100644 --- a/src/routes/space/[id]/+page.svelte +++ b/src/routes/space/[id]/+page.svelte @@ -2,16 +2,19 @@ import Navbar from "$lib/components/Navbar.svelte"; import crossUrl from "$lib/assets/cross.svg"; import placeholder from "$lib/assets/study_space.png"; + import Carousel from "$lib/components/Carousel.svelte"; const { data } = $props(); const { space, supabase } = $derived(data); - const imgUrl = $derived( - space.study_space_images.length > 0 - ? supabase.storage - .from("files_bucket") - .getPublicUrl(space.study_space_images[0].image_path).data.publicUrl - : placeholder + const imgUrls = $derived( + space.study_space_images.length === 0 + ? [placeholder] + : space.study_space_images.map( + (img) => + supabase.storage.from("files_bucket").getPublicUrl(img.image_path).data + .publicUrl + ) ); @@ -22,7 +25,7 @@
- the study space +
{space.location}
@@ -61,6 +64,7 @@ margin: 0 auto; } .nameContainer { + z-index: 10; display: block; width: 100%; padding: 0.6rem; diff --git a/supabase/schemas/0001_study_spaces.sql b/supabase/schemas/0001_study_spaces.sql index 1e07cee..57ec924 100644 --- a/supabase/schemas/0001_study_spaces.sql +++ b/supabase/schemas/0001_study_spaces.sql @@ -12,6 +12,7 @@ CREATE TABLE study_spaces ( -- Location within building, e.g., "Room 101" location text, building_location text, + tags text[] NOT NULL DEFAULT array[]::text[], created_at timestamp with time zone DEFAULT now(), updated_at timestamp with time zone DEFAULT now() ); @@ -24,6 +25,7 @@ CREATE TABLE study_space_images ( PRIMARY KEY (study_space_id, image_path) ); + -- Triggers CREATE TRIGGER study_spaces_updated_at AFTER UPDATE ON study_spaces