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-1305 access the share ad link #11

Merged

Conversation

ameerul-deriv
Copy link
Owner

@ameerul-deriv ameerul-deriv commented Aug 24, 2023

Changes:

Please provide a summary of the change.

  • Added routing to the shared advert by adding advert_id in the url with the advertiser's id
  • Updated custom message for buy/sell advert and fixed/floating rates
  • removed react-qrcode-logo library, used qrcode-react instead as there were issues when downloading or scanning the qrcode.
  • Handled all edge case scenarios for desktop and responsive: (user not logged in, non-verified p2p users, demo account, real non usd, country of residence does not offer p2p, block users, temp barred users, not enough balance sell advert, inactive, paused,deleted, hidden ads)
  • Removed margin-top from dialog scss as it was affecting all dialogs
  • Handled edge cases for navigating to advertiser page without advert_id
  • Fixed console error from advertiser-page-store.js regarding error is null
  • updated test case

Screenshots:

Please provide some screenshots of the change.

Short demo of navigation:

94dd136f-461b-4131-82a0-b1ce4731721d.mp4
Screenshot 2023-08-24 at 1 16 52 PM Screenshot 2023-08-24 at 4 21 57 PM Screenshot 2023-08-24 at 4 22 10 PM Screenshot 2023-08-24 at 4 22 22 PM Screenshot 2023-08-24 at 4 22 40 PM Screenshot 2023-08-24 at 4 22 58 PM

