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