chatGPTBox
chatGPTBox copied to clipboard
Feature: Make the on-page popup resizable
User description
Hello!
I forked this project to make a small improvement. The on-page popup window was a bit too wide and wasn't resizable, which made it hard to use.
What this PR does:
Makes the on-page popup window fully resizable by the user.
Fixes the flexbox layout so that the input box stays at the bottom when resizing, instead of getting hidden.
Removes the default textarea resize handle from the input box, as the whole window is now resizable.
I've attached a GIF of the new behavior. I hope this is a useful contribution!
PR Type
Enhancement
Description
-
Make on-page popup window fully resizable with drag handles
-
Fix flexbox layout to keep input box visible when resizing
-
Remove textarea resize handle, disable default resize behavior
-
Set fixed starting height and minimum constraints for popup
-
Remove dynamic window sizing logic from FloatingToolbar component
Diagram Walkthrough
flowchart LR
A["Popup Container"] -->|"Add flex display"| B["Flexbox Layout"]
B -->|"Set min-height: 0"| C["Proper Flex Shrinking"]
D["Markdown Body"] -->|"Add flex: 1"| C
E["Input Box"] -->|"Fixed 70px height"| F["Visible Input"]
G["Selection Window"] -->|"Add resize: both"| H["User Resizable"]
H -->|"Set constraints"| I["Min 350x300px"]
File Walkthrough
| Relevant files | |||||
|---|---|---|---|---|---|
| Enhancement |
| ||||
| Configuration changes |
|
Summary by CodeRabbit
- New Features
- Added a resizable chat window with drag-to-resize and draggable title bar for flexible placement and sizing.
- Style
- Restructured chat layout for reliable flex-based sizing and overflow handling.
- Stabilized text input with a fixed starting height and disabled resize.
- Tweaked popup/container widths for improved visual proportions across viewports.
[!NOTE]
Other AI code review bot(s) detected
CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.
Walkthrough
Removed window-size dependent width from the floating toolbar, scoped and converted content styles to flex-based/resizable behavior under a new .resizable-popup scope, and reduced popup container width from 460px to 430px.
Changes
| Cohort / File(s) | Summary |
|---|---|
Toolbar Component src/components/FloatingToolbar/index.jsx |
Removed useClampWindowSize import and usage; removed inline width calculation (windowSize[0] * 0.4); chatgptbox-selection-window now relies on a static class (resizable-popup) instead of a dynamic inline width. |
Content Script Styles src/content-script/styles.scss |
Introduced .resizable-popup scoping; converted container elements to flex layout with flex-basis: 0, flex-grow: 1, min-height: 0; .gpt-inner and .markdown-body set to flex: 1; added .resizable-popup .chatgptbox-selection-window with width/height, resize: both, min/max constraints (min-width: 350px, min-height: 300px, max-width: 90vw, max-height: 90vh), and overflow handling; added .draggable, .dragbar, .interact-input, .submit-button, .manual-btn, and preserved pulse animations under the new scope. |
Popup Styles src/popup/styles.scss |
Changed .container-popup-mode width from 460px to 430px; no other structural changes observed. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
- Review points:
src/components/FloatingToolbar/index.jsx— confirm removal of window-size logic doesn't affect positioning or parent expectations.src/content-script/styles.scss— validate flex resizing, min/max constraints, scrollbar behavior, and draggable chrome across viewports and in constrained containers.src/popup/styles.scss— verify popup content layout with reduced width.
Poem
🐰 I nudged the toolbar, freed its width to play,
Wrapped boxes in flex so pixels bend and sway,
A resizable nook with a gentle dragbar,
I hop, I tweak, I polish — close and not too far,
Happy little changes, neat as carrot clay. 🥕
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The PR title 'Feature: Make the on-page popup resizable' accurately and specifically describes the main change: adding resizable functionality to the popup window component. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Summary of Changes
Hello @13pathak, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request enhances the user experience by making the on-page popup window fully resizable. Previously, the fixed size and lack of resizing options could hinder interaction. The changes introduce dynamic sizing capabilities, coupled with crucial flexbox adjustments to maintain the correct positioning of UI elements, particularly the input box, during resizing. Additionally, the native textarea resize functionality is disabled to provide a unified resizing experience through the main popup window.
Highlights
- Resizable Popup Window: The on-page popup can now be freely resized by the user, improving usability.
- Improved Layout Stability: The flexbox layout has been adjusted to ensure the input box remains visible at the bottom of the popup, even when the window is resized.
- Disabled Textarea Resizing: The default resize handle for the input
textareahas been removed, as the entire popup window now handles resizing.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
| Security Compliance | |
| 🟢 | No security concerns identifiedNo security vulnerabilities detected by AI analysis. Human verification advised for critical code. |
| Ticket Compliance | |
| ⚪ | 🎫 No ticket provided
|
| Codebase Duplication Compliance | |
| ⚪ | Codebase context is not definedFollow the guide to enable codebase context checks. |
| Custom Compliance | |
| 🟢 |
Generic: Meaningful Naming and Self-Documenting CodeObjective: Ensure all identifiers clearly express their purpose and intent, making code Status: Passed
|
Generic: Secure Error HandlingObjective: To prevent the leakage of sensitive system information through error messages while Status: Passed
| |
Generic: Secure Logging PracticesObjective: To ensure logs are useful for debugging and auditing without exposing sensitive Status: Passed
| |
Generic: Security-First Input Validation and Data HandlingObjective: Ensure all data inputs are validated, sanitized, and handled securely to prevent Status: Passed
| |
| ⚪ | Generic: Comprehensive Audit TrailsObjective: To create a detailed and reliable record of critical system actions for security analysis Status: Referred Code
|
Generic: Robust Error Handling and Edge Case ManagementObjective: Ensure comprehensive error handling that provides meaningful context and graceful Status: Referred Code
| |
| |
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| Possible issue |
Ensure resize works in FirefoxTo ensure the resize functionality works in Firefox, change src/content-script/styles.scss [1455-1469]
Suggestion importance[1-10]: 8__ Why: The suggestion correctly identifies a cross-browser compatibility issue where | Medium |
| High-level |
Persist the popup's resized dimensionsThe popup window is now resizable, but the dimensions are not saved. Persist the Examples:src/content-script/styles.scss [1455-1469]
src/components/FloatingToolbar/index.jsx [93]
Solution Walkthrough:Before:
After:
Suggestion importance[1-10]: 7__ Why: The suggestion correctly identifies a significant usability improvement by proposing to persist the window's size, which is a logical next step to complete the feature introduced in the PR. | Medium |
| ||