mirror of
https://gitee.com/wanwujie/sub2api-mobile
synced 2026-04-03 06:52:14 +08:00
64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import { Redirect, Tabs } from 'expo-router';
|
|
import { ChartNoAxesCombined, Settings2, Users } from 'lucide-react-native';
|
|
|
|
import { adminConfigState } from '@/src/store/admin-config';
|
|
|
|
const { useSnapshot } = require('valtio/react');
|
|
|
|
export default function TabsLayout() {
|
|
const config = useSnapshot(adminConfigState);
|
|
const hasAccount = Boolean(config.baseUrl.trim());
|
|
|
|
if (!hasAccount) {
|
|
return <Redirect href="/login" />;
|
|
}
|
|
|
|
return (
|
|
<Tabs
|
|
initialRouteName={hasAccount ? 'monitor' : 'settings'}
|
|
screenOptions={{
|
|
headerShown: false,
|
|
tabBarActiveTintColor: '#1d5f55',
|
|
tabBarInactiveTintColor: '#8a8072',
|
|
tabBarStyle: {
|
|
backgroundColor: '#fbf8f2',
|
|
borderTopWidth: 0,
|
|
height: 84,
|
|
paddingTop: 10,
|
|
paddingBottom: 18,
|
|
},
|
|
}}
|
|
>
|
|
<Tabs.Screen
|
|
name="index"
|
|
options={{
|
|
href: null,
|
|
}}
|
|
/>
|
|
<Tabs.Screen
|
|
name="monitor"
|
|
options={{
|
|
title: '概览',
|
|
tabBarIcon: ({ color, size }) => <ChartNoAxesCombined color={color} size={size} />,
|
|
}}
|
|
/>
|
|
<Tabs.Screen
|
|
name="users"
|
|
options={{
|
|
title: '用户',
|
|
tabBarIcon: ({ color, size }) => <Users color={color} size={size} />,
|
|
}}
|
|
/>
|
|
<Tabs.Screen
|
|
name="settings"
|
|
options={{
|
|
title: '服务器',
|
|
tabBarIcon: ({ color, size }) => <Settings2 color={color} size={size} />,
|
|
}}
|
|
/>
|
|
<Tabs.Screen name="groups" options={{ href: null }} />
|
|
<Tabs.Screen name="accounts" options={{ href: null }} />
|
|
</Tabs>
|
|
);
|
|
}
|