Skip to content

Commit

Permalink
somewhat working close &reopen
Browse files Browse the repository at this point in the history
  • Loading branch information
samlhuillier committed Nov 2, 2024
1 parent edd2875 commit 63dc402
Showing 1 changed file with 17 additions and 33 deletions.
50 changes: 17 additions & 33 deletions src/components/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const MainContent: React.FC = () => {

return (
<div className="relative flex size-full overflow-hidden">
{currentlyOpenFilePath && showEditor ? (
{currentlyOpenFilePath && showEditor && (
<div className="size-full overflow-hidden">
<WindowControls
onClose={() => setShowEditor(false)}
Expand All @@ -53,9 +53,6 @@ const MainContent: React.FC = () => {
/>
<EditorManager />
</div>
) : (
// <EmptyPage />
<></>
)}
<WritingAssistant />
</div>
Expand All @@ -66,7 +63,7 @@ const MainPageContent: React.FC = () => {
const [showSimilarFiles, setShowSimilarFiles] = useState(false)
const { currentlyOpenFilePath } = useFileContext()
const { showChatbot, setShowChatbot } = useChatContext()
const { setShowEditor } = useContentContext()
const { setShowEditor, showEditor } = useContentContext()
const { getShortcutDescription } = useAppShortcuts()

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

<ResizablePanel defaultSize={80}>
<div className="size-full">
{currentlyOpenFilePath ? (
<>
{showChatbot ? (
<ResizablePanelGroup direction="horizontal" className="size-full">
{currentlyOpenFilePath || showChatbot ? (
<ResizablePanelGroup direction="horizontal" className="size-full">
{currentlyOpenFilePath && showEditor && (
<>
<ResizablePanel defaultSize={65}>
<MainContent />
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={35}>
<div className="relative size-full bg-pink-200">
<WindowControls
onClose={() => {
setShowChatbot(false)
}}
onMaximize={() => {
setShowEditor(false)
}}
/>
<ChatComponent />
</div>
</ResizablePanel>
</ResizablePanelGroup>
) : (
<MainContent />
</>
)}
{showChatbot && (
<ResizablePanel defaultSize={currentlyOpenFilePath && showEditor ? 35 : 100}>
<div className="relative size-full bg-pink-200">
<WindowControls onClose={() => setShowChatbot(false)} onMaximize={() => setShowEditor(false)} />
<ChatComponent />
</div>
</ResizablePanel>
)}
</>
) : showChatbot ? (
<div className="size-full bg-pink-200">
<ChatComponent />
</div>
</ResizablePanelGroup>
) : (
<div className="size-full">
<EmptyPage />
</div>
<EmptyPage />
)}
</div>
</ResizablePanel>
Expand Down

0 comments on commit 63dc402

Please sign in to comment.