fix(ui): align workspace switcher with sidebar entries

This commit is contained in:
dadachann
2026-07-26 00:23:17 +08:00
parent baf7e86335
commit 276791e7af
2 changed files with 7 additions and 3 deletions
@@ -1916,7 +1916,7 @@ export default function HomeSidebar({
</SidebarHeader> </SidebarHeader>
<div className="px-2 group-data-[collapsible=icon]:px-0"> <div className="px-2 group-data-[collapsible=icon]:px-0">
<WorkspaceSwitcher className="mx-auto w-4/5 group-data-[collapsible=icon]:min-w-0 group-data-[collapsible=icon]:px-2" /> <WorkspaceSwitcher className="w-full group-data-[collapsible=icon]:min-w-0 group-data-[collapsible=icon]:px-2" />
</div> </div>
{/* Navigation items grouped by section */} {/* Navigation items grouped by section */}
@@ -94,10 +94,14 @@ test('moves Cloud plan upgrades into Workspace Settings', () => {
assert.ok(toolbarEnd < membersHeading && membersHeading < cloudInvite); assert.ok(toolbarEnd < membersHeading && membersHeading < cloudInvite);
}); });
test('fills 80 percent of the sidebar, centers the trigger, and truncates long names', () => { test('aligns the workspace trigger with navigation entries on both sides and truncates long names', () => {
assert.match( assert.match(
homeSidebarSource, homeSidebarSource,
/<WorkspaceSwitcher className="mx-auto w-4\/5/, /<div className="px-2[^>]*>[\s\S]*<WorkspaceSwitcher className="w-full/,
);
assert.doesNotMatch(
homeSidebarSource,
/WorkspaceSwitcher className="[^"]*w-4\/5/,
); );
assert.match(workspaceSwitcherSource, /h-9/); assert.match(workspaceSwitcherSource, /h-9/);
assert.match(workspaceSwitcherSource, /w-64/); assert.match(workspaceSwitcherSource, /w-64/);