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
@@ -4,13 +4,14 @@ import { useTranslation } from 'react-i18next';
import { KeyRound, X, Save } from 'lucide-react';
import { credentials } from '../../api';
import type { Credential } from '../../api';
import { Breadcrumbs, Button, Card, Input, CodeEditor } from '../../ui';
import { Breadcrumbs, Button, Card, Input, CodeEditor, useToast } from '../../ui';
import styles from '../Page.module.css';
export function EditCredentialPage() {
const { t } = useTranslation();
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
const toast = useToast();
const [credential, setCredential] = useState<Credential | null>(null);
const [name, setName] = useState('');
@@ -57,9 +58,12 @@ export function EditCredentialPage() {
name: name.trim(),
data: data.trim() || null,
});
toast.success('Credential updated');
navigate(`/credentials/${id}`);
} catch (err) {
setError((err as Error).message);
const message = (err as Error).message;
setError(message);
toast.error(message);
} finally {
setSaving(false);
}