feat(ui): add toasts for create edit and run flows

- add global ToastProvider and useToast hook mounted at app root

- show success/error toasts for environment, credential, snippet, and scenario create/edit actions

- show run-started/error toasts on scenario run actions with 100ms exit animation
This commit is contained in:
2026-04-10 21:44:04 +03:00
parent d511c85891
commit 7444082b65
18 changed files with 285 additions and 31 deletions
@@ -16,6 +16,7 @@ import {
Table,
Timestamp,
UuidBadge,
useToast,
type TableColumn,
} from '../../ui';
import styles from '../Page.module.css';
@@ -24,6 +25,7 @@ export function ScenarioDetailPage() {
const { t } = useTranslation();
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
const toast = useToast();
const [scenario, setScenario] = useState<(Scenario & { steps: ScenarioStep[] }) | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
@@ -66,8 +68,13 @@ export function ScenarioDetailPage() {
const handleRun = async () => {
if (!scenario) return;
const run = await scenarios.run(scenario.id);
navigate(`/scenarios/${id}/runs/${run.id}`);
try {
const run = await scenarios.run(scenario.id);
toast.success('Scenario run started');
navigate(`/scenarios/${id}/runs/${run.id}`);
} catch (err) {
toast.error((err as Error).message);
}
};
const handleDelete = async () => {