forked from wrenn/wrenn
Move sidebar into layout files and fix timer cleanup across frontend
Sidebar and AdminSidebar were re-instantiated on every page navigation (17 pages total), causing unnecessary DOM teardown/rebuild and redundant localStorage reads. Now each lives in its respective +layout.svelte as a single persistent instance. Also adds onDestroy cleanup for leaked timers (settings, team, login RAF loop) and CSS containment on <main> to isolate layout recalculations.
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import AdminSidebar from '$lib/components/AdminSidebar.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { toast } from '$lib/toast.svelte';
|
||||
import { formatDate, timeAgo } from '$lib/utils/format';
|
||||
@ -16,12 +15,6 @@
|
||||
|
||||
const PAGE_SIZE = 50;
|
||||
|
||||
let collapsed = $state(
|
||||
typeof window !== 'undefined'
|
||||
? localStorage.getItem('wrenn_sidebar_collapsed') === 'true'
|
||||
: false
|
||||
);
|
||||
|
||||
let activeTab = $state<'platform' | 'byoc'>('platform');
|
||||
|
||||
// All hosts fetched once
|
||||
@ -163,19 +156,16 @@
|
||||
onMount(fetchHosts);
|
||||
</script>
|
||||
|
||||
<div class="flex h-screen overflow-hidden bg-[var(--color-bg-0)]">
|
||||
<AdminSidebar bind:collapsed />
|
||||
<main class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<!-- Header -->
|
||||
<header class="relative shrink-0 border-b border-[var(--color-border)] bg-[var(--color-bg-1)]">
|
||||
<!-- Subtle gradient wash behind header for depth -->
|
||||
<div class="absolute inset-0 bg-gradient-to-b from-[var(--color-accent)]/[0.02] to-transparent pointer-events-none"></div>
|
||||
|
||||
<main class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<!-- Header -->
|
||||
<header class="relative shrink-0 border-b border-[var(--color-border)] bg-[var(--color-bg-1)]">
|
||||
<!-- Subtle gradient wash behind header for depth -->
|
||||
<div class="absolute inset-0 bg-gradient-to-b from-[var(--color-accent)]/[0.02] to-transparent pointer-events-none"></div>
|
||||
|
||||
<div class="relative flex items-start justify-between px-8 pt-7 pb-5">
|
||||
<div>
|
||||
<h1 class="font-serif text-page leading-none text-[var(--color-text-bright)]">
|
||||
Hosts
|
||||
<div class="relative flex items-start justify-between px-8 pt-7 pb-5">
|
||||
<div>
|
||||
<h1 class="font-serif text-page leading-none text-[var(--color-text-bright)]">
|
||||
Hosts
|
||||
</h1>
|
||||
<p class="mt-2 text-ui text-[var(--color-text-tertiary)]">
|
||||
Platform and BYOC compute across all teams.
|
||||
@ -303,7 +293,6 @@
|
||||
{/if}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
{#snippet skeletonRows()}
|
||||
<div class="rounded-[var(--radius-card)] border border-[var(--color-border)] bg-[var(--color-bg-1)] overflow-hidden shadow-sm">
|
||||
|
||||
Reference in New Issue
Block a user