@devries-cameron20 / t3code Mirror · read-only
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 21, 03:37 UTC

main
ts 26 lines 932 Bytes
Raw
1 // Keep the native drawing inset out of the visible size and edge margins.
2 export const FLOATING_TABS = { edge: 16, bottom: 6, gap: 12, shadow: 8 };
3
4 export function floatingTabsMetrics(
5 count: number,
6 scale: number,
7 fabSize: number,
8 paneWidth?: number,
9 fillWidth = false,
10 ) {
11 const unit = Math.max(1, scale);
12 const spacing = 2 * FLOATING_TABS.edge + FLOATING_TABS.gap;
13 // Share width evenly when space is tight, retaining Android's 48dp touch target.
14 const height =
15 paneWidth === undefined
16 ? fabSize
17 : Math.max(48, Math.min(fabSize, (paneWidth - spacing) / (count + 1)));
18 const beside = spacing + height;
19 const room = paneWidth === undefined ? count * 60 * unit : paneWidth - beside;
20 return {
21 // Reserve the compose slot even while its button is hidden.
22 pill: Math.max(0, fillWidth ? room : Math.min(count * 72 * unit, room)),
23 height,
24 row: beside + count * 60 * unit,
25 };
26 }