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

Ameerul / P2PS-4363 Banner on Buy/Sell page #401

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

ameerul-deriv
Copy link
Contributor

@ameerul-deriv ameerul-deriv commented Nov 11, 2024

  • Added Funds Banner in Buy/Sell
  • Added Funds Modal
  • Added logic on when to show the Banner In Buy/Sell Page
Screenshot 2024-11-11 at 11 32 37 AM Screenshot 2024-11-11 at 11 54 13 AM

Screenshot 2024-11-11 at 4 16 52 PM
Screenshot 2024-11-11 at 4 16 59 PM
Screenshot 2024-11-11 at 4 17 09 PM
Screenshot 2024-11-11 at 4 19 33 PM

Comment on lines +21 to +29
&:hover {
background-color: transparent !important;

& > span {
color: #0e0e0e !important;
}
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

even though I used hideHoverStyles in the button, it didn't work 😅 so i had to manually disable it here

Comment on lines +22 to +30
const { deleteQueryString, setQueryString } = useQueryString();

const onToggleCurrencyDropdown = (shouldShow: boolean) => {
setShowCurrencySelector(shouldShow);
if (!isDesktop) {
if (shouldShow) setQueryString({ modal: 'CurrencyFilterModal' });
else deleteQueryString('modal');
}
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reason why i added this queryString to modal directly is to ensure we hide the banner if currency selector is shown. And in the index.tsx file, I have some logic that handles showing the banner if its either the RadioGroupModal or FundsModal or if there is no Modal showing at all. Below you can see the issue

Screen.Recording.2024-11-11.at.4.25.55.PM.mov
fix.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also you cannot use isModalOpenFor check because it only returns true in whatever component you have called showModal in

Comment on lines 109 to 124
useEffect(() => {
if (
isAdvertiser &&
isBuySellPage &&
((!isDesktop &&
(queryString.modal === 'RadioGroupFilterModal' ||
queryString.modal === 'FundsModal' ||
!queryString.modal)) ||
isDesktop)
) {
setShowFundsBanner(true);
} else {
setShowFundsBanner(false);
}
}, [isAdvertiser, isBuySellPage, isDesktop, location, queryString]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as mentioned previously in my other comment, here is where I handled showing the Banner if there is any Modal shown, this just to prevent the Banner to be shown above the Modal.

@@ -17,6 +17,7 @@ const useActiveAccount = () => {
? {
...activeAccount,
balance: balanceData?.accounts?.[activeAccount?.loginid]?.balance ?? 0,
hasMigratedToWallets: activeAccount?.linked_to.some(item => item.platform === 'dwallet'),
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be temporary until we get the flag from BE.

Copy link

Preview Link: https://P2PS-4363-banner-on1.p2p-standalone.pages.dev

Name Result
Build status Completed ✅
Preview URL Visit Preview
Action URL Visit Action

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.

4 participants