MCPcopy Create free account
hub / github.com/Noumena-Network/code / calculateLayoutDimensions

Function calculateLayoutDimensions

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

Source from the content-addressed store, hash-verified

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

Callers 1

LogoV2Function · 0.85

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected