feat: Implement Progressive Web App (PWA) & Offline-First Resilience#263
Open
kashviporwal-byte wants to merge 1 commit into
Open
feat: Implement Progressive Web App (PWA) & Offline-First Resilience#263kashviporwal-byte wants to merge 1 commit into
kashviporwal-byte wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
This pull request transitions ChaatBazaar from a network-dependent traditional web application into an installable, high-performance, Offline-First Progressive Web App (PWA).
It provides users on slow, unstable, or completely disconnected networks with reliable offline browsing, persistent shopping carts, queue-based checkouts, and automatic background synchronization.
1. Progressive Web App (PWA) Support
manifest.json[NEW]: Standard W3C-compliant web application manifest allowing native desktop and mobile installation with custom splash screens, background styling (#fff8e1), standalone window capabilities, and terracotta theme branding (#bf360c).img/icon-192.pngandimg/icon-512.png.index.htmlmenu.htmlcart.htmlorders.html2. Service Worker & Pre-caching Cache Engine
sw.js[NEW]: A comprehensive client-side intercept proxy worker implementing:index.html,menu.html,cart.html,orders.html,offline.html), CSS styles, local database menu arrays (data/menu.json), local images, and external CDN stylesheets (Google Poppins Fonts and FontAwesome icons).offline.html[NEW]: A visually stunning offline fallback page displaying warm illustrations, navigation links back to cached pages, and connection diagnostic buttons.3. Dynamic Connection Badge & Toast Alerts
js/pwa.js[NEW]: Unified module registering the Service Worker, monitoring browser connectivity states (online/offline), and managing the following visual assets:4. Offline checkout Queuing & Auto-Sync
js/main.js[MODIFY]:chaatPendingOrders). Displays a clean Offline Order Queued! modal window.5. Additional Critical Bug Fixes Included
index.html): Resolved a critical crash where the home page was missing a<script src="js/cart-manager.js"></script>import. The resultingReferenceErrorhalted all JS execution inmain.js, breaking the Order Now scrolling button and preventing PWA functions on the home page.cart.html): Included missingcart-manager.jsscript tag in the cart page to ensure fully operational cart flows.Verification & Testing Details
Tested and validated locally on Google Chrome and Microsoft Edge DevTools:
sw.jsinstalls, activates (self.skipWaiting()), and successfully pre-caches all 30 core assets in thechaat-static-v3Cache Storage.localStorage.chaatPendingOrdersand popped up the custom PWA offline success dialog.