Skip to content

Commit

Permalink
feat: sbtc modal
Browse files Browse the repository at this point in the history
  • Loading branch information
BLuEScioN committed Dec 18, 2024
1 parent 7f19f04 commit 65697a1
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 14 deletions.
Binary file added public/sbtc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/app/_components/PageWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import { SBTCModal } from '@/common/components/modals/SBTCModal';
import { useColorModeValue } from '@chakra-ui/react';
import styled from '@emotion/styled';
import { ReactNode } from 'react';
Expand Down Expand Up @@ -77,7 +78,8 @@ export function PageWrapper({
<IncidentsStatusBarWithErrorBoundary />
<CMSStatusBars statusBarContent={statusBarContent} />
</Flex>
<NakamotoModal />
{/* <NakamotoModal /> */}
<SBTCModal />
<WrapperWithBg>
<Flex
mx="auto"
Expand Down
26 changes: 13 additions & 13 deletions src/common/components/modals/Nakamoto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ import { TextLink } from '../../../ui/TextLink';
export function NakamotoModal() {
const [isOpen, setIsOpen] = useState(false);

// useEffect(() => {
// const nakamotoModalShown = localStorage.getItem('nakamoto3MainnetModalShown');
// try {
// const dismissQueryParam = new URLSearchParams(window.location.search).get('dismiss');
// // to run performance testing without the modal
// if (dismissQueryParam === 'nakamoto') {
// return;
// }
// } catch (e) {}
// if (!nakamotoModalShown || nakamotoModalShown === 'false') {
// setIsOpen(true);
// }
// }, []);
useEffect(() => {
const nakamotoModalShown = localStorage.getItem('nakamoto3MainnetModalShown');
try {
const dismissQueryParam = new URLSearchParams(window.location.search).get('dismiss');
// to run performance testing without the modal
if (dismissQueryParam === 'nakamoto') {
return;
}
} catch (e) {}
if (!nakamotoModalShown || nakamotoModalShown === 'false') {
setIsOpen(true);
}
}, []);

const handleClose = () => {
localStorage.setItem('nakamoto3MainnetModalShown', 'true');
Expand Down
91 changes: 91 additions & 0 deletions src/common/components/modals/SBTCModal.tsx
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>
);
}

0 comments on commit 65697a1

Please sign in to comment.