Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Commit c5f581d

Browse files
committed
Add login screen
1 parent 9a97503 commit c5f581d

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

app/(public)/login.tsx

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
import { useAuth } from '@state/AuthProvider'
2+
import { useQuery } from '@tanstack/react-query'
3+
import { Link } from 'expo-router'
4+
import { useEffect, useState } from 'react'
5+
import { ActivityIndicator, StyleSheet } from 'react-native'
6+
import { SafeAreaView } from 'react-native-safe-area-context'
7+
import { getLoginOnboardingState } from 'src/requests'
8+
import { BUILD_VERSION } from 'src/utils'
9+
import { Button, Input, Separator, Text, View, XStack, YStack } from 'tamagui'
10+
11+
export default function Home() {
12+
const [loading, setLoading] = useState(true)
13+
const { isLoading } = useAuth()
14+
15+
useEffect(() => {
16+
const timer = setTimeout(() => {
17+
setLoading(false)
18+
}, 2000)
19+
20+
return () => clearTimeout(timer)
21+
}, [])
22+
23+
const { isPending, isError, data, error } = useQuery({
24+
queryKey: ['onboarding'],
25+
queryFn: getLoginOnboardingState,
26+
})
27+
28+
if (isPending || isLoading || loading) {
29+
return (
30+
<View flexGrow={1} justifyContent="center" alignItems="center" style={styles.root}>
31+
<ActivityIndicator />
32+
</View>
33+
)
34+
}
35+
36+
if (isError) {
37+
return (
38+
<SafeAreaView style={styles.root} edges={['right', 'left', 'top']}>
39+
<Text>Error: {error.message}</Text>
40+
</SafeAreaView>
41+
)
42+
}
43+
44+
return (
45+
<SafeAreaView style={styles.root} edges={['bottom', 'left', 'right', 'top']}>
46+
<YStack style={{ padding: 20, flexGrow: 1 }} gap="$4">
47+
<View flexGrow={1}></View>
48+
49+
<XStack flexGrow={1} justifyContent="center">
50+
<Text fontSize="$9" fontWeight={'bold'} letterSpacing={-0.5}>
51+
Loops by Pixelfed
52+
</Text>
53+
</XStack>
54+
55+
<YStack>
56+
<Link href="/modal" asChild>
57+
<Button
58+
themeInverse={true}
59+
bg="black"
60+
color="white"
61+
size="$6"
62+
fontSize="$7"
63+
fontWeight="bold"
64+
>
65+
Login
66+
</Button>
67+
</Link>
68+
<XStack mt="$3" justifyContent="center">
69+
<Text
70+
allowFontScaling={false}
71+
fontSize={10}
72+
fontWeight={'bold'}
73+
color="rgba(0,0,0,0.2)"
74+
>
75+
v1.0.0.{BUILD_VERSION}
76+
</Text>
77+
</XStack>
78+
</YStack>
79+
</YStack>
80+
</SafeAreaView>
81+
)
82+
}
83+
84+
const styles = StyleSheet.create({
85+
root: {
86+
flex: 1,
87+
backgroundColor: '#ffe504',
88+
},
89+
container: {
90+
flexGrow: 1,
91+
},
92+
inner: {
93+
flexGrow: 1,
94+
gap: 10,
95+
justifyContent: 'space-around',
96+
},
97+
header: {
98+
fontSize: 36,
99+
marginBottom: 48,
100+
},
101+
textInput: {
102+
height: 40,
103+
borderColor: '#000000',
104+
borderBottomWidth: 1,
105+
marginBottom: 36,
106+
},
107+
btnContainer: {
108+
backgroundColor: 'white',
109+
marginTop: 12,
110+
},
111+
subTextLinks: {
112+
fontSize: 16,
113+
color: '#999',
114+
},
115+
resetPassword: {
116+
marginTop: -10,
117+
paddingRight: 10,
118+
fontSize: 16,
119+
fontWeight: 'bold',
120+
color: '#408DF6',
121+
},
122+
})

0 commit comments

Comments
 (0)