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

Add 3Box profile integration to the Snapshot app #172

Merged
merged 19 commits into from
Dec 6, 2020
Merged

Add 3Box profile integration to the Snapshot app #172

merged 19 commits into from
Dec 6, 2020

Conversation

ChaituVR
Copy link
Member

@ChaituVR ChaituVR commented Dec 2, 2020

Changes proposed in this pull request:

  • Add 3Box profile integration to the Snapshot app

1. Add profile in the top nav

image

2. Add profile and button in account modal

If the User already have an account in 3Box, providing a link to edit
image

if the User is not having an account in 3Box, providing a like to 3Box,
image

3. Add names and avatars of the voters

URLs to test:
http://localhost:8080/#/balancer/proposal/QmQaxYxNp2Vq9PqW7Xc1Acnup7wC2Yrhg3UiYi9DYBFrPZ
More Votes: http://localhost:8080/#/yearn/proposal/QmUAUtyK7FiEAKF3FCeniWsvSiVxT2J6DESVcBKZYnPrCi

image

4. Add name and avatar of the proposal author

Inside Proposal: (http://localhost:8080/#/balancer/proposal/QmQaxYxNp2Vq9PqW7Xc1Acnup7wC2Yrhg3UiYi9DYBFrPZ)
image

5. Add profile in user modal

image

Copy link
Member

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution @ChaituVR. I've added some suggestions.

src/components/Modal/Account.vue Outdated Show resolved Hide resolved
src/components/Modal/Account.vue Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/components/Modal/User.vue Outdated Show resolved Hide resolved
src/components/Avatar.vue Outdated Show resolved Hide resolved
src/store/modules/web3.ts Outdated Show resolved Hide resolved
ChaituVR and others added 5 commits December 2, 2020 20:11
Co-authored-by: Fabien <bonustrack@users.noreply.github.com>
Co-authored-by: Fabien <bonustrack@users.noreply.github.com>
Co-authored-by: Fabien <bonustrack@users.noreply.github.com>
@ChaituVR
Copy link
Member Author

ChaituVR commented Dec 2, 2020

Thanks for the review @bonustrack Added those suggested changes,

also added VUE_APP_IPFS_NODE=ipfs.io to .env to make it work, let me know if it is not required
and also let me know if any other changes required for this feature

@ChaituVR ChaituVR requested a review from bonustrack December 3, 2020 06:36
Copy link
Member

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

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

The size of the app bundle has been increased by x4 with the adding of 3box have a look here:
Without 3Box: https://snapshot.page/report.html
With 3Box: https://bafybeidq45eittd3vfbbydxd3fcwfwe47xvx3p5xbe7gimyztve44totx4.on.fleek.co/report.html
Is there a way to import only what we need from the dependency? I believe what we need is just to query the 3Box API endpoint, we don't need all the advanced functions.

.env Outdated Show resolved Hide resolved
src/store/modules/app.ts Outdated Show resolved Hide resolved
@ChaituVR
Copy link
Member Author

ChaituVR commented Dec 3, 2020

Awesome suggestions :) Thanks for those.. fixed them and now the bundle size is
image
also remove that getprofile call everywhere it is now using 3box's graphql only

Copy link
Member

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

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

Ok last changes,

  • Can you create a file helpers/3box.ts with a method getProfiles and use this method on app.ts and web3.ts, that will reduce duplicate code and make the function more accessible, you don't need to have 2 sub request on for voterProfiles and authorProfile, you could just request profiles of an array of addresses that include both author and voters addresses.
  • Can you resolve conflicts and and run the "lint" script?

@ChaituVR

This comment has been minimized.

@ChaituVR ChaituVR requested a review from bonustrack December 5, 2020 15:54
@bonustrack
Copy link
Member

Sorry i found 2 more issues:

1: When i connect my wallet here https://bafybeidqtbuxmtfemil2qzio3wf5zlonbcerbv2f2t73s3646yuhue7kim.on.fleek.co then refresh the page, the wallet should be reconnected again and there should be a loading indicator in top nav like this:
image
But currently there is no loading indicator.

2: The size of the dependency 3box is too heavy even using only 3box/lib/api. It would be better if we just send a request to 3box API directly using the method subgraphRequest, this method is used in others place in Snapshot.js it's a standard way to query GraphQL APIs, and it's super light.

@ChaituVR
Copy link
Member Author

ChaituVR commented Dec 6, 2020

@bonustrack

Fixed that loading issue, that menu button is missing app.authLoading

<UiButton
      v-if="!$auth.isAuthenticated"
      @click="modalOpen = true"
      :loading="loading || app.authLoading"
>

and removed 3box's library didn't know graphql method exists for this :)
image

@bonustrack
Copy link
Member

Thanks! That's much better now, i've just noticed there is an error when i load the page with a call to profile.name failing:
image

Copy link
Member

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

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

Great work @ChaituVR! The PR is good to be merged

@bonustrack bonustrack merged commit 9f0ff6f into snapshot-labs:develop Dec 6, 2020
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.

2 participants