2022-05-18 11:08:08 -07:00
import React , { useEffect } from 'react' ;
2022-11-26 05:09:28 -08:00
import { FormattedMessage } from 'react-intl' ;
2022-05-11 17:54:23 -07:00
import { useDispatch } from 'react-redux' ;
2022-03-21 11:09:01 -07:00
import { Link } from 'react-router-dom' ;
2022-05-30 11:23:55 -07:00
import { logOut } from 'soapbox/actions/auth' ;
2022-05-18 11:08:08 -07:00
import { openModal } from 'soapbox/actions/modals' ;
2022-05-07 13:52:01 -07:00
import LandingGradient from 'soapbox/components/landing-gradient' ;
2022-05-11 17:54:23 -07:00
import SiteLogo from 'soapbox/components/site-logo' ;
2022-05-30 11:23:55 -07:00
import { Button , Stack , Text } from 'soapbox/components/ui' ;
2022-05-18 11:08:08 -07:00
import { useAppSelector , useOwnAccount } from 'soapbox/hooks' ;
2022-03-21 11:09:01 -07:00
2022-05-28 12:53:22 -07:00
const WaitlistPage = ( /* { account } */ ) = > {
2022-03-21 11:09:01 -07:00
const dispatch = useDispatch ( ) ;
2022-05-18 11:08:08 -07:00
const title = useAppSelector ( ( state ) = > state . instance . title ) ;
const me = useOwnAccount ( ) ;
2022-05-28 12:53:22 -07:00
const isSmsVerified = me ? . source . get ( 'sms_verified' ) ;
2022-03-21 11:09:01 -07:00
2022-05-28 12:53:22 -07:00
const onClickLogOut : React.MouseEventHandler = ( event ) = > {
2022-03-21 11:09:01 -07:00
event . preventDefault ( ) ;
2022-06-10 10:56:22 -07:00
dispatch ( logOut ( ) ) ;
2022-03-21 11:09:01 -07:00
} ;
2022-05-18 11:08:08 -07:00
const openVerifySmsModal = ( ) = > dispatch ( openModal ( 'VERIFY_SMS' ) ) ;
useEffect ( ( ) = > {
if ( ! isSmsVerified ) {
openVerifySmsModal ( ) ;
}
} , [ ] ) ;
2022-03-21 11:09:01 -07:00
return (
2022-05-07 13:52:01 -07:00
< div >
< LandingGradient / >
2022-03-21 11:09:01 -07:00
< main className = 'relative flex flex-col h-screen max-w-7xl mx-auto px-2 sm:px-6 lg:px-8' >
< header className = 'relative flex justify-between h-16' >
< div className = 'flex-1 flex items-stretch justify-center relative' >
< Link to = '/' className = 'cursor-pointer flex-shrink-0 flex items-center' >
2022-05-11 17:54:23 -07:00
< SiteLogo alt = 'Logo' className = 'h-7' / >
2022-03-21 11:09:01 -07:00
< / Link >
2022-11-25 09:04:11 -08:00
< div className = 'absolute inset-y-0 right-0 flex items-center pr-2' >
2022-04-19 12:37:48 -07:00
< Button onClick = { onClickLogOut } theme = 'primary' to = '/logout' >
2022-11-26 05:09:28 -08:00
< FormattedMessage id = 'navigation_bar.logout' defaultMessage = 'Logout' / >
2022-03-21 11:09:01 -07:00
< / Button >
< / div >
< / div >
< / header >
< div className = '-mt-16 flex flex-col justify-center items-center h-full' >
2022-05-18 11:08:08 -07:00
< div className = 'max-w-xl' >
2022-03-21 11:09:01 -07:00
< Stack space = { 4 } >
< img src = '/instance/images/waitlist.png' className = 'mx-auto w-32 h-32' alt = 'Waitlisted' / >
< Stack space = { 2 } >
< Text size = 'lg' theme = 'muted' align = 'center' weight = 'medium' >
2022-11-26 05:09:28 -08:00
< FormattedMessage
id = 'waitlist.body'
defaultMessage = 'Welcome back to {title}! You were previously placed on our waitlist. Please verify your phone number to receive immediate access to your account!'
values = { { title } }
/ >
2022-03-21 11:09:01 -07:00
< / Text >
2022-05-18 11:08:08 -07:00
< div className = 'text-center' >
2022-11-26 05:09:28 -08:00
< Button onClick = { openVerifySmsModal } theme = 'primary' >
< FormattedMessage id = 'waitlist.actions.verify_number' defaultMessage = 'Verify phone number' / >
< / Button >
2022-05-18 11:08:08 -07:00
< / div >
2022-03-21 11:09:01 -07:00
< / Stack >
< / Stack >
< / div >
< / div >
< / main >
< / div >
) ;
} ;
export default WaitlistPage ;