Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split screen #471

Merged
merged 13 commits into from
Nov 3, 2024
Merged

Split screen #471

merged 13 commits into from
Nov 3, 2024

Conversation

samlhuillier
Copy link
Collaborator

No description provided.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces split-screen functionality and centralizes modal management by implementing react-resizable-panels and refactoring the modal state handling system.

  • Added ResizablePanelGroup in MainPage.tsx with configurable panel sizes and handles for flexible split-screen layout
  • Centralized modal management by moving NewDirectoryComponent to CommonModals.tsx and implementing ModalContext
  • Replaced custom event dispatch with direct state management through useModalOpeners hook in shortcuts
  • Simplified IconsSidebar by removing local modal state in favor of the new centralized modal system
  • Added proper memoization and dependency management in ModalContext to prevent unnecessary re-renders

7 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile


const { noteToBeRenamed, fileDirToBeRenamed } = useFileContext()

return (
<div>
<NewDirectoryComponent isOpen={isNewDirectoryModalOpen} onClose={() => setIsNewDirectoryModalOpen(false)} />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider wrapping NewDirectoryComponent in a conditional render like the other modals to prevent unnecessary mounting when closed

</div>
)
}

const MainPageContent: React.FC = () => {
const [showSimilarFiles, setShowSimilarFiles] = useState(false)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: showSimilarFiles state is maintained but SimilarFilesSidebar component was removed - this state and related props can be removed

<ResizableHandle />

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Condition may hide MainContent unexpectedly when both showChatbot is true and currentlyOpenFilePath is false

@samlhuillier samlhuillier merged commit ba9011f into main Nov 3, 2024
9 checks passed
@samlhuillier samlhuillier deleted the split-screen branch November 3, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant