@@ -283,9 +283,13 @@ const SidebarContext = (props: {
283283 ) ,
284284 )
285285
286- const blocks = createMemo ( ( ) => snapshot ( ) . persisted . activeBlocks )
287- const topicTotal = createMemo ( ( ) => snapshot ( ) . persisted . activeBlockTopicTotal )
288- const topicOverflow = createMemo ( ( ) => topicTotal ( ) - blocks ( ) . length )
286+ const TOPIC_LIMIT = 3
287+ const allBlocks = createMemo ( ( ) => snapshot ( ) . persisted . activeBlocks )
288+ const [ topicsExpanded , setTopicsExpanded ] = createSignal ( false )
289+ const blocks = createMemo ( ( ) =>
290+ topicsExpanded ( ) ? allBlocks ( ) : allBlocks ( ) . slice ( 0 , TOPIC_LIMIT ) ,
291+ )
292+ const topicOverflow = createMemo ( ( ) => allBlocks ( ) . length - TOPIC_LIMIT )
289293
290294 const navigateToSummary = ( block : DcpActiveBlockInfo ) => {
291295 props . api . route . navigate ( props . names . routes . summary , {
@@ -419,12 +423,20 @@ const SidebarContext = (props: {
419423 < box flexDirection = "row" width = "100%" height = { 1 } >
420424 < box flexGrow = { 1 } flexShrink = { 1 } height = { 1 } >
421425 < text { ...DIM_TEXT } fg = { props . palette . muted } >
422- ... { topicOverflow ( ) } more topics
426+ { topicsExpanded ( )
427+ ? `showing all ${ allBlocks ( ) . length } topics`
428+ : `... ${ topicOverflow ( ) } more topics` }
423429 </ text >
424430 </ box >
425431 < box flexShrink = { 0 } height = { 1 } paddingLeft = { 1 } >
426- < box backgroundColor = { props . palette . base } height = { 1 } >
427- < text fg = { props . palette . accent } > ▼ </ text >
432+ < box
433+ backgroundColor = { props . palette . base }
434+ height = { 1 }
435+ onMouseUp = { ( ) => setTopicsExpanded ( ! topicsExpanded ( ) ) }
436+ >
437+ < text fg = { props . palette . accent } >
438+ { topicsExpanded ( ) ? " ▲ " : " ▼ " }
439+ </ text >
428440 </ box >
429441 </ box >
430442 </ box >
0 commit comments