Skip to content

fix: close IFrameWrapper closing feat#419

Merged
Hugo0 merged 2 commits intodevelopfrom
fix/close-tos-button
Oct 5, 2024
Merged

fix: close IFrameWrapper closing feat#419
Hugo0 merged 2 commits intodevelopfrom
fix/close-tos-button

Conversation

@nezz0746
Copy link
Copy Markdown
Contributor

@nezz0746 nezz0746 commented Oct 5, 2024

The IFrame own closing button was clashing with the modal closing button, that's probably why it was set to "hidden". But there was no way clear way to close it other than clicking out. Added a close button at the bottom
Screenshot 2024-10-05 at 10 33 16
Screenshot 2024-10-05 at 10 33 36

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
peanut-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 5, 2024 1:38pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 5, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The IframeWrapper component in src/components/Global/IframeWrapper/index.tsx has been updated to remove the modalTitle prop from its interface. The JSX structure has been redesigned to include a flex container that wraps the <iframe> in a styled <div>. Two new buttons for closing the modal have been added, enhancing the component's layout and user interaction.

Changes

File Change Summary
src/components/Global/IframeWrapper/index.tsx Removed modalTitle prop; redesigned JSX to include a flex container, styled <div>, and added close buttons for different screen sizes.

Suggested reviewers

  • Hugo0

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nezz0746
Copy link
Copy Markdown
Contributor Author

nezz0746 commented Oct 5, 2024

Screenshot 2024-10-05 at 10 28 08 Same for TOS

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
src/components/Global/IframeWrapper/index.tsx (1)

50-54: Excellent addition of the close button.

The new close button at the bottom of the iframe directly addresses the PR's main objective. It provides a clear and accessible way for users to close the iframe, solving the issue with the hidden modal close button.

For improved accessibility, consider adding an aria-label to the button:

- <button className="btn-purple w-full" onClick={onClose}>
+ <button className="btn-purple w-full" onClick={onClose} aria-label="Close iframe">

This change will help screen reader users better understand the button's purpose.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4c06890 and e587651.

📒 Files selected for processing (1)
  • src/components/Global/IframeWrapper/index.tsx (1 hunks)
🔇 Additional comments (3)
src/components/Global/IframeWrapper/index.tsx (3)

40-49: Improved layout and styling for better user experience.

The new JSX structure with a flex layout and additional styling for the iframe wrapper enhances the visual presentation of the component. This change aligns well with the PR objectives of improving the user experience.


Line range hint 1-62: Overall excellent improvements to the IframeWrapper component.

The changes made to this component successfully address the PR objectives:

  1. The new close button provides a clear way for users to close the iframe, solving the issue with the hidden modal close button.
  2. The improved layout and styling enhance the visual presentation of the component.
  3. The removal of the unused modalTitle prop keeps the component's API clean.

These changes significantly improve the user experience and the component's functionality. Great work!


Line range hint 4-11: Removal of unused modalTitle prop.

The modalTitle prop has been correctly removed from the component's interface, which is consistent with the structural changes made to the component. This helps keep the component's API clean.

To ensure this change doesn't break any existing code, please run the following script to check for any remaining usage of modalTitle with IframeWrapper:

If this script returns any results, those occurrences should be updated to remove the modalTitle prop.

✅ Verification successful

Final Verification of modalTitle Prop Removal

The modalTitle prop has been successfully removed from the IframeWrapper component's interface, and no remaining usages were found based on the executed search.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining usage of modalTitle with IframeWrapper

# Test: Search for modalTitle prop usage with IframeWrapper
rg --type typescript --type tsx 'IframeWrapper.*modalTitle'

Length of output: 96


Script:

#!/bin/bash
# Description: Check for any remaining usage of modalTitle with IframeWrapper

# Test: Search for modalTitle prop usage with IframeWrapper using correct file types
rg --type ts --type tsx 'IframeWrapper[^)]*modalTitle'

