1- import {
2- ChevronDown ,
3- ChevronsDownUp ,
4- ChevronsUpDown ,
5- MessageCircleQuestion ,
6- Pause ,
7- Plus ,
8- } from "lucide-react" ;
1+ import { ChevronDown , ChevronsDownUp , ChevronsUpDown , Pause , Plus } from "lucide-react" ;
92import { memo , useCallback , useState } from "react" ;
103import { createPortal } from "react-dom" ;
114import { useShallow } from "zustand/react/shallow" ;
@@ -14,7 +7,6 @@ import { when } from "../../lib/format";
147import type { Activity , Bot , Crew } from "../../lib/protocol.gen" ;
158import { activityOf , botsOf , crewList } from "../../store/app" ;
169import { useApp } from "../../store/context" ;
17- import { openQuestions } from "../../store/questions" ;
1810import { isUnread , unreadIn } from "../../store/seen" ;
1911import { Button } from "../../ui/Button" ;
2012import { ContextMenu , menuPoint , type Point } from "../../ui/ContextMenu" ;
@@ -27,13 +19,14 @@ import { ChiefBadge, isChief } from "../bots/ChiefBadge";
2719import { toolAction , toolTitle } from "../chat/toolNames" ;
2820import { CrewDialog } from "./CrewDialog" ;
2921import { setAllCollapsed , setCollapsed , useCollapsed , useCollapsedSet } from "./collapsed" ;
22+ import { QuestionsEntry , row , SearchEntry } from "./SidebarPages" ;
3023
3124/** Crews as sections and their bots as conversations (spec 15.1). */
3225export function Sidebar ( ) {
3326 const t = useT ( ) ;
3427 const words = t . crews . sidebar ;
3528 const crews = useApp ( useShallow ( crewList ) ) ;
36- const overview = useApp ( ( state ) => state . selectedCrewId === null && ! state . questionBox ) ;
29+ const overview = useApp ( ( state ) => state . selectedCrewId === null && ! state . page ) ;
3730 const selectCrew = useApp ( ( state ) => state . selectCrew ) ;
3831 const collapsed = useCollapsedSet ( ) ;
3932 const allFolded = crews . length > 0 && crews . every ( ( crew ) => collapsed . has ( crew . id ) ) ;
@@ -68,6 +61,7 @@ export function Sidebar() {
6861 onClick = { ( ) => setCreating ( true ) }
6962 />
7063 </ div >
64+ < SearchEntry />
7165 < QuestionsEntry />
7266 < ul className = "min-h-0 flex-1 overflow-y-auto px-2 pb-3" >
7367 { crews . map ( ( crew ) => (
@@ -81,42 +75,6 @@ export function Sidebar() {
8175 ) ;
8276}
8377
84- const row =
85- "relative flex w-full items-center rounded-lg text-left transition-colors duration-150 hover:bg-sunken" ;
86-
87- /** The question box (spec 23.6), with how many questions wait. */
88- function QuestionsEntry ( ) {
89- const t = useT ( ) ;
90- const words = t . questions . box ;
91- const count = useApp ( ( state ) => openQuestions ( state ) . length ) ;
92- const open = useApp ( ( state ) => state . questionBox ) ;
93- const openBox = useApp ( ( state ) => state . openQuestionBox ) ;
94- return (
95- < div className = "shrink-0 px-2" >
96- < button
97- type = "button"
98- aria-current = { open ? "page" : undefined }
99- title = { words . open ( count ) }
100- onClick = { openBox }
101- className = { `${ row } gap-2.5 px-2.5 py-1.5 text-sm ${ open ? "bg-sunken text-ink" : "text-ink-soft" } ` }
102- >
103- < MessageCircleQuestion
104- aria-hidden
105- size = { 16 }
106- className = { count > 0 ? "text-warn" : "text-muted" }
107- />
108- < span className = "min-w-0 flex-1 truncate font-medium" > { words . label } </ span >
109- { count > 0 && (
110- < span className = "grid h-[18px] min-w-[18px] place-items-center rounded-full bg-warn px-1 font-semibold text-[11px] text-canvas tabular-nums" >
111- < span aria-hidden > { count } </ span >
112- < span className = "sr-only" > { words . open ( count ) } </ span >
113- </ span >
114- ) }
115- </ button >
116- </ div >
117- ) ;
118- }
119-
12078function CrewEntry ( { crew } : { crew : Crew } ) {
12179 const t = useT ( ) ;
12280 const bots = useApp ( useShallow ( ( state ) => botsOf ( state , crew . id ) ) ) ;
0 commit comments