/* eslint-disable @typescript-eslint/no-var-requires */ import React from 'react'; import { useNavigation } from '../Navigation'; import { View, Stack, Box, useToast, Column, useBreakpointValue, Image, Link, Center, Row, Heading, Icon, } from 'native-base'; import { FontAwesome5 } from '@expo/vector-icons'; import BigActionButton from '../components/BigActionButton'; import API, { APIError } from '../API'; import { setAccessToken } from '../state/UserSlice'; import { useDispatch } from '../state/Store'; import { Translate, translate } from '../i18n/i18n'; import useColorScheme from '../hooks/colorScheme'; import { useAssets } from 'expo-asset'; const handleGuestLogin = async (apiSetter: (accessToken: string) => void): Promise => { const apiAccess = await API.createAndGetGuestAccount(); apiSetter(apiAccess); return translate('loggedIn'); }; const StartPageView = () => { const navigation = useNavigation(); const screenSize = useBreakpointValue({ base: 'small', md: 'big' }); const isSmallScreen = screenSize === 'small'; const dispatch = useDispatch(); const colorScheme = useColorScheme(); const toast = useToast(); const [icon] = useAssets( colorScheme == 'light' ? require('../assets/icon_light.png') : require('../assets/icon_dark.png') ); const [loginBanner] = useAssets(require('../assets/auth/login_banner.png')); const [guestBanner] = useAssets(require('../assets/auth/guest_banner.png')); const [registerBanner] = useAssets(require('../assets/auth/register_banner.png')); return (
} size={isSmallScreen ? '5xl' : '6xl'} /> ChromaCase
navigation.navigate('Login')} // @ts-expect-error Raw CSS style={{ width: isSmallScreen ? '90%' : 'clamp(100px, 33.3%, 600px)', height: 300, margin: 'clamp(10px, 2%, 50px)', }} /> { try { handleGuestLogin((accessToken: string) => { dispatch(setAccessToken(accessToken)); }); } catch (error) { if (error instanceof APIError) { toast.show({ description: translate(error.userMessage) }); return; } toast.show({ description: error as string }); } }} // @ts-expect-error Raw CSS style={{ width: isSmallScreen ? '90%' : 'clamp(100px, 33.3%, 600px)', height: 300, margin: 'clamp(10px, 2%, 50px)', }} />
navigation.navigate('Signup')} // @ts-expect-error Raw CSS style={{ height: 150, width: isSmallScreen ? '90%' : 'clamp(150px, 50%, 600px)', }} />
); }; export default StartPageView;