Make Alerts section collapsible

Wire the Alerts section into the shared CollapsibleSection mechanism
(CollapseToggle + useSectionCollapsed), matching the pattern used by
Metrics and Params, with its own persisted 'alerts' section id.

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 18:44:22 +01:00
co-authored by Claude Sonnet 5
parent e6e5bc8f50
commit 87209ea401
2 changed files with 11 additions and 12 deletions
@@ -1,7 +0,0 @@
# Make Alerts section collapsible
Alerts section should be collapsible.
## Acceptance criteria
- The Alerts section can be collapsed and expanded, consistent with how other collapsible sections behave.
- Collapsed/expanded state persists in a way consistent with the rest of the UI (e.g. across reloads if other sections do so).
+7 -1
View File
@@ -9,7 +9,7 @@ import {
type AlertRule, type AlertRule,
type CompareOp, type CompareOp,
} from '../lib/api' } from '../lib/api'
import { sectionHeaderClassName, sectionHeaderLeftClassName } from './CollapsibleSection' import { CollapseToggle, sectionHeaderClassName, sectionHeaderLeftClassName, useSectionCollapsed } from './CollapsibleSection'
import { HelpIcon } from './HelpIcon' import { HelpIcon } from './HelpIcon'
import { queryInputClassName } from './FilterBar' import { queryInputClassName } from './FilterBar'
@@ -151,6 +151,7 @@ export function Alerts() {
const [form, setForm] = useState<FormState>(EMPTY_FORM) const [form, setForm] = useState<FormState>(EMPTY_FORM)
const [submitError, setSubmitError] = useState<string | null>(null) const [submitError, setSubmitError] = useState<string | null>(null)
const [submitting, setSubmitting] = useState(false) const [submitting, setSubmitting] = useState(false)
const [collapsed, setCollapsed] = useSectionCollapsed('alerts')
async function loadRules() { async function loadRules() {
try { try {
@@ -235,7 +236,11 @@ export function Alerts() {
Alerts Alerts
<HelpIcon sectionId="alerts" label="Help: Alerts" /> <HelpIcon sectionId="alerts" label="Help: Alerts" />
</div> </div>
<div className="flex items-center gap-1.5">
<CollapseToggle collapsed={collapsed} onToggle={() => setCollapsed(!collapsed)} />
</div> </div>
</div>
<div hidden={collapsed}>
<p className="px-3 pt-3 text-xs text-text-faint"> <p className="px-3 pt-3 text-xs text-text-faint">
Every rule delivers to the ntfy sink configured in Settings. Every rule delivers to the ntfy sink configured in Settings.
</p> </p>
@@ -445,5 +450,6 @@ export function Alerts() {
</div> </div>
</div> </div>
</div> </div>
</div>
) )
} }