- Added new CORS origins for local development and specific IP addresses in `settings.py`. - Refactored API URL retrieval logic in `loadSiteDefinition.ts` and `fileAccess.ts` to auto-detect based on the current origin. - Enhanced error handling in API calls and improved logging for better debugging. - Updated `renderTemplate` function to support additional block types and improved rendering logic for various components in `templateEngine.tsx`.
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import { lazy, Suspense } from 'react';
|
|
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
|
import ProtectedRoute from './shared/ProtectedRoute';
|
|
import BuilderLayout from './builder/components/layout/BuilderLayout';
|
|
|
|
// Lazy load builder pages (code-split to avoid loading in public sites)
|
|
const WizardPage = lazy(() => import('./builder/pages/wizard/WizardPage'));
|
|
const PreviewCanvas = lazy(() => import('./builder/pages/preview/PreviewCanvas'));
|
|
const SiteDashboard = lazy(() => import('./builder/pages/dashboard/SiteDashboard'));
|
|
|
|
// Renderer pages (load immediately for public sites)
|
|
const SiteRenderer = lazy(() => import('./pages/SiteRenderer'));
|
|
|
|
// Loading component
|
|
const LoadingFallback = () => (
|
|
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: '100vh' }}>
|
|
<div>Loading...</div>
|
|
</div>
|
|
);
|
|
|
|
function App() {
|
|
return (
|
|
<BrowserRouter>
|
|
<Suspense fallback={<LoadingFallback />}>
|
|
<Routes>
|
|
{/* Public Site Renderer Routes (No Auth) */}
|
|
<Route path="/:siteId/*" element={<SiteRenderer />} />
|
|
<Route path="/" element={<div>IGNY8 Sites Renderer</div>} />
|
|
|
|
{/* Builder Routes (Auth Required) */}
|
|
<Route
|
|
path="/builder/*"
|
|
element={
|
|
<ProtectedRoute>
|
|
<BuilderLayout>
|
|
<Routes>
|
|
<Route path="/" element={<WizardPage />} />
|
|
<Route path="preview" element={<PreviewCanvas />} />
|
|
<Route path="dashboard" element={<SiteDashboard />} />
|
|
<Route path="*" element={<Navigate to="/builder" replace />} />
|
|
</Routes>
|
|
</BuilderLayout>
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
</Routes>
|
|
</Suspense>
|
|
</BrowserRouter>
|
|
);
|
|
}
|
|
|
|
export default App;
|