Skip to content

Commit 55c1bd0

Browse files
committed
fix(web): align workspace footer git status
1 parent b758b9c commit 55c1bd0

4 files changed

Lines changed: 53 additions & 5 deletions

File tree

packages/web/src/features/workspace/views/shared/git-panel-status-strip.test.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ describe("GitPanelStatusStrip", () => {
6161
fireEvent.mouseEnter(branchButton!);
6262

6363
expect(screen.getByRole("tooltip")).toHaveTextContent("feature/tooltip-migration");
64+
expect(branchButton).toHaveTextContent("feature/tooltip-migration");
65+
expect(branchButton).not.toHaveTextContent("↑2");
66+
expect(branchButton).not.toHaveTextContent("↓1");
6467
});
6568

6669
it("opens the desktop branch quick pick from ArrowDown without changing the button semantics", async () => {
@@ -135,4 +138,33 @@ describe("GitPanelStatusStrip", () => {
135138
expect(input).toHaveFocus();
136139
});
137140
});
141+
142+
it("uses start alignment for desktop footer status strips when requested", () => {
143+
const store = createStore();
144+
store.set(localeAtom, "en");
145+
146+
const { container } = render(
147+
<Provider store={store}>
148+
<GitPanelStatusStrip
149+
align="start"
150+
workspaceId="ws-1"
151+
gitState={{
152+
branch: "develop",
153+
ahead: 2,
154+
behind: 1,
155+
staged: [],
156+
modified: [],
157+
deleted: [],
158+
untracked: [],
159+
}}
160+
onOpenBranchSwitcher={vi.fn()}
161+
/>
162+
</Provider>
163+
);
164+
165+
expect(container.querySelector(".git-panel-status-strip")).toHaveClass(
166+
"git-panel-status-strip",
167+
"git-panel-status-strip--start"
168+
);
169+
});
138170
});

packages/web/src/features/workspace/views/shared/git-panel-status-strip.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ interface GitPanelStatusStripProps {
1111
workspaceId: string;
1212
gitState: GitStatus | null | undefined;
1313
onOpenBranchSwitcher?: () => void;
14+
align?: "start" | "end";
1415
}
1516

1617
interface BranchTriggerProps {
@@ -50,10 +51,7 @@ function BranchTrigger({
5051
disabled={disabled}
5152
>
5253
<GitBranch size={11} />
53-
<span className="git-panel-status-strip__branch-text">
54-
{branchName}
55-
{branchSummary ? ` · ${branchSummary}` : ""}
56-
</span>
54+
<span className="git-panel-status-strip__branch-text">{branchName}</span>
5755
</button>
5856
</Tooltip>
5957
);
@@ -63,6 +61,7 @@ export function GitPanelStatusStrip({
6361
workspaceId,
6462
gitState,
6563
onOpenBranchSwitcher,
64+
align = "end",
6665
}: GitPanelStatusStripProps) {
6766
const t = useTranslation();
6867
const viewport = useViewport();
@@ -88,7 +87,7 @@ export function GitPanelStatusStrip({
8887
);
8988

9089
return (
91-
<div className="git-panel-status-strip">
90+
<div className={`git-panel-status-strip git-panel-status-strip--${align}`}>
9291
{viewport === "desktop" && onOpenBranchSwitcher ? (
9392
<DesktopBranchQuickPickPopover
9493
workspaceId={workspaceId}

packages/web/src/features/workspace/views/shared/workspace-status-bar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export function WorkspaceStatusBar({
1717
return (
1818
<div className={`workspace-status-bar${flush ? " workspace-status-bar--flush" : ""}`}>
1919
<GitPanelStatusStrip
20+
align={flush ? "end" : "start"}
2021
workspaceId={workspaceId}
2122
gitState={gitState}
2223
onOpenBranchSwitcher={onOpenBranchSwitcher}

packages/web/src/styles/components.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10170,6 +10170,22 @@ textarea.input {
1017010170
margin-left: auto;
1017110171
}
1017210172

10173+
.git-panel-status-strip--start {
10174+
justify-content: flex-start;
10175+
}
10176+
10177+
.git-panel-status-strip--start .git-panel-status-strip__meta {
10178+
margin-left: 0;
10179+
}
10180+
10181+
.git-panel-status-strip--end {
10182+
justify-content: space-between;
10183+
}
10184+
10185+
.git-panel-status-strip--end .git-panel-status-strip__meta {
10186+
margin-left: auto;
10187+
}
10188+
1017310189
.git-panel-status-strip .git-status-bar {
1017410190
gap: 4px;
1017510191
}

0 commit comments

Comments
 (0)