MCPcopy Create free account
hub / github.com/codeaashu/claude-code / calculateLayoutDimensions

Function calculateLayoutDimensions

src/utils/logoV2Utils.ts:43–75  ·  view source on GitHub ↗
(
  columns: number,
  layoutMode: LayoutMode,
  optimalLeftWidth: number,
)

Source from the content-addressed store, hash-verified

41 * Calculates layout dimensions for the LogoV2 component
42 */
43export function calculateLayoutDimensions(
44 columns: number,
45 layoutMode: LayoutMode,
46 optimalLeftWidth: number,
47): LayoutDimensions {
48 if (layoutMode === 'horizontal') {
49 const leftWidth = optimalLeftWidth
50 const usedSpace =
51 BORDER_PADDING + CONTENT_PADDING + DIVIDER_WIDTH + leftWidth
52 const availableForRight = columns - usedSpace
53
54 let rightWidth = Math.max(30, availableForRight)
55 const totalWidth = Math.min(
56 leftWidth + rightWidth + DIVIDER_WIDTH + CONTENT_PADDING,
57 columns - BORDER_PADDING,
58 )
59
60 // Recalculate right width if we had to cap the total
61 if (totalWidth < leftWidth + rightWidth + DIVIDER_WIDTH + CONTENT_PADDING) {
62 rightWidth = totalWidth - leftWidth - DIVIDER_WIDTH - CONTENT_PADDING
63 }
64
65 return { leftWidth, rightWidth, totalWidth }
66 }
67
68 // Vertical mode
69 const totalWidth = Math.min(columns - BORDER_PADDING, MAX_LEFT_WIDTH + 20)
70 return {
71 leftWidth: totalWidth,
72 rightWidth: totalWidth,
73 totalWidth,
74 }
75}
76
77/**
78 * Calculates optimal left panel width based on content

Callers 1

LogoV2Function · 0.85

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected