Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create soulname modal, lint fixes, walletconnect fix
- Loading branch information
Showing
15 changed files
with
465 additions
and
222 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { MasaLoading } from '../masa-loading'; | ||
|
||
export const ModalError = ({ | ||
subtitle, | ||
handleComplete, | ||
buttonText, | ||
isLoading, | ||
}: { | ||
subtitle: string; | ||
handleComplete: () => void; | ||
buttonText: string; | ||
isLoading?: boolean; | ||
}): JSX.Element => { | ||
if (isLoading) return <MasaLoading />; | ||
|
||
return ( | ||
<div className="interface-error-modal"> | ||
<h3 className="title">Whoops! 💸</h3> | ||
<p className="subtitle">{subtitle}</p> | ||
<button type="button" className="masa-button" onClick={handleComplete}> | ||
{buttonText} | ||
</button> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,152 @@ | ||
import { useAsync } from 'react-use'; | ||
import React, { useCallback, useMemo, useState } from 'react'; | ||
|
||
import { twitterLogo } from '../../../../assets/twitterLogo'; | ||
import { MasaLoading } from '../masa-loading'; | ||
import { useMasaClient } from '../../../masa-client/use-masa-client'; | ||
import { useSoulNames } from '../../../masa/use-soulnames'; | ||
import { useConfig } from '../../../base-provider'; | ||
import { Modal } from './modal'; | ||
|
||
export const ModalSuccess = ({ | ||
onFinish, | ||
}: { | ||
onFinish?: () => void; | ||
}): JSX.Element => { | ||
const [extension, setExtension] = useState<string>(); | ||
const { sdk: masa } = useMasaClient(); | ||
const { company } = useConfig(); | ||
const { soulnames, isLoadingSoulnames } = useSoulNames(); | ||
// const { masa, isLoading, setForcedPage, soulnames, company } = useMasa(); | ||
|
||
useAsync(async () => { | ||
setExtension(await masa?.contracts.instances.SoulNameContract.extension()); | ||
}, [masa]); | ||
|
||
const handleComplete = useCallback(() => { | ||
onFinish?.(); | ||
}, [onFinish]); | ||
|
||
const title = useMemo(() => { | ||
switch (company) { | ||
case 'Masa': { | ||
return 'You have claimed your .soul domain and your Soulbound Identity has been minted.'; | ||
} | ||
case 'Celo': { | ||
return 'You have claimed your .celo domain and your Prosperity Passport has been minted.'; | ||
} | ||
case 'Base': { | ||
return 'You have claimed your .base domain name. Welcome to Base Camp ⛺️'; | ||
} | ||
case 'Base Universe': { | ||
return 'You have claimed your Base Universe .bu domain name. Welcome to Base Universe.'; | ||
} | ||
case 'Brozo': { | ||
return 'You have claimed your Brozo .bro domain name. Welcome to the Brozo community!'; | ||
} | ||
default: { | ||
return 'You have claimed your .soul domain and your Soulbound Identity has been minted.'; | ||
} | ||
} | ||
}, [company]); | ||
|
||
const tweetContentLink = useMemo(() => { | ||
const companyUrlFormatted = company?.toLowerCase().replaceAll(' ', '-'); | ||
|
||
switch (company) { | ||
case 'Masa': { | ||
return 'https://app.masa.finance'; | ||
} | ||
case 'Celo': { | ||
if (soulnames && soulnames.length > 0) { | ||
return `https://raregems.io/celo/celo-domain-names/${ | ||
soulnames?.at(-1)?.tokenDetails.tokenId.toString() ?? '' | ||
}`; | ||
} | ||
|
||
return 'https://app.masa.finance'; | ||
} | ||
case 'Base': { | ||
return 'https://app.basecamp.global'; | ||
} | ||
case 'Base Universe': | ||
case 'Brozo': { | ||
return `https://masa.finance/sbts/${ | ||
companyUrlFormatted ?? '' | ||
}-soulname-token`; | ||
} | ||
default: { | ||
return 'https://app.masa.finance'; | ||
} | ||
} | ||
}, [soulnames, company]); | ||
|
||
const baseTwitterUrl = 'https://twitter.com/intent/tweet?text='; | ||
|
||
const twitterLink = useMemo(() => { | ||
switch (company) { | ||
case 'Masa': { | ||
return `https://twitter.com/intent/tweet?text=Just%20claimed%20my%20.soul%20domain!%20The%20process%20is%20super%20simple%2C%20and%205%2B%20character%20domains%20are%20free%20%F0%9F%A4%A9.%20Grab%20yours%20here%3A%20&url=${tweetContentLink}&hashtags=SoulboundIdentity,Masa`; | ||
} | ||
case 'Celo': { | ||
return `https://twitter.com/intent/tweet?text=Just%20claimed%20my%20.celo%20domain!%20The%20process%20is%20super%20simple%2C%20and%205%2B%20character%20domains%20are%20free%20%F0%9F%A4%A9.%20Grab%20yours%20here%3A%20&url=${tweetContentLink}&hashtags=ProsperityPassport,Celo,Masa`; | ||
} | ||
case 'Base': { | ||
return `https://twitter.com/intent/tweet?text=Just%20claimed%20my%20.base%20domain!%20The%20process%20is%20super%20simple%2C%20and%205%2B%20character%20domains%20are%20free%20%F0%9F%A4%A9.%20Grab%20yours%20here%3A%20&url=${tweetContentLink}&hashtags=Basecamp,Base,Masa`; | ||
} | ||
case 'Base Universe': { | ||
return `https://twitter.com/intent/tweet?text=Just%20claimed%20my%20Base%20Universe%20.bu%20domain%2C%20powered%20by%20%40getmasafi!%20The%20process%20is%20super%20simple%2C%20and%20domains%20are%20free%20on%20testnet%20%F0%9F%A4%A9%C2%A0Grab%20yours%20here%3A%20${tweetContentLink}%20%40UniverseOnBase%20%40BuildOnBase`; | ||
} | ||
case 'Brozo': { | ||
return ( | ||
baseTwitterUrl + | ||
encodeURIComponent( | ||
`Just claimed my @BrozoNFT .bro domain, powered by @getmasafi! The process is super simple. Mint your rare .bro domain before it’s taken: ${tweetContentLink} #Brozo #NFT` | ||
) | ||
); | ||
} | ||
default: { | ||
return `https://twitter.com/intent/tweet?text=Just%20claimed%20my%20.soul%20domain!%20The%20process%20is%20super%20simple%2C%20and%205%2B%20character%20domains%20are%20free%20%F0%9F%A4%A9.%20Grab%20yours%20here%3A%20&url=${tweetContentLink}&hashtags=SoulboundIdentity,Masa`; | ||
} | ||
} | ||
}, [company, tweetContentLink]); | ||
|
||
const buttonText = useMemo(() => { | ||
switch (company) { | ||
default: { | ||
return 'Go to dashboard'; | ||
} | ||
} | ||
}, [company]); | ||
|
||
if (isLoadingSoulnames) | ||
return ( | ||
<Modal> | ||
<MasaLoading />; | ||
</Modal> | ||
); | ||
|
||
return ( | ||
<Modal onClose={onFinish}> | ||
<div | ||
id="gtm_hurray_identity_minted" | ||
className="interface-create-identity" | ||
> | ||
<h3 className="title">Hurray! 🎉</h3> | ||
<p className="subtitle">{title}</p> | ||
<a | ||
className="tweet-domain" | ||
href={twitterLink} | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
<img src={twitterLogo} style={{ width: 40 }} alt="twitter" />{' '} | ||
{`Tweet your ${extension ?? ''} domain`} | ||
</a> | ||
<button className="masa-button" onClick={handleComplete} type="button"> | ||
{buttonText} | ||
</button> | ||
</div> | ||
</Modal> | ||
); | ||
}; |
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
38 changes: 19 additions & 19 deletions
38
src/refactor/ui/components/modals/create-identity/success-view.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,33 +1,33 @@ | ||
import React from 'react'; | ||
import { NiceModalHandler } from '@ebay/nice-modal-react'; | ||
import { twitterLogo } from '../../../../../assets/twitterLogo'; | ||
|
||
interface SuccessViewProps { | ||
titleText: string; | ||
twitterText: string | undefined; | ||
modal: any; | ||
modal: NiceModalHandler<Record<string, unknown>>; | ||
} | ||
|
||
const SuccessView = ({ | ||
titleText, | ||
twitterText, | ||
modal, | ||
}: SuccessViewProps): JSX.Element => { | ||
return ( | ||
<section | ||
id="gtm_hurray_identity_minted" | ||
className="interface-create-identity" | ||
> | ||
<h3 className="title">Hurray! 🎉</h3> | ||
<p className="subtitle">{titleText}</p> | ||
<a className="tweet-domain" target="_blank" rel="noreferrer"> | ||
<img src={twitterLogo} style={{ width: 40 }} alt="twitter" />{' '} | ||
{twitterText} | ||
</a> | ||
<button className="masa-button" onClick={() => modal.hide()}> | ||
Go to dashboard | ||
</button> | ||
</section> | ||
); | ||
}; | ||
}: SuccessViewProps): JSX.Element => ( | ||
<section | ||
id="gtm_hurray_identity_minted" | ||
className="interface-create-identity" | ||
> | ||
<h3 className="title">Hurray! 🎉</h3> | ||
<p className="subtitle">{titleText}</p> | ||
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} | ||
<a className="tweet-domain" target="_blank" rel="noreferrer"> | ||
<img src={twitterLogo} style={{ width: 40 }} alt="twitter" />{' '} | ||
{twitterText} | ||
</a> | ||
<button type="button" className="masa-button" onClick={() => modal.hide()}> | ||
Go to dashboard | ||
</button> | ||
</section> | ||
); | ||
|
||
export default SuccessView; |
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
Oops, something went wrong.