Skip to content

Commit 18d766d

Browse files
Sync public snapshot from freebuff-private
Source: CodebuffAI/freebuff-private@a02e88d6972e9beb2a580fee9147e3dcb49f5dfe
1 parent 36d4602 commit 18d766d

3 files changed

Lines changed: 42 additions & 7 deletions

File tree

bun.lock

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/src/components/freebuff-model-selector.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useKeyboard } from '@opentui/react'
33
import React, {
44
useCallback,
55
useEffect,
6+
useLayoutEffect,
67
useMemo,
78
useRef,
89
useState,
@@ -97,10 +98,15 @@ interface FreebuffModelSelectorProps {
9798
* this, the list scrolls (scrollbar shown, focused row kept in view);
9899
* otherwise the scrollbox shrinks to fit and no scrollbar appears. */
99100
maxHeight: number
101+
/** Notifies the parent whenever the picker expands/collapses. The waiting-room
102+
* screen uses it to promote the wordmark to the full ASCII logo while the
103+
* picker is collapsed (the freed rows make room). */
104+
onExpandedChange?: (expanded: boolean) => void
100105
}
101106

102107
export const FreebuffModelSelector: React.FC<FreebuffModelSelectorProps> = ({
103108
maxHeight,
109+
onExpandedChange,
104110
}) => {
105111
const theme = useTheme()
106112
// contentMaxWidth (not terminalWidth) is the real budget — the parent
@@ -146,6 +152,12 @@ export const FreebuffModelSelector: React.FC<FreebuffModelSelectorProps> = ({
146152
() =>
147153
!canCollapse || !isLanding || selectedModel !== recommendedModel.id,
148154
)
155+
// Mirror the expanded state up to the waiting-room screen (collapsed → it
156+
// promotes the wordmark to the full ASCII logo). useLayoutEffect so the
157+
// parent's logo decision settles before paint, both on mount and on toggle.
158+
useLayoutEffect(() => {
159+
onExpandedChange?.(expanded)
160+
}, [expanded, onExpandedChange])
149161

150162
// Keyboard cursor — separate from the actually-selected model so that
151163
// Tab/arrow navigation can preview without committing. Starts on the user's

cli/src/components/waiting-room-screen.tsx

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,27 @@ export const WaitingRoomScreen: React.FC<WaitingRoomScreenProps> = ({
329329
// height we show the compact wordmark so more models fit without scrolling.
330330
// Section headers always show — the picker scrolls within whatever rows
331331
// remain (see selectorMaxHeight below), so there's no need to hide them.
332-
const logoMode: 'full' | 'text' | 'none' =
333-
terminalHeight >= 40 ? 'full' : terminalHeight >= 20 ? 'text' : 'none'
332+
//
333+
// Exception: when the picker is collapsed it shrinks to ~5 rows, freeing the
334+
// ~6 rows the big logo needs. So on a mid-height window with a collapsed
335+
// picker we promote the wordmark back to the full ASCII logo — it fills what
336+
// would otherwise be dead space above the card. Expanding the list reclaims
337+
// those rows and drops back to the wordmark. 26 is the smallest window where
338+
// the logo block, heading, collapsed picker, streak, and ad all coexist
339+
// without the picker needing to scroll.
340+
//
341+
// The picker (rendered below) owns this and reports it via onExpandedChange;
342+
// we default to collapsed so the first paint reserves logo space correctly.
343+
const [selectorExpanded, setSelectorExpanded] = useState(false)
344+
const COLLAPSED_LOGO_MIN_HEIGHT = 26
345+
const fullLogoFits =
346+
terminalHeight >= 40 ||
347+
(!selectorExpanded && terminalHeight >= COLLAPSED_LOGO_MIN_HEIGHT)
348+
const logoMode: 'full' | 'text' | 'none' = fullLogoFits
349+
? 'full'
350+
: terminalHeight >= 20
351+
? 'text'
352+
: 'none'
334353
const compact = terminalHeight < 22
335354
const showAds = terminalHeight >= 18
336355
const textMarginBottom = 1
@@ -615,7 +634,10 @@ export const WaitingRoomScreen: React.FC<WaitingRoomScreenProps> = ({
615634
{LANDING_HEADING}
616635
</span>
617636
</text>
618-
<FreebuffModelSelector maxHeight={selectorMaxHeight} />
637+
<FreebuffModelSelector
638+
maxHeight={selectorMaxHeight}
639+
onExpandedChange={setSelectorExpanded}
640+
/>
619641
{showSessionCounter && (
620642
<text
621643
style={{
@@ -666,7 +688,10 @@ export const WaitingRoomScreen: React.FC<WaitingRoomScreenProps> = ({
666688
>
667689
{queuedTitleText}
668690
</text>
669-
<FreebuffModelSelector maxHeight={selectorMaxHeight} />
691+
<FreebuffModelSelector
692+
maxHeight={selectorMaxHeight}
693+
onExpandedChange={setSelectorExpanded}
694+
/>
670695
{limitedModeNotice && (
671696
<text
672697
style={{ fg: theme.muted, wrapMode: 'word', marginTop: 1 }}

0 commit comments

Comments
 (0)