Length of output: 84


Script:

#!/bin/bash
# Description: Check for any remaining usage of modalTitle with IframeWrapper

# Test: Search for modalTitle prop usage with IframeWrapper in .ts and .tsx files
rg 'IframeWrapper[^)]*modalTitle' -g '*.ts' -g '*.tsx'

Length of output: 56

@nezz0746 nezz0746 requested a review from Hugo0 October 5, 2024 09:23
@Hugo0
Copy link
Copy Markdown
Contributor

Hugo0 commented Oct 5, 2024

Looks good on desktop, but since we should develop mobile first:

image
image

  1. The Iframe KYC card comes from the bottom on mobile, so it is weird to add the close button at the bottom - Can we try to put it on the top?

  2. can we get rid of the padding? Maybe it looks bad though. But if we can and it doesn't look bad, it'd be great, then users have more real estate on mobile

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (4)
src/components/Global/IframeWrapper/index.tsx (4)

35-42: LGTM! Consider using Tailwind's z-index scale for consistency.

The changes to the Modal component props improve the styling and ensure the iframe appears above other elements. The responsive design and overlay styling enhance the user experience.

Consider using Tailwind's z-index scale for consistency:

-className="z-[1000001]"
+className="z-[9999]"

This maintains the high z-index while aligning with Tailwind's conventions.


46-50: Good addition for mobile UX. Consider sentence case for button text.

The addition of a close button for small screens improves the mobile user experience, addressing the issue raised in the PR objectives.

Consider using sentence case for the button text to align with common UI practices:

-                        CLOSE
+                        Close

This makes the text less aggressive while maintaining clarity.


51-59: Good improvements to iframe styling and security. Consider dynamic height for better responsiveness.

The changes to the iframe and its container improve the overall appearance and security of the component. The sandbox attribute is well-configured to allow necessary interactions while maintaining security.

Consider using a dynamic height calculation for better responsiveness across different screen sizes:

-<div className="h-[550px] overflow-hidden rounded-sm sm:h-[500px] sm:border sm:border-black">
+<div className="h-[calc(100vh-200px)] max-h-[550px] min-h-[300px] overflow-hidden rounded-sm sm:border sm:border-black">

This change allows the iframe to adjust its height based on the viewport, providing a better experience on various devices while maintaining reasonable minimum and maximum heights.


Line range hint 1-71: Summary: Good improvements, but consider addressing feedback on button placement

Overall, the changes to the IframeWrapper component significantly improve its functionality and appearance. The addition of close buttons for both mobile and desktop views addresses the main objective of the PR. However, there are a few points to consider:

  1. The placement of the close button conflicts with the feedback provided in the PR comments. Consider moving it to the top for better mobile UX.
  2. Some minor improvements in styling and responsiveness have been suggested, such as using Tailwind's z-index scale and implementing a dynamic height for the iframe container.
  3. The removal of padding around the iframe, as suggested in the PR comments, should be evaluated for its impact on the overall design.

Please review the suggestions made in the previous comments and consider implementing them to further enhance the component's usability and consistency across different devices.

To ensure a consistent approach across the application, consider creating a reusable CloseButton component that can be easily positioned and styled according to the specific needs of each use case. This would promote consistency and make it easier to implement future changes to the close button behavior or appearance throughout the application.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e587651 and 8b77671.

📒 Files selected for processing (1)
  • src/components/Global/IframeWrapper/index.tsx (1 hunks)
🔇 Additional comments (1)
src/components/Global/IframeWrapper/index.tsx (1)

60-64: ⚠️ Potential issue

Consider relocating the close button for better mobile UX.

While the addition of a close button for larger screens improves the desktop experience, its placement at the bottom conflicts with the feedback provided by Hugo0 in the PR comments.

To address this, consider:

  1. Moving the close button to the top of the iframe for both mobile and desktop views.
  2. Adjusting the padding around the iframe as suggested in the feedback.

