Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export default function App() {
}, [])

return (
<div className="app">
<div className={`app${session.sidebarOpen ? '' : ' sidebar-hidden'}`}>
<QueryBar
query={session.query}
onQueryChange={(q) => updateSession({ query: q })}
Expand All @@ -269,6 +269,8 @@ export default function App() {
<Toolbar
theme={session.theme}
onThemeChange={(t) => updateSession({ theme: t })}
sidebarOpen={session.sidebarOpen}
onSidebarOpenChange={(v) => updateSession({ sidebarOpen: v })}
wideView={session.wideView}
onWideViewChange={(w) => updateSession({ wideView: w })}
showToc={session.showToc}
Expand Down
17 changes: 13 additions & 4 deletions frontend/src/components/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { useState, useCallback, useEffect, useRef } from 'react'
import {
Sun, Moon, Monitor, ChevronsLeftRight, List,
Copy, Check, RotateCcw, ChevronDown, AlertCircle,
Copy, Check, RotateCcw, ChevronDown, AlertCircle, PanelLeft,
} from 'lucide-react'
import type { Session } from '../types'
import type { ParseResult } from '../lib/markdown'

interface Props {
theme: Session['theme']
onThemeChange: (t: Session['theme']) => void
sidebarOpen: boolean
onSidebarOpenChange: (v: boolean) => void
wideView: boolean
onWideViewChange: (w: boolean) => void
showToc: boolean
Expand Down Expand Up @@ -49,9 +51,9 @@ async function writeToClipboard(text: string): Promise<void> {
const ICON_SIZE = 15

export default function Toolbar({
theme, onThemeChange, wideView, onWideViewChange,
showToc, onShowTocChange, showRaw, onShowRawChange,
rawContent, parseResult, onRestart,
theme, onThemeChange, sidebarOpen, onSidebarOpenChange,
wideView, onWideViewChange, showToc, onShowTocChange,
showRaw, onShowRawChange, rawContent, parseResult, onRestart,
}: Props) {
const [copyState, setCopyState] = useState<CopyState>('idle')
const [showCopyMenu, setShowCopyMenu] = useState(false)
Expand Down Expand Up @@ -94,6 +96,13 @@ export default function Toolbar({

return (
<div className="toolbar">
<button
className={`bar-btn ${sidebarOpen ? 'active' : ''}`}
onClick={() => onSidebarOpenChange(!sidebarOpen)}
title="Toggle sidebar"
>
<PanelLeft size={ICON_SIZE} />
</button>
<button
className="bar-btn"
onClick={() => onThemeChange(nextTheme)}
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ html, body {
grid-template-columns: var(--sidebar-w) 1fr;
height: 100vh;
overflow: hidden;
transition: grid-template-columns 0.2s ease;
}

.app.sidebar-hidden {
grid-template-columns: 0 1fr;
}

.app.sidebar-hidden .sidebar {
visibility: hidden;
}

/* ── Query bar ── */
Expand Down
1 change: 1 addition & 0 deletions frontend/src/store/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const defaultSession: Session = {
groupOrder: [],
fileOrder: {},
sidebarLabel: {},
sidebarOpen: true,
};

export function loadSession(): Session {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ export interface Session {
groupOrder: string[];
fileOrder: Record<string, string[]>;
sidebarLabel: Record<string, "name" | "heading">;
sidebarOpen: boolean;
}