Workers P2: Seite /hustler (lazy), Menü „Hustler“ statt Leads, Stil und Schrift Pixelify Sans
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a6f1b0c56d
commit
7ddd60e59b
10 files changed
+382
-7
No files matched your search
+13
-2
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { lazy, Suspense, useCallback, useEffect, useState } from 'react'
|
||||
import { BrowserRouter, Routes, Route, Navigate, Link, useLocation } from 'react-router-dom'
|
||||
import { AuthProvider, useAuth } from './context/AuthContext'
|
||||
import Sidebar from './components/Navbar'
|
||||
@@ -25,6 +25,9 @@ import BankCallbackPage from './pages/BankCallbackPage'
|
||||
import AdminRoute from './components/AdminRoute'
|
||||
import { safeReturnPath } from './lib/returnPath'
|
||||
|
||||
// Hochhaus der Hustler: erst beim Öffnen laden, damit Engine und Schrift nicht im Haupt-Bundle liegen
|
||||
const WorkersPage = lazy(() => import('./pages/WorkersPage'))
|
||||
|
||||
function ProtectedRoute({ children }) {
|
||||
const { user, loading } = useAuth()
|
||||
const location = useLocation()
|
||||
@@ -40,6 +43,12 @@ function ProtectedRoute({ children }) {
|
||||
return children
|
||||
}
|
||||
|
||||
// Alte Adressen /leads und /workers führen auf /hustler, die Query bleibt (/workers?tab=botleads&bot=<id> wird /hustler?tab=botleads&bot=<id>)
|
||||
function HustlerRedirect() {
|
||||
const { search } = useLocation()
|
||||
return <Navigate to={`/hustler${search}`} replace />
|
||||
}
|
||||
|
||||
function AppRoutes() {
|
||||
const { user } = useAuth()
|
||||
const location = useLocation()
|
||||
@@ -57,7 +66,9 @@ function AppRoutes() {
|
||||
<Route path="/customers/gutschriften" element={<ProtectedRoute><CreditsPage /></ProtectedRoute>} />
|
||||
<Route path="/customers/angebote" element={<ProtectedRoute><OffersPage /></ProtectedRoute>} />
|
||||
<Route path="/customers/:id" element={<ProtectedRoute><CustomerDetailPage /></ProtectedRoute>} />
|
||||
<Route path="/leads" element={<Navigate to="/tickets" replace />} />
|
||||
<Route path="/hustler" element={<ProtectedRoute><Suspense fallback={<div className="loading">Wird geladen …</div>}><WorkersPage /></Suspense></ProtectedRoute>} />
|
||||
<Route path="/leads" element={<HustlerRedirect />} />
|
||||
<Route path="/workers" element={<HustlerRedirect />} />
|
||||
{/* Finanzen: nur Admins, alle anderen gehen zu /tickets */}
|
||||
<Route path="/finance" element={<ProtectedRoute><AdminRoute><FinancePage /></AdminRoute></ProtectedRoute>} />
|
||||
<Route path="/finance/einstellungen" element={<ProtectedRoute><AdminRoute><FinanceSettingsPage /></AdminRoute></ProtectedRoute>} />
|
||||
|
||||
Reference in new issue
Block a user