From 396e9e0b03dbb0e9d358bba6df6c329543e58ad9 Mon Sep 17 00:00:00 2001 From: paisley <8197966+su8su@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:25:25 +0800 Subject: [PATCH] style(channels): simplify channel status indicators (#862) --- src/pages/Channels/index.tsx | 33 ++++++++----------- tests/e2e/channels-health-diagnostics.spec.ts | 2 +- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/pages/Channels/index.tsx b/src/pages/Channels/index.tsx index 2f5ccb1af..eae164fe6 100644 --- a/src/pages/Channels/index.tsx +++ b/src/pages/Channels/index.tsx @@ -407,20 +407,8 @@ export function Channels() { [diagnosticsSnapshot], ); - const statusTone = useCallback((status: ChannelGroupItem['status']) => { - switch (status) { - case 'connected': - return 'bg-green-500/10 text-green-700 dark:text-green-300 border-green-500/20'; - case 'connecting': - return 'bg-sky-500/10 text-sky-700 dark:text-sky-300 border-sky-500/20'; - case 'degraded': - return 'bg-yellow-500/10 text-yellow-700 dark:text-yellow-300 border-yellow-500/20'; - case 'error': - return 'bg-destructive/10 text-destructive border-destructive/20'; - default: - return 'bg-black/5 dark:bg-white/5 text-muted-foreground border-black/10 dark:border-white/10'; - } - }, []); + + const statusLabel = useCallback((status: ChannelGroupItem['status']) => { return t(`account.connectionStatus.${status}`); @@ -630,9 +618,17 @@ export function Channels() {

{group.channelType}

- - {statusLabel(group.status)} - +
@@ -684,9 +680,6 @@ export function Channels() {

{displayName}

- - {statusLabel(account.status)} -
{account.lastError && (
{account.lastError}
diff --git a/tests/e2e/channels-health-diagnostics.spec.ts b/tests/e2e/channels-health-diagnostics.spec.ts index 94d748dac..fba43f12a 100644 --- a/tests/e2e/channels-health-diagnostics.spec.ts +++ b/tests/e2e/channels-health-diagnostics.spec.ts @@ -138,7 +138,7 @@ test.describe('Channels health diagnostics', () => { await expect(page.getByTestId('channels-page')).toBeVisible(); await expect(page.getByTestId('channels-health-banner')).toBeVisible(); await expect(page.getByText(/Gateway degraded|网关状态异常|ゲートウェイ劣化/)).toBeVisible(); - await expect(page.locator('div.rounded-2xl').getByText(/Degraded|异常降级|劣化中/).first()).toBeVisible(); + await expect(page.locator('div.rounded-2xl').getByTitle(/Degraded|异常降级|劣化中/).first()).toBeVisible(); await page.getByTestId('channels-restart-gateway').click(); await page.getByTestId('channels-copy-diagnostics').click();