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:
@@ -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>
|
||||
{promoteFrom && (
|
||||
<div className={css.promoteBanner}>
|
||||
Promoting from <code>{promoteFrom}</code> — review and adjust, then save.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{promoteFrom && (
|
||||
<Alert variant="info" title="Promoting a rule">
|
||||
Promoting from <code>{promoteFrom}</code> — review and adjust, then save.
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{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
|
||||
|
||||
Reference in New Issue
Block a user