Skip to content

Commit

Permalink
working resize
Browse files Browse the repository at this point in the history
  • Loading branch information
samlhuillier committed Nov 2, 2024
1 parent 94cff43 commit 9bb0c0e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 31 deletions.
14 changes: 12 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"react-icons": "^4.12.0",
"react-markdown": "^9.0.1",
"react-quill": "^2.0.0",
"react-resizable-panels": "^2.1.6",
"react-rnd": "^10.4.1",
"react-switch": "^7.0.0",
"react-toastify": "^10.0.4",
Expand Down
62 changes: 33 additions & 29 deletions src/components/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'

Check failure on line 2 in src/components/MainPage.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-13)

Cannot find module '@/components/ui/resizable' or its corresponding type declarations.

Check failure on line 2 in src/components/MainPage.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-latest)

Cannot find module '@/components/ui/resizable' or its corresponding type declarations.

Check failure on line 2 in src/components/MainPage.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (windows-latest)

Cannot find module '@/components/ui/resizable' or its corresponding type declarations.

Check failure on line 2 in src/components/MainPage.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Cannot find module '@/components/ui/resizable' or its corresponding type declarations.

Check failure on line 2 in src/components/MainPage.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-13)

Cannot find module '@/components/ui/resizable' or its corresponding type declarations.

Check failure on line 2 in src/components/MainPage.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (macos-latest)

Cannot find module '@/components/ui/resizable' or its corresponding type declarations.

Check failure on line 2 in src/components/MainPage.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (windows-latest)

Cannot find module '@/components/ui/resizable' or its corresponding type declarations.

Check failure on line 2 in src/components/MainPage.tsx

View workflow job for this annotation

GitHub Actions / build_and_package (ubuntu-latest, x64)

Cannot find module '@/components/ui/resizable' or its corresponding type declarations.

import '../styles/global.css'
import ChatComponent from './Chat'
import ResizableComponent from './Common/ResizableComponent'
import TitleBar from './TitleBar/TitleBar'
import EditorManager from './Editor/EditorManager'
import IconsSidebar from './Sidebars/IconsSidebar'
Expand All @@ -21,18 +21,16 @@ const MainContent: React.FC = () => {
const { currentlyOpenFilePath } = useFileContext()

return (
<ResizableComponent resizeSide="right">
<div className="relative flex size-full overflow-hidden">
{currentlyOpenFilePath ? (
<div className="h-full overflow-hidden">
<EditorManager />
</div>
) : (
<EmptyPage />
)}
<WritingAssistant />
</div>
</ResizableComponent>
<div className="relative flex size-full overflow-hidden">
{currentlyOpenFilePath ? (
<div className="h-full overflow-hidden">
<EditorManager />
</div>
) : (
<EmptyPage />
)}
<WritingAssistant />
</div>
)
}

Expand All @@ -50,26 +48,32 @@ const MainPageContent: React.FC = () => {
<IconsSidebar getShortcutDescription={getShortcutDescription} />
</div>

<ResizableComponent resizeSide="right">
<div className="size-full border-y-0 border-l-0 border-r-[0.001px] border-solid border-neutral-700">
<SidebarManager />
</div>
</ResizableComponent>
<ResizablePanelGroup direction="horizontal">
<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 />
</div>
</ResizablePanel>

{/* Main content area with split screen support */}
<div className="flex grow">
{/* Editor section */}
{(!showChatbot || currentlyOpenFilePath) && <MainContent />}
<ResizableHandle />

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

{showChatbot && (
// eslint-disable-next-line react/jsx-no-useless-fragment
<div className="w-full bg-pink-200">
<div className="h-below-titlebar w-full">
<ChatComponent />
</div>
</div>
<>
<ResizableHandle />
<ResizablePanel defaultSize={30}>
<div className="w-full bg-pink-200">
<div className="h-below-titlebar w-full">
<ChatComponent />
</div>
</div>
</ResizablePanel>
</>
)}
</div>
</ResizablePanelGroup>

<CommonModals />
</div>
Expand Down

0 comments on commit 9bb0c0e

Please sign in to comment.