qwen-code/packages/web-shell/client/components/SessionOverviewPanel.module.css
Shaojin Wen 49497f5076
feat(web-shell): color-code each split pane by workspace (#6971)
* feat(web-shell): color-code each split pane by workspace

On a narrow split (split-screen / mobile), it was hard to tell which
workspace each pane belonged to: a pane's header showed only its session
name, and the sole workspace signal — the composer chip at the bottom —
collapsed to a bare folder icon that looked identical for every
workspace, so the workspace was discoverable only by hovering each one.

Surface the workspace where you actually scan — the pane header — and
give each workspace a stable accent color so panes read apart at a
glance and same-workspace panes read as a group:

- Add a colored workspace tag (dot + basename) at the start of each
  pane header on a multi-workspace daemon, and colorize the header
  divider with the same accent. The dot never shrinks, so panes stay
  distinguishable even when the name and session title ellipsize.
- Derive a stable per-workspace color from the workspace's position in
  the daemon's advertised workspaces[], reusing the sidebar
  session-group palette so the two surfaces speak the same color
  language. Extracted into a shared workspaceAccent.module.css.
- Tint the composer workspace chip with the same accent (folder + faint
  background) so it stays distinguishable even in its icon-only compact
  state, instead of a generic folder.

Single-workspace daemons are unchanged: no tag, and the header divider
falls back to the neutral border.

* refactor(web-shell): address review on split-pane workspace accent

- Rename workspaceAccent.module.css -> WorkspaceAccent.module.css to match the
  PascalCase convention used by every other component .module.css; update both
  import sites.
- Hoist the four raw-hex accent colors (red/orange/yellow/green) into shared
  --accent-* theme tokens in App.module.css, and point the workspace accent
  module, the sidebar group dots, and the overview badges at them. The palette
  now has a single source of truth and can't drift between the four surfaces
  (values are unchanged, so rendering is identical).
- Add a compile-time exhaustiveness guard so adding a
  DaemonSessionGroupPresetColor without extending WORKSPACE_ACCENT_COLORS (and
  its CSS class) fails the build instead of silently dropping that accent.
- Give the pane-header workspace tag role="img" so its "Workspace: <name>"
  aria-label is reliably announced; aria-label on a bare span (generic role)
  is not.

* refactor(web-shell): address follow-up review on workspace accent

- Hoist the four --accent-* tokens out of both theme blocks into the
  theme-independent .app scope, so they are declared once (the values do not
  vary by theme) — a genuine single declaration rather than two kept in sync.
- Add a dev-only runtime check that every accent color has a matching class in
  WorkspaceAccent.module.css, closing the gap the compile-time guard cannot
  cover: CSS modules are typed Record<string, string>, so a renamed/removed
  class would otherwise silently drop that color's accent.
- Rename the "same workspace same color" test to describe what it actually
  asserts (a stable color per cwd, and distinct colors across workspaces).

* refactor(web-shell): address second follow-up review on workspace accent

- WorkspaceIndicator tests: assert on imported CSS-module class names instead of
  string literals, so a CSS-module naming change can't silently make the
  substring checks vacuous; add an expanded-mode (non-compact) accent test so a
  refactor that gated the accent on `compact` would be caught.
- workspaceColor.ts: run the CSS-class contract check unconditionally — throw in
  dev, but console.error in production — so a missing class in a prod build is
  at least diagnosable instead of a silent accent drop.
- WorkspaceAccent.module.css: correct the docstring to state exactly which
  tokens come from where — red/orange/yellow/green from --accent-* in
  App.module.css, blue/purple deliberately reusing the --agent-* brand tokens.

---------

Co-authored-by: wenshao <wenshao@example.com>
2026-07-16 02:38:58 +00:00

248 lines
4.7 KiB
CSS

.panel {
display: flex;
flex-direction: column;
gap: 12px;
font-size: 13px;
color: var(--foreground);
}
.toolbar {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
}
.count {
color: var(--muted-foreground);
font-size: 12px;
}
.selectAll {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 12px;
color: var(--muted-foreground);
cursor: pointer;
}
.actionButton {
appearance: none;
padding: 4px 12px;
border: 1px solid var(--primary);
border-radius: 8px;
background: var(--primary);
color: var(--background);
font-size: 13px;
font-weight: 500;
cursor: pointer;
}
.actionButton:disabled {
opacity: 0.55;
cursor: default;
border-color: var(--border);
background: transparent;
color: var(--muted-foreground);
}
.refreshButton {
margin-left: auto;
padding: 4px 12px;
border: 1px solid var(--border);
border-radius: 6px;
background: transparent;
color: var(--foreground);
font-size: 12px;
cursor: pointer;
}
.notice {
padding: 8px 12px;
border-radius: 8px;
font-size: 12px;
color: var(--warning-color);
background: color-mix(in srgb, var(--warning-color) 12%, transparent);
}
/* A responsive grid so the panel fills wide (multi-monitor) screens and still
collapses to a single column on narrow ones. */
.grid {
list-style: none;
margin: 0;
padding: 0;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 10px;
}
.card {
display: flex;
flex-direction: column;
gap: 8px;
padding: 12px;
border: 1px solid var(--border);
border-left-width: 3px;
border-radius: 10px;
background: color-mix(in srgb, var(--foreground) 3%, transparent);
}
.cardCurrent {
outline: 2px solid color-mix(in srgb, var(--primary) 60%, transparent);
outline-offset: -1px;
}
.cardTop {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
.cardCheckbox {
flex: 0 0 auto;
cursor: pointer;
}
.colorDot {
width: 8px;
height: 8px;
flex: 0 0 8px;
border-radius: 999px;
}
.cardLabel {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
border: none;
background: transparent;
color: var(--foreground);
font-size: 13px;
font-weight: 600;
cursor: pointer;
padding: 0;
}
.cardLabel:hover {
text-decoration: underline;
}
.currentBadge {
flex: 0 0 auto;
padding: 1px 7px;
border-radius: 999px;
font-size: 11px;
font-weight: 600;
color: var(--primary);
background: color-mix(in srgb, var(--primary) 14%, transparent);
}
.cardMeta {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
min-width: 0;
}
.metaItem {
color: var(--muted-foreground);
font-size: 12px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
}
.statusBadge {
display: inline-flex;
align-items: center;
padding: 1px 9px;
border-radius: 999px;
font-size: 11px;
font-weight: 600;
}
/* Status accents — applied both to the card's left border and its badge. */
.statusApproval {
border-left-color: var(--warning-color);
}
.statusApproval.statusBadge {
color: var(--warning-color);
background: color-mix(in srgb, var(--warning-color) 14%, transparent);
}
.statusRunning {
border-left-color: var(--primary);
}
.statusRunning.statusBadge {
color: var(--primary);
background: color-mix(in srgb, var(--primary) 14%, transparent);
}
.statusIdle {
border-left-color: var(--border);
}
.statusIdle.statusBadge {
color: var(--muted-foreground);
background: color-mix(in srgb, var(--muted-foreground) 12%, transparent);
}
/* Which workspace a session lives in — only shown on a multi-workspace daemon.
The primary reads muted; a non-primary workspace gets an accent so
cross-workspace sessions stand out in the grid. */
.workspaceBadge {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
max-width: 140px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 1px 8px;
border-radius: 999px;
font-size: 11px;
font-weight: 600;
color: var(--muted-foreground);
background: color-mix(in srgb, var(--muted-foreground) 12%, transparent);
}
.workspaceBadgeOther {
color: var(--primary);
background: color-mix(in srgb, var(--primary) 14%, transparent);
}
.empty {
padding: 24px 12px;
text-align: center;
color: var(--muted-foreground);
font-size: 13px;
}
/* Color tags mirror the sidebar's session-group palette. */
.colorRed {
background: var(--accent-red);
}
.colorOrange {
background: var(--accent-orange);
}
.colorYellow {
background: var(--accent-yellow);
}
.colorGreen {
background: var(--accent-green);
}
.colorBlue {
background: var(--agent-blue-500);
}
.colorPurple {
background: var(--agent-purple-600);
}