mirror of
https://github.com/R0m1k3/podcastic.git
synced 2026-10-22 22:48:03 +02:00
feat: implement React components - dashboard, auth pages, audio player UI
This commit is contained in:
1 parent
8c00a1b0f5
commit
068f4e7ef7
7 files changed
+791
-20
No files matched your search
+23
-20
@@ -1,25 +1,9 @@
|
||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import './styles/globals.css';
|
||||
|
||||
// Placeholder pages
|
||||
const Dashboard = () => (
|
||||
<div className="p-8">
|
||||
<h1 className="text-4xl font-bold mb-4">Dashboard - Coming Soon</h1>
|
||||
<p className="text-light-600">Latest episodes will appear here</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
const Login = () => (
|
||||
<div className="min-h-screen flex items-center justify-center bg-gradient-light">
|
||||
<div className="card max-w-md w-full">
|
||||
<h1 className="text-3xl font-bold mb-6">Podcastic</h1>
|
||||
<p className="text-light-600 mb-8">Sign in to start listening</p>
|
||||
<button className="btn-primary w-full mb-4">Sign In</button>
|
||||
<button className="btn-secondary w-full">Create Account</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
import { authService } from './services/authService';
|
||||
import Login from './pages/Login';
|
||||
import Dashboard from './pages/Dashboard';
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
@@ -30,14 +14,33 @@ const queryClient = new QueryClient({
|
||||
},
|
||||
});
|
||||
|
||||
// Protected Route Component
|
||||
function ProtectedRoute({ children }: { children: React.ReactNode }) {
|
||||
const { accessToken } = authService.getTokens();
|
||||
|
||||
if (!accessToken) {
|
||||
return <Navigate to="/login" replace />;
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<BrowserRouter>
|
||||
<Routes>
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route path="/dashboard" element={<Dashboard />} />
|
||||
<Route
|
||||
path="/dashboard"
|
||||
element={
|
||||
<ProtectedRoute>
|
||||
<Dashboard />
|
||||
</ProtectedRoute>
|
||||
}
|
||||
/>
|
||||
<Route path="/" element={<Navigate to="/dashboard" replace />} />
|
||||
<Route path="*" element={<Navigate to="/dashboard" replace />} />
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
</QueryClientProvider>
|
||||
|
||||
Reference in new issue
Block a user