guardia-messenger/app/(tabs)/settings.tsx
DESKTOP-TKLFCPRython f29f525c77 refactor: 101.79.17.164 → zioinfo.co.kr 전체 도메인 변환 + Manager UI 배포
- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스)
- Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포
- 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:09:17 +09:00

116 lines
5.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 (
<TouchableOpacity style={s.item} onPress={onPress} disabled={toggle}>
<Text style={s.itemIcon}>{icon}</Text>
<View style={{ flex: 1 }}>
<Text style={[s.itemLabel, danger && { color: COLORS.danger }]}>{label}</Text>
{value && <Text style={s.itemValue}>{value}</Text>}
</View>
{toggle
? <Switch value={enabled} onValueChange={onToggle} trackColor={{ true: COLORS.accent }} />
: <Text style={s.chevron}></Text>
}
</TouchableOpacity>
)
}
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 (
<ScrollView style={{ flex: 1, backgroundColor: COLORS.bg }}>
{/* 프로필 카드 */}
<View style={s.profile}>
<View style={s.avatar}>
<Text style={s.avatarText}>{(user?.display_name ?? user?.username ?? 'U')[0].toUpperCase()}</Text>
</View>
<View>
<Text style={s.displayName}>{user?.display_name ?? user?.username}</Text>
<Text style={s.role}>{user?.role ?? '-'}</Text>
{user?.email && <Text style={s.email}>{user.email}</Text>}
</View>
</View>
{/* 서버 정보 */}
<View style={s.section}>
<Text style={s.sectionTitle}> </Text>
<MenuItem icon="🌐" label="GUARDiA 서버" value="zioinfo.co.kr:8443" />
<MenuItem icon="🔒" label="HTTPS 보안 연결" value="TLS 1.3" />
<MenuItem icon="📊" label="API 버전" value="v2.0.0" />
</View>
{/* 알림 설정 */}
<View style={s.section}>
<Text style={s.sectionTitle}></Text>
<MenuItem icon="🔔" label="푸시 알림" toggle enabled={pushEnabled} onToggle={setPush} />
<MenuItem icon="🚨" label="긴급 알림 (인시던트)" toggle enabled={true} onToggle={() => {}} />
<MenuItem icon="📋" label="SR 상태 알림" toggle enabled={true} onToggle={() => {}} />
</View>
{/* 앱 설정 */}
<View style={s.section}>
<Text style={s.sectionTitle}> </Text>
<MenuItem icon="🌙" label="다크 모드" toggle enabled={darkMode} onToggle={setDark} />
<MenuItem icon="🌍" label="언어" value="한국어" />
<MenuItem icon="📱" label="앱 버전" value="1.0.0 (build 1)" />
</View>
{/* 지원 */}
<View style={s.section}>
<Text style={s.sectionTitle}></Text>
<MenuItem icon="📖" label="사용 가이드"
onPress={() => Linking.openURL('http://zioinfo.co.kr:8090')} />
<MenuItem icon="🛡️" label="GUARDiA ITSM 웹"
onPress={() => Linking.openURL('https://zioinfo.co.kr:8443')} />
<MenuItem icon="📧" label="문의하기"
onPress={() => Linking.openURL('mailto:guardia@zioinfo.co.kr')} />
<MenuItem icon="🏢" label="(주)지오정보기술" value="zioinfo.co.kr" />
</View>
{/* 로그아웃 */}
<View style={s.section}>
<MenuItem icon="🚪" label="로그아웃" onPress={handleLogout} danger />
</View>
<View style={{ height: 32 }} />
</ScrollView>
)
}
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 },
})