diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index 7bffba7..87881eb 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -3,12 +3,15 @@ import { browser } from '$app/environment'; import { page } from '$app/stores'; import { goto } from '$app/navigation'; - import { isAuthenticated, tryRefresh, logout } from '$lib/stores/auth'; + import { isAuthenticated, user, tryRefresh, logout } from '$lib/stores/auth'; import { toasts, removeToast } from '$lib/stores/ui'; + import Sidebar from '$lib/components/Sidebar.svelte'; import '../app.css'; const PUBLIC_PATHS = ['/login', '/setup']; + const NO_SIDEBAR_PATHS = ['/login', '/setup']; let authChecked = false; + let sidebarOpen = $state(false); onMount(async () => { if (!$isAuthenticated) { @@ -23,12 +26,18 @@ } } + // 사이드바 표시 여부 + $: showSidebar = $isAuthenticated && !NO_SIDEBAR_PATHS.some(p => $page.url.pathname.startsWith(p)); + // 키보드 단축키 function handleKeydown(e) { if (e.key === '/' && !['INPUT', 'TEXTAREA'].includes(document.activeElement?.tagName)) { e.preventDefault(); document.querySelector('[data-search-input]')?.focus(); } + if (e.key === 'Escape' && sidebarOpen) { + sidebarOpen = false; + } } @@ -39,14 +48,71 @@
로딩 중...
{:else if $isAuthenticated || PUBLIC_PATHS.some(p => $page.url.pathname.startsWith(p))} -