Skip to content

Commit

Permalink
add remaining functionality to thank you modal
Browse files Browse the repository at this point in the history
  • Loading branch information
zielvna committed Sep 5, 2024
1 parent caef90d commit cca65f8
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const Footer = () => {
title='Twitter'
placement='top'
TransitionComponent={FooterTransition}>
<a href={social.twitter} className={classes.footerLink} target='_blank'>
<a href={social.x} className={classes.footerLink} target='_blank'>
<img className={classes.icon} src={icons.TwitterIcon} alt={'twitter icon'} />
</a>
</Tooltip>
Expand Down
58 changes: 36 additions & 22 deletions src/components/Modals/ThankYouModal/ThankYouModal.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,53 @@
import { Box, Button, Typography } from '@material-ui/core'
import useStyles from './style'
import icons from '@static/icons'
import { social } from '@static/links'

export const ThankYouModal: React.FC = () => {
interface Props {
hideModal: () => void
}

export const ThankYouModal: React.FC<Props> = ({ hideModal }) => {
const classes = useStyles()

return (
<>
<Box className={classes.background}></Box>
<Box className={classes.container}>
{/* @ts-expect-error */}
<Box display='flex' flexDirection='column' alignItems='center' sx={{ gap: 16 }}>
<Typography className={classes.title}>Thank you</Typography>
<Typography className={classes.lowerTitle}>
for using Invariant Faucet on Eclipse!
<Box className={classes.gradient}>
<img className={classes.eclipseIcon} src={icons.eclipse} alt='Eclipse icon' />
{/* @ts-expect-error */}
<Box display='flex' flexDirection='column' alignItems='center' sx={{ gap: 16 }}>
<Typography className={classes.title}>Thank you</Typography>
<Typography className={classes.lowerTitle}>
for using Invariant Faucet on Eclipse!
</Typography>
</Box>
<Typography className={classes.description}>
We are building much more on Eclipse right now! 👀 <br />
To stay updated, follow us on our social media.
</Typography>
</Box>
<Typography className={classes.description}>
We are building much more on Eclipse right now! 👀 <br />
To stay updated, follow us on our social media.
</Typography>
{/* @ts-expect-error */}
<Box display='flex' flexDirection='column' alignItems='center' sx={{ gap: 16 }}>
<Typography className={classes.lowerTitle}>Join us here!</Typography>
{/* @ts-expect-error */}
<Box display='flex' sx={{ gap: 24 }}>
<img src={icons.circleDiscord} alt='Discord in circle icon' />
<img src={icons.circleTelegram} alt='Telegram in circle icon' />
<Box display='flex' flexDirection='column' alignItems='center' sx={{ gap: 16 }}>
<Typography className={classes.lowerTitle}>Join us here!</Typography>
{/* @ts-expect-error */}
<Box display='flex' sx={{ gap: 24 }}>
<a href={social.discord} target='_blank'>
<img src={icons.circleDiscord} alt='Discord in circle icon' />
</a>
<a href={social.telegram} target='_blank'>
<img src={icons.circleTelegram} alt='Telegram in circle icon' />
</a>
</Box>
<Typography className={classes.description}>and don't forget to</Typography>
<Button className={classes.button} onClick={() => window.open(social.x, '_blank')}>
Follow us on X!
</Button>
</Box>
<Typography className={classes.description}>and don't forget to</Typography>
<Button className={classes.button}>Follow us on X!</Button>
<Button className={classes.transparentButton} disableRipple onClick={hideModal}>
Close
</Button>
</Box>
<Button className={classes.transparentButton} disableRipple>
Close
</Button>
</Box>
</>
)
Expand Down
25 changes: 19 additions & 6 deletions src/components/Modals/ThankYouModal/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ const useStyles = makeStyles(() => ({
opacity: 0.7
},
container: {
width: 480,
padding: 32,
width: 544,
borderRadius: 24,
background: colors.invariant.component,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
gap: 32,
position: 'absolute',
top: '50%',
left: '50%',
Expand Down Expand Up @@ -75,6 +70,24 @@ const useStyles = makeStyles(() => ({
textDecoration: 'underline',
color: colors.white.main
}
},
eclipseIcon: {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
zIndex: -1,
opacity: 0.1
},
gradient: {
borderRadius: 24,
padding: 32,
background:
'radial-gradient(circle at top, rgba(239, 132, 245, 0.25), rgba(239, 132, 245, 0)), radial-gradient(circle at bottom, rgba(46, 224, 154, 0.25), rgba(46, 224, 154, 0))',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
gap: 32
}
}))

Expand Down
10 changes: 8 additions & 2 deletions src/containers/HeaderWrapper/HeaderWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useDispatch, useSelector } from 'react-redux'
import { useLocation } from 'react-router-dom'
import { NetworkType, EclipseNetworks } from '@consts/static'
import { actions as walletActions, Status } from '@reducers/solanaWallet'
import { address, status } from '@selectors/solanaWallet'
import { address, status, thankYouModalShown } from '@selectors/solanaWallet'
import { actions } from '@reducers/solanaConnection'
import { network, rpcAddress } from '@selectors/solanaConnection'
import { nightlyConnectAdapter, openWalletSelectorModal } from '@web3/selector'
Expand Down Expand Up @@ -45,9 +45,15 @@ export const HeaderWrapper: React.FC = () => {
return lastRPC === null ? EclipseNetworks.MAIN : lastRPC
}, [])

const isThankYouModalShown = useSelector(thankYouModalShown)

const hideThankYouModal = () => {
dispatch(walletActions.showThankYouModal(false))
}

return (
<>
<ThankYouModal />
{isThankYouModalShown && <ThankYouModal hideModal={hideThankYouModal} />}
<Header
address={walletAddress}
onNetworkSelect={(network, rpcAddress, rpcName) => {
Expand Down
4 changes: 3 additions & 1 deletion src/static/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import docsIcon from './svg/docsCircle.svg'
import closeSmallIcon from './svg/closeSmall.svg'
import circleDiscord from './svg/circle-discord.svg'
import circleTelegram from './svg/circle-telegram.svg'
import eclipse from './svg/eclipse.svg'

const icons: { [key: string]: string } = {
USDT: USDIcon,
Expand Down Expand Up @@ -68,7 +69,8 @@ const icons: { [key: string]: string } = {
closeSmallIcon: closeSmallIcon,
docsIcon,
circleDiscord,
circleTelegram
circleTelegram,
eclipse
}

export default icons
2 changes: 1 addition & 1 deletion src/static/links.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const social = {
twitter: 'https://twitter.com/invariant_labs',
x: 'https://twitter.com/invariant_labs',
github: 'https://github.com/invariant-labs',
discord: 'https://discord.gg/w6hTeWTJvG',
telegram: 'https://t.me/+-C9-e6L08AY4YWI0',
Expand Down
4 changes: 4 additions & 0 deletions src/static/svg/eclipse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions src/store/reducers/solanaWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ export interface ISolanaWallet {
balance: BN
accounts: { [key in string]: ITokenAccount }
balanceLoading: boolean
thankYouModalShown: boolean
}

export const defaultState: ISolanaWallet = {
status: Status.Uninitialized,
address: DEFAULT_PUBLICKEY,
balance: new BN(0),
accounts: {},
balanceLoading: false
balanceLoading: false,
thankYouModalShown: false
}

export const solanaWalletSliceName = 'solanaWallet'
Expand Down Expand Up @@ -94,7 +96,11 @@ const solanaWalletSlice = createSlice({
rescanTokens() {},
airdrop() {},
connect() {},
disconnect() {}
disconnect() {},
showThankYouModal(state, action: PayloadAction<boolean>) {
state.thankYouModalShown = action.payload
return state
}
}
})
interface IsetTokenBalance {
Expand Down
2 changes: 2 additions & 0 deletions src/store/sagas/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ export function* handleAirdrop(): Generator {
return
}

yield* put(actions.showThankYouModal(true))

const loaderKey = createLoaderKey()
yield put(
snackbarsActions.add({
Expand Down
19 changes: 11 additions & 8 deletions src/store/selectors/solanaWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import {

const store = (s: AnyProps) => s[solanaWalletSliceName] as ISolanaWallet

export const { address, balance, accounts, status, balanceLoading } = keySelectors(store, [
'address',
'balance',
'accounts',
'status',
'balanceLoading'
])
export const { address, balance, accounts, status, balanceLoading, thankYouModalShown } =
keySelectors(store, [
'address',
'balance',
'accounts',
'status',
'balanceLoading',
'thankYouModalShown'
])

export const tokenBalance = (tokenAddress: PublicKey) =>
createSelector(accounts, tokensAccounts => {
Expand Down Expand Up @@ -132,6 +134,7 @@ export const solanaWalletSelectors = {
accounts,
status,
tokenAccount,
balanceLoading
balanceLoading,
thankYouModalShown
}
export default solanaWalletSelectors

0 comments on commit cca65f8

Please sign in to comment.