How kranthi08-dot/offline-first-e-commerce-pwa works
This is a React storefront prototype demonstrating an offline-capable shopping flow: browse a cached mock catalog, inspect products, manage a cart, and simulate checkout. Offline mutations can be queued and replayed in a sync panel; a separate demo presents conflict-resolution strategies. The app also exposes viewport simulation and guided-review UI. Persistence is browser localStorage, and synchronization and conflict resolution are simulations rather than a connected backend. Edges reflect excerpted imports/calls or SOURCE INDEX references; unsampled implementation details are not inferred.
Main entry points: App.tsx App Coordinator · currency.ts Currency Formatting · ConflictDemoModal.tsx Conflict Demo · storageService.ts Browser Persistence
Components 23
Storefront
- App Coordinator
src/App.tsx - Mock Catalog
src/data/mockProducts.ts - Product Grid
src/components/ProductGrid.tsx - Product Card
src/components/ProductCard.tsx - Product Details
src/components/ProductDetailsModal.tsx - Store Header
src/components/Header.tsx - Adaptive Hero
src/components/AdaptiveHeroSection.tsx - Store Footer
src/components/Footer.tsx
Shopping
- Cart Drawer
src/components/CartDrawer.tsx - Checkout Modal
src/components/CheckoutModal.tsx - Currency Formatting
src/utils/currency.ts
Offline State
- Sync Queue Panel
src/components/SyncQueuePanel.tsx - Queue and Replay
src/services/syncQueueService.ts - Browser Persistence
src/services/storageService.ts - Conflict Demo
src/components/ConflictDemoModal.tsx - Conflict Policies
src/services/conflictService.ts
Demo Experience
- Device Simulator
src/components/DeviceSimulatorToolbar.tsx - Review Guide
src/components/ProjectReviewGuideModal.tsx - Project Badge
src/components/ProjectBadgeBanner.tsx - PWA Placeholder
src/services/pwaPlaceholderService.ts - Domain Types
src/types/index.ts
Other components
- Shopper
- Browser localStorage
Connections 25
- Shopper → App Coordinator: uses storefront
- App Coordinator → Mock Catalog: loads products
src/App.tsx - App Coordinator → Product Grid: renders catalog
src/App.tsx - Product Grid → Product Card: renders items
src/components/ProductGrid.tsx - App Coordinator → Product Details: opens details
src/App.tsx - App Coordinator → Store Header: renders header
src/App.tsx - App Coordinator → Adaptive Hero: renders hero
src/App.tsx - App Coordinator → Store Footer: renders footer
src/App.tsx - App Coordinator → Cart Drawer: renders cart
src/App.tsx - App Coordinator → Checkout Modal: opens checkout
src/App.tsx - App Coordinator → Sync Queue Panel: opens sync panel
src/App.tsx - App Coordinator → Queue and Replay: queues mutations
src/App.tsx - Queue and Replay → Browser Persistence: reads and writes
src/services/syncQueueService.ts - App Coordinator → Browser Persistence: persists cart state
src/App.tsx - Browser Persistence → Browser localStorage: reads and writes
src/services/storageService.ts - App Coordinator → Conflict Demo: opens conflict demo
src/App.tsx - Conflict Demo → Conflict Policies: resolves scenario
src/components/ConflictDemoModal.tsx - App Coordinator → Device Simulator: renders simulator
src/App.tsx - App Coordinator → Review Guide: opens guide
src/App.tsx - App Coordinator → Project Badge: renders badge
src/App.tsx - Product Card → Currency Formatting: formats prices
src/components/ProductCard.tsx - Product Details → Currency Formatting: formats prices
src/components/ProductDetailsModal.tsx - Cart Drawer → Currency Formatting: formats totals
src/components/CartDrawer.tsx - Checkout Modal → Currency Formatting: formats totals
src/components/CheckoutModal.tsx - Conflict Demo → Currency Formatting: formats prices
src/components/ConflictDemoModal.tsx