Merge ticket/002-collapsible-alerts-section

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:33 +01:00
co-authored by Claude Sonnet 5
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).
+11 -5
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,11 +236,15 @@ 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>
<p className="px-3 pt-3 text-xs text-text-faint"> <div hidden={collapsed}>
Every rule delivers to the ntfy sink configured in Settings. <p className="px-3 pt-3 text-xs text-text-faint">
</p> Every rule delivers to the ntfy sink configured in Settings.
<div className="flex gap-4 p-3"> </p>
<div className="flex gap-4 p-3">
<form onSubmit={handleSubmit} className="w-96 shrink-0 space-y-2"> <form onSubmit={handleSubmit} className="w-96 shrink-0 space-y-2">
<div> <div>
<label className="mb-1 block text-xs text-text-subtle">Name</label> <label className="mb-1 block text-xs text-text-subtle">Name</label>
@@ -443,6 +448,7 @@ export function Alerts() {
</div> </div>
)} )}
</div> </div>
</div>
</div> </div>
</div> </div>
) )