diff --git a/manacore/apps/web/src/lib/stores/navigation.ts b/manacore/apps/web/src/lib/stores/navigation.ts
new file mode 100644
index 000000000..f4072e926
--- /dev/null
+++ b/manacore/apps/web/src/lib/stores/navigation.ts
@@ -0,0 +1,4 @@
+import { writable } from 'svelte/store';
+
+export const isSidebarMode = writable(false);
+export const isNavCollapsed = writable(false);
diff --git a/manacore/apps/web/src/routes/(app)/+layout.svelte b/manacore/apps/web/src/routes/(app)/+layout.svelte
index 05bdf87d2..94ded0c52 100644
--- a/manacore/apps/web/src/routes/(app)/+layout.svelte
+++ b/manacore/apps/web/src/routes/(app)/+layout.svelte
@@ -2,9 +2,79 @@
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import type { Snippet } from 'svelte';
+ import { onMount } from 'svelte';
+ import { PillNavigation } from '@manacore/shared-ui';
+ import type { PillNavItem } from '@manacore/shared-ui';
+ import { theme } from '$lib/stores/theme';
+ import { isSidebarMode as sidebarModeStore, isNavCollapsed as collapsedStore } from '$lib/stores/navigation';
let { data, children }: { data: any; children: Snippet } = $props();
- let mobileMenuOpen = $state(false);
+
+ let loading = $state(true);
+ let isSidebarMode = $state(false);
+ let isCollapsed = $state(false);
+
+ // Get theme state
+ let effectiveMode = $derived(theme.effectiveMode);
+
+ // Navigation items for ManaCore
+ const navItems: PillNavItem[] = [
+ { href: '/dashboard', label: 'Dashboard', icon: 'home' },
+ { href: '/organizations', label: 'Organizations', icon: 'building' },
+ { href: '/teams', label: 'Teams', icon: 'users' },
+ { href: '/subscription', label: 'Subscription', icon: 'creditCard' },
+ { href: '/settings', label: 'Settings', icon: 'settings' }
+ ];
+
+ // Navigation shortcuts (Ctrl+1-5)
+ const navRoutes = navItems.map(item => item.href);
+
+ function handleKeydown(event: KeyboardEvent) {
+ const target = event.target as HTMLElement;
+ if (
+ target.tagName === 'INPUT' ||
+ target.tagName === 'TEXTAREA' ||
+ target.isContentEditable
+ ) {
+ return;
+ }
+
+ if ((event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey) {
+ const num = parseInt(event.key);
+ if (num >= 1 && num <= navRoutes.length) {
+ event.preventDefault();
+ const route = navRoutes[num - 1];
+ if (route) {
+ goto(route);
+ }
+ }
+ }
+ }
+
+ function handleModeChange(isSidebar: boolean) {
+ isSidebarMode = isSidebar;
+ sidebarModeStore.set(isSidebar);
+ if (typeof localStorage !== 'undefined') {
+ localStorage.setItem('manacore-nav-sidebar', String(isSidebar));
+ }
+ }
+
+ function handleCollapsedChange(collapsed: boolean) {
+ isCollapsed = collapsed;
+ collapsedStore.set(collapsed);
+ if (typeof localStorage !== 'undefined') {
+ localStorage.setItem('manacore-nav-collapsed', String(collapsed));
+ }
+ }
+
+ function handleToggleTheme() {
+ theme.toggleMode();
+ }
+
+ async function handleSignOut() {
+ await data.supabase.auth.signOut();
+ goto('/login');
+ }
$effect(() => {
if (!data.session) {
@@ -12,99 +82,61 @@
}
});
- const navigation = [
- { name: 'Dashboard', href: '/dashboard' },
- { name: 'Organizations', href: '/organizations' },
- { name: 'Teams', href: '/teams' },
- { name: 'Subscription', href: '/subscription' },
- { name: 'Settings', href: '/settings' }
- ];
+ onMount(() => {
+ // Initialize sidebar mode from localStorage
+ const savedSidebar = localStorage.getItem('manacore-nav-sidebar');
+ if (savedSidebar === 'true') {
+ isSidebarMode = true;
+ sidebarModeStore.set(true);
+ }
- async function handleSignOut() {
- await data.supabase.auth.signOut();
- goto('/login');
- }
+ // Initialize collapsed state from localStorage
+ const savedCollapsed = localStorage.getItem('manacore-nav-collapsed');
+ if (savedCollapsed === 'true') {
+ isCollapsed = true;
+ collapsedStore.set(true);
+ }
+
+ loading = false;
+ });
-
-
-