mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
feat: add dedicated TopUpResult page for payment return flow
Replace toast-based payment return with animated result page showing pending/success/failed/timeout states. Extract shared Spinner, AnimatedCheckmark and AnimatedCrossmark components. Add sessionStorage persistence with validation and TTL for cross-redirect payment data. Unify ProtectedRoute with withLayout prop, add aria-live accessibility.
This commit is contained in:
25
src/App.tsx
25
src/App.tsx
@@ -43,6 +43,7 @@ const PurchaseSuccess = lazy(() => import('./pages/PurchaseSuccess'));
|
||||
const AutoLogin = lazy(() => import('./pages/AutoLogin'));
|
||||
const TopUpMethodSelect = lazy(() => import('./pages/TopUpMethodSelect'));
|
||||
const TopUpAmount = lazy(() => import('./pages/TopUpAmount'));
|
||||
const TopUpResult = lazy(() => import('./pages/TopUpResult'));
|
||||
const ConnectedAccounts = lazy(() => import('./pages/ConnectedAccounts'));
|
||||
const LinkTelegramCallback = lazy(() => import('./pages/LinkTelegramCallback'));
|
||||
const MergeAccounts = lazy(() => import('./pages/MergeAccounts'));
|
||||
@@ -112,7 +113,13 @@ const AdminLandings = lazy(() => import('./pages/AdminLandings'));
|
||||
const AdminLandingEditor = lazy(() => import('./pages/AdminLandingEditor'));
|
||||
const AdminLandingStats = lazy(() => import('./pages/AdminLandingStats'));
|
||||
|
||||
function ProtectedRoute({ children }: { children: React.ReactNode }) {
|
||||
function ProtectedRoute({
|
||||
children,
|
||||
withLayout = true,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
withLayout?: boolean;
|
||||
}) {
|
||||
const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
|
||||
const isLoading = useAuthStore((state) => state.isLoading);
|
||||
const location = useLocation();
|
||||
@@ -122,12 +129,11 @@ function ProtectedRoute({ children }: { children: React.ReactNode }) {
|
||||
}
|
||||
|
||||
if (!isAuthenticated) {
|
||||
// Сохраняем текущий URL для возврата после авторизации
|
||||
saveReturnUrl();
|
||||
return <Navigate to="/login" replace state={{ from: location.pathname }} />;
|
||||
}
|
||||
|
||||
return <Layout>{children}</Layout>;
|
||||
return withLayout ? <Layout>{children}</Layout> : <>{children}</>;
|
||||
}
|
||||
|
||||
function AdminRoute({ children }: { children: React.ReactNode }) {
|
||||
@@ -141,7 +147,6 @@ function AdminRoute({ children }: { children: React.ReactNode }) {
|
||||
}
|
||||
|
||||
if (!isAuthenticated) {
|
||||
// Сохраняем текущий URL для возврата после авторизации
|
||||
saveReturnUrl();
|
||||
return <Navigate to="/login" replace state={{ from: location.pathname }} />;
|
||||
}
|
||||
@@ -283,6 +288,18 @@ function App() {
|
||||
</ProtectedRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/balance/top-up/result"
|
||||
element={
|
||||
<ProtectedRoute withLayout={false}>
|
||||
<ErrorBoundary level="app">
|
||||
<LazyPage>
|
||||
<TopUpResult />
|
||||
</LazyPage>
|
||||
</ErrorBoundary>
|
||||
</ProtectedRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/balance/top-up/:methodId"
|
||||
element={
|
||||
|
||||
Reference in New Issue
Block a user