Final
This commit is contained in:
@@ -1,66 +1,68 @@
|
||||
import React, { Suspense, lazy } from 'react';
|
||||
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
|
||||
import Header from './components/Header';
|
||||
import Footer from './components/Footer';
|
||||
import Cart from './components/Cart';
|
||||
import ScrollToTop from './components/ScrollToTop';
|
||||
import RouteTransition from './components/RouteTransition';
|
||||
import { StoreProvider } from './src/context/StoreContext';
|
||||
|
||||
// Lazy load pages for better performance
|
||||
const Home = lazy(() => import('./pages/Home'));
|
||||
const Collections = lazy(() => import('./pages/Collections'));
|
||||
const Atelier = lazy(() => import('./pages/Atelier'));
|
||||
const Editorial = lazy(() => import('./pages/Editorial'));
|
||||
const ProductPhotography = lazy(() => import('./pages/Journal/ProductPhotography'));
|
||||
const PackagingGuide = lazy(() => import('./pages/Journal/PackagingGuide'));
|
||||
const MotivationInClay = lazy(() => import('./pages/Journal/MotivationInClay'));
|
||||
const ProductDetail = lazy(() => import('./pages/ProductDetail'));
|
||||
const ArticleDetail = lazy(() => import('./pages/ArticleDetail'));
|
||||
const Checkout = lazy(() => import('./pages/Checkout'));
|
||||
const MockPayment = lazy(() => import('./pages/MockPayment'));
|
||||
const Success = lazy(() => import('./pages/Success'));
|
||||
const Admin = lazy(() => import('./pages/Admin'));
|
||||
const FAQ = lazy(() => import('./pages/FAQ'));
|
||||
const Shipping = lazy(() => import('./pages/Shipping'));
|
||||
const Returns = lazy(() => import('./pages/Returns'));
|
||||
const Contact = lazy(() => import('./pages/Contact'));
|
||||
const Privacy = lazy(() => import('./pages/Privacy'));
|
||||
const Cookies = lazy(() => import('./pages/Cookies'));
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<Router>
|
||||
<StoreProvider>
|
||||
<ScrollToTop />
|
||||
<Header />
|
||||
<Cart />
|
||||
<RouteTransition>
|
||||
<Suspense fallback={null}>
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path="/collections" element={<Collections />} />
|
||||
import React, { Suspense, lazy } from 'react';
|
||||
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
|
||||
import Header from './components/Header';
|
||||
import Footer from './components/Footer';
|
||||
import Cart from './components/Cart';
|
||||
import ScrollToTop from './components/ScrollToTop';
|
||||
import RouteTransition from './components/RouteTransition';
|
||||
import { StoreProvider } from './src/context/StoreContext';
|
||||
|
||||
// Lazy load pages for better performance
|
||||
const Home = lazy(() => import('./pages/Home'));
|
||||
const Collections = lazy(() => import('./pages/Collections'));
|
||||
const Atelier = lazy(() => import('./pages/Atelier'));
|
||||
const Editorial = lazy(() => import('./pages/Editorial'));
|
||||
const ProductPhotography = lazy(() => import('./pages/Journal/ProductPhotography'));
|
||||
const PackagingGuide = lazy(() => import('./pages/Journal/PackagingGuide'));
|
||||
const MotivationInClay = lazy(() => import('./pages/Journal/MotivationInClay'));
|
||||
const ProductDetail = lazy(() => import('./pages/ProductDetail'));
|
||||
const ArticleDetail = lazy(() => import('./pages/ArticleDetail'));
|
||||
const Checkout = lazy(() => import('./pages/Checkout'));
|
||||
const MockPayment = lazy(() => import('./pages/MockPayment'));
|
||||
const Success = lazy(() => import('./pages/Success'));
|
||||
const FAQ = lazy(() => import('./pages/FAQ'));
|
||||
const Shipping = lazy(() => import('./pages/Shipping'));
|
||||
const Returns = lazy(() => import('./pages/Returns'));
|
||||
const Contact = lazy(() => import('./pages/Contact'));
|
||||
const Privacy = lazy(() => import('./pages/Privacy'));
|
||||
const Cookies = lazy(() => import('./pages/Cookies'));
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<Router>
|
||||
<StoreProvider>
|
||||
<ScrollToTop />
|
||||
<Header />
|
||||
<Cart />
|
||||
<RouteTransition>
|
||||
<Suspense fallback={null}>
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path="/collections" element={<Collections />} />
|
||||
<Route path="/collections/:slug" element={<ProductDetail />} />
|
||||
<Route path="/atelier" element={<Atelier />} />
|
||||
<Route path="/editorial" element={<Editorial />} />
|
||||
<Route path="/editorial/product-photography-for-small-businesses" element={<ProductPhotography />} />
|
||||
<Route path="/editorial/how-to-care-for-handmade-ceramics" element={<PackagingGuide />} />
|
||||
<Route path="/editorial/finding-motivation-in-clay" element={<MotivationInClay />} />
|
||||
<Route path="/editorial/:slug" element={<ArticleDetail />} />
|
||||
<Route path="/checkout" element={<Checkout />} />
|
||||
<Route path="/mock-payment" element={<MockPayment />} />
|
||||
<Route path="/success" element={<Success />} />
|
||||
<Route path="/admin" element={<Admin />} />
|
||||
<Route path="/faq" element={<FAQ />} />
|
||||
<Route path="/shipping" element={<Shipping />} />
|
||||
<Route path="/returns" element={<Returns />} />
|
||||
<Route path="/contact" element={<Contact />} />
|
||||
<Route path="/privacy" element={<Privacy />} />
|
||||
<Route path="/cookies" element={<Cookies />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
</RouteTransition>
|
||||
<Footer />
|
||||
</StoreProvider>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
<Route path="/checkout" element={<Checkout />} />
|
||||
<Route path="/mock-payment" element={<MockPayment />} />
|
||||
<Route path="/success" element={<Success />} />
|
||||
<Route path="/admin" element={<Navigate to="/" replace />} />
|
||||
<Route path="/faq" element={<FAQ />} />
|
||||
<Route path="/shipping" element={<Shipping />} />
|
||||
<Route path="/returns" element={<Returns />} />
|
||||
<Route path="/contact" element={<Contact />} />
|
||||
<Route path="/privacy" element={<Privacy />} />
|
||||
<Route path="/cookies" element={<Cookies />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
</RouteTransition>
|
||||
<Footer />
|
||||
</StoreProvider>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
||||
Reference in New Issue
Block a user