PULSE-31: PWA support and offline banner #4
Reference in New Issue
Block a user
No description provided.
Delete Branch "staging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements optional PWA support and a clear "You're offline" experience when the dashboard is unreachable (PULSE-31).
Changes
PWA
@ducanh2912/next-pwawith service worker (disabled in dev, active in production).public/manifest.json: name "Pulse", 192×192 and 512×512 icons, standalone display.next build --webpackfor next-pwa compatibility with Next.js 16.Offline banner
OfflineBannercomponent anduseOnlineStatushook; banner only when logged in and offline.fixed top-0,z-[100],rounded-b-xl, no header integration.topOffsetwhen the bar is visible so layout stays correct; main usespt-[8.5rem]when offline.ciphera-ui
bottomContentandtopOffset;overflow-hiddenon bottom strip for rounded corners.^0.0.42.Verification
Greptile Overview
Greptile Summary
This PR implements PWA support and an offline status banner for authenticated users. The implementation adds
@ducanh2912/next-pwafor service worker functionality (disabled in development), creates a fixed yellow banner at the viewport top when users go offline, and adjusts the header and main content padding dynamically to accommodate the banner.Key Changes:
useOnlineStatushook that listens to browser online/offline events with proper SSR handlingOfflineBannercomponent that acceptsisOnlineas a prop for clean separation of concerns--webpackflag for next-pwa compatibilityPrevious Issues Resolved:
useOnlineStatuscalls eliminated by lifting state to parentbarHeightRemconstant correctlyThe implementation is clean, follows React best practices, and all previously identified issues have been addressed.
Confidence Score: 5/5
Important Files Changed
Sequence Diagram
4 files reviewed, 5 comments
Edit Code Review Agent Settings | Greptile
useOnlineStatusis called here and also insideOfflineBanner(line 48), creating duplicate event listeners foronline/offlineevents. Consider lifting the hook call to this component and passingisOnlineas a prop toOfflineBanner.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
@@ -37,8 +40,14 @@ export default function LayoutContent({ children }: { children: React.ReactNoderouter.push('/onboarding')Moved auth check to parent instead of keeping it in
OfflineBanner- the banner now only handles online/offline state while this component controls when it shows based on authentication.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
@@ -0,0 +12,4 @@const handleOffline = () => setIsOnline(false);window.addEventListener('online', handleOnline);window.addEventListener('offline', handleOffline);window.addEventListeneris called without checking ifwindowexists (like line 8 does), which will cause SSR errors in Next.js.Prompt To Fix With AI
@@ -0,0 +1,21 @@{Icon paths use URL encoding (
%20and%26) which may cause issues with some browsers or PWA installers. Use hyphens or underscores in filenames instead.Prompt To Fix With AI
theme_coloris#000000butlayout.tsx:19setsthemeColor: '#FD5E0F'. These should match for consistency.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
5 files reviewed, 1 comment
Edit Code Review Agent Settings | Greptile
@@ -37,8 +40,14 @@ export default function LayoutContent({ children }: { children: React.ReactNoderouter.push('/onboarding')barHeightRemis defined but not used in thept-[8.5rem]calculation on line 64. The hardcoded value could get out of sync if the banner height changes.Prompt To Fix With AI