Skip to content

Commit

Permalink
hardcode project data for dream dao v2 (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraeth-eth authored Nov 23, 2023
1 parent 54ddd28 commit 120bd9e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 19 additions & 1 deletion src/hooks/useJbProject.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useJBProjectMetadata } from '@/contexts/ProjectMetadata'
import { DREAM_DAO } from '@/lib/backend/static/projects'
import { useProjectsQuery } from '@/lib/graphql/hooks'
import {
Ether,
Expand Down Expand Up @@ -90,6 +91,13 @@ export const useJbProject = ({
])

const softTarget = useMemo(() => {
// TODO: Remove this once DREAM DAO has rectified metadata
if (projectId === DREAM_DAO) {
return {
amount: Ether.parse('50000', 18).val,
currency: JB_CURRENCIES.USD,
}
}
if (metadata.softTargetAmount) {
return {
amount: Ether.parse(metadata.softTargetAmount, 0).val,
Expand All @@ -102,7 +110,7 @@ export const useJbProject = ({
amount: 0n,
currency: JB_CURRENCIES.USD,
}
}, [metadata.softTargetAmount, metadata.softTargetCurrency])
}, [metadata.softTargetAmount, metadata.softTargetCurrency, projectId])

const endDate = useMemo(() => {
if (!fundingCycleData.data) return undefined
Expand All @@ -114,9 +122,19 @@ export const useJbProject = ({
return new Date((start + duration) * 1000)
}, [fundingCycleData.data])

const introVideoUrl = useMemo(() => {
// TODO: Remove this once DREAM DAO has rectified metadata
if (projectId === DREAM_DAO) {
return 'https://www.youtube.com/watch?v=r603LXdSQjY'
}

return metadata.introVideoUrl
}, [metadata.introVideoUrl, projectId])

return {
...(pick(_graphqlProject, ['handle', 'contributorsCount']) ?? {}),
...metadata,
introVideoUrl,
softTarget,
endDate,
socialLinks,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/backend/static/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ interface ProjectPageProps {
projectId: number
}

const DREAM_DAO = 600
export const DREAM_DAO = 600n

const ALLOWLIST_PROJECT_IDS = [
/**
* DREAM DAO is required for hard code due to a bug in juicebox that
* accidentally wiped out its domain metadata.
*/
DREAM_DAO,
Number(DREAM_DAO),
]

const getStaticPaths: GetStaticPaths = async () => {
Expand Down

1 comment on commit 120bd9e

@vercel
Copy link

@vercel vercel bot commented on 120bd9e Nov 23, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.