This repository has been archived on 2026-07-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
cloud-reader/mobile/src/screens/SettingsScreen.tsx
T
crisleo94 22ded87250 feat: implement mobile reader
- implement mobile epub reader
2026-06-20 13:33:44 -05:00

91 lines
2.1 KiB
TypeScript

import { type ReactNode } from "react";
import {
View,
Text,
TouchableOpacity,
StyleSheet,
Alert,
} from "react-native";
import { useAuth } from "../context/AuthContext";
export default function SettingsScreen(): ReactNode {
const { user, logout } = useAuth();
const handleLogout = () => {
Alert.alert("Logout", "Are you sure you want to sign out?", [
{ text: "Cancel", style: "cancel" },
{ text: "Sign Out", style: "destructive", onPress: logout },
]);
};
return (
<View style={styles.container}>
<View style={styles.section}>
<Text style={styles.sectionTitle}>Account</Text>
<View style={styles.infoRow}>
<Text style={styles.label}>Username</Text>
<Text style={styles.value}>{user?.username ?? "—"}</Text>
</View>
<View style={styles.infoRow}>
<Text style={styles.label}>Email</Text>
<Text style={styles.value}>{user?.email ?? "—"}</Text>
</View>
</View>
<TouchableOpacity style={styles.logoutButton} onPress={handleLogout}>
<Text style={styles.logoutText}>Sign Out</Text>
</TouchableOpacity>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#0f0f23",
padding: 16,
},
section: {
backgroundColor: "#1a1a2e",
borderRadius: 12,
padding: 16,
marginBottom: 24,
borderWidth: 1,
borderColor: "#333",
},
sectionTitle: {
fontSize: 18,
fontWeight: "600",
color: "#fff",
marginBottom: 16,
},
infoRow: {
flexDirection: "row",
justifyContent: "space-between",
paddingVertical: 12,
borderBottomWidth: 1,
borderBottomColor: "#333",
},
label: {
fontSize: 14,
color: "#888",
},
value: {
fontSize: 14,
color: "#fff",
fontWeight: "500",
},
logoutButton: {
backgroundColor: "rgba(255, 69, 58, 0.15)",
borderRadius: 8,
padding: 16,
alignItems: "center",
borderWidth: 1,
borderColor: "rgba(255, 69, 58, 0.3)",
},
logoutText: {
color: "#ff453a",
fontSize: 16,
fontWeight: "600",
},
});