-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into rohan/lightbox-test
- Loading branch information
Showing
46 changed files
with
1,311 additions
and
142 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 34 additions & 5 deletions
39
apps/mobile/src/components/Mint/MintCampaign/MintCampaignBottomSheet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
import { MCHX_CLAIM_CODE_KEY } from 'src/constants/storageKeys'; | ||
import { useMemo } from 'react'; | ||
import usePersistedState from 'src/hooks/usePersistedState'; | ||
|
||
import { useSanityDataContext } from '~/contexts/SanityDataContext'; | ||
|
||
import MintCampaignPostTransaction from './MintCampaignPostTransaction'; | ||
import MintCampaignPreTransaction from './MintCampaignPreTransaction'; | ||
|
||
export default function MintCampaignBottomSheet({ onClose }: { onClose: () => void }) { | ||
type Props = { | ||
onClose?: () => void; | ||
projectInternalId: string; | ||
}; | ||
|
||
export default function MintCampaignBottomSheet({ onClose, projectInternalId }: Props) { | ||
// claimCode is the identifer used to poll for the status of the mint | ||
// Once we kick off the mint, the backend returns a claim code from Highlight that we can use to check the status of the mint | ||
|
||
const [claimCode, setClaimCode] = usePersistedState(MCHX_CLAIM_CODE_KEY, ''); | ||
const [claimCode, setClaimCode] = usePersistedState(`${projectInternalId}_claim_code`, ''); | ||
|
||
const { data } = useSanityDataContext(); | ||
const projectData = useMemo(() => { | ||
return data?.mintProjects.find((document) => document.internalId === projectInternalId); | ||
}, [data, projectInternalId]); | ||
|
||
if (!projectData) { | ||
// TODO decide best way to handle missing data | ||
return null; | ||
} | ||
|
||
if (claimCode) { | ||
return <MintCampaignPostTransaction claimCode={claimCode} onClose={onClose} />; | ||
return ( | ||
<MintCampaignPostTransaction | ||
claimCode={claimCode} | ||
onClose={onClose} | ||
projectData={projectData} | ||
/> | ||
); | ||
} | ||
|
||
return <MintCampaignPreTransaction setClaimCode={setClaimCode} />; | ||
return ( | ||
<MintCampaignPreTransaction | ||
setClaimCode={setClaimCode} | ||
projectInternalId={projectInternalId} | ||
projectData={projectData} | ||
/> | ||
); | ||
} |
Oops, something went wrong.