From 74f44418f4c29c4e8a25e0451c8de852bd456563 Mon Sep 17 00:00:00 2001 From: Xenon010101 Date: Fri, 5 Jun 2026 20:47:52 +0530 Subject: [PATCH] fix: replace raw alert() calls with toast.error() notifications Replaced 4 browser alert() calls in AdminSkillTestsPage catch blocks with the project's toast.error() system for consistent UI. Closes #1321 Signed-off-by: Xenon010101 --- .../src/module/admin/skill-tests/AdminSkillTestsPage.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/module/admin/skill-tests/AdminSkillTestsPage.tsx b/client/src/module/admin/skill-tests/AdminSkillTestsPage.tsx index 435f9a211..9dd8439a8 100644 --- a/client/src/module/admin/skill-tests/AdminSkillTestsPage.tsx +++ b/client/src/module/admin/skill-tests/AdminSkillTestsPage.tsx @@ -3,6 +3,7 @@ import { BadgeCheck, Plus, Pencil, Trash2, ChevronDown, ChevronRight, Save, X, L import { LoadingScreen } from "../../../components/LoadingScreen"; import api from "../../../lib/axios"; import { SEO } from "../../../components/SEO"; +import toast from "../../../components/ui/toast"; interface SkillTestQuestion { question: string; @@ -63,7 +64,7 @@ export default function AdminSkillTestsPage() { setEditing(data.test); setCreating(false); setExpandedQ(null); - } catch { alert("Failed to load test"); } + } catch { toast.error("Failed to load test"); } }; const handleCreate = () => { @@ -78,14 +79,14 @@ export default function AdminSkillTestsPage() { await api.delete(`/admin/skill-tests/${id}`); setTests((prev) => prev.filter((t) => t.id !== id)); if (editing?.id === id) { setEditing(null); setCreating(false); } - } catch { alert("Failed to delete"); } + } catch { toast.error("Failed to delete"); } }; const handleToggle = async (id: number, isActive: boolean) => { try { await api.patch(`/admin/skill-tests/${id}/toggle`, { isActive }); setTests((prev) => prev.map((t) => t.id === id ? { ...t, isActive } : t)); - } catch { alert("Failed to toggle"); } + } catch { toast.error("Failed to toggle"); } }; const handleSave = async () => { @@ -116,7 +117,7 @@ export default function AdminSkillTestsPage() { setEditing(null); setCreating(false); fetchTests(); - } catch { alert("Failed to save test"); } + } catch { toast.error("Failed to save test"); } finally { setSaving(false); } };