From 7746bbbde423a56eb94888b4cf1d587b9b2c1cf7 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Wed, 20 Jul 2022 09:59:11 -0400 Subject: [PATCH 01/36] refactoring --- vue-app/src/views/MetadataList.vue | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/vue-app/src/views/MetadataList.vue b/vue-app/src/views/MetadataList.vue index 55aa283c1..3421e45c6 100644 --- a/vue-app/src/views/MetadataList.vue +++ b/vue-app/src/views/MetadataList.vue @@ -87,16 +87,16 @@ export default class MetadataList extends Vue { }) if (this.excludeRecipients) { - const exclusion = await this.loadExclusion() + const recipients = await this.getRecipients() this.filteredMetadata = metadata.filter( - ({ id }) => !(id && exclusion.has(id)) + ({ id }) => !(id && recipients.has(id)) ) } else { this.filteredMetadata = metadata } } - private async loadExclusion(): Promise> { + private async getRecipients(): Promise> { const roundAddress = await getCurrentRound() const recipientRegistryAddress = await getRecipientRegistryAddress( roundAddress @@ -113,8 +113,15 @@ export default class MetadataList extends Vue { return new Set( recipients - .map(({ recipientMetadataId, verified, requestType }) => { - let id = recipientMetadataId || '' + .map(({ recipientMetadata, verified, requestType }) => { + let metadata: Metadata + try { + metadata = JSON.parse(recipientMetadata || '') + } catch { + metadata = new Metadata({}) + } + + let id = metadata.id || '' if (Number(requestType) === RequestTypeCode.Removal && verified) { // show metadata if it's not longer a recipient so it can be added again id = '' From 6e06f87d28c3673ab1000067043356053cb54aff Mon Sep 17 00:00:00 2001 From: yuetloo Date: Wed, 20 Jul 2022 10:00:41 -0400 Subject: [PATCH 02/36] refactor recipient submission ui --- vue-app/src/views/MetadataForm.vue | 72 +++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/vue-app/src/views/MetadataForm.vue b/vue-app/src/views/MetadataForm.vue index 02997e62c..86b0e8d3d 100644 --- a/vue-app/src/views/MetadataForm.vue +++ b/vue-app/src/views/MetadataForm.vue @@ -525,6 +525,10 @@ :form="form" :onSuccess="onSuccess" :onSubmit="onSubmit" + :txHash="txHash" + :isWaiting="isWaiting" + :progress="progress" + :txError="txError" /> @@ -569,12 +573,14 @@ import MetadataViewer from '@/views/MetadataViewer.vue' import Dropdown from '@/components/Dropdown.vue' import { Metadata, MetadataFormData } from '@/api/metadata' import { LinkInfo } from '@/api/types' -import { Prop } from 'vue-property-decorator' +import { Prop, Watch } from 'vue-property-decorator' +import { chain, TransactionProgress } from '@/api/core' import { SET_METADATA } from '@/store/mutation-types' import { Project, projectExists } from '@/api/projects' import { CHAIN_INFO } from '@/plugins/Web3/constants/chains' import { ContractReceipt, ContractTransaction } from 'ethers' +import { waitForTransaction } from '@/utils/contracts' type RecievingAddress = { network: string @@ -667,6 +673,11 @@ export default class MetadataForm extends mixins(validationMixin) { selectedNetwork = '' receipt: { hash: string; chainId: number; id: string } | null = null + progress: TransactionProgress | null = null + isWaiting = false + txError = '' + txHash = '' + async created() { const steps = [ 'project', @@ -722,6 +733,11 @@ export default class MetadataForm extends mixins(validationMixin) { return this.networks.sort() } + @Watch('$web3.user') + resetError(): void { + this.txError = '' + } + handleDropdownClick(selection: string): void { this.selectedNetwork = selection } @@ -853,15 +869,59 @@ export default class MetadataForm extends mixins(validationMixin) { ) } - handleStepNav(step): void { + updateProgress(current: number, last: number): void { + this.progress = { current, last } + } + + async addMetadata(): Promise { + const { currentUser } = this.$store.state + + // Reset errors when submitting + this.txError = '' + if (currentUser) { + const { walletProvider } = currentUser + try { + this.isWaiting = true + const transaction = this.onSubmit(this.form, walletProvider) + const receipt = await waitForTransaction( + transaction, + (hash) => (this.txHash = hash) + ) + + await Metadata.waitForBlock( + receipt.blockNumber, + chain.name, + 0, + this.updateProgress + ) + this.isWaiting = false + + if (this.onSuccess) { + this.onSuccess(receipt, this.$web3.chainId) + } + } catch (error) { + this.isWaiting = false + this.txError = error.message + return + } + } + } + + handleStepNav(step: number, updateFurthest?: boolean): void { // If isNavDisabled => disable quick-links if (this.isNavDisabled) return // Save form data - this.saveFormData() - // Navigate - if (this.isStepUnlocked(step)) { - this.gotoStep(this.steps[step]) + this.saveFormData(updateFurthest) + + if (step >= this.steps.length) { + // submit metadata + this.addMetadata() + } else { + // Navigate + if (this.isStepUnlocked(step)) { + this.gotoStep(this.steps[step]) + } } } From 5571c1c2ab35812fb3fb2c289d8a5019c91b09e3 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Wed, 20 Jul 2022 10:02:38 -0400 Subject: [PATCH 03/36] add email field on the join form --- vue-app/src/views/JoinUniversal.vue | 225 ++++++++++++++++++++++++---- 1 file changed, 194 insertions(+), 31 deletions(-) diff --git a/vue-app/src/views/JoinUniversal.vue b/vue-app/src/views/JoinUniversal.vue index a143573f1..247408838 100644 --- a/vue-app/src/views/JoinUniversal.vue +++ b/vue-app/src/views/JoinUniversal.vue @@ -22,16 +22,48 @@
-
+
-
+
-
+
+
+
+

Contact email

+
+

+ For important updates about your project and the funding round. +

+ +

+ We won't display this publicly or add it to the on-chain + registry. +

+

+ This doesn't look like an email. +

+
+
+

Submit project

This is a blockchain transaction that will add your project @@ -39,8 +71,9 @@

@@ -62,8 +95,9 @@ @@ -338,4 +471,34 @@ export default class JoinView extends Vue { .inputs { margin: 1.5rem 0; } + +.input { + border-radius: 16px; + border: 2px solid $button-color; + background-color: var(--bg-secondary-color); + margin: 0.5rem 0; + padding: 0.5rem 1rem; + font-size: 16px; + font-family: Inter; + font-weight: 400; + line-height: 24px; + letter-spacing: 0em; + width: 100%; + &:valid { + border: 2px solid $clr-green; + } + &:hover { + background: var(--bg-primary-color); + border: 2px solid $highlight-color; + box-shadow: 0px 4px 16px 0px 25, 22, 35, 0.4; + } + &:optional { + border: 2px solid $button-color; + background-color: var(--bg-secondary-color); + } +} + +.input.invalid { + border: 2px solid var(--error-color); +} From e2aae741c87411aec4eb3e0ddf2f039a5f276dbc Mon Sep 17 00:00:00 2001 From: yuetloo Date: Wed, 20 Jul 2022 10:04:26 -0400 Subject: [PATCH 04/36] update state on navigate next --- vue-app/src/views/JoinOptimistic.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vue-app/src/views/JoinOptimistic.vue b/vue-app/src/views/JoinOptimistic.vue index d2eaa3ddb..c4df24a0d 100644 --- a/vue-app/src/views/JoinOptimistic.vue +++ b/vue-app/src/views/JoinOptimistic.vue @@ -974,11 +974,11 @@ export default class JoinView extends mixins(validationMixin) { ) } - handleStepNav(step): void { + handleStepNav(step: number, updateFurthest?: boolean): void { // If isNavDisabled => disable quick-links if (this.isNavDisabled) return // Save form data - this.saveFormData() + this.saveFormData(updateFurthest) // Navigate if (this.isStepUnlocked(step)) { this.$router.push({ From e9a5ef4dbf5baef43c6cc2f83c851f023a397880 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Wed, 20 Jul 2022 10:04:53 -0400 Subject: [PATCH 05/36] fix chain short name --- vue-app/src/plugins/Web3/constants/chains.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vue-app/src/plugins/Web3/constants/chains.ts b/vue-app/src/plugins/Web3/constants/chains.ts index 6e69784ab..7035a8041 100644 --- a/vue-app/src/plugins/Web3/constants/chains.ts +++ b/vue-app/src/plugins/Web3/constants/chains.ts @@ -47,8 +47,8 @@ export const CHAIN_INFO: ChainInfo = { explorer: 'https://goerli.etherscan.io', explorerLogo: 'etherscan.svg', explorerLabel: 'Etherscan', - shortName: 'rin', - name: 'rinkeby', + shortName: 'gor', + name: 'goerli', }, [ChainId.HARDHAT]: { label: 'Arbitrum Hardhat', @@ -60,7 +60,7 @@ export const CHAIN_INFO: ChainInfo = { explorerLabel: 'Arbiscan', rpcUrl: 'https://rinkeby.arbitrum.io/rpc', bridge: 'https://bridge.arbitrum.io', - shortName: 'got', + shortName: 'arb-rinkeby', name: 'arbitrum-rinkeby', }, [ChainId.ARBITRUM_ONE]: { From 445228519cc231613c25d4c95d8ba0de1ce4ec48 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Wed, 20 Jul 2022 10:05:20 -0400 Subject: [PATCH 06/36] format long error message --- vue-app/src/components/RecipientSubmissionWidget.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vue-app/src/components/RecipientSubmissionWidget.vue b/vue-app/src/components/RecipientSubmissionWidget.vue index 31a767ae7..e9355d087 100644 --- a/vue-app/src/components/RecipientSubmissionWidget.vue +++ b/vue-app/src/components/RecipientSubmissionWidget.vue @@ -297,6 +297,8 @@ export default class RecipientSubmissionWidget extends Vue { .warning-text { font-size: 14px; + overflow: hidden; + text-overflow: ellipsis; } .warning-text, From 1ae35ea7fe0f4fa062c18e066f29d2eb47def634 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Wed, 20 Jul 2022 10:06:30 -0400 Subject: [PATCH 07/36] refactor to work with new form navigation flow --- .../components/MetadataSubmissionWidget.vue | 100 +++--------------- 1 file changed, 14 insertions(+), 86 deletions(-) diff --git a/vue-app/src/components/MetadataSubmissionWidget.vue b/vue-app/src/components/MetadataSubmissionWidget.vue index be2f179d7..d2e8dc871 100644 --- a/vue-app/src/components/MetadataSubmissionWidget.vue +++ b/vue-app/src/components/MetadataSubmissionWidget.vue @@ -1,36 +1,24 @@