Here's a potential implementation:

-            <div className="flex flex-col gap-2 p-0 sm:p-5">
-                <div className="w-full sm:hidden">
-                    <button className="btn-purple w-full rounded-none" onClick={onClose}>
-                        CLOSE
-                    </button>
-                </div>
+            <div className="flex flex-col gap-2 p-0">
+                <div className="w-full">
+                    <button className="btn-purple w-full rounded-none sm:rounded-t-md" onClick={onClose}>
+                        Close
+                    </button>
+                </div>
                 <div className="h-[550px] overflow-hidden rounded-sm sm:h-[500px] sm:border sm:border-black">
                     <iframe
                         src={src}
                         allow="camera;"
                         style={{ ...style, width: '100%', height: '100%', border: 'none' }}
                         className="rounded-md"
                         sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-modals allow-top-navigation-by-user-activation"
                     />
                 </div>
-                <div className="hidden w-full sm:flex">
-                    <button className="btn-purple w-full" onClick={onClose}>
-                        Close
-                    </button>
-                </div>
             </div>

This change addresses the feedback by:

  1. Placing the close button at the top for all screen sizes.
  2. Removing the extra padding around the iframe.
  3. Maintaining a consistent close button across all devices.

To verify the impact of these changes on the overall layout and user experience, please run the following script:

This script will help identify any potential inconsistencies with other components that might arise from these changes.

✅ Verification successful

Close button placement verified across components.

The search confirmed that the sm:p-5 class is only used in src/components/Global/IframeWrapper/index.tsx, and there are no other button placements within Modal components that would be affected by this change.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any other components or styles that might be affected by these changes

# Test: Search for other uses of sm:p-5 class in the codebase
echo "Checking for other uses of sm:p-5 class:"
rg --type tsx --type jsx 'sm:p-5'

# Test: Search for other button placements in Modal components
echo "Checking for other button placements in Modal components:"
rg --type tsx --type jsx -A 10 -B 10 '<Modal.*?>' | rg '<button'

Length of output: 372


Script:

#!/bin/bash
# Description: Check for any other components or styles that might be affected by these changes

# Test: Search for other uses of sm:p-5 class in the codebase
echo "Checking for other uses of sm:p-5 class:"
rg --type typescriptreact 'sm:p-5'

# Test: Search for other button placements in Modal components
echo "Checking for other button placements in Modal components:"
rg --type typescriptreact -A 10 -B 10 '<Modal.*?>' | rg '<button'

Length of output: 398


Script:

#!/bin/bash
# Description: Check for any other components or styles that might be affected by these changes

# Test: Search for other uses of sm:p-5 class in the codebase
echo "Checking for other uses of sm:p-5 class:"
rg --type tsx 'sm:p-5'

# Test: Search for other button placements in Modal components
echo "Checking for other button placements in Modal components:"
rg --type tsx -A 10 -B 10 '<Modal.*?>' | rg '<button'

Length of output: 350


Script:

#!/bin/bash
# Description: Check for any other components or styles that might be affected by these changes

# Test: Search for other uses of sm:p-5 class in the codebase
echo "Checking for other uses of sm:p-5 class:"
rg -g "*.tsx" 'sm:p-5'

# Test: Search for other button placements in Modal components
echo "Checking for other button placements in Modal components:"
rg -g "*.tsx" -A 10 -B 10 '<Modal.*?>' | rg '<button'

Length of output: 401

video={false}
/**
* Making sure the Iframe showing on top of the Crisp Chat widget
* which has z-index of 1000000
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok we're getting into ridiculous z-index ranges ahahhhahahahha

@Hugo0 Hugo0 merged commit bfa95b9 into develop Oct 5, 2024
@notion-workspace
Copy link
Copy Markdown

@Hugo0 Hugo0 deleted the fix/close-tos-button branch July 3, 2025 18:22
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.

2 participants