@@ -2,16 +2,46 @@ import { getFreebuffModel } from '@codebuff/common/constants/freebuff-models'
22import { TextAttributes } from '@opentui/core'
33import React , { useEffect , useState } from 'react'
44
5+ import { Button } from './button'
56import { ScrollToBottomButton } from './scroll-to-bottom-button'
67import { ShimmerText } from './shimmer-text'
7- import { StopButton } from './stop-button'
8+
89import { useFreebuffSessionProgress } from '../hooks/use-freebuff-session-progress'
910import { useTheme } from '../hooks/use-theme'
1011import { formatElapsedTime } from '../utils/format-elapsed-time'
1112
1213import type { FreebuffSessionResponse } from '../types/freebuff-session'
1314import type { StatusIndicatorState } from '../utils/status-indicator-state'
1415
16+ /** A small status-bar action button with hover-bold styling. */
17+ const StatusActionButton = ( {
18+ children,
19+ onClick,
20+ } : {
21+ children : React . ReactNode
22+ onClick : ( ) => void
23+ } ) => {
24+ const theme = useTheme ( )
25+ const [ hovered , setHovered ] = useState ( false )
26+
27+ return (
28+ < Button
29+ style = { { paddingLeft : 1 , paddingRight : 1 } }
30+ onClick = { onClick }
31+ onMouseOver = { ( ) => setHovered ( true ) }
32+ onMouseOut = { ( ) => setHovered ( false ) }
33+ >
34+ < text >
35+ < span
36+ fg = { theme . secondary }
37+ attributes = { hovered ? TextAttributes . BOLD : TextAttributes . NONE }
38+ >
39+ { children }
40+ </ span >
41+ </ text >
42+ </ Button >
43+ )
44+ }
1545
1646const SHIMMER_INTERVAL_MS = 160
1747
@@ -42,6 +72,7 @@ interface StatusBarProps {
4272 scrollToLatest : ( ) => void
4373 statusIndicatorState : StatusIndicatorState
4474 onStop ?: ( ) => void
75+ onEndSession ?: ( ) => void
4576 freebuffSession : FreebuffSessionResponse | null
4677}
4778
@@ -51,6 +82,7 @@ export const StatusBar = ({
5182 scrollToLatest,
5283 statusIndicatorState,
5384 onStop,
85+ onEndSession,
5486 freebuffSession,
5587} : StatusBarProps ) => {
5688 const theme = useTheme ( )
@@ -229,7 +261,10 @@ export const StatusBar = ({
229261 >
230262 < text style = { { wrapMode : 'none' } } > { elapsedTimeContent } </ text >
231263 { onStop && ( statusIndicatorState . kind === 'waiting' || statusIndicatorState . kind === 'streaming' ) && (
232- < StopButton onClick = { onStop } />
264+ < StatusActionButton onClick = { onStop } > ■ Esc</ StatusActionButton >
265+ ) }
266+ { onEndSession && statusIndicatorState . kind === 'idle' && freebuffSession ?. status === 'active' && (
267+ < StatusActionButton onClick = { onEndSession } > ✕ End session</ StatusActionButton >
233268 ) }
234269 { sessionProgress !== null &&
235270 sessionProgress . remainingMs < COUNTDOWN_VISIBLE_MS &&
0 commit comments