Import aus Monorepo (frischer Start)
All checks were successful
Build & Deploy / deploy (push) Successful in 26s
All checks were successful
Build & Deploy / deploy (push) Successful in 26s
This commit is contained in:
58
src/App.tsx
Normal file
58
src/App.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||
import AppShell from './components/AppShell';
|
||||
import { WizardProvider } from './lib/wizard';
|
||||
import { DialogsProvider } from './lib/dialogs';
|
||||
import Login from './routes/Login';
|
||||
import Auftraege from './routes/Auftraege';
|
||||
import Stammdaten from './routes/Stammdaten';
|
||||
import Configurator from './routes/Configurator';
|
||||
import MusterSeite from './routes/Muster';
|
||||
import { loadSession } from './lib/api';
|
||||
|
||||
/**
|
||||
* Produkt-Direktlinks (Slug → Produktschlüssel): wählen das Produkt vor, der
|
||||
* Konfigurator startet auf Schritt 1. Mehrere freundliche Slugs erlaubt
|
||||
* (z. B. /followups zeigt auf den Schlüssel follow_ups).
|
||||
*/
|
||||
const PRODUKT_PFADE: Record<string, string> = {
|
||||
briefe: 'briefe',
|
||||
postkarten: 'postkarten',
|
||||
unterschriftenservice: 'unterschriftenservice',
|
||||
follow_ups: 'follow_ups',
|
||||
followups: 'follow_ups',
|
||||
'follow-ups': 'follow_ups',
|
||||
};
|
||||
|
||||
function Geschuetzt({ children }: { children: React.ReactNode }) {
|
||||
return loadSession() ? <>{children}</> : <Navigate to="/login" replace />;
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<DialogsProvider>
|
||||
<WizardProvider>
|
||||
<AppShell>
|
||||
<Routes>
|
||||
<Route path="/" element={<Configurator />} />
|
||||
<Route path="/login" element={<Login />} />
|
||||
{/* Muster als eigene Seite (kein Popup) – Direktlink /muster. */}
|
||||
<Route path="/muster" element={<MusterSeite />} />
|
||||
<Route
|
||||
path="/auftraege"
|
||||
element={<Geschuetzt><Auftraege /></Geschuetzt>}
|
||||
/>
|
||||
<Route
|
||||
path="/stammdaten"
|
||||
element={<Geschuetzt><Stammdaten /></Geschuetzt>}
|
||||
/>
|
||||
{/* Produkt-Direktlinks – Produktwahl entfällt, Personentyp bleibt. */}
|
||||
{Object.entries(PRODUKT_PFADE).map(([slug, key]) => (
|
||||
<Route key={slug} path={`/${slug}`} element={<Configurator vorwahlProdukt={key} />} />
|
||||
))}
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
</AppShell>
|
||||
</WizardProvider>
|
||||
</DialogsProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user