Add collapsible primary UI sections (ticket 035)

Log viewer (FilterBar+LogTimeline+LogPreview), Params, Metrics, and
Dashboards can each be collapsed/expanded via a toggle next to their
existing help icon. Collapsed state persists per-section in
localStorage (ottyl.collapsedSections) and content is hidden with the
`hidden` attribute rather than unmounted, so in-progress form state
(a half-filled Metrics/Params form, in-progress Dashboards panel
edits) survives a collapse/expand cycle.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
This commit is contained in:
Hugh Kaznowski
2026-09-05 16:46:22 +01:00
co-authored by Claude Sonnet 5
parent dd1a0a234d
commit 7db1e0f055
7 changed files with 96 additions and 46 deletions
+4 -1
View File
@@ -1,5 +1,6 @@
import { useState } from 'react'
import { ApiError, declareParam, type ParamDeclaration } from '../lib/api'
import { CollapseToggle, useSectionCollapsed } from './CollapsibleSection'
import { HelpIcon } from './HelpIcon'
const EMPTY_KIND: ParamDeclaration['kind'] = 'string'
@@ -11,6 +12,7 @@ export function Params({ params, onDeclared }: { params: ParamDeclaration[]; onD
const [kind, setKind] = useState<ParamDeclaration['kind']>(EMPTY_KIND)
const [submitError, setSubmitError] = useState<string | null>(null)
const [submitting, setSubmitting] = useState(false)
const [collapsed, setCollapsed] = useSectionCollapsed('params')
async function handleSubmit(e: React.FormEvent) {
e.preventDefault()
@@ -35,8 +37,9 @@ export function Params({ params, onDeclared }: { params: ParamDeclaration[]; onD
<div className="mb-2 flex items-center gap-1.5 text-xs text-text-subtle">
Params
<HelpIcon sectionId="parameters" label="Help: Params" />
<CollapseToggle collapsed={collapsed} onToggle={() => setCollapsed(!collapsed)} />
</div>
<div className="flex gap-4">
<div className="flex gap-4" hidden={collapsed}>
<form onSubmit={handleSubmit} className="w-80 shrink-0 space-y-2">
<div>
<label className="mb-1 block text-xs text-text-subtle">Name</label>