@devries-cameron20 / t3code Mirror · read-only / commits / eda0cec923
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 10:15 UTC

refactor(mobile): remove unused layout calculations (#9974)

Julius Marminge committed Sep 5, 2026 at 00:09 UTC eda0cec92398a4097958b55accaa59fdd178a977
2 files changed -57
apps/mobile/src/lib/layout.test.ts
-19
@@ -2,11 +2,9 @@ import { describe, expect, it } from "vite-plus/test";
2
3 import {
4 constrainAuxiliaryPaneWidth,
5 - constrainPrimarySidebarWidth,
5 deriveCenteredContentHorizontalPadding,
6 deriveFileInspectorPaneLayout,
7 deriveLayout,
9 - deriveStableFormSheetDetent,
8 deriveThreadFeedInitialContentInset,
9 deriveThreadWorkLogSizing,
10 deriveWorkspacePaneLayout,
@@ -75,12 +73,6 @@ describe("deriveThreadFeedInitialContentInset", () => {
73 });
74
75 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 -
76 it("preserves a useful main pane while constraining a trailing pane", () => {
77 expect(constrainAuxiliaryPaneWidth({ preferredWidth: 440, availableWidth: 1_100 })).toBe(440);
78 expect(constrainAuxiliaryPaneWidth({ preferredWidth: 440, availableWidth: 900 })).toBe(340);
@@ -392,14 +384,3 @@ describe("deriveWorkspacePaneLayout", () => {
384 });
385 });
386 });
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
-38
@@ -16,7 +16,6 @@ export const SPLIT_LAYOUT_MIN_WIDTH = 720;
16 export const SPLIT_LAYOUT_MIN_HEIGHT = 600;
17
18 export const SPLIT_SIDEBAR_MIN_WIDTH = 280;
19 -export const SPLIT_SIDEBAR_MAX_WIDTH = 460;
19 const SPLIT_SIDEBAR_DEFAULT_MAX_WIDTH = 380;
20
21 export const AUXILIARY_PANE_MIN_CONTENT_WIDTH = 960;
@@ -50,10 +49,6 @@ export const AUXILIARY_PANE_MAX_WIDTH = 480;
49 const AUXILIARY_PANE_DEFAULT_MAX_WIDTH = 320;
50 const FILE_INSPECTOR_MIN_VIEWPORT_WIDTH = 820;
51 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;
52
53 export type LayoutVariant = "compact" | "split";
54
@@ -218,22 +213,6 @@ export function deriveFileInspectorPaneLayout(input: {
213 };
214 }
215
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 -
216 /**
217 * Keep an auxiliary pane within native-feeling bounds without squeezing its
218 * neighboring content below a usable reading/editor width.
@@ -275,20 +254,3 @@ export function deriveCenteredContentHorizontalPadding(input: {
254
255 return minimumPadding + Math.max(0, (viewportWidth - input.maxContentWidth) / 2);
256 }
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 -}