web: add global sidebar fallback

This commit is contained in:
2026-07-23 19:23:02 +09:00
parent 2bd69f9403
commit 308e1ffdbc
5 changed files with 99 additions and 14 deletions
+10 -3
View File
@@ -1,9 +1,11 @@
<script lang="ts">
import { page } from '$app/state';
import WorkspaceAlerts from '$lib/workspace/alerts/WorkspaceAlerts.svelte';
import GlobalSidebar from '$lib/workspace/sidebar/GlobalSidebar.svelte';
import '../app.css';
import type { LayoutProps } from './$types';
let { children }: LayoutProps = $props();
let { data, children }: LayoutProps = $props();
</script>
<WorkspaceAlerts />
@@ -19,7 +21,12 @@
</a>
</nav>
</header>
<div class="app-shell">
{@render children()}
<div class:global-sidebar-layout={!data.workspaceScoped} class="app-shell">
{#if !data.workspaceScoped}
<GlobalSidebar currentPath={page.url.pathname} />
{/if}
<div class="app-content">
{@render children()}
</div>
</div>
</div>
+3 -3
View File
@@ -8,12 +8,12 @@ export const prerender = false;
export const load: LayoutLoad = async ({ fetch, params, url }) => {
if (params.workspaceId) {
return {};
return { workspaceScoped: true };
}
const publicRoutes = new Set(["/account", "/login/device"]);
if (publicRoutes.has(url.pathname)) {
return {};
return { workspaceScoped: false };
}
const workspace = await loadJson<WorkspaceResponse>(fetch, "/api/workspace");
@@ -21,5 +21,5 @@ export const load: LayoutLoad = async ({ fetch, params, url }) => {
const scopedPath = workspaceRoute(workspace.data.workspace_id);
throw redirect(307, `${scopedPath}${url.search}`);
}
return {};
return { workspaceScoped: false };
};