From 206582aa7447464a0d70baa5e26e0f6a71819829 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 10 Nov 2026 22:23:43 -0800 Subject: [PATCH] fix(sidebar): no branch line that only repeats the name, any card style (JA-13) --- .../default-workspace-card-host-row.test.tsx | 21 ++++++++++++------- .../template/default-workspace-card.json | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/components/sidebar/workspace-card/template/default-workspace-card-host-row.test.tsx b/src/renderer/src/components/sidebar/workspace-card/template/default-workspace-card-host-row.test.tsx index e2cb5cf1de9..bbd20ec8304 100644 --- a/src/renderer/src/components/sidebar/workspace-card/template/default-workspace-card-host-row.test.tsx +++ b/src/renderer/src/components/sidebar/workspace-card/template/default-workspace-card-host-row.test.tsx @@ -11,18 +11,18 @@ const probe = compileCardTemplate( defs: undefined, root: { el: 'Probe', - props: { host: '=vars.hostLabel', identity: '=vars.identityInMeta' } + props: { host: '=vars.hostLabel', identity: '=vars.identityInMeta', branch: '=vars.branch' } } }, { ...CARD_PRIMITIVES, - Probe: cardElement(['host', 'identity'], (props) => ( - {`${String(props.host)}|${String(props.identity)}`} + Probe: cardElement(['host', 'identity', 'branch'], (props) => ( + {`${String(props.host)}|${String(props.identity)}|${String(props.branch)}`} )) } ) -function facts(host: { kind: string; contextLabel: string | null }, title: string) { +function facts(host: { kind: string; contextLabel: string | null }, title: string, style = 'new') { return { ws: { id: 'w', @@ -54,7 +54,7 @@ function facts(host: { kind: string; contextLabel: string | null }, title: strin deleteQuickAction: false }, options: { - style: 'new', + style, show: { host: true, branch: true, @@ -88,10 +88,17 @@ describe('default workspace card host row (JA-13)', () => { it('does not repeat the name as the branch line', () => { expect(read(facts({ kind: 'runtime', contextLabel: 'Orca Cloud' }, 'ja-hello'))).toContain( - '|false' + '|false|' ) expect(read(facts({ kind: 'runtime', contextLabel: 'Orca Cloud' }, 'Fix login'))).toContain( - '|true' + '|true|' ) }) + + it('classic cards drop the branch line when it is the name too', () => { + const classic = (title: string): string => + read(facts({ kind: 'runtime', contextLabel: 'Orca Cloud' }, title, 'classic')) + expect(classic('ja-hello')).toMatch(/\|false<\/i>$/) + expect(classic('Fix login')).toMatch(/\|true<\/i>$/) + }) }) diff --git a/src/renderer/src/components/sidebar/workspace-card/template/default-workspace-card.json b/src/renderer/src/components/sidebar/workspace-card/template/default-workspace-card.json index 35568a74f6f..611c827c480 100644 --- a/src/renderer/src/components/sidebar/workspace-card/template/default-workspace-card.json +++ b/src/renderer/src/components/sidebar/workspace-card/template/default-workspace-card.json @@ -13,7 +13,7 @@ "hostBadge": "vars.hostLabel != null && (!vars.compact || place.showProjectName)", "metaRow": "!vars.compact", "detachedInMeta": "vars.metaRow && !vars.folder && ws.detachedHead", - "branch": "!vars.folder && len(ws.branch) > 0 && !vars.newStyle && (!vars.compact || ws.branch != ws.name)", + "branch": "!vars.folder && len(ws.branch) > 0 && !vars.newStyle && ws.branch != ws.name && ws.branch != trim(ws.title)", "identityInMeta": "vars.newStyle && options.show.branch && ws.identity != null && ws.identity != trim(ws.title)", "folderInMeta": "vars.newStyle ? options.show.branch && vars.folder && ws.identity != null : vars.folder", "conflict": "git.conflictOperation == 'cherry-pick'",