Skip to content

Commit d77b111

Browse files
Update desktop navigation chrome and search (#779)
Co-authored-by: Cursor <[email protected]>
1 parent 5ee2cd0 commit d77b111

36 files changed

Lines changed: 1239 additions & 989 deletions

‎bin/pnpm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.pnpm-11.1.3.pkg
1+
.pnpm-11.4.0.pkg

‎desktop/src/app/AppShell.tsx‎

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ChevronLeft, ChevronRight } from "lucide-react";
21
import * as React from "react";
32
import { getCurrentWindow } from "@tauri-apps/api/window";
43
import { useQueryClient } from "@tanstack/react-query";
@@ -9,6 +8,7 @@ import {
98
AppShellOverlays,
109
type BrowseDialogType,
1110
} from "@/app/AppShellOverlays";
11+
import { AppTopChrome } from "@/app/AppTopChrome";
1212
import { useAppNavigation } from "@/app/navigation/useAppNavigation";
1313
import { useBackForwardControls } from "@/app/navigation/useBackForwardControls";
1414
import { useMarkAsReadShortcuts } from "@/app/useMarkAsReadShortcuts";
@@ -62,12 +62,7 @@ import type { Channel, RelayEvent, SearchHit } from "@/shared/api/types";
6262
import { ChannelNavigationProvider } from "@/shared/context/ChannelNavigationContext";
6363
import { hasPrimaryShortcutModifier } from "@/shared/lib/platform";
6464
import { useMessageDeepLinks } from "@/shared/useMessageDeepLinks";
65-
import { Button } from "@/shared/ui/button";
66-
import {
67-
SidebarInset,
68-
SidebarProvider,
69-
SidebarTrigger,
70-
} from "@/shared/ui/sidebar";
65+
import { SidebarInset, SidebarProvider } from "@/shared/ui/sidebar";
7166

7267
type AppView =
7368
| "home"
@@ -174,7 +169,7 @@ export function AppShell() {
174169

175170
const [isChannelManagementOpen, setIsChannelManagementOpen] =
176171
React.useState(false);
177-
const [isSearchOpen, setIsSearchOpen] = React.useState(false);
172+
const [searchFocusRequest, setSearchFocusRequest] = React.useState(0);
178173
const [browseDialogType, setBrowseDialogType] =
179174
React.useState<BrowseDialogType>(null);
180175
const [isNewDmOpen, setIsNewDmOpen] = React.useState(false);
@@ -365,7 +360,7 @@ export function AppShell() {
365360
void refetchChannels();
366361
}, [refetchChannels]);
367362
const handleOpenSearch = React.useCallback(() => {
368-
setIsSearchOpen(true);
363+
setSearchFocusRequest((request) => request + 1);
369364
void refetchChannels();
370365
}, [refetchChannels]);
371366

