import {useEffect, useState} from 'react' import {Pressable, View} from 'react-native' import {ImageBackground} from 'expo-image' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {FocusGuards, FocusScope} from 'radix-ui/internal' import {useLoggedOutViewControls} from '#/state/shell/logged-out' import {Logo} from '#/view/icons/Logo' import {atoms as a, flatten, useBreakpoints, useTheme, web} from '#/alf' import {Button, ButtonText} from '#/components/Button' import {TimesLarge_Stroke2_Corner0_Rounded as XIcon} from '#/components/icons/Times' import {Text} from '#/components/Typography' import {useAnalytics} from '#/analytics' const welcomeModalBg = require('../../assets/images/welcome-modal-bg.webp') interface WelcomeModalProps { control: { isOpen: boolean open: () => void close: () => void } } export function WelcomeModal({control}: WelcomeModalProps) { const {_} = useLingui() const ax = useAnalytics() const {requestSwitchToAccount} = useLoggedOutViewControls() const {gtMobile} = useBreakpoints() const [isExiting, setIsExiting] = useState(false) const [signInLinkHovered, setSignInLinkHovered] = useState(false) const t = useTheme() const fadeOutAndClose = (callback?: () => void) => { setIsExiting(true) setTimeout(() => { control.close() if (callback) callback() }, 150) } useEffect(() => { if (control.isOpen) { ax.metric('welcomeModal:presented', {}) } // eslint-disable-next-line react-hooks/exhaustive-deps }, [control.isOpen]) const onPressCreateAccount = () => { ax.metric('welcomeModal:signupClicked', {}) control.close() requestSwitchToAccount({requestedAccount: 'new'}) } const onPressExplore = () => { ax.metric('welcomeModal:exploreClicked', {}) fadeOutAndClose() } const onPressSignIn = () => { ax.metric('welcomeModal:signinClicked', {}) control.close() requestSwitchToAccount({requestedAccount: 'existing'}) } FocusGuards.useFocusGuards() return ( Witchsky Real talk. {'\n'} Real creatures. {'\n'} Social media if it was good. Already have an account?{' '} setSignInLinkHovered(true)} onPointerLeave={() => setSignInLinkHovered(false)} accessibilityRole="button" accessibilityLabel={_(msg`Sign in`)} accessibilityHint=""> Sign in ) }