Skip to content

Commit cbe4489

Browse files
Remove legacy sidebar state helpers and logic
1 parent 77123c0 commit cbe4489

3 files changed

Lines changed: 17 additions & 23 deletions

File tree

src/lib/components/sidebar.svelte

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import { showSupportModal } from '$routes/(console)/wizard/support/store';
3535
import MobileSupportModal from '$routes/(console)/wizard/support/mobileSupportModal.svelte';
3636
import MobileFeedbackModal from '$routes/(console)/wizard/feedback/mobileFeedbackModal.svelte';
37-
import { getSidebarState, isInDatabasesRoute, updateSidebarState } from '$lib/helpers/sidebar';
37+
import { updateSidebarState } from '$lib/helpers/sidebar';
3838
import { isSmallViewport, isTabletViewport } from '$lib/stores/viewport';
3939
import { Click, trackEvent } from '$lib/actions/analytics';
4040
@@ -59,7 +59,7 @@
5959
};
6060
6161
let {
62-
state = $bindable('icons'),
62+
state = $bindable(),
6363
project,
6464
avatar,
6565
progressCard = undefined,
@@ -102,17 +102,6 @@
102102
};
103103
104104
const studio = $derived(resolvedProfile.id === ProfileMode.STUDIO);
105-
106-
$effect(() => {
107-
state = studio
108-
? 'icons'
109-
: $isTabletViewport
110-
? 'closed'
111-
: // example: manual resize
112-
isInDatabasesRoute(page.route)
113-
? 'icons'
114-
: getSidebarState();
115-
});
116105
</script>
117106

118107
<div

src/lib/layout/shell.svelte

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@
107107
* The sidebar is **always closed** on mobile and tablet devices!
108108
*/
109109
afterNavigate((navigation) => {
110-
if (resolvedProfile.id === ProfileMode.STUDIO) {
111-
state = 'icons';
112-
return;
113-
}
114-
115110
if ($isTabletViewport) {
116111
state = 'closed';
117112
return;
@@ -176,8 +171,19 @@
176171
currentProject: selectedProject
177172
};
178173
179-
$: state = $isSidebarOpen ? 'open' : 'closed';
180-
174+
$: {
175+
if ($isSidebarOpen) {
176+
state = 'open';
177+
} else if ($isTabletViewport) {
178+
state = 'closed';
179+
} else if (resolvedProfile.id === ProfileMode.STUDIO) {
180+
state = 'icons';
181+
} else if (isInDatabasesRoute($page.route)) {
182+
state = 'icons';
183+
} else {
184+
state = 'closed';
185+
}
186+
}
181187
$: subNavigation = $page.data.subNavigation;
182188
183189
$: shouldRenderSidebar = !$isNewWizardStatusOpen && showSideNavigation;

src/lib/profiles/index.svelte.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { asset, resolve } from '$app/paths';
22
import type { ResolvedPathname } from '$app/types';
33
import { OAuthProvider, Platform } from '@appwrite.io/console';
4-
// import { env } from '$env/dynamic/public';
4+
import { env } from '$env/dynamic/public';
55
import { BillingPlan } from '@appwrite.io/console';
66
import type { Component } from 'svelte';
77
import UnauthenticatedConsole from './(unauthenticated)/console.svelte';
@@ -238,5 +238,4 @@ export const studio: Profile = {
238238
}
239239
};
240240

241-
// export const resolvedProfile = env.PUBLIC_CONSOLE_PROFILE === 'studio' ? studio : base;
242-
export const resolvedProfile = studio;
241+
export const resolvedProfile = env.PUBLIC_CONSOLE_PROFILE === 'studio' ? studio : base;

0 commit comments

Comments
 (0)