mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
Update App.tsx
This commit is contained in:
21
src/App.tsx
21
src/App.tsx
@@ -1,8 +1,10 @@
|
|||||||
import { lazy, Suspense } from 'react'
|
import { lazy, Suspense } from 'react'
|
||||||
import { Routes, Route, Navigate, useLocation } from 'react-router-dom'
|
import { Routes, Route, Navigate, useLocation } from 'react-router-dom'
|
||||||
import { useAuthStore } from './store/auth'
|
import { useAuthStore } from './store/auth'
|
||||||
|
import { useBlockingStore } from './store/blocking'
|
||||||
import Layout from './components/layout/Layout'
|
import Layout from './components/layout/Layout'
|
||||||
import PageLoader from './components/common/PageLoader'
|
import PageLoader from './components/common/PageLoader'
|
||||||
|
import { MaintenanceScreen, ChannelSubscriptionScreen } from './components/blocking'
|
||||||
import { saveReturnUrl } from './utils/token'
|
import { saveReturnUrl } from './utils/token'
|
||||||
|
|
||||||
// Auth pages - load immediately (small)
|
// Auth pages - load immediately (small)
|
||||||
@@ -89,9 +91,25 @@ function LazyPage({ children }: { children: React.ReactNode }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function BlockingOverlay() {
|
||||||
|
const { blockingType } = useBlockingStore()
|
||||||
|
|
||||||
|
if (blockingType === 'maintenance') {
|
||||||
|
return <MaintenanceScreen />
|
||||||
|
}
|
||||||
|
|
||||||
|
if (blockingType === 'channel_subscription') {
|
||||||
|
return <ChannelSubscriptionScreen />
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<Routes>
|
<>
|
||||||
|
<BlockingOverlay />
|
||||||
|
<Routes>
|
||||||
{/* Public routes */}
|
{/* Public routes */}
|
||||||
<Route path="/login" element={<Login />} />
|
<Route path="/login" element={<Login />} />
|
||||||
<Route path="/auth/telegram/callback" element={<TelegramCallback />} />
|
<Route path="/auth/telegram/callback" element={<TelegramCallback />} />
|
||||||
@@ -316,6 +334,7 @@ function App() {
|
|||||||
{/* Catch all */}
|
{/* Catch all */}
|
||||||
<Route path="*" element={<Navigate to="/" replace />} />
|
<Route path="*" element={<Navigate to="/" replace />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user