import { Ionicons } from '@expo/vector-icons' import { Block, Img, Text } from '@share/components' import { router, Stack } from 'expo-router' import { observer } from 'mobx-react-lite' import React from 'react' import { ScrollView } from 'react-native' import { ConfirmModal, Toast } from '@share/components' import { userStore } from '@/stores' type MenuItem = { id: string label: string icon: keyof typeof Ionicons.glyphMap onPress: () => void } export default observer(function SettingsPage() { const { user, isAuthenticated, signOut } = userStore const handleLogout = () => { Toast.showModal( { await signOut() Toast.show({ title: '已退出登录' }) router.replace('/(tabs)') // 关闭modal Toast.hideModal() }} />, ) } const menuItems: MenuItem[] = [ { id: 'service', label: '服务条款', icon: 'document-text-outline', onPress: () => { router.push({ pathname: '/webview', params: { url: 'https://mixvideo.bowong.cc/terms', title: '服务条款' }, }) }, }, { id: 'privacy', label: '隐私协议', icon: 'shield-outline', onPress: () => { router.push({ pathname: '/webview', params: { url: 'https://mixvideo.bowong.cc/privacy', title: '隐私协议' }, }) }, }, // { // id: 'about', // label: '关于我们', // icon: 'information-circle-outline', // onPress: () => { // // TODO: 替换为实际的关于我们URL或创建关于页面 // router.push({ // pathname: '/webview', // params: { url: 'https://example.com/about', title: '关于我们' }, // }) // }, // }, ] const handleUserProfileClick = () => { router.push('/profile') } const renderHeader = () => ( router.back()}> 设置 ) const renderUserSection = () => ( {user?.image ? ( ) : ( )} {user?.name || user?.phoneNumber || '未登录'} {user?.phoneNumber && user?.name && ( {user.phoneNumber} )} ) const renderMenuSection = () => ( 使用相关 {menuItems.map((item) => ( {item.label} ))} ) const renderLogoutButton = () => ( 退出登录 ) return ( {renderHeader()} {renderUserSection()} {renderMenuSection()} {renderLogoutButton()} ) })