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

[P2PS] Ameerul /P2PS-675 Share my ads modal #9485

Merged
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
cef5692
chore: create share my ads modal
ameerul-deriv Jul 26, 2023
9aa35e4
chore: fixed animation for closing popup
ameerul-deriv Jul 26, 2023
faec3f1
chore: added test cases, fixed clipboard issue, refactored icons to s…
ameerul-deriv Jul 27, 2023
1bc9a83
chore: separated card component out, removed test case
ameerul-deriv Jul 27, 2023
c362a02
Merge pull request #10 from ameerul-deriv/P2PS-1303-create-modal-comp…
ameerul-deriv Jul 28, 2023
a4e337e
chore: try navigator share
ameerul-deriv Jul 28, 2023
4677a36
chore: removed popup component
ameerul-deriv Jul 28, 2023
e0d6235
chore: added desktop styles to mixin
ameerul-deriv Jul 31, 2023
8594a78
chore: update webpackChunkName for share my ads modal
ameerul-deriv Jul 31, 2023
2f7e90b
chore: added suggestions
ameerul-deriv Jul 31, 2023
363bd33
chore: refactored share-my-ads-socials
ameerul-deriv Jul 31, 2023
91c71d7
chore: added partial, removed unused import
ameerul-deriv Jul 31, 2023
913a052
chore: changed style name and removed default option for qr code
ameerul-deriv Aug 1, 2023
6a04634
chore: changed colour to constant
ameerul-deriv Aug 1, 2023
83c8c3a
chore: changed the component name
ameerul-deriv Aug 1, 2023
c75faef
chore: added functions for sharing image
ameerul-deriv Aug 1, 2023
41f25e6
chore: converted file to blob instead
ameerul-deriv Aug 1, 2023
e1ccfc6
chore: added if check if they can share the file
ameerul-deriv Aug 1, 2023
b79c25a
chore: check if canshare file
ameerul-deriv Aug 1, 2023
12fa4cb
chore: added custom message
ameerul-deriv Aug 3, 2023
ab2be88
chore: added emoji
ameerul-deriv Aug 3, 2023
4631886
chore: added routing to advert modal
ameerul-deriv Aug 10, 2023
c497f5b
chore: check if qr code has loaded
ameerul-deriv Aug 11, 2023
75856d4
chore: fixed imports
ameerul-deriv Aug 11, 2023
04c2c20
chore: use toBlob from html-to-image library
ameerul-deriv Aug 15, 2023
be439e0
chore: use qrcode.react library
ameerul-deriv Aug 15, 2023
834619f
chore: fixed sharing qr code
ameerul-deriv Aug 15, 2023
41cf2fd
chore: fixed qr code styling
ameerul-deriv Aug 15, 2023
dbb974b
chore: fixed logo size
ameerul-deriv Aug 15, 2023
b428936
chore: added loader for when sharing image
ameerul-deriv Aug 15, 2023
c6d56ed
chore: fixed setting the loading if is mobile
ameerul-deriv Aug 15, 2023
978a510
Merge branch 'master' of github.com:binary-com/deriv-app into test-sh…
ameerul-deriv Aug 18, 2023
514b98c
chore: added navigation to advert and checked for edge cases when nav…
ameerul-deriv Aug 22, 2023
58a5bc2
chore: updated stores
ameerul-deriv Aug 22, 2023
845cfd4
chore: fixed getting advertiser list error issue, update styles and c…
ameerul-deriv Aug 23, 2023
53ba66f
chore: changed meta tags for link preview
ameerul-deriv Aug 23, 2023
d57feaf
Merge branch 'master' into test-share-file
ameerul-deriv Aug 23, 2023
6f0c0b7
chore: fixed custom ad message
ameerul-deriv Aug 23, 2023
7efce05
chore: added const for localize message values
ameerul-deriv Aug 23, 2023
2ddefb0
chore: fixed failing test cases
ameerul-deriv Aug 23, 2023
09936d0
chore: changed width of modal
ameerul-deriv Aug 23, 2023
a5a89e5
chore: updated relative path
ameerul-deriv Aug 23, 2023
9847778
chore: fixed switching to demo error and added base64 image
ameerul-deriv Aug 23, 2023
63fca7f
chore: fixed rounded blurry logo for whatsapp preview
ameerul-deriv Aug 24, 2023
2ebbe4e
chore: fixed base64 image
ameerul-deriv Aug 24, 2023
cb9caae
chore: changed image
ameerul-deriv Aug 24, 2023
c0c617a
chore: converted svg to jpg base64
ameerul-deriv Aug 24, 2023
6d36bdd
chore: fixed base64 image loading issues
ameerul-deriv Aug 24, 2023
787f874
chore: replaced with url
ameerul-deriv Aug 24, 2023
3090458
Merge branch 'master' of github.com:binary-com/deriv-app into P2PS-67…
ameerul-deriv Aug 24, 2023
e96525e
Merge branch 'P2PS-675-share-my-posted-ads' into P2PS-1305-access-the…
ameerul-deriv Aug 24, 2023
95ca081
chore: removed unused file, and todo
ameerul-deriv Aug 24, 2023
0c6926d
chore: fixed missing {
ameerul-deriv Aug 24, 2023
1bf3e87
chore: refactored getAdvertInfo and removed return value from hook, u…
ameerul-deriv Aug 25, 2023
32ff17f
chore: added custom hook for p2p advert info, refactored component to…
ameerul-deriv Aug 28, 2023
5282366
Merge branch 'master' of github.com:binary-com/deriv-app into P2PS-67…
ameerul-deriv Aug 28, 2023
9b357f2
chore: fixed merge conflicts
ameerul-deriv Aug 28, 2023
9ff571e
chore: set counterparty_advert_id to empty string instead of null
ameerul-deriv Aug 28, 2023
a2246fc
chore: fixed failing test cases
ameerul-deriv Aug 28, 2023
69d1595
chore: added test case for useP2PAdvertInfo
ameerul-deriv Aug 28, 2023
873b69a
chore: updated test case
ameerul-deriv Aug 29, 2023
bfc195b
chore: removed eslint, removed props for error dialog, refactored cus…
ameerul-deriv Aug 29, 2023
4457cab
chore: added package-lock.json and updated error-dialog
ameerul-deriv Aug 29, 2023
1953d9f
chore: destructured values from general_store
ameerul-deriv Aug 30, 2023
fd08ecd
Merge pull request #11 from ameerul-deriv/P2PS-1305-access-the-share-…
ameerul-deriv Sep 1, 2023
1467712
chore: added suggestion, removed react-qrcode-logo
ameerul-deriv Sep 7, 2023
a1f979a
Merge branch 'master' of github.com:binary-com/deriv-app into P2PS-67…
ameerul-deriv Sep 7, 2023
101b777
Merge branch 'master' of github.com:binary-com/deriv-app into P2PS-67…
ameerul-deriv Sep 8, 2023
25138fa
chore: made sure each new icon was optimized with svgo
ameerul-deriv Sep 8, 2023
58f83a6
chore: used is_virtual from client instead of is_demo, placed wrapper…
ameerul-deriv Sep 8, 2023
832fbbd
chore: updated dependency array, hook returns is_buy, is_sell, implem…
ameerul-deriv Sep 8, 2023
5ad589e
chore: fix conflicts
ameerul-deriv Sep 21, 2023
5f78a5e
chore: fixed issues with displaying shared advert after logging in
ameerul-deriv Sep 21, 2023
0cda98a
chore: empty commit
ameerul-deriv Sep 21, 2023
4b7db20
chore: updated package-lock.json
ameerul-deriv Sep 21, 2023
7ef8576
chore: updated QRCode to QRCodeSVG
ameerul-deriv Sep 21, 2023
0e34da5
Merge branch 'master' of github.com:binary-com/deriv-app into P2PS-67…
ameerul-deriv Sep 21, 2023
4fdc4c4
chore: upgraded qrcode.react 1.0.0 to 3.1.0 in wallets
ameerul-deriv Sep 21, 2023
de74c10
Merge branch 'master' of github.com:binary-com/deriv-app into P2PS-67…
ameerul-deriv Sep 21, 2023
fa83b63
Merge branch 'master' of github.com:binary-com/deriv-app into P2PS-67…
ameerul-deriv Sep 22, 2023
0199fc0
fix: replaced p2p-my-ads__table with my-ads-table style name
ameerul-deriv Sep 22, 2023
8d94fe6
fix: merge conflicts
ameerul-deriv Oct 17, 2023
e3eb97f
chore: removed package-lock for p2p and added suggestions
ameerul-deriv Oct 30, 2023
9681180
Merge branch 'master' of github.com:binary-com/deriv-app into P2PS-67…
ameerul-deriv Oct 30, 2023
ac21b1f
chore: replaced custom_message with advert_url
ameerul-deriv Nov 2, 2023
7f42cf4
fix: url not appending advert_id
ameerul-deriv Nov 3, 2023
49ffe7e
fix: merge conflicts
ameerul-deriv Nov 10, 2023
7b7ffb8
fix: conflicts with master
ameerul-deriv Nov 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 110 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"mobx-react": "^7.5.1",
"onfido-sdk-ui": "^11.0.0",
"prop-types": "^15.7.2",
"qrcode.react": "^1.0.0",
"qrcode.react": "^3.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^11.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cashier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"mobx": "^6.6.1",
"moment": "^2.29.2",
"prop-types": "^15.7.2",
"qrcode.react": "^1.0.0",
"qrcode.react": "^3.1.0",
"react": "^17.0.2",
"react-content-loader": "^6.2.0",
"react-dom": "^17.0.2",
Expand Down
11 changes: 9 additions & 2 deletions packages/cashier/src/components/error-dialog/error-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type TErrorDialogProps = {

type TSetDetails = {
title: string;
cancel_button_text: undefined | string;
cancel_button_text?: string;
confirm_button_text: undefined | string;
onConfirm: undefined | (() => void);
onConfirm?: () => void;
message: undefined | string | TReactElement;
has_close_icon?: boolean;
};
Expand Down Expand Up @@ -107,6 +107,13 @@ const ErrorDialog = observer(({ className, error = {} }: TErrorDialogProps) => {
onConfirm: undefined,
message: error_message,
});
} else if (error_code === 'ShareMyAdsError') {
setDetails({
title: localize('Deriv P2P unavailable'),
confirm_button_text: localize('OK'),
message: error_message,
has_close_icon: true,
});
} else {
setDetails({
title: localize('Cashier Error'),
Expand Down
32 changes: 29 additions & 3 deletions packages/cashier/src/containers/cashier/cashier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier
} = usePaymentAgentTransferVisible();
const { is_payment_agent_visible } = payment_agent;
const { is_from_derivgo } = common;
const { is_cashier_visible: is_visible, toggleCashier } = ui;
const { is_account_setting_loaded, is_logged_in, is_logging_in } = client;
const { is_cashier_visible: is_visible, toggleCashier, toggleReadyToDepositModal } = ui;
const { currency, is_account_setting_loaded, is_logged_in, is_logging_in, is_svg, is_virtual } = client;
const is_account_transfer_visible = useAccountTransferVisible();
const is_onramp_visible = useOnrampVisible();
const p2p_notification_count = useP2PNotificationCount();
Expand Down Expand Up @@ -200,9 +200,35 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier

useEffect(() => {
if (is_p2p_enabled_success && !is_p2p_enabled && history.location.pathname.startsWith(routes.cashier_p2p)) {
const url_params = new URLSearchParams(history.location.search);
const advert_id = url_params.get('advert_id');

history.push(routes.cashier_deposit);

if (advert_id) {
if (is_virtual) {
toggleReadyToDepositModal();
} else {
error.setErrorMessage({
code: 'ShareMyAdsError',
message:
currency !== 'USD' && is_svg
? localize('Deriv P2P is currently unavailable in this currency.')
: localize('Deriv P2P is currently unavailable in your country.'),
});
}
}
}
}, [history, is_p2p_enabled, is_p2p_enabled_success]);
}, [
currency,
error,
history,
is_p2p_enabled,
is_p2p_enabled_success,
is_svg,
is_virtual,
toggleReadyToDepositModal,
]);

if (
((!is_logged_in || isMobile()) && is_logging_in) ||
Expand Down
10 changes: 6 additions & 4 deletions packages/components/src/components/clipboard/clipboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type TClipboard = {
popoverClassName?: string;
popoverAlignment?: 'top' | 'right' | 'bottom' | 'left';
popover_props?: Partial<TPopoverProps>;
size?: string;
};
const Clipboard = ({
text_copy,
Expand All @@ -25,6 +26,7 @@ const Clipboard = ({
popoverClassName,
popover_props = {},
popoverAlignment = 'bottom',
size = '16',
}: TClipboard) => {
const [is_copied, copyToClipboard, setIsCopied] = useCopyToClipboard();
const isMounted = useIsMounted();
Expand All @@ -49,22 +51,22 @@ const Clipboard = ({
alignment={popoverAlignment}
classNameBubble={classNames('dc-clipboard__popover', popoverClassName)}
message={is_copied ? success_message : info_message}
relative_render
{...popover_props}
zIndex='9999'
>
{is_copied && (
{is_copied ? (
<Icon
icon='IcCheckmarkCircle'
custom_color='var(--status-success)'
className={classNames('dc-clipboard', className)}
/>
)}
{!is_copied && (
) : (
<Icon
icon={icon || 'IcClipboard'}
custom_color='var(--text-less-prominent)'
className={classNames('dc-clipboard', className)}
onClick={onClick}
size={size}
/>
)}
</Popover>
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/components/dialog/dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
margin-top: 1.4rem;
&--end {
justify-content: flex-end;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading