Add PWA support and UI redesign
Add full PWA support (icons, manifest, service worker, pwa lib and bridge) and introduce install/offline UI. Generate app icons via a new scripts/generate-icons.js and include multiple icon sizes in public/icons; update manifest and layout head meta/preconnect. Revamp global styles (globals.css) with new utilities, animations, spacing for bottom nav, card shadows, skeletons and accessibility tweaks. Polish major screens (login, collections, map, settings) with improved headers, loading states, touch/press feedback, and layout adjustments; add new components (InstallPrompt, OfflineIndicator, PWABridge) and update various components to match new visual/UX patterns. Update Dockerfile to generate icons and use Next.js static export output (/out) for nginx, and bump package setup to support icon generation.
2026-05-26 22:34:50 +00:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { useOnlineStatus } from '@/lib/pwa';
|
|
|
|
|
import { WifiOff, Wifi } from 'lucide-react';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
import { useState, useEffect } from 'react';
|
|
|
|
|
|
|
|
|
|
export default function OfflineIndicator() {
|
|
|
|
|
const isOnline = useOnlineStatus();
|
|
|
|
|
const [showBanner, setShowBanner] = useState(false);
|
|
|
|
|
const [wasOffline, setWasOffline] = useState(false);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (!isOnline) {
|
|
|
|
|
setShowBanner(true);
|
|
|
|
|
setWasOffline(true);
|
|
|
|
|
} else if (wasOffline) {
|
|
|
|
|
setShowBanner(true);
|
|
|
|
|
const timer = setTimeout(() => {
|
|
|
|
|
setShowBanner(false);
|
|
|
|
|
setWasOffline(false);
|
|
|
|
|
}, 3000);
|
|
|
|
|
return () => clearTimeout(timer);
|
|
|
|
|
}
|
|
|
|
|
}, [isOnline, wasOffline]);
|
|
|
|
|
|
|
|
|
|
if (!showBanner) return null;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
|
|
|
|
'fixed top-0 left-0 right-0 z-[80] transition-transform duration-300 ease-out safe-top',
|
|
|
|
|
showBanner ? 'translate-y-0' : '-translate-y-full'
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
|
|
|
|
'px-4 py-2 text-center text-sm font-medium flex items-center justify-center gap-2',
|
|
|
|
|
isOnline
|
refactor(ui): rebrand app, fix supplier naming
- rename `supplier` field to `suppliers` in OrderItem interface and PocketBase expand queries
- complete visual rebrand to warm cream (#f2f1ed) and dark brown (#26251e) color palette with custom CSS variables
- add accessibility improvements: skip-to-main content link, focus-visible styles, reduced motion support, and proper ARIA labels
- update all component styling to match new theme, including offline indicator, install prompt, login page, modals, map, bottom nav and global CSS
- standardize status colors: use green for success, red for errors, retain orange (#f54e00) as primary accent CTAs
2026-07-05 20:32:20 +00:00
|
|
|
? 'bg-[#1f8a65] text-white'
|
|
|
|
|
: 'bg-[#cf2d56] text-white'
|
Add PWA support and UI redesign
Add full PWA support (icons, manifest, service worker, pwa lib and bridge) and introduce install/offline UI. Generate app icons via a new scripts/generate-icons.js and include multiple icon sizes in public/icons; update manifest and layout head meta/preconnect. Revamp global styles (globals.css) with new utilities, animations, spacing for bottom nav, card shadows, skeletons and accessibility tweaks. Polish major screens (login, collections, map, settings) with improved headers, loading states, touch/press feedback, and layout adjustments; add new components (InstallPrompt, OfflineIndicator, PWABridge) and update various components to match new visual/UX patterns. Update Dockerfile to generate icons and use Next.js static export output (/out) for nginx, and bump package setup to support icon generation.
2026-05-26 22:34:50 +00:00
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
{isOnline ? (
|
|
|
|
|
<>
|
|
|
|
|
<Wifi size={14} />
|
|
|
|
|
Back online
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<WifiOff size={14} />
|
|
|
|
|
You're offline — changes will sync when reconnected
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|