Skip to content

Commit

Permalink
workign resizability
Browse files Browse the repository at this point in the history
  • Loading branch information
samlhuillier committed Nov 2, 2024
1 parent 9874453 commit 04014aa
Showing 1 changed file with 35 additions and 18 deletions.
53 changes: 35 additions & 18 deletions src/components/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react/jsx-no-useless-fragment */
/* eslint-disable no-nested-ternary */
import React, { useState } from 'react'
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'

Expand Down Expand Up @@ -41,14 +43,14 @@ const MainPageContent: React.FC = () => {
const { getShortcutDescription } = useAppShortcuts()

return (
<div className="relative overflow-x-hidden">
<div className="relative flex h-screen flex-col overflow-hidden">
<TitleBar similarFilesOpen={showSimilarFiles} toggleSimilarFiles={() => setShowSimilarFiles(!showSimilarFiles)} />
<div className="flex h-below-titlebar">
<div className="flex min-h-0 flex-1">
<div className="border-y-0 border-l-0 border-r-[0.001px] border-solid border-neutral-700 pt-2.5">
<IconsSidebar getShortcutDescription={getShortcutDescription} />
</div>

<ResizablePanelGroup direction="horizontal">
<ResizablePanelGroup direction="horizontal" className="flex-1">
<ResizablePanel defaultSize={20} minSize={15} maxSize={40}>
<div className="size-full border-y-0 border-l-0 border-r-[0.001px] border-solid border-neutral-700">
<SidebarManager />
Expand All @@ -57,22 +59,37 @@ const MainPageContent: React.FC = () => {

<ResizableHandle />

<ResizablePanel defaultSize={showChatbot ? 50 : 80}>
{(!showChatbot || currentlyOpenFilePath) && <MainContent />}
</ResizablePanel>

{showChatbot && (
<>
<ResizableHandle />
<ResizablePanel defaultSize={30}>
<div className="w-full bg-pink-200">
<div className="h-below-titlebar w-full">
<ChatComponent />
</div>
<ResizablePanel defaultSize={80}>
<div className="size-full">
{currentlyOpenFilePath ? (
<>
{showChatbot ? (
<ResizablePanelGroup direction="horizontal" className="size-full">
<ResizablePanel defaultSize={65}>
<MainContent />
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={35}>
<div className="size-full bg-pink-200">
<ChatComponent />
</div>
</ResizablePanel>
</ResizablePanelGroup>
) : (
<MainContent />
)}
</>
) : showChatbot ? (
<div className="size-full bg-pink-200">
<ChatComponent />
</div>
) : (
<div className="size-full">
<EmptyPage />
</div>
</ResizablePanel>
</>
)}
)}
</div>
</ResizablePanel>
</ResizablePanelGroup>

<CommonModals />
Expand Down

0 comments on commit 04014aa

Please sign in to comment.