feat: allow hiding workspace card metadata (#2701)

This commit is contained in:
Jinjing
2026-05-23 13:02:50 -07:00
committed by GitHub
parent 21b30bc513
commit ace241c43f
10 changed files with 187 additions and 57 deletions
-1
View File
@@ -19,7 +19,6 @@ import { DEFAULT_WORKTREE_CARD_PROPERTIES } from './worktree-card-properties'
export { DEFAULT_STATUS_BAR_ITEMS } from './status-bar-defaults'
export {
ALWAYS_VISIBLE_WORKTREE_CARD_PROPERTIES,
DEFAULT_WORKTREE_CARD_PROPERTIES,
normalizeWorktreeCardProperties
} from './worktree-card-properties'
+8
View File
@@ -2025,9 +2025,13 @@ export type WorktreeCardProperty =
| 'unread'
// Legacy persisted preference. CI status is now represented by linked PR metadata.
| 'ci'
// GitHub issue metadata shown on workspace cards.
| 'issue'
// Linear issue metadata shown on workspace cards.
| 'linear-issue'
| 'pr'
| 'comment'
| 'ports'
// Why: inline list of agent activity rendered directly inside each
// workspace card when the experimental agent-activity feature is on. On by
// default (see DEFAULT_WORKTREE_CARD_PROPERTIES in shared/constants.ts) —
@@ -2152,6 +2156,10 @@ export type PersistedUIState = {
* stamped on every prior load and so is permanently dirty for the
* prior-RC opt-out cohort the widened migration is meant to reach. */
_inlineAgentsDefaultedForAllUsers?: boolean
/** One-shot migration flag for card properties that were split out after
* the original metadata toggles shipped. Set once so later deliberate
* unchecks of Linear issue and Ports stick across restarts. */
_expandedWorktreeCardPropertiesDefaulted?: boolean
/** Snapshot of totalAgentsSpawned captured the first time we see the current
* app version. Why: the nag threshold counts agents spawned *since the
* user's last update* so a fresh install or new release does not trigger
+22 -11
View File
@@ -1,28 +1,39 @@
import type { WorktreeCardProperty } from './types'
export const ALWAYS_VISIBLE_WORKTREE_CARD_PROPERTIES: WorktreeCardProperty[] = [
'status',
'unread',
'issue',
'pr',
'comment'
]
const FIXED_WORKTREE_CARD_PROPERTIES: WorktreeCardProperty[] = ['status', 'unread']
export const DEFAULT_WORKTREE_CARD_PROPERTIES: WorktreeCardProperty[] = [
...ALWAYS_VISIBLE_WORKTREE_CARD_PROPERTIES,
...FIXED_WORKTREE_CARD_PROPERTIES,
'issue',
'linear-issue',
'pr',
'comment',
'ports',
// Why: agent activity is the primary reason users opt into the feature, so
// show it inline on each card by default. Unchecking this from the
// Workspaces view options hides the inline list entirely.
'inline-agents'
]
const WORKTREE_CARD_PROPERTY_ORDER: WorktreeCardProperty[] = [
'status',
'unread',
'ci',
'issue',
'linear-issue',
'pr',
'comment',
'ports',
'inline-agents'
]
export function normalizeWorktreeCardProperties(
properties: readonly WorktreeCardProperty[] | null | undefined
): WorktreeCardProperty[] {
const normalized = [...ALWAYS_VISIBLE_WORKTREE_CARD_PROPERTIES]
const normalized: WorktreeCardProperty[] = [...FIXED_WORKTREE_CARD_PROPERTIES]
const source = properties ?? DEFAULT_WORKTREE_CARD_PROPERTIES
for (const property of source) {
if (!normalized.includes(property)) {
for (const property of WORKTREE_CARD_PROPERTY_ORDER) {
if (source.includes(property) && !normalized.includes(property)) {
normalized.push(property)
}
}