This commit is contained in:
2026-06-30 10:33:56 +08:00
commit 6e047dc0a5
607 changed files with 65966 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
import { NavLink, Outlet, useNavigate } from 'react-router-dom';
import { isLoggedIn } from '../lib/api';
const TABS = [
{ to: '/', end: true, icon: 'home', label: '首页' },
{ to: '/records', icon: 'receipt_long', label: '核销记录' },
{ to: '/mine', icon: 'person', label: '我的' },
] as const;
export default function TabLayout() {
const navigate = useNavigate();
if (!isLoggedIn()) {
navigate('/login');
return null;
}
return (
<>
<Outlet />
<nav className="app-tabbar">
{TABS.map((tab) => (
<NavLink
key={tab.to}
to={tab.to}
end={tab.end}
className={({ isActive }) => `app-tabbar-item${isActive ? ' active' : ''}`}
>
<span className="material-symbols-outlined app-tabbar-icon">{tab.icon}</span>
<span className="app-tabbar-label">{tab.label}</span>
</NavLink>
))}
</nav>
</>
);
}