Making the code easier to read and more consistent.
This commit is contained in:
@@ -1,34 +1,47 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { ae_loc, ae_sess, ae_api, slct } from '$lib/stores/ae_stores';
|
||||
import { Building, Globe, History, LayoutDashboard, List, Lock, MapPin, Phone, ShieldCheck, Users } from '@lucide/svelte';
|
||||
interface Props {
|
||||
data: any;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
let { data, children }: Props = $props();
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { ae_loc, ae_sess, ae_api, slct } from '$lib/stores/ae_stores';
|
||||
import {
|
||||
Building,
|
||||
Globe,
|
||||
History,
|
||||
LayoutDashboard,
|
||||
List,
|
||||
Lock,
|
||||
MapPin,
|
||||
Phone,
|
||||
ShieldCheck,
|
||||
Users
|
||||
} from '@lucide/svelte';
|
||||
interface Props {
|
||||
data: any;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
onMount(() => {
|
||||
if (!$ae_loc.manager_access) {
|
||||
// Wait for a second to see if the permissions load before redirecting.
|
||||
setTimeout(() => {
|
||||
if (!$ae_loc.manager_access) {
|
||||
console.log('Access Denied to /core. Redirecting to home.');
|
||||
goto('/');
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
onMount(() => {
|
||||
if (!$ae_loc.manager_access) {
|
||||
// Wait for a second to see if the permissions load before redirecting.
|
||||
setTimeout(() => {
|
||||
if (!$ae_loc.manager_access) {
|
||||
console.log('Access Denied to /core. Redirecting to home.');
|
||||
goto('/');
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Core - {$ae_loc.title ?? 'Æ loading...'}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="ae_core h-full max-h-full max-w-6xl overflow-auto flex flex-col gap-1 m-auto p-4">
|
||||
<div
|
||||
class="ae_core h-full max-h-full max-w-6xl overflow-auto flex flex-col gap-1 m-auto p-4">
|
||||
{#if $ae_loc.manager_access}
|
||||
<nav class="flex flex-wrap gap-2 mb-6 border-b border-surface-500/30 pb-4">
|
||||
<nav
|
||||
class="flex flex-wrap gap-2 mb-6 border-b border-surface-500/30 pb-4">
|
||||
<a href="/core" class="btn btn-sm preset-tonal-surface">
|
||||
<LayoutDashboard size={14} class="mr-1" /> Dashboard
|
||||
</a>
|
||||
@@ -44,7 +57,9 @@
|
||||
<a href="/core/people" class="btn btn-sm preset-tonal-warning">
|
||||
<Users size={14} class="mr-1" /> People
|
||||
</a>
|
||||
<a href="/core/activity_logs" class="btn btn-sm preset-tonal-success">
|
||||
<a
|
||||
href="/core/activity_logs"
|
||||
class="btn btn-sm preset-tonal-success">
|
||||
<History size={14} class="mr-1" /> Logs
|
||||
</a>
|
||||
<a href="/core/addresses" class="btn btn-sm preset-tonal-surface">
|
||||
@@ -62,15 +77,21 @@
|
||||
{@render children?.()}
|
||||
</section>
|
||||
{:else}
|
||||
<section class="flex flex-col items-center justify-center grow text-center space-y-4 py-20">
|
||||
<section
|
||||
class="flex flex-col items-center justify-center grow text-center space-y-4 py-20">
|
||||
<div class="p-6 bg-error-500/10 rounded-full">
|
||||
<Lock size={64} class="text-error-500" />
|
||||
</div>
|
||||
<h1 class="h1 font-black">Access Restricted</h1>
|
||||
<p class="max-w-md opacity-70">The area you are trying to access is reserved for system managers. If you believe you should have access, please sign in with an authorized account.</p>
|
||||
<p class="max-w-md opacity-70">
|
||||
The area you are trying to access is reserved for system
|
||||
managers. If you believe you should have access, please sign in
|
||||
with an authorized account.
|
||||
</p>
|
||||
<div class="flex gap-4 pt-4">
|
||||
<a href="/" class="btn preset-filled-primary font-bold">Return Home</a>
|
||||
<a href="/" class="btn preset-filled-primary font-bold"
|
||||
>Return Home</a>
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user