GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(mobile): keep compact native workspace root sidebar pinned · pingdotgg/t3code@b8c0952

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/mobile/src
    • features/layout
      • AdaptiveWorkspaceLayout.tsx
    • lib
      • layout.test.ts
      • layout.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx‎

Copy file name to clipboardExpand all lines: apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
deriveLayout,
3939
type VerticalHinge,
4040
deriveWorkspacePaneLayout,
41+
isPrimarySidebarPinned,
4142
type FileInspectorPaneLayout,
4243
type Layout,
4344
type WorkspaceAuxiliaryPaneRole,
@@ -245,10 +246,6 @@ function AdaptiveWorkspaceLayoutContent(
245246
const navigation = useNavigation();
246247
const activeRoleOwner = useRef<symbol | null>(null);
247248
const [primarySidebarPreferredVisible, setPrimarySidebarPreferredVisible] = useState(true);
248-
// Native columns keep a sidebar toggle in the empty detail header, so only
249-
// the JS layout must pin the sidebar open on the workspace root.
250-
const primarySidebarPinned = pathname === "/" && !nativeWorkspace;
251-
const showPrimarySidebar = primarySidebarPinned || primarySidebarPreferredVisible;
252249
const [supplementaryPanePreferredVisible, setSupplementaryPanePreferredVisible] = useState(true);
253250
const [supplementaryPanePreferredWidth, setSupplementaryPanePreferredWidth] = useState<
254251
number | null
@@ -264,6 +261,12 @@ function AdaptiveWorkspaceLayoutContent(
264261
() => deriveLayout({ width: viewportWidth, height, nativeMetrics }),
265262
[height, viewportWidth, nativeMetrics],
266263
);
264+
const primarySidebarPinned = isPrimarySidebarPinned({
265+
pathname,
266+
nativeWorkspace,
267+
usesSplitView: baseLayout.usesSplitView,
268+
});
269+
const showPrimarySidebar = primarySidebarPinned || primarySidebarPreferredVisible;
267270
const shouldRenderNavigationRail = Platform.OS === "android" && baseLayout.usesSplitView;
268271
const navigationRailWidth =
269272
shouldRenderNavigationRail && showPrimarySidebar
Collapse file

‎apps/mobile/src/lib/layout.test.ts‎

Copy file name to clipboardExpand all lines: apps/mobile/src/lib/layout.test.ts
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
deriveThreadFeedInitialContentInset,
1010
deriveThreadWorkLogSizing,
1111
deriveWorkspacePaneLayout,
12+
isPrimarySidebarPinned,
1213
SPLIT_LAYOUT_MIN_HEIGHT,
1314
SPLIT_LAYOUT_MIN_WIDTH,
1415
} from "./layout";
@@ -161,6 +162,36 @@ describe("deriveLayout", () => {
161162
});
162163
});
163164

165+
describe("isPrimarySidebarPinned", () => {
166+
it("lets native split columns collapse the sidebar on the workspace root", () => {
167+
expect(
168+
isPrimarySidebarPinned({ pathname: "/", nativeWorkspace: true, usesSplitView: true }),
169+
).toBe(false);
170+
});
171+
172+
it("keeps compact native roots pinned so search cannot hide the sidebar for a later split", () => {
173+
expect(
174+
isPrimarySidebarPinned({ pathname: "/", nativeWorkspace: true, usesSplitView: false }),
175+
).toBe(true);
176+
});
177+
178+
it("keeps the JS split layout pinned on the workspace root", () => {
179+
expect(
180+
isPrimarySidebarPinned({ pathname: "/", nativeWorkspace: false, usesSplitView: true }),
181+
).toBe(true);
182+
});
183+
184+
it("never pins outside the workspace root", () => {
185+
expect(
186+
isPrimarySidebarPinned({
187+
pathname: "/threads/a/b",
188+
nativeWorkspace: false,
189+
usesSplitView: true,
190+
}),
191+
).toBe(false);
192+
});
193+
});
194+
164195
describe("deriveWorkspacePaneLayout", () => {
165196
it("keeps the auxiliary pane out of a standard iPad detail column", () => {
166197
const layout = deriveLayout({ width: 1_194, height: 834 });
Collapse file

‎apps/mobile/src/lib/layout.ts‎

Copy file name to clipboardExpand all lines: apps/mobile/src/lib/layout.ts
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,20 @@ export function alignListPaneToHinge(input: {
158158
return { ...layout, listPaneWidth, listPaneGap: hinge.width };
159159
}
160160

161+
/**
162+
* Whether the workspace root must keep the primary sidebar open. Native split
163+
* columns keep a sidebar toggle in the empty detail header, so only they may
164+
* collapse it there. Compact layouts stay pinned so a reveal request (such as
165+
* focusing search) cannot flip the saved preference for a later split view.
166+
*/
167+
export function isPrimarySidebarPinned(input: {
168+
readonly pathname: string;
169+
readonly nativeWorkspace: boolean;
170+
readonly usesSplitView: boolean;
171+
}): boolean {
172+
return input.pathname === "/" && !(input.nativeWorkspace && input.usesSplitView);
173+
}
174+
161175
export function deriveWorkspacePaneLayout(input: {
162176
readonly layout: Layout;
163177
readonly viewportWidth: number;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.