Skip to content

Commit 63dc402

Browse files
committed
somewhat working close &reopen
1 parent edd2875 commit 63dc402

File tree

1 file changed

+17
-33
lines changed

1 file changed

+17
-33
lines changed

src/components/MainPage.tsx

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const MainContent: React.FC = () => {
4343

4444
return (
4545
<div className="relative flex size-full overflow-hidden">
46-
{currentlyOpenFilePath && showEditor ? (
46+
{currentlyOpenFilePath && showEditor && (
4747
<div className="size-full overflow-hidden">
4848
<WindowControls
4949
onClose={() => setShowEditor(false)}
@@ -53,9 +53,6 @@ const MainContent: React.FC = () => {
5353
/>
5454
<EditorManager />
5555
</div>
56-
) : (
57-
// <EmptyPage />
58-
<></>
5956
)}
6057
<WritingAssistant />
6158
</div>
@@ -66,7 +63,7 @@ const MainPageContent: React.FC = () => {
6663
const [showSimilarFiles, setShowSimilarFiles] = useState(false)
6764
const { currentlyOpenFilePath } = useFileContext()
6865
const { showChatbot, setShowChatbot } = useChatContext()
69-
const { setShowEditor } = useContentContext()
66+
const { setShowEditor, showEditor } = useContentContext()
7067
const { getShortcutDescription } = useAppShortcuts()
7168

7269
return (
@@ -88,40 +85,27 @@ const MainPageContent: React.FC = () => {
8885

8986
<ResizablePanel defaultSize={80}>
9087
<div className="size-full">
91-
{currentlyOpenFilePath ? (
92-
<>
93-
{showChatbot ? (
94-
<ResizablePanelGroup direction="horizontal" className="size-full">
88+
{currentlyOpenFilePath || showChatbot ? (
89+
<ResizablePanelGroup direction="horizontal" className="size-full">
90+
{currentlyOpenFilePath && showEditor && (
91+
<>
9592
<ResizablePanel defaultSize={65}>
9693
<MainContent />
9794
</ResizablePanel>
9895
<ResizableHandle />
99-
<ResizablePanel defaultSize={35}>
100-
<div className="relative size-full bg-pink-200">
101-
<WindowControls
102-
onClose={() => {
103-
setShowChatbot(false)
104-
}}
105-
onMaximize={() => {
106-
setShowEditor(false)
107-
}}
108-
/>
109-
<ChatComponent />
110-
</div>
111-
</ResizablePanel>
112-
</ResizablePanelGroup>
113-
) : (
114-
<MainContent />
96+
</>
97+
)}
98+
{showChatbot && (
99+
<ResizablePanel defaultSize={currentlyOpenFilePath && showEditor ? 35 : 100}>
100+
<div className="relative size-full bg-pink-200">
101+
<WindowControls onClose={() => setShowChatbot(false)} onMaximize={() => setShowEditor(false)} />
102+
<ChatComponent />
103+
</div>
104+
</ResizablePanel>
115105
)}
116-
</>
117-
) : showChatbot ? (
118-
<div className="size-full bg-pink-200">
119-
<ChatComponent />
120-
</div>
106+
</ResizablePanelGroup>
121107
) : (
122-
<div className="size-full">
123-
<EmptyPage />
124-
</div>
108+
<EmptyPage />
125109
)}
126110
</div>
127111
</ResizablePanel>

0 commit comments

Comments
 (0)