Spaces:
Sleeping
Sleeping
Download frontend/src/App.js from monumkp89/pixelcraft: direct link, hf CLI and curl.
- Browser
- Download file 2.2 kB
-
https://huggingface.co/spaces/monumkp89/pixelcraft/resolve/main/frontend/src/App.js
- Command line
-
hf download hf://spaces/monumkp89/pixelcraft/frontend/src/App.js
-
curl -L -o App.js https://huggingface.co/spaces/monumkp89/pixelcraft/resolve/main/frontend/src/App.js
2.2 kB
| import React from 'react'; | |
| import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; | |
| import { AuthProvider, useAuth } from './context/AuthContext'; | |
| import Landing from './pages/Landing'; | |
| import Login from './pages/Login'; | |
| import Signup from './pages/Signup'; | |
| import ForgotPassword from './pages/ForgotPassword'; | |
| import Dashboard from './pages/Dashboard'; | |
| import Explore from './pages/Explore'; | |
| import PublicProfile from './pages/PublicProfile'; | |
| import AiAssistant from './components/AiAssistant'; | |
| import AiVoiceAssistant from './components/AiVoiceAssistant'; | |
| import './styles/App.css'; | |
| const routerBasename = process.env.PUBLIC_URL || '/'; | |
| const ProtectedRoute = ({ children }) => { | |
| const { token, loading } = useAuth(); | |
| if (loading) { | |
| return <div className="app-loading">Loading...</div>; | |
| } | |
| return token ? children : <Navigate to="/login" />; | |
| }; | |
| function App() { | |
| return ( | |
| <BrowserRouter basename={routerBasename}> | |
| <AuthProvider> | |
| <AppContent /> | |
| </AuthProvider> | |
| </BrowserRouter> | |
| ); | |
| } | |
| function AppContent() { | |
| const { token } = useAuth(); | |
| // Simple test render first | |
| return ( | |
| <div style={{ padding: '20px', fontSize: '24px', color: 'red' }}> | |
| <h1>React App is Working!</h1> | |
| <p>Token: {token ? 'Yes' : 'No'}</p> | |
| <p>Loading status will show here</p> | |
| </div> | |
| ); | |
| // Original code commented out for testing | |
| /* | |
| return ( | |
| <> | |
| <Routes> | |
| <Route path="/" element={<Landing />} /> | |
| <Route path="/explore" element={<Explore />} /> | |
| <Route path="/users/:userId" element={<PublicProfile />} /> | |
| <Route path="/login" element={<Login />} /> | |
| <Route path="/signup" element={<Signup />} /> | |
| <Route path="/forgot-password" element={<ForgotPassword />} /> | |
| <Route | |
| path="/dashboard" | |
| element={ | |
| <ProtectedRoute> | |
| <Dashboard /> | |
| </ProtectedRoute> | |
| } | |
| /> | |
| <Route path="/voice-assistant" element={<AiVoiceAssistant />} /> | |
| </Routes> | |
| {token && <AiAssistant />} | |
| </> | |
| ); | |
| */ | |
| } | |
| export default App; | |