Skip to content

Self-hosted MCP server + dashboard giving Claude Code, Cursor & Hermes agents shared long-term memory over a git-backed markdown vault. Agent-native, Obsidian-compatible second brain — markdown RAG, no vector DB.

fix(mobile): nav becomes an off-canvas drawer; note takes full width

Ronalds Palacisf8aa0dd10715
diff --git a/app/(app)/layout.tsx b/app/(app)/layout.tsx
index e6382fd..8f51c93 100644
--- a/app/(app)/layout.tsx
+++ b/app/(app)/layout.tsx
@@ -1,17 +1,70 @@
"use client";
+import { useEffect, useState } from "react";
+import { usePathname } from "next/navigation";
+import useSWR from "swr";
+import { Menu, Search } from "lucide-react";
import { ActivityBar } from "@/components/activity-bar";
import { Sidebar } from "@/components/sidebar";
import { CommandPalette } from "@/components/command-palette";
import { useArrowNav } from "@/lib/use-arrow-nav";
+import { fetcher } from "@/lib/client";
+import { cn } from "@/lib/utils";
+
+const FALLBACK_NAME = process.env.NEXT_PUBLIC_APP_NAME || "Engram";
export default function AppLayout({ children }: { children: React.ReactNode }) {
useArrowNav();
+ const [open, setOpen] = useState(false);
+ const pathname = usePathname();
+ const { data: feat } = useSWR<{ appName?: string }>("/api/features", fetcher);
+ const appName = feat?.appName || FALLBACK_NAME;
+
+ // Close the mobile nav drawer whenever the route changes (e.g. tapping a note).
+ useEffect(() => setOpen(false), [pathname]);
+
return (
- <div className="flex h-dvh overflow-hidden">
- <ActivityBar />
- <Sidebar />
- <main className="relative flex-1 overflow-hidden">{children}</main>
+ <div className="flex h-dvh flex-col overflow-hidden md:flex-row">
+ {/* Mobile top bar — hidden on desktop, where the nav is always visible. */}
+ <header className="flex h-12 shrink-0 items-center gap-2 border-b border-border bg-sidebar px-2 md:hidden">
+ <button
+ onClick={() => setOpen(true)}
+ aria-label="Open menu"
+ className="inline-flex size-9 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground"
+ >
+ <Menu size={18} />
+ </button>
+ <div className="flex items-center gap-2">
+ <span className="size-2 rounded-full bg-primary" />
+ <span className="text-sm font-medium tracking-tight">{appName}</span>
+ </div>
+ <button
+ onClick={() => (window as unknown as { __openPalette?: () => void }).__openPalette?.()}
+ aria-label="Search"
+ className="ml-auto inline-flex size-9 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground"
+ >
+ <Search size={17} />
+ </button>
+ </header>
+
+ {/* Backdrop — mobile only, when the drawer is open. */}
+ {open && (
+ <div className="fixed inset-0 z-30 bg-black/50 md:hidden" onClick={() => setOpen(false)} aria-hidden />
+ )}
+
+ {/* Nav: activity bar + sidebar. Off-canvas drawer on mobile, static column on desktop. */}
+ <div
+ className={cn(
+ "z-40 flex shrink-0 transition-transform duration-200 ease-out",
+ "fixed inset-y-0 left-0 md:static md:translate-x-0",
+ open ? "translate-x-0 shadow-2xl" : "-translate-x-full",
+ )}
+ >
+ <ActivityBar />
+ <Sidebar />
+ </div>
+
+ <main className="relative min-w-0 flex-1 overflow-hidden">{children}</main>
<CommandPalette />
</div>
);
diff --git a/components/note-view.tsx b/components/note-view.tsx
index 2a4f497..3b4937a 100644
--- a/components/note-view.tsx
+++ b/components/note-view.tsx
@@ -39,7 +39,7 @@ function Editor({ value, onChange }: { value: string; onChange: (v: string) => v
value={value}
onChange={(e) => onChange(e.target.value)}
spellCheck={false}
- className="scrollbar-none h-full w-full resize-none bg-background px-6 py-6 font-mono text-[13px] leading-relaxed text-foreground outline-none"
+ className="scrollbar-none h-full w-full resize-none bg-background px-4 py-4 font-mono text-[13px] leading-relaxed text-foreground outline-none sm:px-6 sm:py-6"
/>
);
}
@@ -154,9 +154,9 @@ export function NoteView({ path }: { path: string }) {
{mode === "edit" && <Editor value={raw} onChange={onEdit} />}
{mode === "split" && (
- <div className="grid h-full grid-cols-2 divide-x divide-border">
+ <div className="grid h-full grid-cols-1 grid-rows-2 divide-y divide-border md:grid-cols-2 md:grid-rows-1 md:divide-x md:divide-y-0">
<Editor value={raw} onChange={onEdit} />
- <div className="scrollbar-none overflow-y-auto px-6 py-6">
+ <div className="scrollbar-none overflow-y-auto px-4 py-4 sm:px-6 sm:py-6">
<Markdown content={previewBody} resolve={resolve} />
</div>
</div>
@@ -164,7 +164,7 @@ export function NoteView({ path }: { path: string }) {
{mode === "preview" && (
<div className="scrollbar-none h-full overflow-y-auto">
- <article className="mx-auto max-w-5xl px-8 py-10">
+ <article className="mx-auto max-w-5xl px-5 py-7 sm:px-8 sm:py-10">
<header className="mb-7">
<h1 className="text-2xl font-semibold tracking-tight">{note.title}</h1>
{(note.tags.length > 0 || note.status || note.type) && (