From 54add6a12f5119f5e9c64cb4065d734a19cae68f Mon Sep 17 00:00:00 2001 From: peakchao Date: Sat, 27 Jun 2026 18:39:55 +0800 Subject: [PATCH 1/2] fix(web): optimize channel tag aggregate card layout (QuantumNous#5640) - let tag aggregate cards use the full left content width so the channel count badge can sit beside long tag names - hide the meaningless ID cell for tag aggregate rows and keep aggregate badges from being clipped in card view - localize tag channel count and aggregate status labels across supported frontend locales --- .../channels/components/channel-card.tsx | 17 +++++++++-- .../channels/components/channels-columns.tsx | 30 ++++++++++++++----- web/default/src/i18n/locales/en.json | 5 +++- web/default/src/i18n/locales/fr.json | 5 +++- web/default/src/i18n/locales/ja.json | 5 +++- web/default/src/i18n/locales/ru.json | 5 +++- web/default/src/i18n/locales/vi.json | 5 +++- web/default/src/i18n/locales/zh.json | 5 +++- web/default/src/i18n/static-keys.ts | 3 ++ 9 files changed, 65 insertions(+), 15 deletions(-) diff --git a/web/default/src/features/channels/components/channel-card.tsx b/web/default/src/features/channels/components/channel-card.tsx index 89fc3a3e5c9..9207f6753c3 100644 --- a/web/default/src/features/channels/components/channel-card.tsx +++ b/web/default/src/features/channels/components/channel-card.tsx @@ -97,7 +97,15 @@ function ChannelCardComponent({ {!isTagRow && selectCell && ( {selectCell} )} -
{typeCell}
+
+ {typeCell} +
{showStatusBadge && statusCell} @@ -112,7 +120,12 @@ function ChannelCardComponent({
{/* Left column */}
-
+
div]:!max-w-none [&>div]:w-full' + )} + > {!isTagRow && (
#{sensitiveVisible ? row.original.id : SENSITIVE_MASK} diff --git a/web/default/src/features/channels/components/channels-columns.tsx b/web/default/src/features/channels/components/channels-columns.tsx index 09289c7e000..534279a8343 100644 --- a/web/default/src/features/channels/components/channels-columns.tsx +++ b/web/default/src/features/channels/components/channels-columns.tsx @@ -538,6 +538,10 @@ export function useChannelsColumns(): ColumnDef[] { header: t('ID'), meta: { mobileHidden: true }, cell: ({ row }) => { + if (isTagAggregateRow(row.original)) { + return null + } + const id = row.getValue('id') as number return }, @@ -558,13 +562,17 @@ export function useChannelsColumns(): ColumnDef[] { if (isTagRow) { const tag = (row.original as TagRow).tag || name const childrenCount = (row.original as TagRow).children?.length || 0 + const channelCountLabel = t( + childrenCount === 1 ? '{{count}} channel' : '{{count}} channels', + { count: childrenCount } + ) return ( -
+
-
- Tag:{tag} +
+ + {t('Tag:')} {tag} +
@@ -804,11 +815,16 @@ export function useChannelsColumns(): ColumnDef[] { if (isTagRow) { const childrenCount = (row.original as TagRow).children?.length || 0 const hasEnabled = status === 1 + const statusLabel = t(hasEnabled ? 'Active' : 'Inactive') + const aggregateStatusLabel = t('{{status}} ({{count}})', { + status: statusLabel, + count: childrenCount, + }) if (hasEnabled) { return ( [] { } else { return ( Date: Sat, 27 Jun 2026 19:17:02 +0800 Subject: [PATCH 2/2] fix(web): localize tag aggregate count labels - use i18next plural resolution for tag aggregate channel counts - add plural forms for channel count labels across supported locales - add missing Inactive translation key for aggregate status badges Refs #5640 --- .../src/features/channels/components/channels-columns.tsx | 7 +++---- web/default/src/i18n/locales/en.json | 5 +++++ web/default/src/i18n/locales/fr.json | 5 +++++ web/default/src/i18n/locales/ja.json | 5 +++++ web/default/src/i18n/locales/ru.json | 5 +++++ web/default/src/i18n/locales/vi.json | 5 +++++ web/default/src/i18n/locales/zh.json | 5 +++++ web/default/src/i18n/static-keys.ts | 6 +++++- 8 files changed, 38 insertions(+), 5 deletions(-) diff --git a/web/default/src/features/channels/components/channels-columns.tsx b/web/default/src/features/channels/components/channels-columns.tsx index 534279a8343..5a0e35bd24d 100644 --- a/web/default/src/features/channels/components/channels-columns.tsx +++ b/web/default/src/features/channels/components/channels-columns.tsx @@ -562,10 +562,9 @@ export function useChannelsColumns(): ColumnDef[] { if (isTagRow) { const tag = (row.original as TagRow).tag || name const childrenCount = (row.original as TagRow).children?.length || 0 - const channelCountLabel = t( - childrenCount === 1 ? '{{count}} channel' : '{{count}} channels', - { count: childrenCount } - ) + const channelCountLabel = t('{{count}} channel', { + count: childrenCount, + }) return (
diff --git a/web/default/src/i18n/locales/en.json b/web/default/src/i18n/locales/en.json index 0b16c6de79d..24cd58b3577 100644 --- a/web/default/src/i18n/locales/en.json +++ b/web/default/src/i18n/locales/en.json @@ -27,6 +27,10 @@ "{{count}} announcements will be removed from the list.": "{{count}} announcements will be removed from the list.", "{{count}} API shortcuts will be removed from the list.": "{{count}} API shortcuts will be removed from the list.", "{{count}} channel": "{{count}} channel", + "{{count}} channel_few": "{{count}} channels", + "{{count}} channel_many": "{{count}} channels", + "{{count}} channel_one": "{{count}} channel", + "{{count}} channel_other": "{{count}} channels", "{{count}} channel(s) deleted": "{{count}} channel(s) deleted", "{{count}} channel(s) disabled": "{{count}} channel(s) disabled", "{{count}} channel(s) enabled": "{{count}} channel(s) enabled", @@ -2200,6 +2204,7 @@ "Important": "Important", "In Progress": "In Progress", "In:": "In:", + "Inactive": "Inactive", "incident": "incident", "incidents": "incidents", "Incidents": "Incidents", diff --git a/web/default/src/i18n/locales/fr.json b/web/default/src/i18n/locales/fr.json index de4d0497f90..c0b4fbfb82e 100644 --- a/web/default/src/i18n/locales/fr.json +++ b/web/default/src/i18n/locales/fr.json @@ -27,6 +27,10 @@ "{{count}} announcements will be removed from the list.": "{{count}} annonces seront retirées de la liste.", "{{count}} API shortcuts will be removed from the list.": "{{count}} raccourcis API seront retirés de la liste.", "{{count}} channel": "{{count}} canal", + "{{count}} channel_few": "{{count}} canaux", + "{{count}} channel_many": "{{count}} canaux", + "{{count}} channel_one": "{{count}} canal", + "{{count}} channel_other": "{{count}} canaux", "{{count}} channel(s) deleted": "{{count}} canal(canaux) supprimé(s)", "{{count}} channel(s) disabled": "{{count}} canal(canaux) désactivé(s)", "{{count}} channel(s) enabled": "{{count}} canal(canaux) activé(s)", @@ -2200,6 +2204,7 @@ "Important": "Important", "In Progress": "En cours", "In:": "Entrée :", + "Inactive": "Inactif", "incident": "incident", "incidents": "incidents", "Incidents": "Incidents", diff --git a/web/default/src/i18n/locales/ja.json b/web/default/src/i18n/locales/ja.json index 0f651ad62c5..2afdacf70a9 100644 --- a/web/default/src/i18n/locales/ja.json +++ b/web/default/src/i18n/locales/ja.json @@ -27,6 +27,10 @@ "{{count}} announcements will be removed from the list.": "{{count}} 件のお知らせがリストから削除されます。", "{{count}} API shortcuts will be removed from the list.": "{{count}} 件の API ショートカットがリストから削除されます。", "{{count}} channel": "{{count}} チャンネル", + "{{count}} channel_few": "{{count}} チャンネル", + "{{count}} channel_many": "{{count}} チャンネル", + "{{count}} channel_one": "{{count}} チャンネル", + "{{count}} channel_other": "{{count}} チャンネル", "{{count}} channel(s) deleted": "{{count}} 個のチャネルを削除しました", "{{count}} channel(s) disabled": "{{count}} 個のチャネルを無効にしました", "{{count}} channel(s) enabled": "{{count}} 個のチャネルを有効にしました", @@ -2200,6 +2204,7 @@ "Important": "重要", "In Progress": "処理中", "In:": "入力:", + "Inactive": "無効", "incident": "件", "incidents": "件", "Incidents": "インシデント", diff --git a/web/default/src/i18n/locales/ru.json b/web/default/src/i18n/locales/ru.json index e2368b71b96..884b2eecb88 100644 --- a/web/default/src/i18n/locales/ru.json +++ b/web/default/src/i18n/locales/ru.json @@ -27,6 +27,10 @@ "{{count}} announcements will be removed from the list.": "{{count}} объявлений будут удалены из списка.", "{{count}} API shortcuts will be removed from the list.": "{{count}} ярлыков API будут удалены из списка.", "{{count}} channel": "{{count}} канал", + "{{count}} channel_few": "{{count}} канала", + "{{count}} channel_many": "{{count}} каналов", + "{{count}} channel_one": "{{count}} канал", + "{{count}} channel_other": "{{count}} канала", "{{count}} channel(s) deleted": "Удалено {{count}} каналов", "{{count}} channel(s) disabled": "Отключено {{count}} каналов", "{{count}} channel(s) enabled": "Включено {{count}} каналов", @@ -2200,6 +2204,7 @@ "Important": "Важно", "In Progress": "Выполняется", "In:": "Вх:", + "Inactive": "Неактивна", "incident": "инцидент", "incidents": "инцидентов", "Incidents": "Инциденты", diff --git a/web/default/src/i18n/locales/vi.json b/web/default/src/i18n/locales/vi.json index ea8b7462969..7687264404c 100644 --- a/web/default/src/i18n/locales/vi.json +++ b/web/default/src/i18n/locales/vi.json @@ -27,6 +27,10 @@ "{{count}} announcements will be removed from the list.": "{{count}} thông báo sẽ bị xóa khỏi danh sách.", "{{count}} API shortcuts will be removed from the list.": "{{count}} lối tắt API sẽ bị xóa khỏi danh sách.", "{{count}} channel": "{{count}} kênh", + "{{count}} channel_few": "{{count}} kênh", + "{{count}} channel_many": "{{count}} kênh", + "{{count}} channel_one": "{{count}} kênh", + "{{count}} channel_other": "{{count}} kênh", "{{count}} channel(s) deleted": "Đã xóa {{count}} kênh", "{{count}} channel(s) disabled": "Đã tắt {{count}} kênh", "{{count}} channel(s) enabled": "Đã bật {{count}} kênh", @@ -2200,6 +2204,7 @@ "Important": "Quan trọng", "In Progress": "Đang xử lý", "In:": "Vào:", + "Inactive": "Không hoạt động", "incident": "sự cố", "incidents": "sự cố", "Incidents": "Sự cố", diff --git a/web/default/src/i18n/locales/zh.json b/web/default/src/i18n/locales/zh.json index 53c895cbaa7..da85541b95f 100644 --- a/web/default/src/i18n/locales/zh.json +++ b/web/default/src/i18n/locales/zh.json @@ -27,6 +27,10 @@ "{{count}} announcements will be removed from the list.": "将从列表中移除 {{count}} 条公告。", "{{count}} API shortcuts will be removed from the list.": "将从列表中移除 {{count}} 个 API 快捷方式。", "{{count}} channel": "{{count}} 个渠道", + "{{count}} channel_few": "{{count}} 个渠道", + "{{count}} channel_many": "{{count}} 个渠道", + "{{count}} channel_one": "{{count}} 个渠道", + "{{count}} channel_other": "{{count}} 个渠道", "{{count}} channel(s) deleted": "已删除 {{count}} 个渠道", "{{count}} channel(s) disabled": "已禁用 {{count}} 个渠道", "{{count}} channel(s) enabled": "已启用 {{count}} 个渠道", @@ -2200,6 +2204,7 @@ "Important": "重要", "In Progress": "进行中", "In:": "入:", + "Inactive": "未生效", "incident": "次故障", "incidents": "次故障", "Incidents": "事件", diff --git a/web/default/src/i18n/static-keys.ts b/web/default/src/i18n/static-keys.ts index 3e587c4fc85..8f1a24fe159 100644 --- a/web/default/src/i18n/static-keys.ts +++ b/web/default/src/i18n/static-keys.ts @@ -516,8 +516,12 @@ export const STATIC_I18N_KEYS = [ 'Batch detection failed', 'Batch detection complete: {{channels}} channels, {{add}} to add, {{remove}} to remove, {{fails}} failed', '{{count}} channel', - '{{count}} channels', + '{{count}} channel_one', + '{{count}} channel_other', + '{{count}} channel_few', + '{{count}} channel_many', '{{status}} ({{count}})', + 'Inactive', // Dashboard flow stages (labels/descriptions passed to t at runtime) 'User',