Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Feature/1708 affiliate link owner info show #2026

Closed

Conversation

maria-vslvn
Copy link
Contributor

Summary

<<if there's an issue>>Fixes #1708

add and modify the affiliate link owner info display ate the profile page

To Test

  1. Open the page Profile
    Checkout the new display and updates

@github-actions
Copy link
Contributor

  • 🔭 GP Swap: Gnosis Protocol v2 Swap UI

@elena-zh elena-zh added the Protofire Handled by Protofire development team label Dec 21, 2021
Copy link

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

Hey @maria-vslvn ,

some issues:

  1. It would be nice to hide the field when a user is not connected to the Mainnet, as referral data is available only there
    mainnet

  2. It would be great to hide the field if a user has not traded before
    do not show when no trades

  3. No need to show this link to a user with trades, and these trades were done without a referral link

  4. Referral link can't be the connected address. The value is the address that is uploaded to ipfs when a user follows a referral link

  5. Seems that the fields are not placed in 1 horizontal line on the form
    not in line

  6. Mobile and tablet views are changed in this PR. It would be great to leave them as they are currently deployed in Prod
    mobile
    tablet

@ramirotw
Copy link
Contributor

ramirotw commented Jan 4, 2022

@maria-vslvn you should pick the referral address by using the hook useReferralAddress.

And btw there's a typo in Reffered -> Referred

@ramirotw ramirotw self-requested a review January 4, 2022 14:56
Copy link
Contributor

@ramirotw ramirotw left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

Minor comment, otherwise looking good to me.

Would just make sure Elena's comments are addressed

src/custom/pages/Profile/index.tsx Outdated Show resolved Hide resolved
@ramirotw ramirotw added the Auto-merge PRs with this tag will be automatically merged when approved and CI succeeds label Jan 5, 2022
@elena-zh
Copy link

Hi @maria-vslvn , cases 1-4 from the comment above #2026 (review) are still not fixed.
The purpose of the current issue is to show a user an address he/she has followed, and under which he/she has done a trade. This value (referral address) should be taken from the BE.
In this PR I see that you are trying to show the new referral link, that is currently active, and is stored in the local storage.
I assume, that is why all these issues are still not fixed.

Thanks.

Copy link

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

We still do not indicate under which link the 1st trade was done.

@matextrem
Copy link
Contributor

@ramirotw @alfetopito Which is the endpoint needed to retrieve the referrer user? Trades enpoint does not return any information related to that.

@ramirotw
Copy link
Contributor

@ramirotw @alfetopito Which is the endpoint needed to retrieve the referrer user? Trades enpoint does not return any information related to that.

I believe the way we could do that is:

  1. get the user first trade by using the /trades endpoint
  2. using the orderId from that trade query the /orders/{uid}
  3. using the appData from the order response, we could use the decode helper @alfetopito implemented in https://codepen.io/pacara/pen/BadZgjg (this should be part of the sdk btw)
  4. extract the referrer address from there

does that makes sense @alfetopito or we have a simpler and better way to do it?

@alfetopito
Copy link
Contributor

@ramirotw @alfetopito Which is the endpoint needed to retrieve the referrer user? Trades enpoint does not return any information related to that.

I believe the way we could do that is:

1. get the user first trade by using the /trades endpoint

2. using the orderId from that trade query the /orders/{uid}

3. using the appData from the order response, we could use the decode helper @alfetopito implemented in https://codepen.io/pacara/pen/BadZgjg (this should be part of the sdk btw)

4. extract the referrer address from there

does that makes sense @alfetopito or we have a simpler and better way to do it?

Yeah, that sounds about right.
Don't think there's an easier way right now.

src/custom/pages/Profile/index.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@alongoni alongoni left a comment

Choose a reason for hiding this comment

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

Looks great!
image
image

@alfetopito
Copy link
Contributor

Regarding the first point from Elena comment and talking to Rami, a solution for this would be trying to getTrades pointing to the default env (i.e: barn). If getTrades does not returns anything, try with prod environment.

WDTY is the best approach to handle it @alfetopito ?

CC: @ramirotw

I was sure something like that had already been implemented for the affiliate program, before we upload it to IPFS, but looking at the code right now I couldn't find it.

Did we just talk about it but did not actually implement it?

Anyway, I think this would make sense for both but could be a follow up PR

@matextrem
Copy link
Contributor

@alfetopito You mean this ticket? #1819. @elena-zh shared it to me but I was unsure if it was the same case.

@alfetopito
Copy link
Contributor

@matextrem I've raised this internally with the backend team to check for an alternative solution.

Will let you know when I get an answer

@matextrem
Copy link
Contributor

@elena-zh @alfetopito updated!

@matextrem
Copy link
Contributor

I have read the CLA Document and I hereby sign the CLA

@matextrem
Copy link
Contributor

recheckcla

@elena-zh
Copy link

Hey @matextrem , seems that the last your commit was not properly merged as I still can't see a referree for an account with trades in the Prod server
image
image

@alongoni , WDYT about left-aligning all these elements in a mobile view like we do for the tablet view?
image
image

Also, it would be nice to make have a common style: currently, icons, fields' labels have different sizes, colors, etc.

src/custom/api/gnosisProtocol/api.ts Outdated Show resolved Hide resolved
src/custom/api/gnosisProtocol/api.ts Outdated Show resolved Hide resolved
src/custom/api/gnosisProtocol/api.ts Outdated Show resolved Hide resolved
src/custom/api/gnosisProtocol/api.ts Show resolved Hide resolved
src/custom/api/gnosisProtocol/api.ts Outdated Show resolved Hide resolved
const [stgResponse, prodResponse] = response

if (!response.length) {
const [stgErrResponse, prodErrResponse] = results as PromiseFulfilledResult<any>[]
Copy link
Contributor

Choose a reason for hiding this comment

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

General comment for both fns: there seems to be a lot of anys. Don't we know the types returned?

Copy link
Contributor

Choose a reason for hiding this comment

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

There seems to be a problem with Promise.allSettled and typing (https://stackoverflow.com/a/67533949) . I tried the solution suggested there but I was not able to make it work with our current eslint configuration so I have to type those cases with any

src/custom/api/gnosisProtocol/api.ts Outdated Show resolved Hide resolved
src/custom/api/gnosisProtocol/api.ts Outdated Show resolved Hide resolved
@alongoni
Copy link
Contributor

alongoni commented Feb 24, 2022

Regarding styles:
image
@matextrem you can check the CSS here:

https://www.figma.com/file/bcoZf5RIgVKDItdOaTZq18/GP-Swap?node-id=3581%3A697

Not sure yet about left-aligning all elements (Referred by + Last updated + View all orders). I'll check it in a prototype on figma.

@elena-zh
Copy link

Hey @matextrem , great changes!

The last thing that I have noticed today is that the account referee info is not auto-removed when switch to another account without trades/referral code. See the video: https://watch.screencastify.com/v/xHXmzYwUEKS80xTjMmWU

Could you please fix this?

@matextrem
Copy link
Contributor

@elena-zh Updated!

Copy link

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

LGTM now!

@alfetopito
Copy link
Contributor

As was discussed in the last sync meeting, we decided to not proceed with this feature.

Thanks for the effort everyone, but unfortunately it won't go live.

@alfetopito alfetopito closed this Mar 4, 2022
@alfetopito alfetopito deleted the feature/1708-affiliate-link-owner-info-show branch March 4, 2022 17:23
@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Protofire Handled by Protofire development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Affiliate] Show a user info about affiliate link owner
6 participants