2026-05-24 19:51:29 +00:00
|
|
|
'use client';
|
|
|
|
|
|
2026-05-26 22:55:21 +00:00
|
|
|
import { useState, useEffect, useCallback, useMemo } from 'react';
|
2026-05-24 19:51:29 +00:00
|
|
|
import { useRouter } from 'next/navigation';
|
2026-05-24 22:47:47 +00:00
|
|
|
import { OrderItem } from '@/lib/types';
|
2026-05-24 19:51:29 +00:00
|
|
|
import { useAuth } from '@/components/AuthProvider';
|
|
|
|
|
import BottomNav from '@/components/BottomNav';
|
|
|
|
|
import CollectionItemCard from '@/components/CollectionItemCard';
|
2026-05-26 22:55:21 +00:00
|
|
|
import SupplierGroup from '@/components/SupplierGroup';
|
2026-07-07 15:15:42 +00:00
|
|
|
import AreaGroup from '@/components/AreaGroup';
|
2026-05-24 19:51:29 +00:00
|
|
|
import CollectModal from '@/components/CollectModal';
|
|
|
|
|
import ProblemModal from '@/components/ProblemModal';
|
|
|
|
|
import {
|
2026-07-07 15:15:42 +00:00
|
|
|
getMyAssignedItems,
|
|
|
|
|
getPoolItems,
|
|
|
|
|
getProblemItems,
|
2026-05-24 19:51:29 +00:00
|
|
|
updateCollectionStatus,
|
|
|
|
|
reportProblem,
|
|
|
|
|
isAuthenticated,
|
|
|
|
|
logout,
|
2026-07-07 18:43:17 +00:00
|
|
|
getItemDisplayQty,
|
2026-05-24 19:51:29 +00:00
|
|
|
} from '@/lib/pocketbase';
|
2026-07-07 18:43:17 +00:00
|
|
|
import { getCached, setCached } from '@/lib/itemsCache';
|
2026-07-07 15:15:42 +00:00
|
|
|
import { cn, clusterByProximity } from '@/lib/utils';
|
2026-05-24 19:51:29 +00:00
|
|
|
import {
|
|
|
|
|
RefreshCw,
|
|
|
|
|
LogOut,
|
|
|
|
|
MapPin,
|
|
|
|
|
AlertCircle,
|
|
|
|
|
CheckCircle2,
|
|
|
|
|
Search,
|
|
|
|
|
X,
|
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
|
|
|
Package,
|
2026-07-07 15:15:42 +00:00
|
|
|
Layers,
|
2026-05-24 19:51:29 +00:00
|
|
|
} from 'lucide-react';
|
|
|
|
|
|
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
|
|
|
// Cursor-harmonized supplier color palette: same warm cream surface
|
|
|
|
|
// for every group, with the *name* color living in a single muted
|
|
|
|
|
// tile (not a saturated left-border stripe). Each group gets a
|
|
|
|
|
// distinct hue but all read as part of the same family.
|
2026-05-26 22:55:21 +00:00
|
|
|
const SUPPLIER_COLORS = [
|
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
|
|
|
{ dot: 'bg-[#f54e00]', light: 'bg-[#ebeae5]', text: 'text-[#26251e]', ring: 'ring-[#f54e00]/30' }, // orange (signature)
|
|
|
|
|
{ dot: 'bg-[#18714f]', light: 'bg-[#e6f1ec]', text: 'text-[#125a3e]', ring: 'ring-[#18714f]/30' }, // emerald
|
|
|
|
|
{ dot: 'bg-[#6c5a99]', light: 'bg-[#ece8f3]', text: 'text-[#4a3d6b]', ring: 'ring-[#6c5a99]/30' }, // violet
|
|
|
|
|
{ dot: 'bg-[#cf2d56]', light: 'bg-[#fbeaef]', text: 'text-[#8a1b3a]', ring: 'ring-[#cf2d56]/30' }, // rose
|
|
|
|
|
{ dot: 'bg-[#8a5a02]', light: 'bg-[#fcf3d8]', text: 'text-[#8a5a02]', ring: 'ring-[#d49103]/30' }, // amber
|
|
|
|
|
{ dot: 'bg-[#26251e]', light: 'bg-[#ebeae5]', text: 'text-[#26251e]', ring: 'ring-[#26251e]/30' }, // ink
|
|
|
|
|
{ dot: 'bg-[#6b6760]', light: 'bg-[#ebeae5]', text: 'text-[#4a4742]', ring: 'ring-[#6b6760]/30' }, // warm gray
|
2026-07-07 15:15:42 +00:00
|
|
|
{ dot: 'bg-[#0d9488]', light: 'bg-[#e6f5f3]', text: 'text-[#0a7a70]', ring: 'ring-[#0d9488]/30' }, // teal
|
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
|
|
|
{ dot: 'bg-[#8a1b3a]', light: 'bg-[#fbeaef]', text: 'text-[#8a1b3a]', ring: 'ring-[#cf2d56]/30' }, // crimson
|
|
|
|
|
{ dot: 'bg-[#4a3d6b]', light: 'bg-[#ece8f3]', text: 'text-[#4a3d6b]', ring: 'ring-[#6c5a99]/30' }, // indigo
|
2026-05-26 22:55:21 +00:00
|
|
|
];
|
|
|
|
|
|
2026-05-24 19:51:29 +00:00
|
|
|
export default function CollectionsPage() {
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const { isLoggedIn, user, isLoading: authLoading } = useAuth();
|
2026-07-07 18:43:17 +00:00
|
|
|
// Hydrate initial state from the in-memory cache so tab switching
|
|
|
|
|
// shows last-known data instantly (no loading skeleton) while the
|
|
|
|
|
// background re-fetch lands. Without this, every bottom-nav click
|
|
|
|
|
// shows a blank-then-skeleton-then-content flash, which is the
|
|
|
|
|
// "feels sluggish on PC" symptom drivers reported.
|
|
|
|
|
const [items, setItems] = useState<OrderItem[]>(() => {
|
|
|
|
|
if (typeof window === 'undefined') return [];
|
|
|
|
|
return getCached('assigned') ?? [];
|
|
|
|
|
});
|
|
|
|
|
const [filteredItems, setFilteredItems] = useState<OrderItem[]>(items);
|
|
|
|
|
// Only show the loading skeleton on first mount when we have
|
|
|
|
|
// absolutely nothing to show. Subsequent loads (returning to
|
|
|
|
|
// the tab, switching tabs) get the cached items immediately
|
|
|
|
|
// and the re-fetch happens silently in the background.
|
|
|
|
|
const [isLoading, setIsLoading] = useState<boolean>(items.length === 0);
|
2026-05-24 19:51:29 +00:00
|
|
|
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
|
|
|
const [error, setError] = useState('');
|
|
|
|
|
const [searchQuery, setSearchQuery] = useState('');
|
2026-05-24 22:47:47 +00:00
|
|
|
const [selectedItem, setSelectedItem] = useState<OrderItem | null>(null);
|
2026-05-24 19:51:29 +00:00
|
|
|
const [showCollectModal, setShowCollectModal] = useState(false);
|
|
|
|
|
const [showProblemModal, setShowProblemModal] = useState(false);
|
|
|
|
|
const [toast, setToast] = useState<{ message: string; type: 'success' | 'error' | 'warning' } | null>(null);
|
2026-05-26 22:55:21 +00:00
|
|
|
const [viewMode, setViewMode] = useState<'compact' | 'detailed'>('compact');
|
2026-07-07 15:15:42 +00:00
|
|
|
const [groupMode, setGroupMode] = useState<'supplier' | 'area'>('supplier');
|
|
|
|
|
const [statusFilter, setStatusFilter] = useState<'assigned' | 'collection_pool' | 'problem'>('assigned');
|
2026-05-26 22:55:21 +00:00
|
|
|
|
|
|
|
|
// Track which supplier groups are expanded
|
|
|
|
|
const [expandedSuppliers, setExpandedSuppliers] = useState<Set<string>>(new Set());
|
2026-07-07 15:15:42 +00:00
|
|
|
const [expandedAreas, setExpandedAreas] = useState<Set<string>>(new Set());
|
2026-05-24 19:51:29 +00:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
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
|
|
|
if (!authLoading && !isLoggedIn) router.push('/login/');
|
2026-05-24 19:51:29 +00:00
|
|
|
}, [isLoggedIn, authLoading, router]);
|
|
|
|
|
|
2026-07-07 18:43:17 +00:00
|
|
|
// Each tab maps to a different PocketBase fetch — pool and problems
|
|
|
|
|
// are SYSTEM-WIDE (any driver can see them), assigned is the current
|
|
|
|
|
// driver's personal list only. This is the contract the brief asked
|
|
|
|
|
// for: "pool must show all items in collection_pool, same with
|
|
|
|
|
// problems; default when you open the app should be assigned".
|
|
|
|
|
//
|
|
|
|
|
// The cache write on success is what makes subsequent tab switches
|
|
|
|
|
// instant — the next page mount reads the cache and renders the
|
|
|
|
|
// last-known list with no skeleton flash.
|
|
|
|
|
const loadItems = useCallback(async (showLoading = true) => {
|
2026-05-24 19:51:29 +00:00
|
|
|
if (!isAuthenticated()) return;
|
2026-07-07 18:43:17 +00:00
|
|
|
// Only show the loading skeleton when we genuinely have nothing
|
|
|
|
|
// to render. If cached data is on screen, the re-fetch happens
|
|
|
|
|
// silently and the user sees fresh data appear without a flash.
|
|
|
|
|
if (showLoading && items.length === 0) setIsLoading(true);
|
2026-05-24 19:51:29 +00:00
|
|
|
setError('');
|
|
|
|
|
try {
|
2026-07-07 15:15:42 +00:00
|
|
|
let data: OrderItem[] = [];
|
|
|
|
|
if (statusFilter === 'assigned') {
|
|
|
|
|
data = await getMyAssignedItems();
|
|
|
|
|
} else if (statusFilter === 'collection_pool') {
|
|
|
|
|
data = await getPoolItems();
|
|
|
|
|
} else if (statusFilter === 'problem') {
|
|
|
|
|
data = await getProblemItems();
|
|
|
|
|
}
|
2026-05-24 22:47:47 +00:00
|
|
|
setItems(data);
|
|
|
|
|
setFilteredItems(data);
|
2026-07-07 18:43:17 +00:00
|
|
|
setCached(statusFilter, data);
|
2026-07-07 15:15:42 +00:00
|
|
|
const allSupplierIds = new Set<string>();
|
2026-05-26 22:55:21 +00:00
|
|
|
data.forEach(i => {
|
2026-07-07 15:15:42 +00:00
|
|
|
if (i.expand?.supplier?.id) allSupplierIds.add(i.expand.supplier.id);
|
2026-05-26 22:55:21 +00:00
|
|
|
});
|
2026-07-07 15:15:42 +00:00
|
|
|
setExpandedSuppliers(allSupplierIds);
|
|
|
|
|
const allAreaIds = new Set<string>();
|
|
|
|
|
const clusters = clusterByProximity(data, 2);
|
|
|
|
|
clusters.forEach(c => allAreaIds.add(c.id));
|
|
|
|
|
setExpandedAreas(allAreaIds);
|
2026-05-24 19:51:29 +00:00
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Failed to load collections:', err);
|
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
|
|
|
setError('Failed to load collections. Pull down to retry.');
|
2026-05-24 19:51:29 +00:00
|
|
|
} finally {
|
|
|
|
|
setIsLoading(false);
|
|
|
|
|
setIsRefreshing(false);
|
|
|
|
|
}
|
2026-07-07 18:43:17 +00:00
|
|
|
}, [statusFilter, items.length]);
|
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
|
|
|
useEffect(() => { loadItems(); }, [loadItems]);
|
2026-05-24 19:51:29 +00:00
|
|
|
|
2026-07-07 18:43:17 +00:00
|
|
|
// Seed items from cache the moment the filter changes, BEFORE the
|
|
|
|
|
// network re-fetch resolves. This is what kills the
|
|
|
|
|
// skeleton-flash on tab/filter switches — driver taps Pool, the
|
|
|
|
|
// page immediately renders whatever was last cached for pool, and
|
|
|
|
|
// the re-fetch swaps in fresh data when it lands.
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const cached = getCached(statusFilter);
|
|
|
|
|
if (cached) {
|
|
|
|
|
setItems(cached);
|
|
|
|
|
setFilteredItems(cached);
|
|
|
|
|
}
|
|
|
|
|
// intentionally not depending on `items` — we only want this to
|
|
|
|
|
// fire when statusFilter changes (or on mount).
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [statusFilter]);
|
|
|
|
|
|
2026-05-24 19:51:29 +00:00
|
|
|
useEffect(() => {
|
2026-05-24 22:47:47 +00:00
|
|
|
let filtered = items;
|
2026-05-24 19:51:29 +00:00
|
|
|
if (searchQuery) {
|
|
|
|
|
const query = searchQuery.toLowerCase();
|
2026-05-24 22:47:47 +00:00
|
|
|
filtered = filtered.filter((i) => {
|
|
|
|
|
const desc = i.description || '';
|
|
|
|
|
const supplier = i.expand?.supplier?.suppliername || '';
|
|
|
|
|
const orderNum = i.expand?.order?.order_number || '';
|
2026-05-24 19:51:29 +00:00
|
|
|
return (
|
|
|
|
|
desc.toLowerCase().includes(query) ||
|
|
|
|
|
supplier.toLowerCase().includes(query) ||
|
|
|
|
|
orderNum.toLowerCase().includes(query)
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
2026-05-24 22:47:47 +00:00
|
|
|
setFilteredItems(filtered);
|
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
|
|
|
}, [items, searchQuery, statusFilter]);
|
|
|
|
|
|
|
|
|
|
// Counts for the status chip strip — derived from the unfiltered
|
|
|
|
|
// list so chips stay stable as the user types in the search field.
|
2026-07-07 15:15:42 +00:00
|
|
|
// Each tab pulls from a different PB query (driver-scoped vs system-wide),
|
|
|
|
|
// so these counts aren't comparable across tabs; they each represent
|
|
|
|
|
// the size of the most recent fetch for THAT tab.
|
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
|
|
|
const statusCounts = useMemo(() => ({
|
|
|
|
|
assigned: items.filter((i) => i.item_status === 'assigned').length,
|
2026-07-07 15:15:42 +00:00
|
|
|
collection_pool: items.filter((i) => i.item_status === 'collection_pool').length,
|
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
|
|
|
problem: items.filter((i) => i.problem_flag).length,
|
|
|
|
|
}), [items]);
|
2026-05-24 19:51:29 +00:00
|
|
|
|
2026-07-07 15:15:42 +00:00
|
|
|
// Mirror the currently selected tab to localStorage so the Map page
|
|
|
|
|
// can pick it up on its next visit and show the same dataset the
|
|
|
|
|
// driver was last working with.
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
|
window.localStorage.setItem('1driver_map_tab', statusFilter);
|
|
|
|
|
}
|
|
|
|
|
}, [statusFilter]);
|
|
|
|
|
|
2026-05-24 19:51:29 +00:00
|
|
|
const handleRefresh = async () => {
|
|
|
|
|
setIsRefreshing(true);
|
2026-05-24 22:47:47 +00:00
|
|
|
await loadItems(false);
|
2026-05-24 19:51:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const showToast = (message: string, type: 'success' | 'error' | 'warning' = 'success') => {
|
|
|
|
|
setToast({ message, type });
|
|
|
|
|
setTimeout(() => setToast(null), 3000);
|
|
|
|
|
};
|
|
|
|
|
|
2026-07-07 18:43:17 +00:00
|
|
|
const handleCollect = async (item: OrderItem, receivedQty: number, notes: string, photo: File | null) => {
|
2026-05-24 19:51:29 +00:00
|
|
|
try {
|
2026-07-07 18:43:17 +00:00
|
|
|
// expectedQty is computed from the same getItemDisplayQty the
|
|
|
|
|
// modal uses, so the comparison happens against the same number
|
|
|
|
|
// the driver just saw on screen.
|
|
|
|
|
const expectedQty = getItemDisplayQty(item);
|
2026-05-24 22:47:47 +00:00
|
|
|
await updateCollectionStatus(item.id, 'collected', {
|
|
|
|
|
qty_collected: receivedQty,
|
2026-05-24 19:51:29 +00:00
|
|
|
notes,
|
2026-07-07 18:43:17 +00:00
|
|
|
photo,
|
|
|
|
|
expectedQty,
|
2026-05-24 22:47:47 +00:00
|
|
|
collected_date: new Date().toISOString(),
|
2026-05-24 19:51:29 +00:00
|
|
|
});
|
2026-05-24 22:47:47 +00:00
|
|
|
setItems((prev) => prev.filter((i) => i.id !== item.id));
|
2026-05-24 19:51:29 +00:00
|
|
|
setShowCollectModal(false);
|
|
|
|
|
showToast('Collection completed successfully');
|
|
|
|
|
} catch (err) {
|
|
|
|
|
showToast('Failed to update collection', 'error');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
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
|
|
|
const handleProblem = async (item: OrderItem, problemType: string, description: string) => {
|
2026-05-24 19:51:29 +00:00
|
|
|
try {
|
2026-05-24 22:47:47 +00:00
|
|
|
await reportProblem(item.id, problemType, description);
|
|
|
|
|
setItems((prev) => prev.filter((i) => i.id !== item.id));
|
2026-05-24 19:51:29 +00:00
|
|
|
setShowProblemModal(false);
|
|
|
|
|
showToast('Problem reported successfully', 'warning');
|
|
|
|
|
} catch (err) {
|
|
|
|
|
showToast('Failed to report problem', 'error');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleNavigate = (lat: number, lng: number, name: string) => {
|
|
|
|
|
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
2026-05-24 22:47:47 +00:00
|
|
|
const url = isIOS
|
|
|
|
|
? `maps://maps.apple.com/?q=${encodeURIComponent(name)}&ll=${lat},${lng}`
|
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
|
|
|
: `https://www.google.com/maps/dir/?api=1&destination=${lat},${lng}`;
|
2026-05-24 19:51:29 +00:00
|
|
|
window.open(url, '_blank');
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-26 22:55:21 +00:00
|
|
|
const toggleSupplier = (supplierId: string) => {
|
|
|
|
|
setExpandedSuppliers(prev => {
|
|
|
|
|
const next = new Set(prev);
|
|
|
|
|
if (next.has(supplierId)) next.delete(supplierId);
|
|
|
|
|
else next.add(supplierId);
|
|
|
|
|
return next;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2026-07-07 15:15:42 +00:00
|
|
|
const toggleArea = (clusterId: string) => {
|
|
|
|
|
setExpandedAreas(prev => {
|
|
|
|
|
const next = new Set(prev);
|
|
|
|
|
if (next.has(clusterId)) next.delete(clusterId);
|
|
|
|
|
else next.add(clusterId);
|
|
|
|
|
return next;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-26 22:55:21 +00:00
|
|
|
const expandAll = () => {
|
2026-07-07 15:15:42 +00:00
|
|
|
if (groupMode === 'supplier') {
|
|
|
|
|
const allIds = new Set<string>();
|
|
|
|
|
filteredItems.forEach(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
|
|
|
if (i.expand?.supplier?.id) allIds.add(i.expand.supplier.id);
|
2026-07-07 15:15:42 +00:00
|
|
|
});
|
|
|
|
|
setExpandedSuppliers(allIds);
|
|
|
|
|
} else {
|
|
|
|
|
const allIds = new Set<string>();
|
|
|
|
|
areaClusters.forEach(c => allIds.add(c.id));
|
|
|
|
|
setExpandedAreas(allIds);
|
|
|
|
|
}
|
2026-05-26 22:55:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const collapseAll = () => setExpandedSuppliers(new Set());
|
|
|
|
|
|
2026-06-09 22:05:06 +00:00
|
|
|
// Group by supplier - items without supplier are grouped under "Unknown"
|
2026-05-26 22:55:21 +00:00
|
|
|
const groupedArray = useMemo(() => {
|
|
|
|
|
const grouped = filteredItems.reduce((acc, item) => {
|
|
|
|
|
const supplier = item.expand?.supplier;
|
2026-06-09 22:05:06 +00:00
|
|
|
const key = supplier?.id || '__unknown__';
|
2026-05-26 22:55:21 +00:00
|
|
|
if (!acc[key]) acc[key] = { supplier, items: [] };
|
|
|
|
|
acc[key].items.push(item);
|
|
|
|
|
return acc;
|
2026-06-09 22:05:06 +00:00
|
|
|
}, {} as Record<string, { supplier: NonNullable<OrderItem['expand']>['supplier'] | null; items: OrderItem[] }>);
|
2026-05-24 19:51:29 +00:00
|
|
|
|
2026-05-26 22:55:21 +00:00
|
|
|
return Object.values(grouped).sort((a, b) =>
|
2026-06-09 22:05:06 +00:00
|
|
|
(a.supplier?.suppliername || 'zzz').localeCompare(b.supplier?.suppliername || 'zzz')
|
2026-05-26 22:55:21 +00:00
|
|
|
);
|
|
|
|
|
}, [filteredItems]);
|
2026-05-24 19:51:29 +00:00
|
|
|
|
2026-07-07 15:15:42 +00:00
|
|
|
// Group by geographic proximity — items within 2km share a cluster color
|
|
|
|
|
const areaClusters = useMemo(() => {
|
|
|
|
|
return clusterByProximity(filteredItems, 2);
|
|
|
|
|
}, [filteredItems]);
|
|
|
|
|
|
2026-05-24 19:51:29 +00:00
|
|
|
if (authLoading) {
|
|
|
|
|
return (
|
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="min-h-screen flex items-center justify-center bg-[#f2f1ed]">
|
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 flex-col items-center gap-3">
|
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-10 h-10 border-[3px] border-[#f54e00] border-t-transparent rounded-full animate-spin" />
|
|
|
|
|
<p className="text-sm text-[rgba(38,37,30,0.55)]">Loading...</p>
|
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>
|
2026-05-24 19:51:29 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-24 22:47:47 +00:00
|
|
|
if (!isLoggedIn) return null;
|
2026-05-24 19:51:29 +00:00
|
|
|
|
|
|
|
|
return (
|
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="min-h-screen bg-[#f2f1ed] pb-nav">
|
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
|
|
|
{/* Header */}
|
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
|
|
|
<header
|
|
|
|
|
className="bg-[#e6e5e0] text-[#26251e] safe-top sticky top-0 z-40 border-b border-[rgba(38,37,30,0.1)] backdrop-blur-md"
|
|
|
|
|
role="banner"
|
|
|
|
|
style={{ boxShadow: '0 1px 0 rgba(38,37,30,0.06)' }}
|
|
|
|
|
>
|
2026-07-07 16:28:19 +00:00
|
|
|
<div className="brand-accent-top" aria-hidden="true" />
|
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="px-4 pt-2 pb-3">
|
2026-05-24 19:51:29 +00:00
|
|
|
<div className="flex items-center justify-between">
|
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-1 min-w-0">
|
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
|
|
|
<h1 className="text-xl font-bold tracking-tight text-[#26251e]">Collections</h1>
|
|
|
|
|
<p className="text-[13px] text-[rgba(38,37,30,0.55)] truncate">{user?.name || user?.email}</p>
|
2026-05-24 19:51:29 +00:00
|
|
|
</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
|
|
|
<div className="flex items-center gap-1.5">
|
|
|
|
|
<div className="relative">
|
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="absolute -top-0.5 -right-0.5 w-2.5 h-2.5 bg-[#f54e00] rounded-full border-2 border-[#e6e5e0] animate-pulse" aria-hidden="true" />
|
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
|
|
|
|
|
onClick={handleRefresh}
|
|
|
|
|
disabled={isRefreshing}
|
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={isRefreshing ? 'Refreshing collections' : 'Refresh collections'}
|
|
|
|
|
className="p-2.5 rounded-xl bg-[#ebeae5] active:bg-[#e1e0db] transition-all touch-manipulation"
|
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
|
|
|
<RefreshCw size={18} className={cn('text-[#26251e]', isRefreshing && 'animate-spin')} aria-hidden="true" />
|
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>
|
|
|
|
|
</div>
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => logout()}
|
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="Sign out"
|
|
|
|
|
className="p-2.5 rounded-xl bg-[#ebeae5] active:bg-[#e1e0db] transition-all touch-manipulation"
|
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
|
|
|
<LogOut size={18} className="text-[#26251e]" aria-hidden="true" />
|
2026-05-24 19:51:29 +00:00
|
|
|
</button>
|
|
|
|
|
</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
|
|
|
{/* Search bar */}
|
2026-05-26 22:55:21 +00:00
|
|
|
<div className="px-4 pb-2">
|
2026-05-24 19:51:29 +00:00
|
|
|
<div className="relative">
|
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
|
|
|
<Search size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-[rgba(38,37,30,0.55)] pointer-events-none" aria-hidden="true" />
|
|
|
|
|
<label htmlFor="collections-search" className="sr-only">Search collections</label>
|
2026-05-24 19:51:29 +00:00
|
|
|
<input
|
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
|
|
|
id="collections-search"
|
2026-05-24 19:51:29 +00:00
|
|
|
type="text"
|
|
|
|
|
value={searchQuery}
|
|
|
|
|
onChange={(e) => setSearchQuery(e.target.value)}
|
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
|
|
|
placeholder="Search by item, supplier, order..."
|
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 pl-9 pr-9 py-2.5 bg-[#f2f1ed] border border-[rgba(38,37,30,0.1)] rounded-xl text-sm text-[#26251e] placeholder:text-[rgba(38,37,30,0.4)] focus:outline-none focus:ring-2 focus:ring-[#f54e00]/30 focus:border-[#f54e00] focus:bg-[#f7f7f4] transition-all"
|
2026-05-24 19:51:29 +00:00
|
|
|
/>
|
|
|
|
|
{searchQuery && (
|
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
|
|
|
|
|
onClick={() => setSearchQuery('')}
|
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="Clear search"
|
|
|
|
|
className="absolute right-3 top-1/2 -translate-y-1/2 text-[rgba(38,37,30,0.55)] active: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
|
|
|
>
|
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
|
|
|
<X size={16} aria-hidden="true" />
|
2026-05-24 19:51:29 +00:00
|
|
|
</button>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-05-26 22:55:21 +00:00
|
|
|
{/* Stats + Controls bar */}
|
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="px-4 pb-2 flex items-center justify-between gap-2">
|
|
|
|
|
<div className="flex items-center gap-1.5 min-w-0">
|
|
|
|
|
<span className="inline-flex items-center gap-1 px-2.5 py-1 rounded-full bg-[#ebeae5] text-[11px] font-medium text-[#26251e]">
|
|
|
|
|
<Package size={12} aria-hidden="true" />
|
2026-05-26 22:55:21 +00:00
|
|
|
{items.length} item{items.length !== 1 ? 's' : ''}
|
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
|
|
|
</span>
|
2026-05-26 22:55:21 +00:00
|
|
|
{groupedArray.length > 0 && (
|
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="inline-flex items-center gap-1 px-2.5 py-1 rounded-full bg-[#ebeae5] text-[11px] font-medium text-[#26251e]">
|
|
|
|
|
<MapPin size={12} aria-hidden="true" />
|
2026-05-26 22:55:21 +00:00
|
|
|
{groupedArray.length} stop{groupedArray.length !== 1 ? 's' : ''}
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* View toggle */}
|
2026-07-07 15:15:42 +00:00
|
|
|
<div className="flex items-center gap-1 flex-shrink-0">
|
|
|
|
|
{/* Group mode toggle */}
|
|
|
|
|
<div
|
|
|
|
|
className="flex items-center gap-0.5 bg-[rgba(38,37,30,0.06)] rounded-lg p-0.5"
|
|
|
|
|
role="group"
|
|
|
|
|
aria-label="Group by"
|
|
|
|
|
>
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => setGroupMode('supplier')}
|
|
|
|
|
aria-pressed={groupMode === 'supplier'}
|
|
|
|
|
className={cn(
|
|
|
|
|
'px-2 py-1 rounded-md text-[11px] font-semibold transition-all flex items-center gap-1',
|
|
|
|
|
groupMode === 'supplier' ? 'bg-white text-[#26251e] shadow-sm' : 'text-[rgba(38,37,30,0.6)]'
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<MapPin size={10} aria-hidden="true" />
|
|
|
|
|
Supplier
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => setGroupMode('area')}
|
|
|
|
|
aria-pressed={groupMode === 'area'}
|
|
|
|
|
className={cn(
|
|
|
|
|
'px-2 py-1 rounded-md text-[11px] font-semibold transition-all flex items-center gap-1',
|
|
|
|
|
groupMode === 'area' ? 'bg-white text-[#26251e] shadow-sm' : 'text-[rgba(38,37,30,0.6)]'
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<Layers size={10} aria-hidden="true" />
|
|
|
|
|
Area
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* View density toggle */}
|
|
|
|
|
<div
|
|
|
|
|
className="flex items-center gap-1 bg-[rgba(38,37,30,0.06)] rounded-lg p-0.5"
|
|
|
|
|
role="group"
|
|
|
|
|
aria-label="Item density"
|
|
|
|
|
>
|
2026-05-26 22:55:21 +00:00
|
|
|
<button
|
|
|
|
|
onClick={() => setViewMode('compact')}
|
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={viewMode === 'compact'}
|
2026-05-26 22:55:21 +00:00
|
|
|
className={cn(
|
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
|
|
|
'px-2.5 py-1 rounded-md text-[11px] font-semibold transition-all',
|
|
|
|
|
viewMode === 'compact' ? 'bg-white text-[#26251e] shadow-sm' : 'text-[rgba(38,37,30,0.6)]'
|
2026-05-26 22:55:21 +00:00
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
Compact
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => { setViewMode('detailed'); expandAll(); }}
|
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={viewMode === 'detailed'}
|
2026-05-26 22:55:21 +00:00
|
|
|
className={cn(
|
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
|
|
|
'px-2.5 py-1 rounded-md text-[11px] font-semibold transition-all',
|
|
|
|
|
viewMode === 'detailed' ? 'bg-white text-[#26251e] shadow-sm' : 'text-[rgba(38,37,30,0.6)]'
|
2026-05-26 22:55:21 +00:00
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
Detailed
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2026-05-24 19:51:29 +00:00
|
|
|
</div>
|
2026-07-07 15:15:42 +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
|
|
|
|
|
|
|
|
{/* Status filter chips — show counts of each state so drivers
|
|
|
|
|
can see at a glance what's pending vs flagged. */}
|
|
|
|
|
<div
|
|
|
|
|
className="px-4 pb-3 flex items-center gap-1.5 overflow-x-auto no-scrollbar -mx-1"
|
|
|
|
|
role="tablist"
|
|
|
|
|
aria-label="Filter by status"
|
|
|
|
|
>
|
|
|
|
|
{([
|
|
|
|
|
{ key: 'assigned', label: 'Assigned' },
|
2026-07-07 15:15:42 +00:00
|
|
|
{ key: 'collection_pool', label: 'Pool' },
|
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
|
|
|
{ key: 'problem', label: 'Problems' },
|
|
|
|
|
] as const).map(({ key, label }) => {
|
|
|
|
|
const count = statusCounts[key];
|
|
|
|
|
const active = statusFilter === key;
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
key={key}
|
|
|
|
|
role="tab"
|
|
|
|
|
aria-selected={active}
|
|
|
|
|
onClick={() => setStatusFilter(key)}
|
|
|
|
|
className={cn(
|
|
|
|
|
'inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-[11px] font-semibold transition-all touch-manipulation flex-shrink-0',
|
|
|
|
|
active
|
|
|
|
|
? 'bg-[#26251e] text-[#f2f1ed]'
|
|
|
|
|
: 'bg-[rgba(38,37,30,0.06)] text-[rgba(38,37,30,0.7)] active:bg-[rgba(38,37,30,0.12)]'
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
{label}
|
|
|
|
|
<span
|
|
|
|
|
className={cn(
|
|
|
|
|
'inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full text-[10px] font-bold',
|
|
|
|
|
active ? 'bg-[#f54e00] text-white' : 'bg-[rgba(38,37,30,0.08)] text-[rgba(38,37,30,0.6)]'
|
|
|
|
|
)}
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
>
|
|
|
|
|
{count}
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
2026-05-24 19:51:29 +00:00
|
|
|
</header>
|
|
|
|
|
|
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
|
|
|
{/* Content */}
|
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
|
|
|
<main className="p-4 custom-scrollbar" role="main" aria-live="polite">
|
2026-05-24 19:51:29 +00:00
|
|
|
{isLoading ? (
|
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="space-y-3" aria-label="Loading your collections" aria-busy="true">
|
2026-05-26 22:55:21 +00:00
|
|
|
{[...Array(3)].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} className="bg-[#e6e5e0] rounded-2xl p-4 border border-[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
|
|
|
<div className="skeleton h-4 w-3/4 rounded-lg mb-3" />
|
|
|
|
|
<div className="skeleton h-3 w-1/2 rounded-lg mb-2" />
|
|
|
|
|
<div className="skeleton h-3 w-2/3 rounded-lg" />
|
2026-05-24 19:51:29 +00:00
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
) : error ? (
|
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="text-center py-16 px-4" role="alert">
|
|
|
|
|
<div className="w-16 h-16 bg-[#fbeaef] rounded-2xl flex items-center justify-center mx-auto mb-4">
|
|
|
|
|
<AlertCircle size={32} className="text-[#b3224a]" aria-hidden="true" />
|
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>
|
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-[#26251e] font-semibold mb-1">{error}</p>
|
|
|
|
|
<p className="text-[rgba(38,37,30,0.55)] text-sm mb-6">Check your connection and try again</p>
|
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
|
|
|
|
|
onClick={handleRefresh}
|
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="inline-flex items-center gap-2 px-6 py-3 bg-[#f54e00] text-white rounded-xl text-sm font-semibold active:bg-[#d44200] transition-colors touch-manipulation press-feedback min-h-[44px]"
|
|
|
|
|
style={{ boxShadow: '0 4px 12px rgba(245,78,0,0.3)' }}
|
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
|
|
|
<RefreshCw size={16} aria-hidden="true" />
|
2026-05-24 19:51:29 +00:00
|
|
|
Try Again
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2026-07-07 15:15:42 +00:00
|
|
|
) : filteredItems.length === 0 ? (
|
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="text-center py-16 px-4">
|
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-16 h-16 bg-[#e6f1ec] rounded-2xl flex items-center justify-center mx-auto mb-4">
|
|
|
|
|
<CheckCircle2 size={32} className="text-[#18714f]" aria-hidden="true" />
|
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>
|
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-[#26251e] font-semibold text-lg mb-1">
|
2026-07-07 15:15:42 +00:00
|
|
|
{searchQuery ? 'Nothing matches' : 'All caught up'}
|
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>
|
|
|
|
|
<p className="text-[rgba(38,37,30,0.55)] text-sm">
|
|
|
|
|
{searchQuery
|
|
|
|
|
? 'No collections match your search.'
|
2026-07-07 15:15:42 +00:00
|
|
|
: statusFilter === 'assigned'
|
|
|
|
|
? 'No assigned collections right now. New pickups will appear here.'
|
|
|
|
|
: statusFilter === 'collection_pool'
|
|
|
|
|
? 'Collection pool is empty — nothing to claim right now.'
|
|
|
|
|
: 'No problems reported. Nice work.'}
|
2026-05-24 19:51:29 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
2026-05-26 22:55:21 +00:00
|
|
|
<div className="space-y-4">
|
2026-07-07 15:15:42 +00:00
|
|
|
{groupMode === 'supplier' ? (
|
|
|
|
|
groupedArray.map(({ supplier, items: supplierItems }, groupIdx) => {
|
|
|
|
|
const color = SUPPLIER_COLORS[groupIdx % SUPPLIER_COLORS.length];
|
|
|
|
|
const isExpanded = expandedSuppliers.has(supplier!.id);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<SupplierGroup
|
|
|
|
|
key={supplier!.id}
|
|
|
|
|
supplier={supplier!}
|
|
|
|
|
items={supplierItems}
|
|
|
|
|
color={color}
|
|
|
|
|
isExpanded={isExpanded}
|
|
|
|
|
viewMode={viewMode}
|
|
|
|
|
onToggle={() => toggleSupplier(supplier!.id)}
|
|
|
|
|
onCollect={(item) => { setSelectedItem(item); setShowCollectModal(true); }}
|
|
|
|
|
onProblem={(item) => { setSelectedItem(item); setShowProblemModal(true); }}
|
|
|
|
|
onNavigate={handleNavigate}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
) : (
|
|
|
|
|
areaClusters.map((cluster, clusterIdx) => {
|
|
|
|
|
const color = SUPPLIER_COLORS[clusterIdx % SUPPLIER_COLORS.length];
|
|
|
|
|
const isExpanded = expandedAreas.has(cluster.id);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<AreaGroup
|
|
|
|
|
key={cluster.id}
|
|
|
|
|
clusterId={cluster.id}
|
|
|
|
|
label={cluster.label}
|
|
|
|
|
items={cluster.items}
|
|
|
|
|
center={cluster.center}
|
|
|
|
|
color={color}
|
|
|
|
|
isExpanded={isExpanded}
|
|
|
|
|
viewMode={viewMode}
|
|
|
|
|
onToggle={() => toggleArea(cluster.id)}
|
|
|
|
|
onCollect={(item) => { setSelectedItem(item); setShowCollectModal(true); }}
|
|
|
|
|
onProblem={(item) => { setSelectedItem(item); setShowProblemModal(true); }}
|
|
|
|
|
onNavigate={handleNavigate}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
)}
|
2026-05-24 19:51:29 +00:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</main>
|
|
|
|
|
|
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
|
|
|
{/* Modals */}
|
2026-05-24 19:51:29 +00:00
|
|
|
<CollectModal
|
2026-05-24 22:47:47 +00:00
|
|
|
item={selectedItem}
|
2026-05-24 19:51:29 +00:00
|
|
|
isOpen={showCollectModal}
|
2026-05-24 22:47:47 +00:00
|
|
|
onClose={() => { setShowCollectModal(false); setSelectedItem(null); }}
|
2026-05-24 19:51:29 +00:00
|
|
|
onConfirm={handleCollect}
|
|
|
|
|
/>
|
|
|
|
|
<ProblemModal
|
2026-05-24 22:47:47 +00:00
|
|
|
item={selectedItem}
|
2026-05-24 19:51:29 +00:00
|
|
|
isOpen={showProblemModal}
|
2026-05-24 22:47:47 +00:00
|
|
|
onClose={() => { setShowProblemModal(false); setSelectedItem(null); }}
|
2026-05-24 19:51:29 +00:00
|
|
|
onConfirm={handleProblem}
|
|
|
|
|
/>
|
|
|
|
|
|
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
|
|
|
{/* Toast */}
|
2026-05-24 19:51:29 +00:00
|
|
|
{toast && (
|
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="fixed top-4 left-4 right-4 z-[70] animate-slide-down safe-top pointer-events-none"
|
|
|
|
|
role="status"
|
|
|
|
|
aria-live="polite"
|
|
|
|
|
>
|
2026-05-24 22:47:47 +00:00
|
|
|
<div className={cn(
|
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
|
|
|
'px-4 py-3 rounded-2xl text-sm font-medium text-white text-center pointer-events-auto',
|
|
|
|
|
toast.type === 'success' && 'bg-[#18714f]',
|
|
|
|
|
toast.type === 'error' && 'bg-[#cf2d56]',
|
|
|
|
|
toast.type === 'warning' && 'bg-[#d49103]'
|
|
|
|
|
)}
|
|
|
|
|
style={{ boxShadow: '0 14px 32px rgba(0,0,0,0.18)' }}
|
|
|
|
|
>
|
2026-05-24 19:51:29 +00:00
|
|
|
{toast.message}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<BottomNav />
|
|
|
|
|
</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
|
|
|
}
|