client: screens and app routing
Add all game screens: Login, Dashboard, Market (buy/sell), Inventory, Missions, Travel (city selection), Leaderboard; wired via react-router in App.tsx with protected routes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||
import { useAuth } from './auth/AuthContext';
|
||||
import { Layout } from './components/Layout';
|
||||
import { DashboardScreen } from './screens/DashboardScreen';
|
||||
import { InventoryScreen } from './screens/InventoryScreen';
|
||||
import { LeaderboardScreen } from './screens/LeaderboardScreen';
|
||||
import { LoginScreen } from './screens/LoginScreen';
|
||||
import { MarketScreen } from './screens/MarketScreen';
|
||||
import { MissionsScreen } from './screens/MissionsScreen';
|
||||
import { TravelScreen } from './screens/TravelScreen';
|
||||
|
||||
export function App() {
|
||||
const { token } = useAuth();
|
||||
|
||||
if (!token) {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="*" element={<LoginScreen />} />
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Routes>
|
||||
<Route element={<Layout />}>
|
||||
<Route path="/" element={<DashboardScreen />} />
|
||||
<Route path="/market" element={<MarketScreen />} />
|
||||
<Route path="/missions" element={<MissionsScreen />} />
|
||||
<Route path="/inventory" element={<InventoryScreen />} />
|
||||
<Route path="/travel" element={<TravelScreen />} />
|
||||
<Route path="/leaderboard" element={<LeaderboardScreen />} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user