Skip to content

Commit 01a1d53

Browse files
refactor(mobile): remove unused layout calculations
1 parent d2c3e2e commit 01a1d53

2 files changed

Lines changed: 0 additions & 57 deletions

File tree

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import { describe, expect, it } from "vite-plus/test";
22

33
import {
44
constrainAuxiliaryPaneWidth,
5-
constrainPrimarySidebarWidth,
65
deriveCenteredContentHorizontalPadding,
76
deriveFileInspectorPaneLayout,
87
deriveLayout,
9-
deriveStableFormSheetDetent,
108
deriveThreadFeedInitialContentInset,
119
deriveThreadWorkLogSizing,
1210
deriveWorkspacePaneLayout,
@@ -75,12 +73,6 @@ describe("deriveThreadFeedInitialContentInset", () => {
7573
});
7674

7775
describe("resizable pane constraints", () => {
78-
it("keeps a preferred sidebar width across large windows and clamps it in a narrow split view", () => {
79-
expect(constrainPrimarySidebarWidth(430, 1_366)).toBe(430);
80-
expect(constrainPrimarySidebarWidth(430, 744)).toBe(384);
81-
expect(constrainPrimarySidebarWidth(100, 1_366)).toBe(280);
82-
});
83-
8476
it("preserves a useful main pane while constraining a trailing pane", () => {
8577
expect(constrainAuxiliaryPaneWidth({ preferredWidth: 440, availableWidth: 1_100 })).toBe(440);
8678
expect(constrainAuxiliaryPaneWidth({ preferredWidth: 440, availableWidth: 900 })).toBe(340);
@@ -392,14 +384,3 @@ describe("deriveWorkspacePaneLayout", () => {
392384
});
393385
});
394386
});
395-
396-
describe("deriveStableFormSheetDetent", () => {
397-
it.each([
398-
{ height: 1_194, expected: 0.62 },
399-
{ height: 834, expected: 0.863 },
400-
{ height: 600, expected: 0.893 },
401-
{ height: 0, expected: 0.92 },
402-
])("derives a stable sheet detent for height $height", ({ height, expected }) => {
403-
expect(deriveStableFormSheetDetent(height)).toBe(expected);
404-
});
405-
});

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

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export const SPLIT_LAYOUT_MIN_WIDTH = 720;
1616
export const SPLIT_LAYOUT_MIN_HEIGHT = 600;
1717

1818
export const SPLIT_SIDEBAR_MIN_WIDTH = 280;
19-
export const SPLIT_SIDEBAR_MAX_WIDTH = 460;
2019
const SPLIT_SIDEBAR_DEFAULT_MAX_WIDTH = 380;
2120

2221
export const AUXILIARY_PANE_MIN_CONTENT_WIDTH = 960;
@@ -50,10 +49,6 @@ export const AUXILIARY_PANE_MAX_WIDTH = 480;
5049
const AUXILIARY_PANE_DEFAULT_MAX_WIDTH = 320;
5150
const FILE_INSPECTOR_MIN_VIEWPORT_WIDTH = 820;
5251
const FILE_INSPECTOR_MIN_MAIN_WIDTH = 560;
53-
const STABLE_FORM_SHEET_MAX_HEIGHT = 720;
54-
const STABLE_FORM_SHEET_VERTICAL_MARGIN = 64;
55-
const STABLE_FORM_SHEET_MIN_DETENT = 0.62;
56-
const STABLE_FORM_SHEET_MAX_DETENT = 0.92;
5752

5853
export type LayoutVariant = "compact" | "split";
5954

@@ -218,22 +213,6 @@ export function deriveFileInspectorPaneLayout(input: {
218213
};
219214
}
220215

221-
/** Keep a user-selected sidebar width useful as a window is resized. */
222-
export function constrainPrimarySidebarWidth(
223-
preferredWidth: number,
224-
viewportWidth = Number.POSITIVE_INFINITY,
225-
): number {
226-
const safeWidth = Number.isFinite(preferredWidth) ? preferredWidth : SPLIT_SIDEBAR_MIN_WIDTH;
227-
const viewportMax = Number.isFinite(viewportWidth)
228-
? Math.max(SPLIT_SIDEBAR_MIN_WIDTH, viewportWidth - 360)
229-
: SPLIT_SIDEBAR_MAX_WIDTH;
230-
return clamp(
231-
Math.round(safeWidth),
232-
SPLIT_SIDEBAR_MIN_WIDTH,
233-
Math.min(SPLIT_SIDEBAR_MAX_WIDTH, viewportMax),
234-
);
235-
}
236-
237216
/**
238217
* Keep an auxiliary pane within native-feeling bounds without squeezing its
239218
* neighboring content below a usable reading/editor width.
@@ -275,20 +254,3 @@ export function deriveCenteredContentHorizontalPadding(input: {
275254

276255
return minimumPadding + Math.max(0, (viewportWidth - input.maxContentWidth) / 2);
277256
}
278-
279-
export function deriveStableFormSheetDetent(containerHeight: number): number {
280-
if (!Number.isFinite(containerHeight) || containerHeight <= 0) {
281-
return STABLE_FORM_SHEET_MAX_DETENT;
282-
}
283-
284-
const targetHeight = Math.min(
285-
STABLE_FORM_SHEET_MAX_HEIGHT,
286-
Math.max(0, containerHeight - STABLE_FORM_SHEET_VERTICAL_MARGIN),
287-
);
288-
const detent = clamp(
289-
targetHeight / containerHeight,
290-
STABLE_FORM_SHEET_MIN_DETENT,
291-
STABLE_FORM_SHEET_MAX_DETENT,
292-
);
293-
return Math.round(detent * 1_000) / 1_000;
294-
}

0 commit comments

Comments
 (0)