Skip to content

Phase2#37

Merged
AccessiT3ch merged 17 commits intomainfrom
phase2
Feb 2, 2026
Merged

Phase2#37
AccessiT3ch merged 17 commits intomainfrom
phase2

Conversation

@AccessiT3ch
Copy link
Copy Markdown
Contributor

This pull request introduces several improvements to the offline caching and sharing features in the app, particularly within the Header component. The changes enhance the user experience by providing better feedback during offline caching, more robust network state handling, and improved fallbacks and testing for the share functionality.

Offline caching and install experience:

  • Added offline caching logic to the Header component, including network state detection, caching progress indication (spinner), and user alerts for success, partial failure, or errors during resource caching. The "Save" button now triggers caching if the app is installed, and provides appropriate feedback based on cache and network state. (src/Components/Header/Header.jsx, [1] [2] [3]
  • Expanded and improved tests for the "Save" button to cover scenarios such as already cached resources, offline state, caching progress, partial failures, and error handling. (src/Components/Header/header.test.jsx, [1] [2] [3]

Share functionality and testing:

  • Updated the share handler tests to prioritize the Share API when available, with Clipboard API as a fallback, and improved error handling for various scenarios (permission denied, generic errors, missing APIs). Also updated success callback tests for both APIs. (src/utils.error-handling.test.js, [1] [2] [3] [4] [5] [6] [7] [8] [9]

Minor UI/UX improvements:

AccessiT3ch and others added 17 commits February 2, 2026 09:39
- Mark Phase 2.1 as completed (PR #32 merged)
- Mark Phase 2.3 as completed (UpdatePrompt done in 2.1)
- Update Phase 2.2 with scope clarifications:
  - Cache external resources (PDFs, assets)
  - Save button triggers offline caching
  - Add offline indicator to Header
- Create network utility for online/offline detection
- Create storage utility with localStorage wrapper
- Create cache utility for managing external resource caching
- Add offline indicator (🟢/🔴) to Header
- Enhance Save button to trigger offline caching when app installed
- Add runtime caching for external PDFs in vite.config.js
- Update Header tests for new caching behavior
- All tests passing (187 tests)
- All core tasks completed
- Offline caching utilities implemented
- Network indicator added to Header
- Save button enhanced with caching functionality
- Deferred utility tests to Phase 5
- Manual offline testing needed
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: AccessiT3ch <95449364+AccessiT3ch@users.noreply.github.com>
fix(cache): use removeItem() and correct fetch modes
- Add 11 tests for network.js (100% coverage)
- Add 18 tests for storage.js (100% coverage)
- Add 18 tests for cache.js (100% coverage)
- Test online/offline detection and network changes
- Test localStorage error handling and edge cases
- Test cache operations with mocked Cache API
- All 234 tests passing (47 new tests added)
- Overall coverage: 97.65% statements, 96.12% branches
- Mark utility tests as completed (47 new tests)
- All utility modules now have 100% coverage
- Overall coverage: 97.65% statements, 96.12% branches
- 234 tests passing
Phase 2.2: Implement Offline Resource Caching
Set display: 'none' on the absolutely-positioned div in Header.jsx (top-right, 1.5rem) to remove the element from the UI without deleting the markup. This temporarily hides the control/indicator while preserving its code for potential future use.
Phase 2.3 bug fixes:

Bug 1: Share API Detection
- Remove mobile/desktop distinction for Share API
- Prioritize navigator.share when available (any platform)
- Fall back to clipboard API when share not available
- Fixes Android apps incorrectly reporting no Share API

Bug 2: Resource Modal Links
- Add as="a" prop to Button components to ensure proper anchor rendering
- All resource links now correctly open in new tabs
- Fixes California Rapid Response Networks links opening in same tab

Also:
- Update all shareHandler tests to reflect new prioritization logic
- Renumber Update Strategy section from 2.3 to 2.4 in workplan
- Update workplan with Phase 2.3 bug fix details

Tests: All 234 tests passing
Import cache utilities and expand Header tests to cover caching and install flows. Added tests to verify: already-cached message when resources are complete; loading spinner while caching; partial success alert when some resources fail; error alert when caching throws; and handling a beforeinstallprompt event without a userChoice property. Mocks for cacheUtils (isCached, cacheResources), navigator.onLine, and matchMedia are used to exercise different states.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Phase 2.3: Bug Fixes - Share API and Resource Links
@AccessiT3ch AccessiT3ch merged commit ce6668c into main Feb 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants