diff --git a/src/App.tsx b/src/App.tsx index e5f5916..51e55c7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,13 +1,25 @@ +import { lazy, Suspense } from 'react'; import { Routes, Route, Navigate } from 'react-router-dom'; import { Header } from '@/components/Header'; import { AutoSign } from '@/components/AutoSign'; import { TelemetryBanner } from '@/components/TelemetryBanner'; -import Send from '@/pages/Send'; -import Receive from '@/pages/Receive'; -import Privacy from '@/pages/Privacy'; import { HelpButton } from '@/components/HelpButton'; -import Vault from '@/pages/Vault'; -import Schedule from '@/pages/Schedule'; +import { + StellarSendSkeleton, + StellarReceiveSkeleton, + StellarWithdrawSkeleton, + StellarActivitySkeleton, + StellarSettingsSkeleton, +} from '@/components/Skeletons'; + +// Lazy-load every page so each Route gets its own Suspense boundary and the +// correct skeleton is shown while the chunk is fetched/parsed. +const Send = lazy(() => import('@/pages/Send')); +const Receive = lazy(() => import('@/pages/Receive')); +const Privacy = lazy(() => import('@/pages/Privacy')); +const Vault = lazy(() => import('@/pages/Vault')); +const Schedule = lazy(() => import('@/pages/Schedule')); +const History = lazy(() => import('@/pages/History')); export function App() { return ( @@ -17,12 +29,63 @@ export function App() {
- } /> - } /> - } /> - } /> - } /> - } /> + }> + + + } + /> + }> + + + } + /> + }> + + + } + /> + }> + + + } + /> + }> + + + } + /> + }> + + + } + /> + {/* /pay is a payment-link entry point — reuses the Send chunk */} + }> + + + } + /> } />
diff --git a/src/components/Skeletons/SkeletonBlock.tsx b/src/components/Skeletons/SkeletonBlock.tsx new file mode 100644 index 0000000..5887a8a --- /dev/null +++ b/src/components/Skeletons/SkeletonBlock.tsx @@ -0,0 +1,25 @@ +/** + * SkeletonBlock – a single animated placeholder block. + * + * Uses a shimmer animation defined in index.css via the `animate-skeleton` + * Tailwind utility. All dimensions are passed as Tailwind classes so callers + * control width/height while this component owns the animation, colour, and + * aria attributes. + */ +import type { HTMLAttributes } from 'react'; + +interface SkeletonBlockProps extends HTMLAttributes { + /** Extra Tailwind classes, e.g. "w-32 h-4" */ + className?: string; +} + +export function SkeletonBlock({ className = '', ...rest }: SkeletonBlockProps) { + return ( +