diff --git a/vue-app/src/api/projects.ts b/vue-app/src/api/projects.ts index d0c57eb09..8dea2823d 100644 --- a/vue-app/src/api/projects.ts +++ b/vue-app/src/api/projects.ts @@ -59,6 +59,19 @@ export async function getRecipientRegistryAddress(roundAddress: string | null): } } +export async function getCurrentRecipientRegistryAddress(): Promise { + const data = await sdk.GetRecipientRegistryInfo({ + factoryAddress: factory.address.toLowerCase(), + }) + + const registryAddress = + data.fundingRoundFactory?.currentRound?.recipientRegistry?.id || + data.fundingRoundFactory?.recipientRegistry?.id || + '' + + return registryAddress +} + export async function getProjects(registryAddress: string, startTime?: number, endTime?: number): Promise { if (recipientRegistryType === 'simple') { return await SimpleRegistry.getProjects(registryAddress, startTime, endTime) @@ -71,11 +84,21 @@ export async function getProjects(registryAddress: string, startTime?: number, e } } -export async function getProject(registryAddress: string, recipientId: string): Promise { +/** + * Get project information + * + * TODO: add subgraph event listener to track recipients from simple and kleros registries + * + * @param registryAddress recipient registry address + * @param recipientId recipient id + * @param filter filter result by locked or verified status + * @returns project information + */ +export async function getProject(registryAddress: string, recipientId: string, filter = true): Promise { if (recipientRegistryType === 'simple') { return await SimpleRegistry.getProject(registryAddress, recipientId) } else if (recipientRegistryType === 'optimistic') { - return await OptimisticRegistry.getProject(recipientId) + return await OptimisticRegistry.getProject(recipientId, filter) } else if (recipientRegistryType === 'kleros') { return await KlerosRegistry.getProject(registryAddress, recipientId) } else { diff --git a/vue-app/src/api/recipient-registry-optimistic.ts b/vue-app/src/api/recipient-registry-optimistic.ts index 59686c312..3b2e83d23 100644 --- a/vue-app/src/api/recipient-registry-optimistic.ts +++ b/vue-app/src/api/recipient-registry-optimistic.ts @@ -374,7 +374,14 @@ export async function getProjects(registryAddress: string, startTime?: number, e return projects } -export async function getProject(recipientId: string): Promise { +/** + * Get project information + * + * @param recipientId recipient id + * @param filter default to always filter result by locked or verified status + * @returns project + */ +export async function getProject(recipientId: string, filter = true): Promise { if (!isHexString(recipientId, 32)) { return null } @@ -398,6 +405,10 @@ export async function getProject(recipientId: string): Promise { return null } + if (!filter) { + return project + } + const requestType = Number(recipient.requestType) if (requestType === RequestTypeCode.Registration) { if (recipient.verified) { diff --git a/vue-app/src/components/CopyButton.vue b/vue-app/src/components/CopyButton.vue index e174ec67a..a486ed06a 100644 --- a/vue-app/src/components/CopyButton.vue +++ b/vue-app/src/components/CopyButton.vue @@ -2,7 +2,6 @@
{ - return getBlockExplorer(props.hash) + return getBlockExplorerByHash(props.hash) }) onMounted(() => { diff --git a/vue-app/src/locales/cn.json b/vue-app/src/locales/cn.json index 1690753d9..a27d7d52e 100644 --- a/vue-app/src/locales/cn.json +++ b/vue-app/src/locales/cn.json @@ -1198,7 +1198,7 @@ "progress": { "step": { "project": "关于项目", - "donation": "捐款细节", + "fund": "捐款细节", "team": "团队", "links": "链接", "image": "图片", diff --git a/vue-app/src/locales/en.json b/vue-app/src/locales/en.json index 9a6f658c7..52fa20ae1 100644 --- a/vue-app/src/locales/en.json +++ b/vue-app/src/locales/en.json @@ -1198,7 +1198,7 @@ "progress": { "step": { "project": "About the project", - "donation": "Donation details", + "fund": "Donation details", "team": "Team details", "links": "Links", "image": "Images", diff --git a/vue-app/src/locales/es.json b/vue-app/src/locales/es.json index bed594d92..e6f24399c 100644 --- a/vue-app/src/locales/es.json +++ b/vue-app/src/locales/es.json @@ -1198,7 +1198,7 @@ "progress": { "step": { "project": "Acerca del proyecto", - "donation": "Detalles de la donación", + "fund": "Detalles de la donación", "team": "Detalles del equipo", "links": "Enlaces", "image": "Imágenes", diff --git a/vue-app/src/router/index.ts b/vue-app/src/router/index.ts index b56a8f06d..57fafaaf1 100644 --- a/vue-app/src/router/index.ts +++ b/vue-app/src/router/index.ts @@ -191,7 +191,7 @@ const routes: Array = [ }, }, { - path: '/recipients/:hash', + path: '/recipients/:id', name: 'recipient-profile', component: RecipientProfile, meta: { diff --git a/vue-app/src/utils/explorer.ts b/vue-app/src/utils/explorer.ts index 34bf3ed3a..be8087194 100644 --- a/vue-app/src/utils/explorer.ts +++ b/vue-app/src/utils/explorer.ts @@ -1,7 +1,7 @@ import { chain } from '@/api/core' import { getAssetsUrl } from '@/utils/url' -export function getBlockExplorer(hash: string): { label: string; url: string; logo: string; logoUrl: string } { +export function getBlockExplorerByHash(hash: string): { label: string; url: string; logo: string; logoUrl: string } { return { label: chain.explorerLabel as string, url: `${chain.explorer}/tx/${hash}`, @@ -9,3 +9,21 @@ export function getBlockExplorer(hash: string): { label: string; url: string; lo logoUrl: getAssetsUrl(chain.explorerLogo), } } + +export function getBlockExplorerByAddress(address: string): { + label: string + url: string + logo: string + logoUrl: string +} | null { + if (!address) { + return null + } + + return { + label: chain.explorerLabel as string, + url: `${chain.explorer}/address/${address}`, + logo: chain.explorerLogo as string, + logoUrl: getAssetsUrl(chain.explorerLogo), + } +} diff --git a/vue-app/src/views/JoinView.vue b/vue-app/src/views/JoinView.vue index 41f06fa3a..7be65e7dc 100644 --- a/vue-app/src/views/JoinView.vue +++ b/vue-app/src/views/JoinView.vue @@ -790,7 +790,7 @@ const rules = computed(() => { const v$ = useVuelidate(rules, form) const currentStep = ref(0) -const steps = ['project', 'donation', 'team', 'links', 'image', 'review', 'submit', 'confirm'] +const steps = ['project', 'fund', 'team', 'links', 'image', 'review', 'submit', 'confirm'] const stepNames = steps.slice(0, steps.length - 1) const showSummaryPreview = ref(false) const isWaiting = ref(false) @@ -884,7 +884,6 @@ function isStepValid(step: number): boolean { return isLinkStepValid() } const stepName: string = steps[step] - return !v$.value[stepName]?.$invalid } diff --git a/vue-app/src/views/ProjectAdded.vue b/vue-app/src/views/ProjectAdded.vue index a13419c5b..cbdc5f1bb 100644 --- a/vue-app/src/views/ProjectAdded.vue +++ b/vue-app/src/views/ProjectAdded.vue @@ -23,7 +23,9 @@
- {{ $t('projectAdded.link2') }} + {{ + $t('projectAdded.link2') + }} {{ $t('projectAdded.link3') }}
@@ -43,11 +45,21 @@ import ImageResponsive from '@/components/ImageResponsive.vue' import { useAppStore } from '@/stores' import { useRoute } from 'vue-router' import { storeToRefs } from 'pinia' +import { getRecipientBySubmitHash } from '@/api/projects' const route = useRoute() const appStore = useAppStore() const { currentRound } = storeToRefs(appStore) const hash = computed(() => route.params.hash as string) + +const recipientId = ref('') + +onMounted(async () => { + const recipient = await getRecipientBySubmitHash(hash.value) + if (recipient) { + recipientId.value = recipient.id + } +})