Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): colour every session status pill on the dashboard
Yudhi Armyndharis238636903a82
diff --git a/dashboard/src/pages/Dashboard.css b/dashboard/src/pages/Dashboard.cssindex 5090e8f1e..6edde54f6 100644--- a/dashboard/src/pages/Dashboard.css+++ b/dashboard/src/pages/Dashboard.css@@ -226,12 +226,24 @@color: var(--primary-text);}-.dashboard .status-pill.connecting,+.dashboard .status-pill.initializing,.dashboard .status-pill.authenticating {background: rgba(245, 158, 11, 0.15);color: var(--warning-text);}+.dashboard .status-pill.qr_ready {+ background: rgba(59, 130, 246, 0.1);+ color: var(--info);+}++/* Needs a human: a heavier tint of the in-progress amber, so the two do not read alike. */+.dashboard .status-pill.action_required {+ background: rgba(245, 158, 11, 0.3);+ color: var(--warning-text);+}++.dashboard .status-pill.created,.dashboard .status-pill.disconnected {background: var(--bg-light);color: var(--text-muted);diff --git a/dashboard/src/pages/Dashboard.test.ts b/dashboard/src/pages/Dashboard.test.tsindex cf0270126..c328bd4d4 100644--- a/dashboard/src/pages/Dashboard.test.ts+++ b/dashboard/src/pages/Dashboard.test.ts@@ -6,6 +6,7 @@import '../test-helpers/register-hooks.ts';import { test, before, afterEach } from 'node:test';import assert from 'node:assert/strict';+import { readFileSync } from 'node:fs';import { createElement } from 'react';import { MemoryRouter } from 'react-router-dom';import { QueryClient, QueryClientProvider } from '@tanstack/react-query';@@ -244,3 +245,17 @@ test('an admin key loads the chart section', async () => {renderDashboard();await rtl.waitFor(() => assert.ok(requested.some(p => p.startsWith('/api/stats/messages'))));});++// The session table renders `status-pill ${session.status}`, so every status needs its own colour.+test('the status pill styles every session status and nothing else', () => {+ const entity = readFileSync(+ new URL('../../../src/modules/session/entities/session.entity.ts', import.meta.url),+ 'utf8',+ );+ const block = /export enum SessionStatus \{([^}]*)\}/.exec(entity)?.[1] ?? '';+ const statuses = [...block.matchAll(/= '([a-z_]+)'/g)].map(m => m[1]).sort();+ assert.ok(statuses.length > 0, 'SessionStatus was not found');+ const css = readFileSync(new URL('./Dashboard.css', import.meta.url), 'utf8');+ const styled = [...new Set([...css.matchAll(/\.dashboard \.status-pill\.([a-z_]+)/g)].map(m => m[1]))].sort();+ assert.deepEqual(styled, statuses);+});