2026-05-24 19:51:29 +00:00
|
|
|
'use client';
|
|
|
|
|
|
2026-05-24 23:33:54 +00:00
|
|
|
import { useEffect, useMemo, useState, useCallback, useRef } from 'react';
|
|
|
|
|
import { MapContainer, TileLayer, Marker, Popup, Polyline, useMap } from 'react-leaflet';
|
2026-05-26 23:17:56 +00:00
|
|
|
import { OrderItem, Supplier } from '@/lib/types';
|
2026-05-24 20:31:35 +00:00
|
|
|
import { formatCurrency, calculateDistance, parseCoordinates } from '@/lib/utils';
|
2026-05-24 23:33:54 +00:00
|
|
|
import { getDriverTrail, isAuthenticated, getCurrentUser } from '@/lib/pocketbase';
|
2026-05-26 23:17:56 +00:00
|
|
|
import { Navigation, AlertTriangle, Route, Crosshair } from 'lucide-react';
|
2026-05-24 19:51:29 +00:00
|
|
|
import L from 'leaflet';
|
|
|
|
|
|
|
|
|
|
const defaultIcon = L.icon({
|
|
|
|
|
iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png',
|
|
|
|
|
iconRetinaUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon-2x.png',
|
|
|
|
|
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-shadow.png',
|
|
|
|
|
iconSize: [25, 41],
|
|
|
|
|
iconAnchor: [12, 41],
|
|
|
|
|
popupAnchor: [1, -34],
|
|
|
|
|
shadowSize: [41, 41],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const currentLocationIcon = L.divIcon({
|
|
|
|
|
className: 'custom-div-icon',
|
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
|
|
|
html: `<div style="position:relative;">
|
|
|
|
|
<div style="width:22px;height:22px;background:#ea580c;border:3px solid white;border-radius:50%;box-shadow:0 2px 8px rgba(0,0,0,0.3);position:relative;z-index:2;"></div>
|
|
|
|
|
<div style="width:40px;height:40px;background:rgba(234,88,12,0.15);border-radius:50%;position:absolute;top:-9px;left:-9px;z-index:1;animation:pulse 2s infinite;"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<style>@keyframes pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.5);opacity:0}}</style>`,
|
|
|
|
|
iconSize: [22, 22],
|
|
|
|
|
iconAnchor: [11, 11],
|
2026-05-24 19:51:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
interface MapViewProps {
|
2026-05-24 22:47:47 +00:00
|
|
|
items: OrderItem[];
|
2026-05-24 19:51:29 +00:00
|
|
|
onNavigate: (lat: number, lng: number, name: string) => void;
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-24 22:47:47 +00:00
|
|
|
function MapBounds({ items }: { items: OrderItem[] }) {
|
2026-05-24 19:51:29 +00:00
|
|
|
const map = useMap();
|
|
|
|
|
useEffect(() => {
|
2026-05-24 22:47:47 +00:00
|
|
|
const validPoints = items
|
|
|
|
|
.map((i) => {
|
|
|
|
|
const coords = parseCoordinates(i.expand?.supplier?.coordinates);
|
2026-05-24 20:31:35 +00:00
|
|
|
return coords ? [coords.latitude, coords.longitude] as [number, number] : null;
|
|
|
|
|
})
|
|
|
|
|
.filter((point): point is [number, number] => point !== null);
|
2026-05-24 19:51:29 +00:00
|
|
|
if (validPoints.length > 0) {
|
|
|
|
|
const bounds = L.latLngBounds(validPoints);
|
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
|
|
|
map.fitBounds(bounds, { padding: [60, 60], maxZoom: 15 });
|
2026-05-24 19:51:29 +00:00
|
|
|
}
|
2026-05-24 22:47:47 +00:00
|
|
|
}, [map, items]);
|
2026-05-24 23:33:54 +00:00
|
|
|
return null;
|
|
|
|
|
}
|
2026-05-24 19:51:29 +00:00
|
|
|
|
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
|
|
|
function RecenterButton({ center }: { center: [number, number] }) {
|
2026-05-24 23:33:54 +00:00
|
|
|
const map = useMap();
|
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
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => map.setView(center, map.getZoom(), { animate: true })}
|
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
|
|
|
aria-label="Recenter on me"
|
|
|
|
|
className="flex items-center justify-center w-10 h-10 bg-[#e6e5e0]/95 backdrop-blur-sm rounded-xl active:bg-[#ebeae5] transition-all touch-manipulation press-feedback-sm"
|
|
|
|
|
style={{ boxShadow: '0 14px 32px rgba(0,0,0,0.18), 0 0 0 1px rgba(38,37,30,0.1)' }}
|
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
|
|
|
>
|
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
|
|
|
<Crosshair size={18} className="text-[#26251e]" />
|
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
|
|
|
</button>
|
|
|
|
|
);
|
2026-05-24 19:51:29 +00:00
|
|
|
}
|
|
|
|
|
|
2026-05-24 22:47:47 +00:00
|
|
|
export default function CollectionMap({ items, onNavigate }: MapViewProps) {
|
2026-05-24 19:51:29 +00:00
|
|
|
const [userLocation, setUserLocation] = useState<[number, number] | null>(null);
|
2026-05-24 23:33:54 +00:00
|
|
|
const [trail, setTrail] = useState<[number, number][]>([]);
|
|
|
|
|
const [showTrail, setShowTrail] = useState(true);
|
|
|
|
|
const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
2026-05-24 19:51:29 +00:00
|
|
|
|
2026-05-24 23:33:54 +00:00
|
|
|
// Get current position
|
2026-05-24 19:51:29 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
if ('geolocation' in navigator) {
|
|
|
|
|
navigator.geolocation.getCurrentPosition(
|
2026-05-24 22:47:47 +00:00
|
|
|
(pos) => setUserLocation([pos.coords.latitude, pos.coords.longitude]),
|
|
|
|
|
() => {},
|
2026-05-24 20:31:35 +00:00
|
|
|
{ enableHighAccuracy: false, timeout: 30000 }
|
2026-05-24 19:51:29 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}, []);
|
|
|
|
|
|
2026-05-24 23:33:54 +00:00
|
|
|
// Fetch trail data periodically
|
|
|
|
|
const fetchTrail = useCallback(async () => {
|
|
|
|
|
if (!isAuthenticated()) return;
|
|
|
|
|
const user = getCurrentUser();
|
|
|
|
|
if (!user) return;
|
|
|
|
|
const data = await getDriverTrail(user.id);
|
|
|
|
|
const points = data
|
|
|
|
|
.filter((loc) => loc.latitude && loc.longitude)
|
|
|
|
|
.map((loc) => [loc.latitude, loc.longitude] as [number, number]);
|
|
|
|
|
if (points.length > 0) {
|
|
|
|
|
setTrail(points);
|
|
|
|
|
}
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchTrail();
|
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
|
|
|
intervalRef.current = setInterval(fetchTrail, 60000);
|
2026-05-24 23:33:54 +00:00
|
|
|
return () => {
|
|
|
|
|
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
|
|
|
};
|
|
|
|
|
}, [fetchTrail]);
|
|
|
|
|
|
|
|
|
|
// Group by supplier
|
2026-05-24 19:51:29 +00:00
|
|
|
const suppliers = useMemo(() => {
|
2026-05-24 22:47:47 +00:00
|
|
|
const map = new Map<string, { supplier: Supplier; items: OrderItem[]; coords: { latitude: number; longitude: number } }>();
|
|
|
|
|
items.forEach((item) => {
|
|
|
|
|
if (!item.expand?.supplier) return;
|
|
|
|
|
const supplier = item.expand.supplier;
|
2026-05-24 20:31:35 +00:00
|
|
|
const coords = parseCoordinates(supplier.coordinates);
|
|
|
|
|
if (!coords) return;
|
2026-05-24 19:51:29 +00:00
|
|
|
const key = supplier.id;
|
|
|
|
|
if (!map.has(key)) {
|
2026-05-24 22:47:47 +00:00
|
|
|
map.set(key, { supplier, items: [], coords });
|
2026-05-24 19:51:29 +00:00
|
|
|
}
|
2026-05-24 22:47:47 +00:00
|
|
|
map.get(key)!.items.push(item);
|
2026-05-24 19:51:29 +00:00
|
|
|
});
|
|
|
|
|
return Array.from(map.values());
|
2026-05-24 22:47:47 +00:00
|
|
|
}, [items]);
|
2026-05-24 19:51:29 +00:00
|
|
|
|
2026-05-24 22:47:47 +00:00
|
|
|
const defaultCenter: [number, number] = [-33.9249, 18.4241];
|
2026-05-24 19:51:29 +00:00
|
|
|
const center = userLocation || defaultCenter;
|
|
|
|
|
|
2026-05-24 22:47:47 +00:00
|
|
|
const getDistance = (coords: { latitude: number; longitude: number }) => {
|
2026-05-24 20:31:35 +00:00
|
|
|
if (!userLocation) return null;
|
2026-05-24 22:47:47 +00:00
|
|
|
return calculateDistance(userLocation[0], userLocation[1], coords.latitude, coords.longitude);
|
2026-05-24 19:51:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2026-05-26 23:17:56 +00:00
|
|
|
<div className="absolute inset-0">
|
|
|
|
|
<MapContainer
|
|
|
|
|
center={center}
|
|
|
|
|
zoom={12}
|
|
|
|
|
className="absolute inset-0 z-0"
|
|
|
|
|
zoomControl={false}
|
|
|
|
|
style={{ height: '100%', width: '100%' }}
|
|
|
|
|
>
|
2026-05-24 23:33:54 +00:00
|
|
|
<TileLayer
|
|
|
|
|
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
|
|
|
|
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
|
|
|
/>
|
|
|
|
|
|
2026-05-24 22:47:47 +00:00
|
|
|
<MapBounds items={items} />
|
2026-05-24 19:51:29 +00:00
|
|
|
|
|
|
|
|
{userLocation && (
|
|
|
|
|
<Marker position={userLocation} icon={currentLocationIcon}>
|
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
|
|
|
<Popup>
|
|
|
|
|
<div className="text-sm font-medium">Your Location</div>
|
|
|
|
|
</Popup>
|
2026-05-24 19:51:29 +00:00
|
|
|
</Marker>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-05-24 23:33:54 +00:00
|
|
|
{/* Trail polyline */}
|
|
|
|
|
{showTrail && trail.length > 1 && (
|
|
|
|
|
<>
|
|
|
|
|
<Polyline
|
|
|
|
|
positions={trail}
|
|
|
|
|
pathOptions={{
|
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
|
|
|
color: '#1f8a65',
|
2026-05-24 23:33:54 +00:00
|
|
|
weight: 4,
|
|
|
|
|
opacity: 0.7,
|
|
|
|
|
dashArray: '10, 8',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Marker
|
|
|
|
|
position={trail[0]}
|
|
|
|
|
icon={L.divIcon({
|
|
|
|
|
className: '',
|
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
|
|
|
html: '<div style="width:14px;height:14px;background:#1f8a65;border:3px solid #f2f1ed;border-radius:50%;box-shadow:0 1px 4px rgba(0,0,0,0.3);"></div>',
|
2026-05-24 23:33:54 +00:00
|
|
|
iconSize: [14, 14],
|
|
|
|
|
iconAnchor: [7, 7],
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<Popup><div className="text-xs font-medium">Trip Start</div></Popup>
|
|
|
|
|
</Marker>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-05-24 22:47:47 +00:00
|
|
|
{suppliers.map(({ supplier, items: supplierItems, coords }) => {
|
|
|
|
|
const distance = getDistance(coords);
|
2026-05-24 19:51:29 +00:00
|
|
|
return (
|
2026-05-24 22:47:47 +00:00
|
|
|
<Marker key={supplier.id} position={[coords.latitude, coords.longitude]} icon={defaultIcon}>
|
2026-05-24 19:51:29 +00:00
|
|
|
<Popup>
|
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
|
|
|
<div className="min-w-[200px] max-w-[260px]">
|
2026-05-24 19:51:29 +00:00
|
|
|
<h3 className="font-bold text-sm mb-1">{supplier.suppliername}</h3>
|
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
|
|
|
{supplier.supplieraddress && (
|
|
|
|
|
<p className="text-xs text-gray-500 mb-2">{supplier.supplieraddress}</p>
|
|
|
|
|
)}
|
|
|
|
|
{distance && (
|
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
|
|
|
<p className="text-xs text-[#f54e00] mb-2 font-semibold">
|
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
|
|
|
{distance < 1 ? `${Math.round(distance * 1000)}m` : `${distance.toFixed(1)} km`} away
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
2026-05-24 19:51:29 +00:00
|
|
|
<div className="space-y-1.5 mb-3">
|
2026-05-24 22:47:47 +00:00
|
|
|
{supplierItems.map((i) => (
|
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
|
|
|
<div key={i.id} className="text-xs p-2 bg-[#ebeae5] rounded-lg">
|
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
|
|
|
<div className="flex items-center gap-1.5">
|
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
|
|
|
{i.problem_flag && <AlertTriangle size={12} className="text-[#b3224a] flex-shrink-0" />}
|
2026-05-24 22:47:47 +00:00
|
|
|
<span className="font-medium truncate">{i.description}</span>
|
2026-05-24 19:51:29 +00:00
|
|
|
</div>
|
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
|
|
|
<span className="text-[rgba(38,37,30,0.55)] text-[11px]">Qty: {i.order_qty || i.quantity || 0}</span>
|
2026-05-24 19:51:29 +00:00
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
<button
|
2026-05-24 22:47:47 +00:00
|
|
|
onClick={() => onNavigate(coords.latitude, coords.longitude, supplier.suppliername)}
|
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
|
|
|
className="w-full flex items-center justify-center gap-1.5 py-2 px-3 bg-[#f54e00] text-white rounded-lg text-sm font-semibold active:bg-[#d44200] transition-colors"
|
2026-05-24 19:51:29 +00:00
|
|
|
>
|
2026-05-24 22:47:47 +00:00
|
|
|
<Navigation size={14} /> Navigate
|
2026-05-24 19:51:29 +00:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</Popup>
|
|
|
|
|
</Marker>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</MapContainer>
|
|
|
|
|
|
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
|
|
|
{/* Floating controls */}
|
|
|
|
|
<div className="absolute top-3 right-3 space-y-2 z-[400]">
|
|
|
|
|
{/* Recenter */}
|
|
|
|
|
{userLocation && (
|
|
|
|
|
<RecenterButton center={userLocation} />
|
|
|
|
|
)}
|
|
|
|
|
|
2026-05-24 23:33:54 +00:00
|
|
|
{/* Trail toggle */}
|
|
|
|
|
{trail.length > 1 && (
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => setShowTrail(!showTrail)}
|
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
|
|
|
aria-pressed={showTrail}
|
|
|
|
|
className={`flex items-center gap-1.5 px-3 py-2 rounded-xl text-xs font-semibold transition-colors press-feedback-sm ${
|
|
|
|
|
showTrail
|
|
|
|
|
? 'bg-[#26251e] text-[#f2f1ed]'
|
|
|
|
|
: 'bg-[#e6e5e0]/95 backdrop-blur-sm text-[#26251e]'
|
2026-05-24 23:33:54 +00:00
|
|
|
}`}
|
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
|
|
|
style={{ boxShadow: '0 14px 32px rgba(0,0,0,0.18), 0 0 0 1px rgba(38,37,30,0.1)' }}
|
2026-05-24 23:33:54 +00:00
|
|
|
>
|
|
|
|
|
<Route size={14} />
|
|
|
|
|
Trail
|
|
|
|
|
</button>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{/* Legend */}
|
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
|
|
|
<div
|
|
|
|
|
className="bg-[#e6e5e0]/95 backdrop-blur-sm rounded-xl p-3"
|
|
|
|
|
style={{ boxShadow: '0 14px 32px rgba(0,0,0,0.18), 0 0 0 1px rgba(38,37,30,0.1)' }}
|
|
|
|
|
>
|
|
|
|
|
<p className="text-[10px] font-bold text-[rgba(38,37,30,0.55)] uppercase tracking-wider mb-2">Legend</p>
|
2026-05-24 23:33:54 +00:00
|
|
|
<div className="space-y-1.5">
|
|
|
|
|
<div className="flex items-center gap-2">
|
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
|
|
|
<div className="w-3 h-3 rounded-full bg-[#f54e00] border-2 border-white shadow-sm" />
|
|
|
|
|
<span className="text-[11px] text-[#26251e]">You</span>
|
2026-05-24 23:33:54 +00:00
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center gap-2">
|
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
|
|
|
<div className="w-3 h-3.5 bg-[#26251e]/70 rounded-sm" />
|
|
|
|
|
<span className="text-[11px] text-[#26251e]">Stop</span>
|
2026-05-24 19:51:29 +00:00
|
|
|
</div>
|
2026-05-24 23:33:54 +00:00
|
|
|
{trail.length > 1 && (
|
|
|
|
|
<div className="flex items-center gap-2">
|
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
|
|
|
<div className="w-5 h-0" style={{ borderTop: '2px dashed #1f8a65' }} />
|
|
|
|
|
<span className="text-[11px] text-[#26251e]">Route</span>
|
2026-05-24 23:33:54 +00:00
|
|
|
</div>
|
|
|
|
|
)}
|
2026-05-24 19:51:29 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
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
|
|
|
}
|