From 5cc27f852b02446659e0ab85305916c9f5e5a5f0 Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Wed, 6 Aug 2025 00:12:19 +0200 Subject: feat: Implement pull-to-refresh functionality across various components - Added `PullToRefresh` component to enable pull-to-refresh behavior in `StopList` and `Estimates` pages. - Integrated `usePullToRefresh` hook to manage pull-to-refresh state and actions. - Created `UpdateNotification` component to inform users of available updates from the service worker. - Enhanced service worker management with `ServiceWorkerManager` class for better update handling and caching strategies. - Updated CSS styles for new components and improved layout for better user experience. - Refactored API caching logic in service worker to handle multiple endpoints and dynamic cache expiration. - Added auto-refresh functionality for estimates data to keep information up-to-date. --- src/frontend/app/components/UpdateNotification.css | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/frontend/app/components/UpdateNotification.css (limited to 'src/frontend/app/components/UpdateNotification.css') diff --git a/src/frontend/app/components/UpdateNotification.css b/src/frontend/app/components/UpdateNotification.css new file mode 100644 index 0000000..6183194 --- /dev/null +++ b/src/frontend/app/components/UpdateNotification.css @@ -0,0 +1,114 @@ +.update-notification { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 9999; + background-color: var(--button-background-color); + color: white; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); + animation: slideDown 0.3s ease-out; +} + +@keyframes slideDown { + from { + transform: translateY(-100%); + } + to { + transform: translateY(0); + } +} + +.update-content { + display: flex; + align-items: center; + padding: 12px 16px; + gap: 12px; + max-width: 100%; +} + +.update-icon { + flex-shrink: 0; + display: flex; + align-items: center; + justify-content: center; + width: 32px; + height: 32px; + background-color: rgba(255, 255, 255, 0.2); + border-radius: 50%; +} + +.update-text { + flex: 1; + min-width: 0; +} + +.update-title { + font-size: 0.9rem; + font-weight: 600; + margin-bottom: 2px; +} + +.update-description { + font-size: 0.8rem; + opacity: 0.9; + line-height: 1.2; +} + +.update-actions { + display: flex; + align-items: center; + gap: 8px; + flex-shrink: 0; +} + +.update-button { + background: rgba(255, 255, 255, 0.2); + border: 1px solid rgba(255, 255, 255, 0.3); + color: white; + padding: 6px 12px; + border-radius: 6px; + font-size: 0.8rem; + font-weight: 500; + cursor: pointer; + transition: background-color 0.2s ease; +} + +.update-button:hover:not(:disabled) { + background: rgba(255, 255, 255, 0.3); +} + +.update-button:disabled { + opacity: 0.7; + cursor: not-allowed; +} + +.update-dismiss { + background: none; + border: none; + color: white; + padding: 6px; + border-radius: 4px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + transition: background-color 0.2s ease; +} + +.update-dismiss:hover { + background: rgba(255, 255, 255, 0.2); +} + +@media (min-width: 768px) { + .update-content { + max-width: 768px; + margin: 0 auto; + } +} + +@media (min-width: 1024px) { + .update-content { + max-width: 1024px; + } +} -- cgit v1.3