-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathprofile.tsx
More file actions
51 lines (46 loc) · 1.52 KB
/
profile.tsx
File metadata and controls
51 lines (46 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { StyleSheet, Text, View } from "react-native";
import { useAuth } from "@/lib/auth";
import { useRouter } from "expo-router";
export default function ProfileScreen() {
const { isAuthenticated, address, signOut } = useAuth();
const router = useRouter();
if (!isAuthenticated) {
return (
<View style={styles.center}>
<Text style={styles.subtitle}>Sign in to view your profile</Text>
<Text style={styles.link} onPress={() => router.push("/(auth)/login")}>
Sign In
</Text>
</View>
);
}
return (
<View style={styles.container}>
<View style={styles.section}>
<Text style={styles.label}>Address</Text>
<Text style={styles.value} selectable>
{address}
</Text>
</View>
<Text
style={styles.signOut}
onPress={async () => {
await signOut();
router.replace("/");
}}
>
Sign Out
</Text>
</View>
);
}
const styles = StyleSheet.create({
container: { flex: 1, backgroundColor: "#fff", padding: 20 },
center: { flex: 1, alignItems: "center", justifyContent: "center", padding: 20 },
section: { marginBottom: 24 },
label: { fontSize: 13, color: "#6b7280", marginBottom: 4, textTransform: "uppercase" },
value: { fontSize: 15, fontFamily: "monospace" },
subtitle: { fontSize: 16, color: "#6b7280" },
link: { fontSize: 16, color: "#16a34a", marginTop: 16, fontWeight: "600" },
signOut: { fontSize: 16, color: "#ef4444", marginTop: 32, fontWeight: "600" },
});