Skip to content

Commit ff76f31

Browse files
committed
feat: add candidate creation flow
1 parent e91af00 commit ff76f31

81 files changed

Lines changed: 4328 additions & 561 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/web/next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const basicConfig = {
3737
'@buildeross/stores',
3838
'@buildeross/auction-ui',
3939
'@buildeross/proposal-ui',
40+
'@buildeross/candidate-ui',
4041
'@buildeross/dao-ui',
4142
'@buildeross/feed-ui',
4243
'@buildeross/create-proposal-ui',

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"@buildeross/analytics": "workspace:*",
77
"@buildeross/auction-ui": "workspace:*",
88
"@buildeross/blocklist": "workspace:*",
9+
"@buildeross/candidate-ui": "workspace:*",
910
"@buildeross/constants": "workspace:*",
1011
"@buildeross/create-dao-ui": "workspace:*",
1112
"@buildeross/create-proposal-ui": "workspace:*",

apps/web/src/pages/dao/[network]/[token]/candidate/[candidateId].tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { CACHE_TIMES } from '@buildeross/constants/cacheTimes'
22
import { PUBLIC_DEFAULT_CHAINS } from '@buildeross/constants/chains'
33
import type { CandidateGroup } from '@buildeross/sdk'
44
import { getCandidateGroup } from '@buildeross/sdk'
5+
import { getDAOAddresses } from '@buildeross/sdk/contract'
56
import { useChainStore } from '@buildeross/stores'
6-
import { CHAIN_ID } from '@buildeross/types'
7+
import { AddressType, CHAIN_ID } from '@buildeross/types'
78
import { Box, Button, Flex, Stack, Text } from '@buildeross/zord'
89
import { GetServerSideProps } from 'next'
910
import { useRouter } from 'next/router'
@@ -201,7 +202,7 @@ CandidateDetailPage.getLayout = getDaoLayout
201202

202203
export const getServerSideProps: GetServerSideProps = async (context) => {
203204
const network = context.params?.network as string
204-
// const token = context.params?.token as string
205+
const token = context.params?.token as AddressType
205206
const candidateId = context.params?.candidateId as string
206207

207208
// Validate network
@@ -213,6 +214,12 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
213214
return { notFound: true }
214215
}
215216

217+
const addresses = await getDAOAddresses(validChain.id, token)
218+
219+
if (!addresses) {
220+
return { notFound: true }
221+
}
222+
216223
// Fetch candidate data server-side
217224
let initialData: CandidateGroup | undefined
218225
try {
@@ -233,8 +240,10 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
233240

234241
return {
235242
props: {
243+
addresses,
236244
candidateId,
237245
initialData: initialData || null,
246+
chainId: validChain.id,
238247
},
239248
}
240249
}

0 commit comments

Comments
 (0)