mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
refactor(structure): remove frontend placeholder
Some checks failed
Build, Push and Update Image in Manifest / build-and-update (push) Has been cancelled
Some checks failed
Build, Push and Update Image in Manifest / build-and-update (push) Has been cancelled
This commit is contained in:
@@ -1,110 +0,0 @@
|
||||
import React from 'react';
|
||||
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
|
||||
import { AuthProvider, useAuth } from './contexts/AuthContext';
|
||||
import { Layout } from './components/Layout';
|
||||
import { ProtectedRoute } from './components/ProtectedRoute';
|
||||
import { Login } from './components/Login';
|
||||
import { Register } from './components/Register';
|
||||
import { Dashboard } from './components/Dashboard';
|
||||
import { Transactions } from './components/Transactions';
|
||||
|
||||
const AppRoutes: React.FC = () => {
|
||||
const { user, loading } = useAuth();
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-gray-50">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Routes>
|
||||
{!user ? (
|
||||
<>
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route path="/register" element={<Register />} />
|
||||
<Route path="*" element={<Navigate to="/login" replace />} />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Route path="/" element={
|
||||
<ProtectedRoute>
|
||||
<Layout>
|
||||
<Dashboard />
|
||||
</Layout>
|
||||
</ProtectedRoute>
|
||||
} />
|
||||
<Route path="/transactions" element={
|
||||
<ProtectedRoute>
|
||||
<Layout>
|
||||
<Transactions />
|
||||
</Layout>
|
||||
</ProtectedRoute>
|
||||
} />
|
||||
<Route path="/analytics" element={
|
||||
<ProtectedRoute>
|
||||
<Layout>
|
||||
<Dashboard />
|
||||
</Layout>
|
||||
</ProtectedRoute>
|
||||
} />
|
||||
<Route path="/profile" element={
|
||||
<ProtectedRoute>
|
||||
<Layout>
|
||||
<div className="p-6">
|
||||
<h1 className="text-2xl font-bold text-gray-900">Profile</h1>
|
||||
<p className="mt-4 text-gray-600">Profile management coming soon...</p>
|
||||
</div>
|
||||
</Layout>
|
||||
</ProtectedRoute>
|
||||
} />
|
||||
<Route path="/settings" element={
|
||||
<ProtectedRoute>
|
||||
<Layout>
|
||||
<div className="p-6">
|
||||
<h1 className="text-2xl font-bold text-gray-900">Settings</h1>
|
||||
<div className="mt-4 bg-white rounded-lg shadow-sm p-6 border border-gray-200">
|
||||
<h2 className="text-lg font-semibold mb-4">API Configuration</h2>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700">
|
||||
API Base URL
|
||||
</label>
|
||||
<p className="mt-1 text-sm text-gray-600">
|
||||
{import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000'}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700">
|
||||
Environment
|
||||
</label>
|
||||
<p className="mt-1 text-sm text-gray-600">
|
||||
{import.meta.env.VITE_ENVIRONMENT || 'development'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Layout>
|
||||
</ProtectedRoute>
|
||||
} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</>
|
||||
)}
|
||||
</Routes>
|
||||
);
|
||||
};
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<Router>
|
||||
<AuthProvider>
|
||||
<AppRoutes />
|
||||
</AuthProvider>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user