generated from stacks-network/.github
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
107 additions
and
14 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,91 @@ | ||
import { | ||
ModalBody, | ||
ModalCloseButton, | ||
ModalContent, | ||
ModalFooter, | ||
ModalOverlay, | ||
Stack, | ||
} from '@chakra-ui/react'; | ||
import { ArrowUpRight } from '@phosphor-icons/react'; | ||
import { useQueryClient } from '@tanstack/react-query'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
import { Icon } from '../../..//ui/Icon'; | ||
import { ButtonLink } from '../../../ui/ButtonLink'; | ||
import { Flex } from '../../../ui/Flex'; | ||
import { Image } from '../../../ui/Image'; | ||
import { Modal } from '../../../ui/Modal'; | ||
import { Text } from '../../../ui/Text'; | ||
import { TextLink } from '../../../ui/TextLink'; | ||
|
||
export function SBTCModal() { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
useEffect(() => { | ||
const sbtcModalShown = localStorage.getItem('sbtcModalShown'); | ||
try { | ||
const dismissQueryParam = new URLSearchParams(window.location.search).get('dismiss'); | ||
// to run performance testing without the modal | ||
if (dismissQueryParam === 'sbtc') { | ||
return; | ||
} | ||
} catch (e) {} | ||
if (!sbtcModalShown || sbtcModalShown === 'false') { | ||
setIsOpen(true); | ||
} | ||
}, []); | ||
|
||
const handleClose = () => { | ||
localStorage.setItem('sbtcModalShown', 'true'); | ||
setIsOpen(false); | ||
}; | ||
|
||
const queryClient = useQueryClient(); | ||
|
||
return ( | ||
<Modal title={'sBTC'} isOpen={isOpen} onClose={() => handleClose()}> | ||
<ModalOverlay /> | ||
<ModalContent width={'762px'} maxWidth={'full'}> | ||
<ModalCloseButton | ||
_focus={{ | ||
boxShadow: 'none', | ||
}} | ||
/> | ||
<ModalBody pt={12}> | ||
<Stack alignItems={'center'} gap={6}> | ||
<Text fontSize={'4xl'} textAlign={'center'}> | ||
✨ sBTC is here ✨ | ||
</Text> | ||
<Image src={'/sbtc.png'} alt={'sBTC'} /> | ||
<Text>sBTC is live! You can now put your Bitcoin to work in DeFi apps.</Text> | ||
<ButtonLink | ||
variant={'primary'} | ||
href={'https://app.stacks.co/'} | ||
onClick={() => { | ||
handleClose(); | ||
void queryClient.clear(); | ||
}} | ||
_hover={{ textDecoration: 'none' }} | ||
bg="accent.stacks-500" | ||
> | ||
Mint sBTC | ||
</ButtonLink> | ||
<ModalFooter borderTop={'1px'} width={'full'} justifyContent={'center'}> | ||
<Flex alignItems="center" gap={1}> | ||
<TextLink | ||
color="accent.stacks-500" | ||
href={'https://www.stacks.co/sbtc'} | ||
fontSize={'sm'} | ||
target={'_blank'} | ||
> | ||
Learn more about sBTC | ||
</TextLink> | ||
<Icon as={ArrowUpRight} size={3} color="accent.stacks-500" /> | ||
</Flex> | ||
</ModalFooter> | ||
</Stack> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
} |