web: add global sidebar fallback
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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 };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user