feat: add search button to FixedSidebarToggle and integrate onOpenSearch prop

This commit is contained in:
tusharmagar 2026-02-19 15:04:11 +05:30
parent b238089e2d
commit 73da27eec6

View file

@ -224,6 +224,7 @@ function FixedSidebarToggle({
canNavigateBack, canNavigateBack,
canNavigateForward, canNavigateForward,
onNewChat, onNewChat,
onOpenSearch,
leftInsetPx, leftInsetPx,
}: { }: {
onNavigateBack: () => void onNavigateBack: () => void
@ -231,6 +232,7 @@ function FixedSidebarToggle({
canNavigateBack: boolean canNavigateBack: boolean
canNavigateForward: boolean canNavigateForward: boolean
onNewChat: () => void onNewChat: () => void
onOpenSearch: () => void
leftInsetPx: number leftInsetPx: number
}) { }) {
const { toggleSidebar, state } = useSidebar() const { toggleSidebar, state } = useSidebar()
@ -257,6 +259,15 @@ function FixedSidebarToggle({
> >
<SquarePen className="size-5" /> <SquarePen className="size-5" />
</button> </button>
<button
type="button"
onClick={onOpenSearch}
className="flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors"
style={{ marginLeft: TITLEBAR_BUTTON_GAP_PX }}
aria-label="Search"
>
<SearchIcon className="size-5" />
</button>
{/* Back / Forward navigation */} {/* Back / Forward navigation */}
{isCollapsed && ( {isCollapsed && (
<> <>
@ -2769,14 +2780,6 @@ function App() {
onCloseTab={closeChatTab} onCloseTab={closeChatTab}
/> />
)} )}
<button
type="button"
onClick={() => setIsSearchOpen(true)}
className="titlebar-no-drag flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors"
aria-label="Search"
>
<SearchIcon className="size-4" />
</button>
{selectedPath && ( {selectedPath && (
<div className="flex items-center gap-1 text-xs text-muted-foreground self-center shrink-0 pl-2"> <div className="flex items-center gap-1 text-xs text-muted-foreground self-center shrink-0 pl-2">
{isSaving ? ( {isSaving ? (
@ -3078,6 +3081,7 @@ function App() {
canNavigateBack={canNavigateBack} canNavigateBack={canNavigateBack}
canNavigateForward={canNavigateForward} canNavigateForward={canNavigateForward}
onNewChat={handleNewChatTab} onNewChat={handleNewChatTab}
onOpenSearch={() => setIsSearchOpen(true)}
leftInsetPx={isMac ? MACOS_TRAFFIC_LIGHTS_RESERVED_PX : 0} leftInsetPx={isMac ? MACOS_TRAFFIC_LIGHTS_RESERVED_PX : 0}
/> />
</SidebarProvider> </SidebarProvider>