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
+9 -3
View File
@@ -5,12 +5,13 @@ import { Play, Plus, Trash2, Download, ClipboardList } from 'lucide-react';
import { parse as yamlParse } from 'yaml';
import { scenarios } from '../../api';
import type { Scenario } from '../../api';
import { Breadcrumbs, Button, Table, type TableColumn, Timestamp, UuidBadge } from '../../ui';
import { Breadcrumbs, Button, Table, type TableColumn, Timestamp, UuidBadge, useToast } from '../../ui';
import styles from '../Page.module.css';
export function ScenariosPage() {
const { t } = useTranslation();
const navigate = useNavigate();
const toast = useToast();
const [items, setItems] = useState<Scenario[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
@@ -30,8 +31,13 @@ export function ScenariosPage() {
}, [load]);
const handleRun = async (id: string) => {
const run = await scenarios.run(id);
navigate(`/scenarios/${id}/runs/${run.id}`);
try {
const run = await scenarios.run(id);
toast.success('Scenario run started');
navigate(`/scenarios/${id}/runs/${run.id}`);
} catch (err) {
toast.error((err as Error).message);
}
};
const handleDelete = async (id: string) => {