({ context, diagnosticsPromise }: Props)
| 99 | } |
| 100 | |
| 101 | export function Status({ context, diagnosticsPromise }: Props): React.ReactNode { |
| 102 | const mainLoopModel = useAppState(s => s.mainLoopModel); |
| 103 | const mcp = useAppState(s => s.mcp); |
| 104 | const [theme] = useTheme(); |
| 105 | |
| 106 | // Sections are synchronous — compute in render so they're never empty. |
| 107 | // diagnosticsPromise is created once in Settings.tsx so it resolves once |
| 108 | // per pane invocation instead of re-fetching on every tab switch (Tab |
| 109 | // unmounts children when not selected, which was causing the flash). |
| 110 | const sections = React.useMemo( |
| 111 | () => [buildPrimarySection(), buildSecondarySection({ mainLoopModel, mcp, theme, context })], |
| 112 | [mainLoopModel, mcp, theme, context], |
| 113 | ); |
| 114 | |
| 115 | // flexGrow so the "Esc to cancel" footer pins to the bottom of the |
| 116 | // Modal's inner ScrollBox when content is short. The ScrollBox content |
| 117 | // wrapper has flexGrow:1 (fills at least the viewport), so this stretches |
| 118 | // to match. Without it, short Status content floats at the top and the |
| 119 | // footer sits mid-modal with 2-3 trailing blank rows below. Outside a |
| 120 | // Modal (non-fullscreen), leave layout alone — no ScrollBox to fill. |
| 121 | const grow = useIsInsideModal() ? 1 : undefined; |
| 122 | |
| 123 | return ( |
| 124 | <Box flexDirection="column" flexGrow={grow}> |
| 125 | <Box flexDirection="column" gap={1} flexGrow={grow}> |
| 126 | {sections.map( |
| 127 | (properties, i) => |
| 128 | properties.length > 0 && ( |
| 129 | <Box key={i} flexDirection="column"> |
| 130 | {properties.map(({ label, value }, j) => ( |
| 131 | <Box key={j} flexDirection="row" gap={1} flexShrink={0}> |
| 132 | {label !== undefined && <Text bold>{label}:</Text>} |
| 133 | <PropertyValue value={value} /> |
| 134 | </Box> |
| 135 | ))} |
| 136 | </Box> |
| 137 | ), |
| 138 | )} |
| 139 | |
| 140 | <Suspense fallback={null}> |
| 141 | <Diagnostics promise={diagnosticsPromise} /> |
| 142 | </Suspense> |
| 143 | </Box> |
| 144 | <Text dimColor> |
| 145 | <ConfigurableShortcutHint action="confirm:no" context="Settings" fallback="Esc" description="cancel" /> |
| 146 | </Text> |
| 147 | </Box> |
| 148 | ); |
| 149 | } |
| 150 | |
| 151 | function Diagnostics({ promise }: { promise: Promise<Diagnostic[]> }): React.ReactNode { |
| 152 | const diagnostics = use(promise); |
nothing calls this directly
no test coverage detected