refactor(alerts/ui): wizard banners → DS Alert, step body → section card

Promote banner and prefill warnings now render as DS Alert components
(info / warning variants). Step body wraps in sectionStyles.section
for card affordance matching other forms in the app.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-21 10:17:54 +02:00
parent 1b6e6ce40c
commit e861e0199c

View File

@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useNavigate, useParams, useSearchParams } from 'react-router';
import { Button, SectionHeader, useToast } from '@cameleer/design-system';
import { Alert, Button, SectionHeader, useToast } from '@cameleer/design-system';
import { PageLoader } from '../../../components/PageLoader';
import {
useAlertRule,
@@ -24,6 +24,7 @@ import { prefillFromPromotion, type PrefillWarning } from './promotion-prefill';
import { useCatalog } from '../../../api/queries/catalog';
import { useOutboundConnections } from '../../../api/queries/admin/outboundConnections';
import { useSelectedEnv } from '../../../api/queries/alertMeta';
import sectionStyles from '../../../styles/section-card.module.css';
import css from './wizard.module.css';
const STEP_LABELS: Record<WizardStep, string> = {
@@ -148,15 +149,16 @@ export default function RuleEditorWizard() {
<div className={css.wizard}>
<div className={css.header}>
<SectionHeader>{isEdit ? `Edit rule: ${form.name}` : 'New alert rule'}</SectionHeader>
</div>
{promoteFrom && (
<div className={css.promoteBanner}>
Promoting from <code>{promoteFrom}</code> &mdash; review and adjust, then save.
</div>
<Alert variant="info" title="Promoting a rule">
Promoting from <code>{promoteFrom}</code> review and adjust, then save.
</Alert>
)}
</div>
{warnings.length > 0 && (
<div className={css.promoteBanner}>
<strong>Review before saving:</strong>
<Alert variant="warning" title="Review before saving">
<ul style={{ margin: '4px 0 0 16px', padding: 0 }}>
{warnings.map((w) => (
<li key={w.field}>
@@ -164,12 +166,14 @@ export default function RuleEditorWizard() {
</li>
))}
</ul>
</div>
</Alert>
)}
<nav className={css.steps}>
{WIZARD_STEPS.map((s, i) => (
<button
key={s}
type="button"
className={`${css.step} ${step === s ? css.stepActive : ''} ${i < idx ? css.stepDone : ''}`}
onClick={() => setStep(s)}
>
@@ -177,7 +181,9 @@ export default function RuleEditorWizard() {
</button>
))}
</nav>
<div className={css.stepBody}>{body}</div>
<section className={`${sectionStyles.section} ${css.stepBody}`}>{body}</section>
<div className={css.footer}>
<Button variant="secondary" onClick={onBack} disabled={idx === 0}>
Back