Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): replace alert() with Toast notifications
rmyndharis10263435ce30
diff --git a/dashboard/src/pages/Infrastructure.tsx b/dashboard/src/pages/Infrastructure.tsxindex aeadd4318..175be4a82 100644--- a/dashboard/src/pages/Infrastructure.tsx+++ b/dashboard/src/pages/Infrastructure.tsx@@ -15,6 +15,7 @@ import {import { infraApi } from '../services/api';import { useDocumentTitle } from '../hooks/useDocumentTitle';import { PageHeader } from '../components/PageHeader';+import { useToast } from '../components/Toast';import './Infrastructure.css';// Watermark icons@@ -83,6 +84,7 @@ interface RateLimitConfig {export function Infrastructure() {useDocumentTitle('Infrastructure');+ const toast = useToast();const [loading, setLoading] = useState(true);const [saving, setSaving] = useState(false);const [showRestartModal, setShowRestartModal] = useState(false);@@ -291,10 +293,10 @@ export function Infrastructure() {setPendingProfiles(result.profiles || []);setShowRestartModal(true);} else {- alert('Failed to save configuration: ' + result.message);+ toast.error('Save Failed', result.message);}} catch (err) {- alert('Failed to save configuration: ' + (err instanceof Error ? err.message : 'Unknown error'));+ toast.error('Save Failed', err instanceof Error ? err.message : 'Unknown error');} finally {setSaving(false);}diff --git a/dashboard/src/pages/Plugins.tsx b/dashboard/src/pages/Plugins.tsxindex 096386081..84c3f6266 100644--- a/dashboard/src/pages/Plugins.tsx+++ b/dashboard/src/pages/Plugins.tsx@@ -19,6 +19,7 @@ import { pluginsApi, infraApi } from '../services/api';import type { Plugin, Engine } from '../services/api';import { useDocumentTitle } from '../hooks/useDocumentTitle';import { PageHeader } from '../components/PageHeader';+import { useToast } from '../components/Toast';import './Plugins.css';type PluginType = 'engine' | 'storage' | 'queue' | 'auth' | 'extension';@@ -40,6 +41,7 @@ interface EngineConfig {export default function Plugins() {useDocumentTitle('Plugins');+ const toast = useToast();const [plugins, setPlugins] = useState<Plugin[]>([]);const [engines, setEngines] = useState<Engine[]>([]);const [currentEngine, setCurrentEngine] = useState<string>('');@@ -112,9 +114,13 @@ export default function Plugins() {setActionLoading(pluginId);try {const result = await pluginsApi.healthCheck(pluginId);- alert(result.healthy ? `✓ Healthy: ${result.message}` : `✗ Unhealthy: ${result.message}`);+ if (result.healthy) {+ toast.success('Health Check Passed', result.message);+ } else {+ toast.warning('Health Check Failed', result.message);+ }} catch (err) {- alert(`Health check failed: ${err instanceof Error ? err.message : 'Unknown error'}`);+ toast.error('Health Check Error', err instanceof Error ? err.message : 'Unknown error');} finally {setActionLoading(null);}@@ -129,10 +135,10 @@ export default function Plugins() {setSavingConfig(true);try {// For now, show a success message - actual implementation would call API- alert('Configuration saved! Server restart required to apply changes.');+ toast.success('Configuration Saved', 'Server restart required to apply changes.');setShowConfigModal(false);} catch (err) {- alert(`Failed to save config: ${err instanceof Error ? err.message : 'Unknown error'}`);+ toast.error('Save Failed', err instanceof Error ? err.message : 'Unknown error');} finally {setSavingConfig(false);}