From 2eac368602340a04128c39f5dc854649dd0f9f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=85=E8=86=80?= Date: Sat, 17 Oct 2026 01:47:38 +0800 Subject: [PATCH] style(console): redesign route cards for narrow screens The card was one flex row whose badges, filter chips, targets and five hand-drawn icon buttons squeezed the route name on small screens. It is now a grid driven by a container query: name and actions share the top line, the filter summary (clamped to two lines) and targets follow, and the tags wrap below; from 40rem the tags move up beside the title. Targets of the same platform collapse into one tag with a count, long ids truncate instead of widening the page, and the actions use lucide icons with accessible labels. --- app/assets/css/main.css | 123 +++++++------ app/components/ConsolePage.vue | 2 +- app/components/RouteCard.vue | 324 ++++++++++++++------------------- app/composables/useI18n.ts | 2 + 4 files changed, 204 insertions(+), 247 deletions(-) diff --git a/app/assets/css/main.css b/app/assets/css/main.css index 7072cc2..4529a82 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -283,8 +283,13 @@ } /* ---- Route cards ---- */ + .route-list { + @apply flex flex-col gap-2.5; + container-type: inline-size; + } + .route-card { - @apply flex animate-rise items-center gap-4 rounded-xl border border-border bg-surface px-5 py-3.5 shadow-xs transition-all duration-150; + @apply block animate-rise rounded-xl border border-border bg-surface px-4 py-3 shadow-xs transition-all duration-150; } .route-card:hover { @@ -295,28 +300,70 @@ @apply opacity-60; } - .route-card-main { - @apply min-w-0 flex-1 space-y-2.5; + /* Mobile-first: title row with actions, then filters/targets, then the tags. */ + .route-row { + @apply grid items-center gap-x-3 gap-y-2; + grid-template-columns: auto minmax(0, 1fr) auto; + grid-template-areas: + "lead title actions" + "body body body" + "tags tags tags"; } - .route-card-header { - @apply flex flex-wrap items-center gap-2.5; + .route-lead { + @apply flex items-center; + grid-area: lead; } - .route-card-title { - @apply flex min-w-0 flex-wrap items-center gap-2; + .route-title { + @apply flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1; + grid-area: title; } .route-name { - @apply text-[15px] font-semibold tracking-tight text-text; + @apply min-w-0 text-[15px] font-semibold tracking-tight text-text; + overflow-wrap: anywhere; } .route-id { @apply rounded-md bg-surface-2 px-1.5 py-0.5 font-mono text-[11px] text-faint; } - .route-card-badges { - @apply ml-auto flex flex-wrap items-center gap-1.5; + .route-position { + @apply grid h-5 min-w-5 place-items-center rounded-md bg-accent-dim px-1 font-mono text-[11px] font-semibold text-accent-text tabular-nums; + } + + .route-tags { + @apply flex flex-wrap items-center justify-end gap-1.5; + grid-area: tags; + } + + .route-actions { + @apply flex items-center gap-0.5; + grid-area: actions; + } + + .route-body { + @apply min-w-0 space-y-2; + grid-area: body; + } + + @container (min-width: 40rem) { + .route-row { + grid-template-columns: auto minmax(0, 1fr) auto auto; + grid-template-areas: + "lead title tags actions" + ". body body body"; + } + } + + .route-summary { + @apply line-clamp-2 text-[12.5px] leading-relaxed text-muted; + overflow-wrap: anywhere; + } + + .route-summary.is-empty { + @apply italic text-faint; } .route-badge { @@ -324,18 +371,18 @@ } .route-badge-dot { - @apply inline-block h-1.5 w-1.5 rounded-full; + @apply inline-block h-1.5 w-1.5 rounded-full bg-current; } - .route-badge-dc { + .route-badge-discord { @apply border-accent/20 bg-accent-dim/30 text-accent-text; } - .route-badge-tg { + .route-badge-telegram { @apply border-info/20 bg-info-dim/30 text-info; } - .route-badge-fs { + .route-badge-feishu { @apply border-warn/20 bg-warn-dim/30 text-warn; } @@ -351,44 +398,12 @@ @apply border-accent/30 bg-accent-dim/20 text-accent-text; } - .route-card-filters { - @apply flex flex-wrap items-center gap-2 text-xs; - } - - .route-chip { - @apply inline-flex items-center gap-1.5 rounded-md border border-border bg-surface-2 px-2.5 py-1 text-[11.5px]; - } - - .route-chip-type { - @apply font-bold uppercase tracking-wider text-faint text-[10px]; - } - - .route-chip-val { - @apply font-medium text-text; - } - - .route-chip.exclude { - @apply border-bad/20 bg-bad-dim/20; - } - - .route-chip.exclude .route-chip-type { - @apply text-bad; - } - - .route-chip-empty { - @apply italic text-muted; - } - .route-card-targets { @apply flex flex-wrap items-center gap-2 text-xs; } - .route-target { - @apply inline-flex items-center; - } - .route-target-row { - @apply inline-flex items-center gap-1.5 rounded-md border border-border/80 bg-surface-2/60 px-2 py-0.5 text-xs; + @apply inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-border/80 bg-surface-2/60 px-2 py-0.5 text-xs; } .route-target-label { @@ -396,19 +411,7 @@ } .route-target-id { - @apply font-mono text-[11.5px] text-text; - } - - .route-card-actions { - @apply flex shrink-0 items-center gap-1 self-center; - } - - .route-action-btn { - @apply flex h-7 w-7 items-center justify-center rounded-md text-muted transition-colors hover:bg-surface-2 hover:text-text disabled:pointer-events-none disabled:opacity-25; - } - - .route-action-btn-danger:hover { - @apply bg-bad-dim/30 text-bad; + @apply min-w-0 truncate font-mono text-[11.5px] text-text; } /* ---- Toggle switch ---- */ diff --git a/app/components/ConsolePage.vue b/app/components/ConsolePage.vue index 861af20..63d041d 100644 --- a/app/components/ConsolePage.vue +++ b/app/components/ConsolePage.vue @@ -108,7 +108,7 @@

{{ groupRoutesError }}

-
+
-
-
+
+
- -
- {{ route.name || t("route.untitled") }} - {{ route.id }} -
-
- - - {{ - tg.platform === "telegram" - ? "Telegram" - : tg.platform === "feishu" - ? t("route.feishu") - : "Discord" - }} - - {{ t("route.fallback") }} - {{ t("route.stop") }} - @roles -
+
-
-
- - {{ summary }} - - - {{ t("route.noFilters") }} - -
+
+ {{ displayName }} + {{ route.id }} +
+
+ + + {{ platformLabel(p.platform) }} + + @roles + {{ + t("route.fallback") + }} + {{ + t("route.stop") + }} +
+ +
+ + + + + + + + + + + + +
+ +
+

+ {{ summary || t("route.noFilters") }} +

-
-
- - - - - - - - - - -
-
+ + + + + + + + + + + +
- -
- - - - - - - - - - - - - - - - - - - - - - -
diff --git a/app/composables/useI18n.ts b/app/composables/useI18n.ts index 85be0b5..3db0266 100644 --- a/app/composables/useI18n.ts +++ b/app/composables/useI18n.ts @@ -142,6 +142,7 @@ const en: Dict = { "group.routesIn": "Routes in {name}", "routes.emptyGroup": "No routes in this group yet.", "routes.createFirst": "Create your first route", + "routes.delete": "Delete route", "route.untitled": "(untitled)", "route.noFilters": "no filters", "route.channel": "CHANNEL", @@ -543,6 +544,7 @@ const zh: Dict = { "group.routesIn": "{name} 的路由", "routes.emptyGroup": "该分组还没有路由。", "routes.createFirst": "创建第一个路由", + "routes.delete": "删除路由", "route.untitled": "(未命名)", "route.noFilters": "无过滤器", "route.channel": "频道",