Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Feat : AI Assistant Options Partially Hidden or Not Visible While Scrolling down the page and Selecting Text#407

Merged
weilirs merged 1 commit intoreorproject:mainfrom
dheerajsingh89:Fixes/AI_Assistant_Options_Hidden_Issue
Sep 23, 2024
Merged

Feat : AI Assistant Options Partially Hidden or Not Visible While Scrolling down the page and Selecting Text#407
weilirs merged 1 commit intoreorproject:mainfrom
dheerajsingh89:Fixes/AI_Assistant_Options_Hidden_Issue

Conversation

@dheerajsingh89
Copy link
Copy Markdown
Contributor

Fixes #402
/claim #402

Now We can see the AI Assistant in all the cases as shown below in video

screen-capture.webm

Copy link
Copy Markdown

@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 pull request addresses the AI Assistant options visibility issue when scrolling and selecting text, implementing a Popover component for improved positioning.

  • Introduced @radix-ui/react-popover in package.json for enhanced UI components
  • Modified src/components/Editor/HighlightExtension.tsx to adjust button positioning calculations
  • Refactored src/components/WritingAssistant/WritingAssistant.tsx to use the new Popover component
  • Added src/components/ui/popover.tsx to implement a custom Popover component using Radix UI primitives
  • Ensure to test the solution thoroughly across different screen sizes and scroll positions

4 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings


// Calculate the button position below the last word
const buttonTop = top >= window.innerHeight ? 20 : top - 35 // Adjust the vertical offset as needed
const buttonTop = top >= window.innerHeight ? 50 : top - 125 // Adjust the vertical offset as needed
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

style: The hardcoded values (50 and 125) might not be flexible enough for all screen sizes and resolutions. Consider using relative values or calculating these dynamically based on the viewport size.

// Calculate the button position below the last word
const buttonTop = top >= window.innerHeight ? 20 : top - 35 // Adjust the vertical offset as needed
const buttonTop = top >= window.innerHeight ? 50 : top - 125 // Adjust the vertical offset as needed
const buttonLeft = (left + right) / 2 - 190 // Position the button horizontally centered
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

style: The horizontal positioning (buttonLeft) remains unchanged. This might still cause issues in some cases, especially on smaller screens or with long selections.

</Popover>
)}

{getLastMessage(messages, 'assistant') && (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

style: The positioning of this div might still cause issues in certain viewport sizes. Consider using a more dynamic positioning approach

@weilirs weilirs merged commit 022a0e5 into reorproject:main Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI Assistant Options Partially Hidden or Not Visible While Scrolling down the page and Selecting Text

2 participants