feat: added edit button to admin mode
This commit is contained in:
@@ -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,14 +87,17 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</p>
|
</p>
|
||||||
<div class="addrMap" bind:this={mapElem}></div>
|
<div class="addrMap" bind:this={mapElem}></div>
|
||||||
|
{#if adminMode}
|
||||||
<button
|
<a href={`/space/${space.id}/edit`} class="editButton">Edit</a>
|
||||||
type="button"
|
{:else}
|
||||||
class="reportButton"
|
<button
|
||||||
onclick={() => {
|
type="button"
|
||||||
isReportVisible = true;
|
class="reportButton"
|
||||||
}}>Report</button
|
onclick={() => {
|
||||||
>
|
isReportVisible = true;
|
||||||
|
}}>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>
|
||||||
|
|||||||
Reference in New Issue
Block a user