Skip to content

Commit 82ad5db

Browse files
committed
refactor: remove notepad functionality and introduce NoteView component
This commit removes the notepad functionality from the AppHeader and Layout components, streamlining the UI. It introduces a new NoteView component that encapsulates both the NoteList and NoteEditor, enhancing the organization of note-related features within the application.
1 parent d90be80 commit 82ad5db

File tree

3 files changed

+15
-51
lines changed

3 files changed

+15
-51
lines changed

src/components/layout/AppHeader.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
Notebook,
32
PanelRightOpen,
43
PanelRightClose,
54
PanelLeft,
@@ -55,15 +54,6 @@ export function AppHeader() {
5554
<PanelRightOpen className="w-4 h-4" />
5655
)}
5756
</Button>
58-
<Button
59-
variant={rightView === "notepad" ? "default" : "outline"}
60-
size="icon"
61-
onClick={() =>
62-
setRightView(rightView === "notepad" ? null : "notepad")
63-
}
64-
>
65-
<Notebook className="w-4 h-4" />
66-
</Button>
6757
<PublishCloudDialog />
6858
<UserDropdown />
6959
<AppMenu />

src/components/layout/index.tsx

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ import { AppSidebar } from "./AppSidebar";
44
import { Toaster } from "sonner";
55
import { useNavigationStore } from "@/stores/navigationStore";
66
import { PanelGroup, Panel, PanelResizeHandle } from "react-resizable-panels";
7-
import {
8-
ResizableHandle,
9-
ResizablePanel,
10-
ResizablePanelGroup,
11-
} from "@/components/ui/resizable";
127
import {
138
FileExplorerPanel,
149
McpPanel,
@@ -20,18 +15,16 @@ import AgentsView from "@/views/AgentsView";
2015
import { WebPreview } from "../WebPreview";
2116
import { useLayoutStore } from "@/stores";
2217
import { DiffViewer } from "../filetree/DiffViewer";
23-
import { NoteList, NoteEditor } from "../notes";
24-
import { useNoteStore } from "@/stores/useNoteStore";
2518
import LoginView from "@/views/LoginView";
2619
import { SkillsView } from "../skills/SkillsView";
2720
import { HomeView } from "@/views/HomeView";
21+
import { NoteView } from "@/views/NoteView";
2822

2923
export function Layout() {
3024
const { mainView, rightView, setRightView, setMainView } =
3125
useNavigationStore();
3226
const { webPreviewUrl, setWebPreviewUrl, diffFile, selectedFile } =
3327
useLayoutStore();
34-
const { showNoteList } = useNoteStore();
3528

3629
const handleTabChange = (view: string) => {
3730
setMainView(view as any);
@@ -77,7 +70,7 @@ export function Layout() {
7770
{mainView === "codex" && <ChatView />}
7871
{mainView === "agents-editor" && <AgentsView />}
7972
{mainView === "login" && <LoginView />}
80-
{mainView === "prompt" && <NoteList />}
73+
{mainView === "prompt" && <NoteView />}
8174
{mainView === "mcp" && <McpPanel />}
8275
{mainView === "skills" && <SkillsView />}
8376
{mainView === "usage" && <UsagePanel />}
@@ -98,38 +91,7 @@ export function Layout() {
9891
minSize={20}
9992
className="overflow-hidden"
10093
>
101-
{rightView === "notepad" ? (
102-
<ResizablePanelGroup
103-
direction="horizontal"
104-
className="h-full w-full overflow-hidden"
105-
>
106-
{showNoteList && (
107-
<>
108-
<ResizablePanel
109-
id="notepad-list"
110-
order={1}
111-
defaultSize={30}
112-
minSize={0}
113-
className="min-w-0 overflow-hidden"
114-
>
115-
<div className="h-full w-full overflow-auto">
116-
<NoteList />
117-
</div>
118-
</ResizablePanel>
119-
<ResizableHandle withHandle />
120-
</>
121-
)}
122-
<ResizablePanel
123-
id="notepad-editor"
124-
order={showNoteList ? 2 : 1}
125-
defaultSize={showNoteList ? 70 : 100}
126-
minSize={50}
127-
className="min-w-0 overflow-hidden"
128-
>
129-
<NoteEditor />
130-
</ResizablePanel>
131-
</ResizablePanelGroup>
132-
) : rightView === "webPreview" ? (
94+
{rightView === "webPreview" ? (
13395
<div className="h-full overflow-auto">
13496
<WebPreview
13597
url={webPreviewUrl || ""}

src/views/NoteView.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { NoteEditor, NoteList } from "@/components/notes";
2+
3+
export function NoteView() {
4+
return (
5+
<div className="flex h-full">
6+
<NoteList />
7+
<span className="w-full">
8+
<NoteEditor />
9+
</span>
10+
</div>
11+
);
12+
}

0 commit comments

Comments
 (0)