Skip to content

Commit c5f0526

Browse files
committed
polish: update TopBar and navigation integration
- Refactor TopBar component - Update navigation integration with new panel system - Layout adjustments for panel features
1 parent 27211de commit c5f0526

File tree

4 files changed

+74
-65
lines changed

4 files changed

+74
-65
lines changed

src/renderer/App.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import { MainLayout } from "@components/MainLayout";
2-
import { DragDropProvider } from "@dnd-kit/react";
32
import { AuthScreen } from "@features/auth/components/AuthScreen";
43
import { useAuthStore } from "@features/auth/stores/authStore";
5-
import { useDragDropHandlers } from "@features/panels";
64
import { Flex, Spinner, Text } from "@radix-ui/themes";
75
import { initializePostHog } from "@renderer/lib/analytics";
86
import { useEffect, useState } from "react";
97

108
function App() {
119
const { isAuthenticated, initializeOAuth } = useAuthStore();
1210
const [isLoading, setIsLoading] = useState(true);
13-
const dragDropHandlers = useDragDropHandlers();
1411

1512
// Initialize PostHog analytics
1613
useEffect(() => {
@@ -32,9 +29,7 @@ function App() {
3229
);
3330
}
3431

35-
const content = isAuthenticated ? <MainLayout /> : <AuthScreen />;
36-
37-
return <DragDropProvider {...dragDropHandlers}>{content}</DragDropProvider>;
32+
return isAuthenticated ? <MainLayout /> : <AuthScreen />;
3833
}
3934

4035
export default App;

src/renderer/components/MainLayout.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MainSidebar } from "@components/MainSidebar";
2-
import { TopBar } from "@components/ui/topnav/TopBar";
32
import { StatusBar } from "@components/StatusBar";
43
import { UpdatePrompt } from "@components/UpdatePrompt";
4+
import { TopBar } from "@components/ui/topnav/TopBar";
55
import { CommandMenu } from "@features/command/components/CommandMenu";
66
import { SettingsView } from "@features/settings/components/SettingsView";
77
import { TaskDetail } from "@features/task-detail/components/TaskDetail";
@@ -17,8 +17,14 @@ import { Toaster } from "sonner";
1717

1818
export function MainLayout() {
1919
const { setCliMode } = useLayoutStore();
20-
const { view, toggleSettings, navigateToTaskList, navigateToTask, goBack, goForward } =
21-
useNavigationStore();
20+
const {
21+
view,
22+
toggleSettings,
23+
navigateToTaskList,
24+
navigateToTask,
25+
goBack,
26+
goForward,
27+
} = useNavigationStore();
2228
useIntegrations();
2329
const [commandMenuOpen, setCommandMenuOpen] = useState(false);
2430

Lines changed: 63 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,69 @@
1-
import { Box, Flex, IconButton, TextField } from '@radix-ui/themes'
2-
import { ChevronLeftIcon, ChevronRightIcon, MagnifyingGlassIcon, GearIcon } from '@radix-ui/react-icons'
3-
import { useNavigationStore } from '@stores/navigationStore'
1+
import {
2+
ChevronLeftIcon,
3+
ChevronRightIcon,
4+
GearIcon,
5+
MagnifyingGlassIcon,
6+
} from "@radix-ui/react-icons";
7+
import { Box, Flex, IconButton, TextField } from "@radix-ui/themes";
8+
import { useNavigationStore } from "@stores/navigationStore";
49

510
interface TopBarProps {
6-
onSearchClick?: () => void
11+
onSearchClick?: () => void;
712
}
813

914
export const TopBar = ({ onSearchClick }: TopBarProps) => {
10-
const { goBack, goForward, canGoBack, canGoForward, toggleSettings } = useNavigationStore()
15+
const { goBack, goForward, canGoBack, canGoForward, toggleSettings } =
16+
useNavigationStore();
1117

12-
return (
13-
<Flex className="w-full h-10 border-b border-gray-6" align="center" justify="between" px="2" gap="3">
14-
<Flex gap="1" className="flex-shrink-0 ml-20">
15-
<IconButton
16-
size="1"
17-
variant="ghost"
18-
onClick={goBack}
19-
disabled={!canGoBack()}
20-
className={canGoBack() ? 'cursor-pointer' : 'cursor-not-allowed'}
21-
>
22-
<ChevronLeftIcon />
23-
</IconButton>
24-
<IconButton
25-
size="1"
26-
variant="ghost"
27-
onClick={goForward}
28-
disabled={!canGoForward()}
29-
className={canGoForward() ? 'cursor-pointer' : 'cursor-not-allowed'}
30-
>
31-
<ChevronRightIcon />
32-
</IconButton>
33-
</Flex>
34-
<Box className="flex-1 max-w-[500px]">
35-
<TextField.Root
36-
size="1"
37-
placeholder="Search..."
38-
onClick={onSearchClick}
39-
className="cursor-pointer"
40-
readOnly
41-
>
42-
<TextField.Slot>
43-
<MagnifyingGlassIcon height="14" width="14" />
44-
</TextField.Slot>
45-
<TextField.Slot>
46-
<Box className="text-xs text-gray-10">⌘P</Box>
47-
</TextField.Slot>
48-
</TextField.Root>
49-
</Box>
50-
<Flex gap="1">
51-
<IconButton
52-
size="1"
53-
variant="ghost"
54-
onClick={toggleSettings}
55-
>
56-
<GearIcon />
57-
</IconButton>
58-
</Flex>
59-
</Flex>
60-
)
61-
}
18+
return (
19+
<Flex
20+
className="h-10 min-h-10 w-full border-gray-6 border-b"
21+
align="center"
22+
justify="between"
23+
px="2"
24+
gap="3"
25+
>
26+
<Flex gap="1" className="ml-20 flex-shrink-0">
27+
<IconButton
28+
size="1"
29+
variant="ghost"
30+
onClick={goBack}
31+
disabled={!canGoBack()}
32+
className={canGoBack() ? "cursor-pointer" : "cursor-not-allowed"}
33+
>
34+
<ChevronLeftIcon />
35+
</IconButton>
36+
<IconButton
37+
size="1"
38+
variant="ghost"
39+
onClick={goForward}
40+
disabled={!canGoForward()}
41+
className={canGoForward() ? "cursor-pointer" : "cursor-not-allowed"}
42+
>
43+
<ChevronRightIcon />
44+
</IconButton>
45+
</Flex>
46+
<Box className="max-w-[500px] flex-1">
47+
<TextField.Root
48+
size="1"
49+
placeholder="Search..."
50+
onClick={onSearchClick}
51+
className="cursor-pointer"
52+
readOnly
53+
>
54+
<TextField.Slot>
55+
<MagnifyingGlassIcon height="14" width="14" />
56+
</TextField.Slot>
57+
<TextField.Slot>
58+
<Box className="text-gray-10 text-xs">⌘P</Box>
59+
</TextField.Slot>
60+
</TextField.Root>
61+
</Box>
62+
<Flex gap="1">
63+
<IconButton size="1" variant="ghost" onClick={toggleSettings}>
64+
<GearIcon />
65+
</IconButton>
66+
</Flex>
67+
</Flex>
68+
);
69+
};

src/renderer/stores/navigationStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { track } from "@renderer/lib/analytics";
12
import type { Task } from "@shared/types";
23
import { create } from "zustand";
3-
import { track } from "@renderer/lib/analytics";
44
import { ANALYTICS_EVENTS } from "@/types/analytics";
55

66
type ViewType = "task-list" | "task-detail" | "settings";

0 commit comments

Comments
 (0)