diff --git a/src/lib/components/SpaceCard.svelte b/src/lib/components/SpaceCard.svelte index ce07d42..a2d5901 100644 --- a/src/lib/components/SpaceCard.svelte +++ b/src/lib/components/SpaceCard.svelte @@ -11,7 +11,8 @@ imgSrc: string; href?: string; isFavourite: boolean; - onToggleFavourite: () => void; + + onToggleFavourite?: () => void; } const { space, hours, alt, imgSrc, href, isFavourite, onToggleFavourite }: Props = $props(); @@ -21,9 +22,11 @@
-
- -
+ {#if onToggleFavourite} +
+ +
+ {/if}

{space.location}

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index fa3f5b8..9db01ea 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -232,7 +232,7 @@ space={studySpace} hours={studySpace.study_space_hours} isFavourite={favouriteIds.includes(studySpace.id)} - onToggleFavourite={() => handleToggleFavourite(studySpace.id)} + onToggleFavourite={session ? () => handleToggleFavourite(studySpace.id) : undefined} /> {/each} diff --git a/src/routes/space/[id]/+page.svelte b/src/routes/space/[id]/+page.svelte index 9e37048..22eb0bf 100644 --- a/src/routes/space/[id]/+page.svelte +++ b/src/routes/space/[id]/+page.svelte @@ -122,11 +122,15 @@ {/if}
-
-
{space.location}
-
- -
+
+
{space.location}
+ {#await supabase.auth.getSession() then resp} + {#if resp.data.session} +
+ +
+ {/if} + {/await}
{#if space.description != null && space.description.length > 0}

@@ -223,12 +227,13 @@ } .nameContainer { - z-index: 10; - display: block; + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.5rem; width: 100%; padding: 0.6rem; margin-top: -0.5rem; - object-position: center; background-color: #49bd85; border-radius: 8px; font-size: 2.8rem; @@ -338,12 +343,12 @@ font-family: monospace; color: #eaffeb; } - .titleContainer { + /* .titleContainer { display: flex; align-items: center; justify-content: space-between; margin: -0.5rem 0 1rem; - } + } */ .title-fav { font-size: 2rem; background: rgba(0, 0, 0, 0.4);