feat:admin mode display

This commit is contained in:
Barf-Vader
2025-06-17 13:03:58 +01:00
parent ade34ac7ca
commit 8abcd3a979
2 changed files with 27 additions and 5 deletions

View File

@@ -202,7 +202,8 @@
<span class="checkReports"> <span class="checkReports">
<Button href="/space/reports" type="link" style="red">Check Reports</Button> <Button href="/space/reports" type="link" style="red">Check Reports</Button>
</span> </span>
{:else if session} {/if}
{#if session}
<button class="fav-button" onclick={() => (showFavourites = !showFavourites)} type="button"> <button class="fav-button" onclick={() => (showFavourites = !showFavourites)} type="button">
{showFavourites ? "All spaces" : "My favourites"} {showFavourites ? "All spaces" : "My favourites"}
</button> </button>
@@ -232,9 +233,7 @@
imgSrc={imgUrl} imgSrc={imgUrl}
space={studySpace} space={studySpace}
isFavourite={favouriteIds.includes(studySpace.id)} isFavourite={favouriteIds.includes(studySpace.id)}
onToggleFavourite={session && !adminMode onToggleFavourite={session ? () => handleToggleFavourite(studySpace.id) : undefined}
? () => handleToggleFavourite(studySpace.id)
: undefined}
isAvailable={studySpace.study_space_hours.length === 0 isAvailable={studySpace.study_space_hours.length === 0
? undefined ? undefined
: isOpenNow(studySpace.study_space_hours).isOpen} : isOpenNow(studySpace.study_space_hours).isOpen}
@@ -257,6 +256,9 @@
<Button href="/auth" type="link">Login / Signup</Button> <Button href="/auth" type="link">Login / Signup</Button>
{/if} {/if}
</footer> </footer>
{#if adminMode}
<div class="adminMode">You are in admin mode</div>
{/if}
<style> <style>
main { main {
@@ -327,4 +329,24 @@
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }
} }
.adminMode {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
position: sticky;
left: 0;
gap: 0.5rem;
padding: 0.75rem;
font-size: 1rem;
background-color: #182125;
bottom: 0;
border-radius: 0.5rem;
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
color: #eaffeb;
border: 2px solid #eaffeb;
z-index: 1000;
}
</style> </style>

View File

@@ -116,7 +116,7 @@
<main> <main>
<div class="imgContainer"> <div class="imgContainer">
{#await supabase.auth.getSession() then resp} {#await supabase.auth.getSession() then resp}
{#if resp.data.session && !adminMode} {#if resp.data.session}
<div class="title-fav"> <div class="title-fav">
<Favourite <Favourite
{isFavourite} {isFavourite}