@@ -400,7 +395,6 @@ export function AppShell() {
400395

401396
const handleOpenSettings = React.useCallback(
402397
(section: SettingsSection = DEFAULT_SETTINGS_SECTION) => {
403-
setIsSearchOpen(false);
404398
setIsChannelManagementOpen(false);
405399
setSettingsSection(section);
406400
setSettingsOpen(true);
@@ -659,36 +653,19 @@ export function AppShell() {
659653
<HuddleProvider>
660654
<div className="flex h-dvh flex-col overflow-hidden overscroll-none">
661655
<SidebarProvider className="min-h-0 flex-1 overflow-hidden">
662-
<div
663-
aria-hidden="true"
664-
className="fixed inset-x-0 top-0 z-20 h-10 cursor-default select-none"
665-
data-tauri-drag-region
656+
<AppTopChrome
657+
canGoBack={canGoBack}
658+
canGoForward={canGoForward}
659+
channels={channels}
660+
currentPubkey={identityQuery.data?.pubkey}
661+
onGoBack={goBack}
662+
onGoForward={goForward}
663+
onOpenChannel={(channelId) => {
664+
void goChannel(channelId);
665+
}}
666+
onOpenResult={handleOpenSearchResult}
667+
searchFocusRequest={searchFocusRequest}
666668
/>
667-
<div className="fixed left-[80px] top-[9px] z-50 flex items-center gap-0.5">
668-
<SidebarTrigger className="h-[22px] w-[22px] text-muted-foreground/70 hover:bg-muted/60 hover:text-foreground" />
669-
<Button
670-
aria-label="Go back"
671-
className="h-[22px] w-[22px] text-muted-foreground/70 hover:bg-muted/60 hover:text-foreground"
672-
data-testid="global-back"
673-
disabled={!canGoBack}
674-
onClick={goBack}
675-
size="icon"
676-
variant="ghost"
677-
>
678-
<ChevronLeft className="h-3 w-3" />
679-
</Button>
680-
<Button
681-
aria-label="Go forward"
682-
className="h-[22px] w-[22px] text-muted-foreground/70 hover:bg-muted/60 hover:text-foreground"
683-
data-testid="global-forward"
684-
disabled={!canGoForward}
685-
onClick={goForward}
686-
size="icon"
687-
variant="ghost"
688-
>
689-
<ChevronRight className="h-3 w-3" />
690-
</Button>
691-
</div>
692669
<AppSidebar
693670
activeWorkspace={workspacesHook.activeWorkspace}
694671
channels={sidebarChannels}
@@ -770,7 +747,6 @@ export function AppShell() {
770747
});
771748
await goChannel(directMessage.id);
772749
}}
773-
onOpenSearch={handleOpenSearch}
774750
onSelectAgents={() => {
775751
void goAgents();
776752
}}
@@ -821,16 +797,13 @@ export function AppShell() {
821797
channels={channels}
822798
currentPubkey={identityQuery.data?.pubkey}
823799
isChannelManagementOpen={isChannelManagementOpen}
824-
isSearchOpen={isSearchOpen}
825800
onBrowseChannelJoin={handleBrowseChannelJoin}
826801
onBrowseDialogOpenChange={handleBrowseDialogOpenChange}
827802
onChannelManagementOpenChange={setIsChannelManagementOpen}
828803
onDeleteActiveChannel={() => {
829804
setIsChannelManagementOpen(false);
830805
void goHome({ replace: true });
831806
}}
832-
onOpenSearchResult={handleOpenSearchResult}
833-
onSearchOpenChange={setIsSearchOpen}
834807
onSelectChannel={(channelId) => {
835808
void goChannel(channelId);
836809
}}

‎desktop/src/app/AppShellOverlays.tsx‎

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from "react";
22

3-
import type { Channel, SearchHit } from "@/shared/api/types";
3+
import type { Channel } from "@/shared/api/types";
44

55
const ChannelBrowserDialog = React.lazy(async () => {
66
const module = await import("@/features/channels/ui/ChannelBrowserDialog");
@@ -12,11 +12,6 @@ const ChannelManagementSheet = React.lazy(async () => {
1212
return { default: module.ChannelManagementSheet };
1313
});
1414

15-
const SearchDialog = React.lazy(async () => {
16-
const module = await import("@/features/search/ui/SearchDialog");
17-
return { default: module.SearchDialog };
18-
});
19-
2015
export type BrowseDialogType = "stream" | "forum" | null;
2116

2217
type AppShellOverlaysProps = {
@@ -25,13 +20,10 @@ type AppShellOverlaysProps = {
2520
channels: Channel[];
2621
currentPubkey?: string;
2722
isChannelManagementOpen: boolean;
28-
isSearchOpen: boolean;
2923
onBrowseChannelJoin: (channelId: string) => Promise<void>;
3024
onBrowseDialogOpenChange: (open: boolean) => void;
3125
onChannelManagementOpenChange: (open: boolean) => void;
3226
onDeleteActiveChannel: () => void;
33-
onOpenSearchResult: (hit: SearchHit) => void;
34-
onSearchOpenChange: (open: boolean) => void;
3527
onSelectChannel: (channelId: string) => void;
3628
};
3729

@@ -41,13 +33,10 @@ export function AppShellOverlays({
4133
channels,
4234
currentPubkey,
4335
isChannelManagementOpen,
44-
isSearchOpen,
4536
onBrowseChannelJoin,
4637
onBrowseDialogOpenChange,
4738
onChannelManagementOpenChange,
4839
onDeleteActiveChannel,
49-
onOpenSearchResult,
50-
onSearchOpenChange,
5140
onSelectChannel,
5241
}: AppShellOverlaysProps) {
5342
return (
@@ -65,19 +54,6 @@ export function AppShellOverlays({
6554
</React.Suspense>
6655
) : null}
6756

68-
{isSearchOpen ? (
69-
<React.Suspense fallback={null}>
70-
<SearchDialog
71-
channels={channels}
72-
currentPubkey={currentPubkey}
73-
onOpenChannel={onSelectChannel}
74-
onOpenResult={onOpenSearchResult}
75-
onOpenChange={onSearchOpenChange}
76-
open={true}
77-
/>
78-
</React.Suspense>
79-
) : null}
80-
8157
{isChannelManagementOpen && activeChannel !== null ? (
8258
<React.Suspense fallback={null}>
8359
<ChannelManagementSheet

‎desktop/src/app/AppTopChrome.tsx‎

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { ChevronLeft, ChevronRight } from "lucide-react";
2+
3+
import { TopbarSearch } from "@/features/search/ui/TopbarSearch";
4+
import type { Channel, SearchHit } from "@/shared/api/types";
5+
import { Button } from "@/shared/ui/button";
6+
import { SidebarTrigger, useSidebar } from "@/shared/ui/sidebar";
7+
8+
type AppTopChromeProps = {
9+
canGoBack: boolean;
10+
canGoForward: boolean;
11+
channels: Channel[];
12+
currentPubkey?: string;
13+
onGoBack: () => void;
14+
onGoForward: () => void;
15+
onOpenChannel: (channelId: string) => void;
16+
onOpenResult: (hit: SearchHit) => void;
17+
searchFocusRequest: number;
18+
};
19+
20+
function GlobalTopDivider() {
21+
const { state } = useSidebar();
22+
23+
return (
24+
<div
25+
aria-hidden="true"
26+
className="pointer-events-none fixed right-0 top-10 z-50 h-px bg-border/35"
27+
style={{ left: state === "expanded" ? "var(--sidebar-width)" : 0 }}
28+
/>
29+
);
30+
}
31+
32+
export function AppTopChrome({
33+
canGoBack,
34+
canGoForward,
35+
channels,
36+
currentPubkey,
37+
onGoBack,
38+
onGoForward,
39+
onOpenChannel,
40+
onOpenResult,
41+
searchFocusRequest,
42+
}: AppTopChromeProps) {
43+
return (
44+
<>
45+
<div
46+
aria-hidden="true"
47+
className="fixed inset-x-0 top-0 z-20 h-10 cursor-default select-none"
48+
data-tauri-drag-region
49+
/>
50+
<GlobalTopDivider />
51+
<div className="fixed left-[80px] top-[9px] z-[80] flex items-center gap-0.5">
52+
<SidebarTrigger className="h-[22px] w-[22px] text-muted-foreground/70 hover:bg-muted/60 hover:text-foreground" />
53+
<Button
54+
aria-label="Go back"
55+
className="h-[22px] w-[22px] text-muted-foreground/70 hover:bg-muted/60 hover:text-foreground"
56+
data-testid="global-back"
57+
disabled={!canGoBack}
58+
onClick={onGoBack}
59+
size="icon"
60+
variant="ghost"
61+
>
62+
<ChevronLeft className="h-3 w-3" />
63+
</Button>
64+
<Button
65+
aria-label="Go forward"
66+
className="h-[22px] w-[22px] text-muted-foreground/70 hover:bg-muted/60 hover:text-foreground"
67+
data-testid="global-forward"
68+
disabled={!canGoForward}
69+
onClick={onGoForward}
70+
size="icon"
71+
variant="ghost"
72+
>
73+
<ChevronRight className="h-3 w-3" />
74+
</Button>
75+
</div>
76+
<TopbarSearch
77+
channels={channels}
78+
className="fixed left-1/2 top-[7px] z-[80] hidden w-[300px] max-w-[34vw] -translate-x-1/2 md:block lg:w-[360px] lg:max-w-[38vw] xl:w-[420px] xl:max-w-[42vw] 2xl:w-[480px] 2xl:max-w-[44vw]"
79+
currentPubkey={currentPubkey}
80+
focusRequest={searchFocusRequest}
81+
onOpenChannel={onOpenChannel}
82+
onOpenResult={onOpenResult}
83+
/>
84+
</>
85+
);
86+
}

‎desktop/src/app/routes/index.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ function HomeRouteComponent() {
2020
<HomeScreen
2121
availableChannelIds={availableChannelIds}
2222
currentPubkey={identityQuery.data?.pubkey}
23+
onOpenChannel={(channelId) => {
24+
void goChannel(channelId);
25+
}}
2326
onOpenContext={(channelId, messageId) => {
2427
void goChannel(channelId, { messageId });
2528
}}
Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from "react";
22

3-
import { ChatHeader } from "@/features/chat/ui/ChatHeader";
43
import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback";
54

65
const AgentsView = React.lazy(async () => {
@@ -10,19 +9,10 @@ const AgentsView = React.lazy(async () => {
109

1110
export function AgentsScreen() {
1211
return (
13-
<>
14-
<ChatHeader
15-
description="Choose personas from Persona Catalog, create local ACP workers, and monitor the relay-visible agent directory."
16-
mode="agents"
17-
overlaysContent
18-
title="Agents"
19-
/>
20-
21-
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
22-
<React.Suspense fallback={<ViewLoadingFallback kind="agents" />}>
23-
<AgentsView />
24-
</React.Suspense>
25-
</div>
26-
</>
12+
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
13+
<React.Suspense fallback={<ViewLoadingFallback kind="agents" />}>
14+
<AgentsView />
15+
</React.Suspense>
16+
</div>
2717
);
2818
}

‎desktop/src/features/channels/ui/AgentSessionThreadPanel.tsx‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ export function AgentSessionThreadPanel({
6868
<>
6969
{isOverlay && <OverlayPanelBackdrop onClose={onClose} />}
7070
<aside
71-
className={cn(
72-
PANEL_BASE_CLASS,
73-
!isOverlay && "pt-11",
74-
isOverlay && PANEL_OVERLAY_CLASS,
75-
)}
71+
className={cn(PANEL_BASE_CLASS, isOverlay && PANEL_OVERLAY_CLASS)}
7672
data-testid="agent-session-thread-panel"
7773
style={{ width: `${widthPx}px` }}
7874
>
@@ -94,7 +90,22 @@ export function AgentSessionThreadPanel({
9490
</button>
9591
)}
9692

97-
<div className="flex items-center gap-3 border-b border-border/70 px-4 py-2.5">
93+
{!isOverlay ? (
94+
<div
95+
aria-hidden="true"
96+
className="pointer-events-none absolute inset-x-0 top-0 z-40 h-[76px] bg-background/45 backdrop-blur-xl after:absolute after:bottom-0 after:left-0 after:top-10 after:w-px after:bg-border/80 supports-[backdrop-filter]:bg-background/35"
97+
/>
98+
) : null}
99+
100+
<div
101+
className={cn(
102+
"z-50 flex cursor-default select-none items-center gap-3 px-4",
103+
isOverlay
104+
? "relative min-h-[44px] shrink-0 border-b border-border/70 bg-background/70 py-2.5 backdrop-blur-xl supports-[backdrop-filter]:bg-background/55"
105+
: "absolute inset-x-0 top-11 min-h-[32px] py-[4px]",
106+
)}
107+
data-tauri-drag-region
108+
>
98109
<Bot className="h-4 w-4 shrink-0 text-muted-foreground" />
99110
<div className="min-w-0 flex-1">
100111
<h2 className="truncate text-sm font-semibold tracking-tight">
@@ -157,7 +168,10 @@ export function AgentSessionThreadPanel({
157168
<div
158169
ref={scrollRef}
159170
onScroll={onScroll}
160-
className="min-h-0 flex-1 overflow-y-auto px-3 py-4"
171+
className={cn(
172+
"min-h-0 flex-1 overflow-y-auto px-3 pb-4",
173+
isOverlay ? "pt-4" : "pt-[76px]",
174+
)}
161175
>
162176
<ManagedAgentSessionPanel
163177
agent={agent}

0 commit comments

Comments
 (0)