File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,6 +226,28 @@ export function sessionBarQuery(
226226// How many rows the session list fetches to fill its screen from.
227227export const SESSION_BAR_FETCH = 50
228228
229+ // The picker header's description of the bar's active filters — the answer to
230+ // "where are the rest of my sessions?". Mirrors sessionBarQuery exactly: a
231+ // clause appears here iff the matching filter went into the query. null when
232+ // the list is unfiltered.
233+ export function sessionBarFilterLabel (
234+ bar : {
235+ days : number
236+ repo : 'cwd' | 'any'
237+ statuses : 'all' | 'unfinished'
238+ sources : string [ ] | undefined
239+ } ,
240+ detectedRepo : string | null ,
241+ ) : string | null {
242+ const clauses : string [ ] = [ ]
243+ if ( bar . repo === 'cwd' && detectedRepo ) clauses . push ( detectedRepo )
244+ if ( bar . days > 0 ) clauses . push ( `last ${ bar . days === 1 ? 'day' : `${ bar . days } days` } ` )
245+ if ( bar . statuses === 'unfinished' ) clauses . push ( 'unfinished' )
246+ if ( bar . sources ) clauses . push ( `source ${ bar . sources . join ( '/' ) } ` )
247+ if ( clauses . length === 0 ) return null
248+ return `filtering to ${ clauses . join ( ' · ' ) } `
249+ }
250+
229251// Attention transitions: a session that WAS in flight and now waits for a
230252// human (waiting/sleeping/idle) deserves the sidebar dot. Pure step function
231253// over consecutive poll snapshots.
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import {
3535 rowMeta ,
3636 rowStatusWord ,
3737 navSlice ,
38+ sessionBarFilterLabel ,
3839 sessionBarQuery ,
3940 sessionSource ,
4041 SELECTION_GLYPH ,
@@ -494,6 +495,10 @@ export function SessionsApp(props: SessionsAppProps): React.ReactElement {
494495 const whoText = props . ghLogin
495496 ? `@${ props . ghLogin } in ${ customerLogin } `
496497 : customerLogin
498+ // Over the picker the right edge answers "why is this list short?" instead
499+ // of carrying the focused session's meta: the filters are why sessions are
500+ // missing, and the list is the one screen where that question comes up.
501+ const filterText = navOpen ? sessionBarFilterLabel ( sessionBar , props . detectedRepo ) : null
497502 const header = (
498503 // Unpainted, like every other surface: its own blank rows above and below
499504 // are what set the title apart, not a tint.
@@ -524,7 +529,7 @@ export function SessionsApp(props: SessionsAppProps): React.ReactElement {
524529 { /* Armed, the bar carries the ctrl+c prompt: the nav and the
525530 new-session form have no notice line of their own, and the
526531 header is the one band always on screen. */ }
527- { navArmed || paneArmed ? CTRL_C_QUIT_HINT : ( metaText ?? whoText ) }
532+ { navArmed || paneArmed ? CTRL_C_QUIT_HINT : ( filterText ?? metaText ?? whoText ) }
528533 </ Text >
529534 </ Box >
530535 </ Box >
You can’t perform that action at this time.
0 commit comments