feat: added edit button to admin mode

This commit is contained in:
Barf-Vader
2025-06-11 18:06:04 +01:00
parent e7a7275af7
commit 6bae8bb361

View File

@@ -11,6 +11,8 @@
const { data } = $props(); const { data } = $props();
const { space, supabase } = $derived(data); const { space, supabase } = $derived(data);
let adminMode = $state(true);
const place = $derived(space.building_location as google.maps.places.PlaceResult); const place = $derived(space.building_location as google.maps.places.PlaceResult);
const imgUrls = $derived( const imgUrls = $derived(
space.study_space_images.length === 0 space.study_space_images.length === 0
@@ -85,7 +87,9 @@
{/each} {/each}
</p> </p>
<div class="addrMap" bind:this={mapElem}></div> <div class="addrMap" bind:this={mapElem}></div>
{#if adminMode}
<a href={`/space/${space.id}/edit`} class="editButton">Edit</a>
{:else}
<button <button
type="button" type="button"
class="reportButton" class="reportButton"
@@ -93,6 +97,7 @@
isReportVisible = true; isReportVisible = true;
}}>Report</button }}>Report</button
> >
{/if}
</main> </main>
<style> <style>
@@ -201,4 +206,18 @@
cursor: pointer; cursor: pointer;
margin-top: 1rem; margin-top: 1rem;
} }
.editButton {
width: 100%;
padding: 0.4rem;
border-radius: 0.5rem;
border: none;
background-color: #49bd85;
color: #ffffff;
font-size: 1rem;
cursor: pointer;
margin-top: 1rem;
text-decoration: none;
text-align: center;
}
</style> </style>