Skip to content

[READY] Add widget mode#580

Merged
ebma merged 8 commits into
stagingfrom
577-create-a-widget-for-business-partners
Apr 24, 2025
Merged

[READY] Add widget mode#580
ebma merged 8 commits into
stagingfrom
577-create-a-widget-for-business-partners

Conversation

@Sharqiewicz
Copy link
Copy Markdown
Member

When mode=widget is added to the url the widget mode is being activated.

@Sharqiewicz Sharqiewicz linked an issue Apr 18, 2025 that may be closed by this pull request
@Sharqiewicz Sharqiewicz requested review from a team and Copilot April 18, 2025 16:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a widget mode that deactivates several UI components when the URL parameter mode=widget is present. It refactors the main page structure by wrapping all main sections into a new component and conditionally hides components such as Footer, MobileMenu, and the compare fees button based on widget mode.

  • Introduces a new hook, useWidgetMode, to detect widget activation.
  • Centralizes the rendering of main sections into MainSections.tsx.
  • Conditionally renders UI elements in layouts and components (Navbar, RampSubmitButtons, KYCForm) based on widget mode.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/src/pages/main/index.tsx Uses MainSections to encapsulate section rendering with widget mode awareness.
frontend/src/pages/main/MainSections.tsx New file that conditionally renders page sections unless widget mode is active.
frontend/src/layouts/index.tsx Hides the Footer component in widget mode.
frontend/src/hooks/useWidgetMode.ts New hook to determine if widget mode is active based on URL parameters.
frontend/src/components/RampSubmitButtons/index.tsx Conditionally renders the compare fees button based on widget mode.
frontend/src/components/Navbar/index.tsx Hides navigation elements (nav block, MobileMenu, MobileMenuList) when widget mode is active.
frontend/src/components/BrlaComponents/KYCForm/index.tsx Conditionally hides the compare fees button in the KYC form when widget mode is active.

import { useMemo } from 'react';

export const useWidgetMode = (): boolean => {
const isWidgetMode = useMemo(() => {
Copy link

Copilot AI Apr 18, 2025

Choose a reason for hiding this comment

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

[nitpick] The useWidgetMode hook memoizes the widget mode state only on mount. If the URL search parameters can change during the session and widget mode should update dynamically, consider updating the dependency array accordingly.

Copilot uses AI. Check for mistakes.
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 18, 2025

Deploy Preview for pendulum-pay ready!

Name Link
🔨 Latest commit efa71da
🔍 Latest deploy log https://app.netlify.com/sites/pendulum-pay/deploys/680a5be9684ce2000880083c
😎 Deploy Preview https://deploy-preview-580--pendulum-pay.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Copy Markdown
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@ebma ebma merged commit fcdda9b into staging Apr 24, 2025
3 of 4 checks passed
@ebma ebma deleted the 577-create-a-widget-for-business-partners branch April 24, 2025 15:43
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.

Create a widget for business partners

3 participants