|
14 | 14 | import SideNavigation from '$lib/layout/navigation.svelte'; |
15 | 15 | import { hasOnboardingDismissed } from '$lib/helpers/onboarding'; |
16 | 16 | import { isSidebarOpen, noWidthTransition } from '$lib/stores/sidebar'; |
17 | | - import { page } from '$app/stores'; |
| 17 | + import { page } from '$app/state'; |
18 | 18 | import { BillingPlanGroup, type Models } from '@appwrite.io/console'; |
19 | 19 | import { getSidebarState, isInDatabasesRoute, updateSidebarState } from '$lib/helpers/sidebar'; |
20 | 20 | import { isTabletViewport } from '$lib/stores/viewport'; |
|
25 | 25 | export let showSideNavigation = false; |
26 | 26 | export let selectedProject: Models.Project = null; |
27 | 27 |
|
28 | | - /** Only treat `page.data.project` as active outside project routes (e.g. account, org) it can linger. */ |
29 | | - $: activeProject = |
30 | | - selectedProject && |
31 | | - ($page.route.id?.includes('project-[region]-[project]') || |
32 | | - $page.url.pathname.includes('/project-')) |
33 | | - ? selectedProject |
34 | | - : null; |
| 28 | + $: activeProject = selectedProject && page.params.project ? selectedProject : null; |
35 | 29 |
|
36 | 30 | // variables |
37 | 31 | let yOnMenuOpen: number; |
|
145 | 139 | // subscriptions |
146 | 140 | isNewWizardStatusOpen.subscribe((value) => (showHeader = !value)); |
147 | 141 |
|
148 | | - page.subscribe(({ url }) => { |
149 | | - $showSubNavigation = url.searchParams.get('openNavbar') === 'true'; |
| 142 | + $: { |
| 143 | + const url = page.url; |
| 144 | + showSubNavigation.set(url.searchParams.get('openNavbar') === 'true'); |
150 | 145 | clearTimeout(timeoutId); |
151 | 146 |
|
152 | 147 | if (url.pathname.includes('project-')) { |
|
156 | 151 | } else { |
157 | 152 | showContentTransition = false; |
158 | 153 | } |
159 | | - }); |
| 154 | + } |
160 | 155 |
|
161 | 156 | // reactive blocks |
162 | 157 | $: sideSize = $hasSubNavigation ? ($isNarrow ? '17rem' : '25rem') : '12.5rem'; |
|
196 | 191 |
|
197 | 192 | $: state = $isSidebarOpen ? 'open' : 'closed'; |
198 | 193 |
|
199 | | - $: subNavigation = $page.data.subNavigation; |
| 194 | + $: subNavigation = page.data.subNavigation; |
200 | 195 |
|
201 | 196 | $: shouldRenderSidebar = |
202 | 197 | !$isNewWizardStatusOpen && showSideNavigation && !$showOnboardingAnimation; |
|
257 | 252 | class:icons-content={state === 'icons' && activeProject} |
258 | 253 | class:no-sidebar={!hasSidebarSpace}> |
259 | 254 | <section class="main-content" data-test={showSideNavigation}> |
260 | | - {#if $page.data?.header} |
| 255 | + {#if page.data?.header} |
261 | 256 | <div class="layout-header"> |
262 | | - <svelte:component this={$page.data.header} /> |
| 257 | + <svelte:component this={page.data.header} /> |
263 | 258 | </div> |
264 | 259 | {/if} |
265 | 260 | <slot /> |
|
0 commit comments