ameerul-deriv and others added 30 commits August 1, 2023 11:41
@@ -21,6 +21,7 @@ const ErrorModal = ({
has_close_icon={has_close_icon}
is_open={is_modal_open}
title={error_modal_title}
toggleModal={onClose ?? hideModal}
Copy link
Owner Author

Choose a reason for hiding this comment

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

for some reason the error modals in p2p can have the x icon but then we can't press them since it was missing the toggleModal function here so i decided to add it

packages/p2p/src/stores/advertiser-page-store.js Outdated Show resolved Hide resolved
Comment on lines +644 to +647
setCounterpartyAdvertId(counterparty_advert_id) {
this.counterparty_advert_id = counterparty_advert_id;
}

Choose a reason for hiding this comment

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

Can this be handled in the component? Let's not add more logic to stores.

Copy link
Owner Author

Choose a reason for hiding this comment

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

ideally it would be best, let me try and see if we can move it to the component buttt i added this because i needed to track if there was an advert id, and when the user navigates to the shared ad, the advert_id in search param disappears and reappears, so it kept causing issues when trying to show the advert... hence why i needed this observable... it was a similar issue for the advertiser id and the order id when niloofar and I changed the routing

Copy link
Owner Author

Choose a reason for hiding this comment

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

so i tried to handle everything in app.jsx where i used useState to track the advert_id in search params. This did work, but the modal couldn't close because it still had a value within the state. And because that state is only handled in the app, i can't change the value... You can see that i had set `counterparty_advert_id' to an empty string so it wont show the modal.

i did try to reset the state in app, but then the modal wouldn't show

@@ -73,7 +73,6 @@
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
margin-top: 1.4rem;

Choose a reason for hiding this comment

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

Please add this to QA checklist.

Copy link

@adrienne-deriv adrienne-deriv left a comment

Choose a reason for hiding this comment

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

LGTM

if (response.error) {
this.setErrorMessage(response.error);
} else {
const { list } = response.p2p_advert_list;

Choose a reason for hiding this comment

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

Suggested change
const { list } = response.p2p_advert_list;
const { list = [] } = response.p2p_advert_list;

Can the list (returned by BE) be undefined?

Copy link
Owner Author

Choose a reason for hiding this comment

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

just checked, the list wont be undefined, and there will always be an array returned *unless theres an error

Copy link
Owner Author

Choose a reason for hiding this comment

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

just that the above error couldn't recognise response.error, so we needed to check for response first

@ameerul-deriv ameerul-deriv merged commit fd08ecd into P2PS-675-share-my-posted-ads Sep 1, 2023
2 checks passed
ameerul-deriv pushed a commit that referenced this pull request Sep 8, 2023
* refactor: ts migration of chart loader

* refactor: ts migration of screen large form and started purchase

* refactor: add types in store and refcator contract

* refactor: ts migaration of purchase field

* refactor: ts migration of cancel deal info

* refactor: ts migration of the purchase btn

* refactor: cancel deal info

* refactor: remove simular types

* refactor: create file for types

* chore: cover return value with react fragment

* refactor: apply suggestions

* refactor: update imports

* refactor: type returned value

* refactor: left an explanation of expecting ts error

* Akmal / feat: migrate EmptyPortfolioMessage, ErrorComponent and Page404 in Trader package (#5)

* feat: migrate Page404 to Typescript

* feat: migrate EmptyPortfolioMessage to Typescript

* feat: migrate ErrorComponent to Typescript

* fix: dialog prop

* fix: dialog type

* chore: remove React.FC

* maryia/WEBREL-321/feat: migrate Actions files to TS (#4)

* feat: migrate /contract-type.js to ts & remove barrier.js

* feat: migrate duration to ts + remove unused currency.js

* feat: migrate actions/purchase to ts

* feat: migrate actions/symbol to ts

* feat: migrate start-date.js to ts

* feat: migrate actions/test.js to ts

* chore: improve types in start-date and duration

* fix: address review comments

* revert: unnecessary line deletion

* fix: address reviews

* refactor: remove some code smells

* refactor: remove code smells

* refactor: update types in stores

* Akmal / feat: migrate utils in Trader package  (#9)

* feat: migrate MarketUnderlying to Typescript

* feat: migrate errors to Typescript

* feat: migrate error spec to Typescript

* feat: migrate index to Typescript

* feat: migrate validator to Typescript

* feat: trigger vercel

* chore: sort options alphabetically

* fix: TValidationResult type

* chore: prettier formatting

* refactor: reduce code smells

* chore: validator type improvements (binary-com#12)

* Kate / DTRA-249 / Code refactoring and removing duplicated files (binary-com#13)

* refactor: remove duplicated file

* refactor: test improvements

* fix: removed forgotten import

* chore: empty commit to retrigger checks

* refactor: apply suggestion

* maryia/DTRA-260/TS migration of /Constants files & SmartChart/Helpers files in Trader (#6)

* feat: validation-rules and ui.js to ts

* chore: squash merge maryia/WEBREL-321/actions-to-TS changes

* chore: added types to validation-rules.ts

* chore: remove unused ui.js, migrate used ui.js and index.js to ts

* chore: remove unused ui.js

* chore: remove unused markers.js, and migrate barriers.js to ts

* chore: added types to barriers.js and its test

* test: add missing test for removeBarrier to barriers

* Revert "chore: squash merge maryia/WEBREL-321/actions-to-TS changes"

* feat: migrated chart-barrier-store.js to ts

* feat: remove unused ChartMarkerStore

* build: trigger build

* fix: address review comments

* henry/webrel-319/ts-migration-modules-trading-helpers-folder (#11)

* fix: merge conflicts

* fix: resolve comments

* fix: remove comment

* fix: add loadash types dependency

* refactor: move error type to common props file

* fix: circle CI

* fix: resolve comment

* fix: bug

* fix: convert returntype to use ttradestore

* empty commit

* fix: type change

* fix: resolve comments

* fix: comments

* maryia/861n17c54/fix: sonarcloud warnings (binary-com#14)

* fix: sonarcloud warnings

* fix: types

* fix: resolve conflicts

* refactor: apply suggestions

* refactor: add last suggestion

* refactor: tests

* refactor: update function

* refactor: add ts migration of exist tests

* fix: tests

* fix: test case

---------

Co-authored-by: Akmal Djumakhodjaev <akmal@binary.com>
Co-authored-by: Maryia <103177211+maryia-deriv@users.noreply.github.com>
Co-authored-by: henry-deriv <118344354+henry-deriv@users.noreply.github.com>
Co-authored-by: Matin shafiei <matin@deriv.com>
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.