import React from 'react';
import {
Alert,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native';
import { useColorScheme } from '../../hooks/use-color-scheme';
import { useAuth } from '../../src/context/AuthContext';
import { useRouter } from 'expo-router';
import Constants from 'expo-constants';
export default function SettingsScreen() {
const { user, serverAddress, logout } = useAuth();
const router = useRouter();
const colorScheme = useColorScheme() ?? 'light';
const isDark = colorScheme === 'dark';
const bgColor = isDark ? '#0b0b0d' : '#f5f5f5';
const sectionBg = isDark ? '#1c1c1e' : '#fff';
const sectionTitleBg = isDark ? '#111111' : '#f9f9f9';
const textColor = isDark ? '#fff' : '#333';
const subTextColor = isDark ? '#c6c6c8' : '#666';
const primary = isDark ? '#0A84FF' : '#007AFF';
const destructiveColor = '#f44336';
const handleLogout = () => {
Alert.alert('Logout', 'Are you sure you want to logout?', [
{ text: 'Cancel', style: 'cancel' },
{
text: 'Logout',
style: 'destructive',
onPress: async () => {
await logout();
router.replace('/login');
},
},
]);
};
const SettingItem = ({
label,
value,
onPress,
}: {
label: string;
value?: string;
onPress?: () => void;
}) => (
{label}
{value}
);
const ActionButton = ({
title,
onPress,
destructive = false,
}: {
title: string;
onPress: () => void;
destructive?: boolean;
}) => (
{title}
);
return (
Information
Actions
UpSnap Mobile App
Connect to your UpSnap server
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f5f5f5',
},
content: {
padding: 20,
},
section: {
backgroundColor: '#fff',
borderRadius: 12,
marginBottom: 20,
overflow: 'hidden',
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 4,
elevation: 3,
},
sectionTitle: {
fontSize: 14,
fontWeight: 'bold',
color: '#666',
paddingHorizontal: 15,
paddingTop: 15,
paddingBottom: 10,
backgroundColor: '#f9f9f9',
borderTopLeftRadius: 12,
borderTopRightRadius: 12,
},
settingItem: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
paddingHorizontal: 15,
paddingVertical: 15,
borderBottomWidth: 1,
borderBottomColor: '#f0f0f0',
},
settingLabel: {
fontSize: 16,
color: '#333',
flex: 1,
},
settingValueContainer: {
flex: 1,
alignItems: 'flex-end',
},
settingValue: {
fontSize: 14,
color: '#666',
maxWidth: 200,
},
actionButton: {
backgroundColor: '#007AFF',
margin: 15,
padding: 15,
borderRadius: 8,
alignItems: 'center',
},
actionButtonDestructive: {
backgroundColor: '#f44336',
},
actionButtonText: {
color: '#fff',
fontSize: 16,
fontWeight: 'bold',
},
actionButtonTextDestructive: {
color: '#fff',
},
footer: {
alignItems: 'center',
paddingVertical: 30,
},
footerText: {
fontSize: 14,
color: '#999',
marginBottom: 5,
},
});