owlboard-svelte/src/routes/ldb/+page.svelte

43 lines
1.0 KiB
Svelte
Raw Normal View History

2023-06-13 13:38:59 +01:00
<script>
2023-06-16 22:55:18 +01:00
import Header from '$lib/navigation/header.svelte'
2023-06-19 19:42:41 +01:00
import Nav from '$lib/navigation/nav-ldb.svelte'
import PublicLdb from '$lib/ldb/public-ldb.svelte';
import StaffLdb from '$lib/ldb/staff-ldb.svelte';
import { uuid } from '$lib/stores/uuid.js';
2023-06-16 22:55:18 +01:00
import {onMount} from 'svelte'
2023-06-13 13:38:59 +01:00
2023-06-19 14:21:17 +01:00
let title = "Loading"
2023-06-16 22:55:18 +01:00
async function getHeadcode() {
2023-06-13 13:38:59 +01:00
return new URLSearchParams(window.location.search).get('station');
}
2023-06-19 14:21:17 +01:00
let station = "";
let staff = false;
let uuidValue = "";
$: uuidValue = $uuid;
2023-06-14 00:43:06 +01:00
2023-06-13 13:38:59 +01:00
onMount(async () => {
2023-06-16 22:55:18 +01:00
station = await getHeadcode() || "";
2023-06-19 14:21:17 +01:00
if (uuidValue !== null && uuidValue !== "" && uuidValue !== "null") {
staff = true;
2023-06-19 14:21:17 +01:00
title = "Staff Board"
} else {
2023-06-19 14:21:17 +01:00
title = "Public Board"
}
2023-06-13 13:38:59 +01:00
})
</script>
2023-06-14 11:02:46 +01:00
<Header {title} />
2023-06-13 13:38:59 +01:00
2023-06-16 22:55:18 +01:00
<!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb -->
2023-06-17 01:53:08 +01:00
{#if !staff}
2023-06-19 14:21:17 +01:00
<PublicLdb {station} bind:title={title} />
{:else}
<StaffLdb {station} />
2023-06-17 01:53:08 +01:00
{/if}
2023-06-13 13:38:59 +01:00
2023-06-16 22:55:18 +01:00
<Nav />