import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Alert, Switch, Linking } from 'react-native'
import { COLORS } from '../../constants/Config'
import { useAuth } from '../../hooks/useAuth'
import { useState } from 'react'
function MenuItem({ icon, label, value, onPress, danger, toggle, enabled, onToggle }:
{ icon: string; label: string; value?: string; onPress?: () => void; danger?: boolean
toggle?: boolean; enabled?: boolean; onToggle?: (v: boolean) => void }) {
return (
{icon}
{label}
{value && {value}}
{toggle
?
: ›
}
)
}
export default function SettingsScreen() {
const { user, logout } = useAuth()
const [pushEnabled, setPush] = useState(true)
const [darkMode, setDark] = useState(false)
const handleLogout = () => {
Alert.alert('로그아웃', '정말 로그아웃하시겠습니까?', [
{ text: '취소', style: 'cancel' },
{ text: '로그아웃', style: 'destructive', onPress: logout },
])
}
return (
{/* 프로필 카드 */}
{(user?.display_name ?? user?.username ?? 'U')[0].toUpperCase()}
{user?.display_name ?? user?.username}
{user?.role ?? '-'}
{user?.email && {user.email}}
{/* 서버 정보 */}
서버 연결
{/* 알림 설정 */}
알림
{/* 앱 설정 */}
앱 설정
{/* 지원 */}
지원
Linking.openURL('http://zioinfo.co.kr:8090')} />
Linking.openURL('https://zioinfo.co.kr:8443')} />
Linking.openURL('mailto:guardia@zioinfo.co.kr')} />
{/* 로그아웃 */}
)
}
const s = StyleSheet.create({
profile: { backgroundColor:COLORS.primary, padding:24,
flexDirection:'row', alignItems:'center', gap:16 },
avatar: { width:56, height:56, borderRadius:28,
backgroundColor:'rgba(255,255,255,.2)', justifyContent:'center', alignItems:'center' },
avatarText: { fontSize:24, fontWeight:'800', color:'#fff' },
displayName: { fontSize:18, fontWeight:'700', color:'#fff' },
role: { fontSize:12, color:'#aac4e8', marginTop:2 },
email: { fontSize:12, color:'#aac4e8' },
section: { backgroundColor:'#fff', marginHorizontal:0, marginTop:12 },
sectionTitle:{ fontSize:12, fontWeight:'600', color:COLORS.muted,
paddingHorizontal:16, paddingTop:14, paddingBottom:6,
textTransform:'uppercase', letterSpacing:.5 },
item: { flexDirection:'row', alignItems:'center', paddingHorizontal:16,
paddingVertical:14, borderBottomWidth:1, borderBottomColor:'#f1f5f9', gap:12 },
itemIcon: { fontSize:20, width:28, textAlign:'center' },
itemLabel: { fontSize:14, color:COLORS.text, fontWeight:'500' },
itemValue: { fontSize:12, color:COLORS.muted, marginTop:2 },
chevron: { fontSize:20, color:COLORS.muted },
})