Show repo icons on compact worktree cards (#5673)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Brennan Benson
2026-06-17 22:05:04 -07:00
committed by GitHub
co-authored by Orca
parent 752e20d64d
commit 4a3ec0232f
7 changed files with 107 additions and 116 deletions
@@ -4,8 +4,10 @@ import { translate } from '@/i18n/i18n'
import { searchKeywords, translateSearchKeyword } from './settings-search-keywords'
import { createLocalizedCatalog } from '@/i18n/localized-catalog'
import { getGeneralProjectRuntimeSearchEntries } from './general-project-runtime-search'
import { getGeneralSupportSearchEntries } from './general-support-search'
export { getGeneralEditorSearchEntries } from './general-editor-search'
export { getGeneralSupportSearchEntries } from './general-support-search'
export const getGeneralWorkspaceSearchEntries = createLocalizedCatalog(() => [
{
@@ -274,23 +276,6 @@ export const getGeneralAgentSearchEntries = createLocalizedCatalog(() => [
}
])
export const getGeneralSupportSearchEntries = createLocalizedCatalog(() => [
{
title: translate('auto.components.settings.general.search.36a72f0d9e', 'Star Orca on GitHub'),
description: translate(
'auto.components.settings.general.search.e0b8c8bc25',
'Support the project with a GitHub star via the gh CLI.'
),
keywords: [
...translateSearchKeyword('auto.components.settings.general.search.e4fb4516d0', 'star'),
...translateSearchKeyword('auto.components.settings.general.search.06ea5a69a6', 'github'),
...translateSearchKeyword('auto.components.settings.general.search.b65665703a', 'support'),
...translateSearchKeyword('auto.components.settings.general.search.e6b01c8e30', 'feedback'),
...translateSearchKeyword('auto.components.settings.general.search.bdfb6dc21b', 'like')
]
}
])
type GeneralPaneSearchOptions = {
includeProjectRuntime?: boolean
}
@@ -0,0 +1,20 @@
import { translate } from '@/i18n/i18n'
import { createLocalizedCatalog } from '@/i18n/localized-catalog'
import { translateSearchKeyword } from './settings-search-keywords'
export const getGeneralSupportSearchEntries = createLocalizedCatalog(() => [
{
title: translate('auto.components.settings.general.search.36a72f0d9e', 'Star Orca on GitHub'),
description: translate(
'auto.components.settings.general.search.e0b8c8bc25',
'Support the project with a GitHub star via the gh CLI.'
),
keywords: [
...translateSearchKeyword('auto.components.settings.general.search.e4fb4516d0', 'star'),
...translateSearchKeyword('auto.components.settings.general.search.06ea5a69a6', 'github'),
...translateSearchKeyword('auto.components.settings.general.search.b65665703a', 'support'),
...translateSearchKeyword('auto.components.settings.general.search.e6b01c8e30', 'feedback'),
...translateSearchKeyword('auto.components.settings.general.search.bdfb6dc21b', 'like')
]
}
])
@@ -1210,7 +1210,12 @@ const WorktreeCard = React.memo(function WorktreeCard({
{showInlineRepoBadge && (
<RepoIdentityChip repo={repo}>
<RepoBadgeMark color={repo.badgeColor} className="size-2 rounded-[2px]" />
<RepoIconGlyph
repoIcon={repo.repoIcon}
color={resolveRepoHeaderColor(repo.badgeColor)}
className="size-full"
iconClassName="size-3"
/>
</RepoIdentityChip>
)}
@@ -40,15 +40,14 @@ import type { AppMemory, UsageValues, Worktree } from '../../../../shared/types'
import { ORPHAN_WORKTREE_ID } from '../../../../shared/constants'
import { isFolderRepo } from '../../../../shared/repo-kind'
import { isWorkspaceOldForCleanup } from '../../../../shared/workspace-cleanup'
import {
mergeSnapshotAndSessions,
UNATTRIBUTED_REPO_ID,
type DaemonSession,
type Metric,
type UnifiedProjectGroup,
type UnifiedSessionRow,
type UnifiedWorktreeRow
} from './mergeSnapshotAndSessions'
import { mergeSnapshotAndSessions, UNATTRIBUTED_REPO_ID } from './mergeSnapshotAndSessions'
import type {
DaemonSession,
Metric,
UnifiedProjectGroup,
UnifiedSessionRow,
UnifiedWorktreeRow
} from './resource-usage-merge-types'
import { WorkspaceSpaceCompactPanel } from './WorkspaceSpaceCompactPanel'
import { STATUS_BAR_CONTEXT_MENU_EXEMPT_PROPS } from './status-bar-context-menu-policy'
import {
@@ -3,12 +3,8 @@
single-source view of how snapshot + daemon-session inputs combine. */
import { describe, expect, it } from 'vitest'
import type { MemorySnapshot, TerminalTab, WorktreeMemory } from '../../../../shared/types'
import {
mergeSnapshotAndSessions,
UNATTRIBUTED_REPO_ID,
type DaemonSession,
type MergeContext
} from './mergeSnapshotAndSessions'
import { mergeSnapshotAndSessions, UNATTRIBUTED_REPO_ID } from './mergeSnapshotAndSessions'
import type { DaemonSession, MergeContext } from './resource-usage-merge-types'
function emptyAppMemory() {
return {
@@ -1,8 +1,3 @@
/* eslint-disable max-lines -- Why: this module deliberately co-locates the
renderer-local view-model types, the merge function, and its supporting
string-manipulation helpers because they exist solely to feed the popover
in ResourceUsageStatusSegment.tsx. Splitting would scatter logic that has
exactly one consumer. See docs/resource-usage-merge-spec.md. */
/**
* Resource Manager popover merge helper.
*
@@ -22,90 +17,20 @@
* See docs/resource-usage-merge-spec.md for the full design.
*/
import type {
MemorySnapshot,
SessionMemory,
TerminalTab,
WorktreeMemory
} from '../../../../shared/types'
import type { MemorySnapshot, SessionMemory, WorktreeMemory } from '../../../../shared/types'
import { parsePtySessionId } from '../../../../shared/pty-session-id-format'
import { parsePaneKey as parseStablePaneKey } from '../../../../shared/stable-pane-id'
import {
getRepoIdFromWorktreeId,
getWorktreePathBasenameFromId
} from '../../../../shared/worktree-id'
// ─── View-model types (renderer-local) ──────────────────────────────
/** `null` === "no local sample" (e.g. SSH PTY); UI renders as em-dash. */
export type Metric = number | null
export type DaemonSession = {
id: string
cwd: string
title: string
}
export type UnifiedSessionRow = {
sessionId: string
paneKey: string | null
pid: number
label: string
bound: boolean
tabId: string | null
cpu: Metric
memory: Metric
hasLocalSamples: boolean
}
export type UnifiedWorktreeRow = {
worktreeId: string
worktreeName: string
repoId: string
repoName: string
cpu: Metric
memory: Metric
history: number[]
hasLocalSamples: boolean
/** Why: the chip in ResourceUsageStatusSegment now keys on this — the repo
* has an SSH connectionId — instead of `!hasLocalSamples`, which used to
* mislabel warm-reattached *local* PTYs as REMOTE. */
isRemote: boolean
sessions: UnifiedSessionRow[]
}
export type UnifiedProjectGroup = {
repoId: string
repoName: string
cpu: Metric
memory: Metric
/** Why: renamed in spirit but kept as `hasRemoteChildren` for callsite
* stability — the repo-level chip predicate is now "the repo's
* connectionId is non-null", which is the only way a repo can have
* remote children. */
hasRemoteChildren: boolean
worktrees: UnifiedWorktreeRow[]
}
// ─── Inputs that the renderer already has on hand ───────────────────
export type MergeContext = {
/** From useAppStore: maps tabId → worktreeId for tab-walk resolution. */
tabsByWorktree: Record<string, TerminalTab[]>
/** From useAppStore: maps tabId → ptyIds[] for the bound check. */
ptyIdsByTabId: Record<string, string[]>
/** From useAppStore: per-tab live pane titles (for label resolution). */
runtimePaneTitlesByTabId: Record<string, Record<number, string>>
/** From useAppStore: false until the renderer has booted enough state to
* trust the bound/orphan distinction. Mirrors the existing gate. */
workspaceSessionReady: boolean
/** Repo display names by repo id. Used for new groups synthesized from
* daemon sessions whose repo isn't in the snapshot (typical SSH case). */
repoDisplayNameById: Map<string, string>
/** Repo connectionId by repo id (null/missing == local). Drives the
* `· remote` chip predicate, decoupling label from data-coverage. */
repoConnectionIdById: Map<string, string | null>
}
import type {
DaemonSession,
MergeContext,
UnifiedProjectGroup,
UnifiedSessionRow,
UnifiedWorktreeRow
} from './resource-usage-merge-types'
// ─── Helpers ────────────────────────────────────────────────────────
@@ -0,0 +1,61 @@
import type { TerminalTab } from '../../../../shared/types'
/** `null` === "no local sample" (e.g. SSH PTY); UI renders as em-dash. */
export type Metric = number | null
export type DaemonSession = {
id: string
cwd: string
title: string
}
export type UnifiedSessionRow = {
sessionId: string
paneKey: string | null
pid: number
label: string
bound: boolean
tabId: string | null
cpu: Metric
memory: Metric
hasLocalSamples: boolean
}
export type UnifiedWorktreeRow = {
worktreeId: string
worktreeName: string
repoId: string
repoName: string
cpu: Metric
memory: Metric
history: number[]
hasLocalSamples: boolean
/** Why: repo connectionId, not sample presence, drives the remote chip. */
isRemote: boolean
sessions: UnifiedSessionRow[]
}
export type UnifiedProjectGroup = {
repoId: string
repoName: string
cpu: Metric
memory: Metric
/** Why: kept for callsite stability; this now means SSH-backed repo rows. */
hasRemoteChildren: boolean
worktrees: UnifiedWorktreeRow[]
}
export type MergeContext = {
/** From useAppStore: maps worktreeId -> tabs[] for tab-walk resolution. */
tabsByWorktree: Record<string, TerminalTab[]>
/** From useAppStore: maps tabId -> ptyIds[] for the bound check. */
ptyIdsByTabId: Record<string, string[]>
/** From useAppStore: per-tab live pane titles (for label resolution). */
runtimePaneTitlesByTabId: Record<string, Record<number, string>>
/** From useAppStore: false until renderer state can distinguish bound/orphan. */
workspaceSessionReady: boolean
/** Repo display names by repo id for daemon-only groups. */
repoDisplayNameById: Map<string, string>
/** Repo connectionId by repo id (null/missing == local). */
repoConnectionIdById: Map<string, string | null>
}