Restructure Core management into linkable routes and add common layout navigation

- Renamed person route to people for consistency
- Refactored /core dashboard to use standard <a> links
- Added common management <nav> to core layout
- Replaced goto() with standard links across all list and detail pages
- Fixed 500 error caused by broken import path and strict layout data
This commit is contained in:
Scott Idem
2026-01-06 15:33:08 -05:00
parent 5d2186e8ca
commit a0f04726e0
14 changed files with 135 additions and 167 deletions

View File

@@ -1,102 +1,43 @@
<script lang="ts">
/** @type {import('./$types').LayoutData} */
let log_lvl: number = 0;
// *** Import Svelte specific
// import { goto } from '$app/navigation';
// import type { Writable } from 'svelte/store';
// *** Import Aether specific variables and functions
// import type { key_val } from '$lib/ae_stores';
// import { ae_util } from '$lib/ae_utils/ae_utils';
// import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct } from '$lib/stores/ae_stores';
import {
events_loc,
events_slct,
events_trigger,
events_trig_kv
} from '$lib/stores/ae_events_stores';
// import Element_data_store from '$lib/element_data_store_v2.svelte';
interface SubmenuItem {
name: string;
href: string;
title: string;
access?: 'trusted' | 'administrator' | 'manager'; // Assuming these are the access levels
disable?: boolean;
hide?: boolean;
}
interface LayoutData {
submenu: SubmenuItem[]; // Assuming submenu is an array of SubmenuItem
// Add other properties of data if needed
}
import { Building, Globe, Users, ShieldCheck, List, LayoutDashboard } from 'lucide-svelte';
interface Props {
data: LayoutData; // Use the specific interface
data: any;
children?: import('svelte').Snippet;
}
let { data, children }: Props = $props();
$events_loc.qry__enabled = 'enabled';
$events_loc.qry__hidden = 'not_hidden';
$events_loc.qry__limit = 15;
$events_loc.qry__offset = 0;
if (log_lvl) {
console.log(`$slct.account_id = `, $slct.account_id);
}
// let ae_acct = data[$slct.account_id];
// if (log_lvl) {
// console.log(`ae_acct = `, ae_acct);
// }
</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">
{#if $ae_loc?.manager_access === 'test-new-submenu'}
<section class="submenu flex flex-row justify-center" class:hidden={$ae_loc.iframe}>
<span class=" preset-tonal-secondary px-4 py-2">
{#each Object.entries(data.submenu) as [key, item]: SubmenuItem}
<!-- <a href="/settings/{item.slug}">{item.title}</a> -->
<!-- class:hidden={!$ae_loc.trusted_access && item.access} -->
{#if item.disable}
<!-- <button
title={item.title}
class="hover:variant-ghost-secondary"
class:hidden={(!$ae_loc.trusted_access && item.access === 'trusted') || (!$ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
disabled={item.disable}
on:click={() => {
// goto(item.href, { });
}}
>
{item.name}
</button> -->
{:else}
<!-- <a
href={item.href}
title={item.title}
class="hover:variant-ghost-secondary"
class:hidden={(!$ae_loc.trusted_access && item.access === 'trusted') || (!$ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
class:disabled={item.disable}
>
{item.name}
</a> -->
{/if}
{/each}
</span>
</section>
<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">
<a href="/core" class="btn btn-sm variant-soft-surface">
<LayoutDashboard size={14} class="mr-1" /> Dashboard
</a>
<a href="/core/accounts" class="btn btn-sm variant-soft-primary">
<Building size={14} class="mr-1" /> Accounts
</a>
<a href="/core/sites" class="btn btn-sm variant-soft-secondary">
<Globe size={14} class="mr-1" /> Sites
</a>
<a href="/core/users" class="btn btn-sm variant-soft-error">
<ShieldCheck size={14} class="mr-1" /> Users
</a>
<a href="/core/people" class="btn btn-sm variant-soft-warning">
<Users size={14} class="mr-1" /> People
</a>
<a href="/core/lookups" class="btn btn-sm variant-soft-surface">
<List size={14} class="mr-1" /> Lookups
</a>
</nav>
{/if}
<section class="main_content grow px-1 md:px-2 pb-28">
<!-- <div class="container m-auto"> -->
{@render children?.()}
<!-- </div> -->
</section>
</div>
</div>