import { type Component, type JSX, createSignal, Show, lazy, Suspense, onMount } from "solid-js"; import { Sidebar, BottomNav } from "./Navigation"; import { store, activeTaskId, setActiveTaskId } from "@/store"; import { PanelLeftOpen } from "lucide-solid"; const TaskDetail = lazy(() => import("./TaskDetail").then(m => ({ default: m.TaskDetail }))); const QuickEntry = lazy(() => import("./QuickEntry").then(m => ({ default: m.QuickEntry }))); import { Button } from "./ui/button"; import { cn } from "@/lib/utils"; interface LayoutProps { children: JSX.Element; currentView: string; setView: (v: string) => void; } export const Layout: Component = (props) => { const [isSidebarLocked, setIsSidebarLocked] = createSignal(true); const [isSidebarPeeking, setIsSidebarPeeking] = createSignal(false); onMount(() => { // Preload TaskDetail and QuickEntry in background setTimeout(() => { import("./TaskDetail"); import("./QuickEntry"); }, 500); }); // Derived active task for the detail view const activeTask = () => store.tasks.find(t => t.id === activeTaskId()); return (
{/* Expand Trigger Button (visible when not locked) */} {!isSidebarLocked() && ( )}
{props.children}
{/* Mobile Bottom Nav */}
setActiveTaskId(null)} />
); };