import { StatusBar } from 'expo-status-bar'; import { useState } from 'react'; import { StyleSheet, Text, View, TextInput, TouchableOpacity, ScrollView, Switch, } from 'react-native'; import { DEFAULT_GATEWAY_CONFIG } from '@yuzu-gca/shared'; /** U-001: Settings Page for Yuzu GCA Android Client */ export default function App() { const [tab, setTab] = useState<'settings' | 'device' | 'connection'>('settings'); // Settings state const [gatewayUrl, setGatewayUrl] = useState(DEFAULT_GATEWAY_CONFIG.url); const [deviceName, setDeviceName] = useState('Android Device'); const [autoConnect, setAutoConnect] = useState(true); const [heartbeatInterval, setHeartbeatInterval] = useState(String(DEFAULT_GATEWAY_CONFIG.heartbeatInterval / 1000)); const [logLevel, setLogLevel] = useState('info'); // Connection state const [connStatus, setConnStatus] = useState<'disconnected' | 'connecting' | 'connected' | 'error'>('disconnected'); return ( {/* Header */} Yuzu GCA Settings {/* Tabs */} {(['settings', 'device', 'connection'] as const).map(t => ( setTab(t)} style={[styles.tab, tab === t && styles.tabActive]}> {t === 'settings' ? 'Gateway' : t === 'device' ? 'Device' : 'Connection'} ))} {tab === 'settings' && ( <> {/* Gateway URL */} Gateway URL {/* Heartbeat Interval */} Heartbeat (seconds) {/* Auto-connect */} Auto-connect on start {/* Log Level */} Log Level {(['debug', 'info', 'warn', 'error'] as const).map(lv => ( setLogLevel(lv)} > {lv} ))} )} {tab === 'device' && ( <> Device Name Device Info Platform: Android MCP Server: {gatewayUrl ? 'Configured' : 'Not configured'} Capabilities: 36 tools (7 implemented) )} {tab === 'connection' && ( <> {connStatus === 'connected' ? '🟢 Connected' : connStatus === 'connecting' ? '🟡 Connecting...' : connStatus === 'error' ? '🔴 Error' : '⚫ Disconnected'} setConnStatus(connStatus === 'disconnected' ? 'connecting' : 'disconnected')} > {connStatus === 'disconnected' ? 'Connect' : 'Disconnect'} )} ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#0f172a', paddingTop: 48 }, title: { fontSize: 28, fontWeight: '800', color: '#e2e8f0', textAlign: 'center' }, subtitle: { fontSize: 12, color: '#64748b', textAlign: 'center', marginBottom: 16 }, tabBar: { flexDirection: 'row', marginHorizontal: 16, marginBottom: 16 }, tab: { flex: 1, padding: 10, alignItems: 'center', borderBottomWidth: 2, borderBottomColor: '#1e293b', }, tabActive: { borderBottomColor: '#3b82f6' }, tabText: { fontSize: 14, color: '#64748b' }, tabTextActive: { color: '#3b82f6', fontWeight: '600' }, body: { flex: 1, paddingHorizontal: 16 }, label: { fontSize: 12, color: '#94a3b8', marginBottom: 4, marginTop: 12 }, input: { backgroundColor: '#1e293b', color: '#e2e8f0', borderRadius: 8, padding: 12, fontSize: 14, marginBottom: 4, }, switchRow: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginTop: 12 }, chipRow: { flexDirection: 'row', gap: 8, marginTop: 4 }, chip: { paddingHorizontal: 12, paddingVertical: 6, borderRadius: 16, backgroundColor: '#1e293b' }, chipActive: { backgroundColor: '#1e40af' }, chipText: { fontSize: 12, color: '#94a3b8' }, chipTextActive: { color: '#fff' }, infoCard: { backgroundColor: '#1e293b', borderRadius: 8, padding: 16, marginTop: 16 }, infoTitle: { fontSize: 14, color: '#38bdf8', marginBottom: 8 }, infoText: { fontSize: 12, color: '#94a3b8', marginTop: 4 }, connIndicator: { borderRadius: 8, padding: 16, marginTop: 16, alignItems: 'center' }, conn_connected: { backgroundColor: '#064e3b' }, conn_connecting: { backgroundColor: '#78350f' }, conn_error: { backgroundColor: '#7f1d1d' }, conn_disconnected: { backgroundColor: '#1e293b' }, connText: { fontSize: 16, color: '#e2e8f0' }, btn: { borderRadius: 8, padding: 14, marginTop: 16, alignItems: 'center' }, btnPrimary: { backgroundColor: '#1e40af' }, btnDanger: { backgroundColor: '#991b1b' }, btnText: { fontSize: 16, color: '#fff', fontWeight: '600' }, });