Repository navigation
feat(logistics,shared): add toast queue manager, route optimization hook, fleet map drag-drop, and delivery ETA map tests (#429, #487, #831, #832) - #946
Merged
johdanike merged 2 commits intoOct 28, 2026
Conversation
…tion hook, fleet map drag-drop, and delivery ETA map tests (SwiftChainn#429, SwiftChainn#487, SwiftChainn#831, SwiftChainn#832)
|
@Meet-hybrid Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Please resolve conflicts |
Contributor
Author
Done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements four cohesive frontend & logistics improvements across toast notification queue management, route optimization, interactive fleet map waypoint reordering, and automated delivery route ETA map testing:
#429) — Adds a centralizedcontext/ToastProvider.tsxusing React Context, Framer Motion, andtoastServicethat dispatchessuccess,error, andinfoalerts, enforces amaxVisibleon-screen limit (default3), queues overflow alerts in FIFO order, auto-dismisses visible toasts after their timeout, and syncs system alerts/config from the backend API.#487) — Adds dynamic remaining ETA (calculateRemainingEtaMinutes) and ISO estimated delivery timestamp (calculateEstimatedDeliveryDate) support tocomponents/shipments/TrackingMap.tsxalong with comprehensive component tests in__tests__/components/shipments/TrackingMapEta.test.tsxverifying physical route updates, polyline/marker changes, ETA calculations, and loading/empty/error states.#831) — Enhanceshooks/useRouteOptimization.tsand addsservices/routeOptimizationService.ts(Component -> Hook -> Servicepattern) to compute optimal waypoint order, distance (km), duration (min), and polyline coordinates ([lat, lng][]), support adding/removing/reordering waypoints, and cache routes by waypoint set with HTTP 429 rate-limit protection.#832) — Enhancescomponents/fleet/FleetMapClient.tsxwith interactive waypoint drag-and-drop reordering powered byuseRouteOptimization, displaying dashed drop zone previews while dragging, highlighting valid drop positions, updating connection lines in real time, and smoothly snapping markers to valid drop positions.Related Issues
Closes #429
Closes #487
Closes #831
Closes #832
Changes
🔔 Issue #429 — Frontend: Toast Notification Queue Manager
context/ToastProvider.tsxToastProvider,useToastContext, anduseToastQueuefor dispatchingsuccess,error, andinfonotifications.maxVisible(default3) visible toasts on screen while holding additional rapidly triggered notifications inqueuedToasts(FIFO queue).toastService(lib/toast.ts) to retrieve backend configuration and toast messages without inline mock objects.context/__tests__/ToastProvider.test.tsxsuccess/error/infodispatching, rapid 5-error queueing (3visible,2queued), auto-dismiss FIFO promotion, manual dismissal, and backend sync.🗺️ Issue #487 — [Test] Component: View Estimated Delivery Date Map Logic & UI
components/shipments/TrackingMap.tsxcalculateRemainingEtaMinutesandcalculateEstimatedDeliveryDateto compute accurate remaining ETA ascurrentLocationprogresses along the delivery route and derive the ISO estimated delivery timestamp.currentLocationin live map bounds and exposes testable attributes for physical route and ETA verification while preserving existing behavior.__tests__/components/shipments/TrackingMapEta.test.tsxcurrentLocationmarker movement, dynamic route waypoint/polyline updates, accurate ETA & estimated delivery date calculation, and loading, empty, and error states with mocked external dependencies.🧭 Issue #831 — Hook:
useRouteOptimizationfor Waypoint Reordering and Route Calculationtypes/routeOptimizer.tsRouteOptimizationResultinterface (waypoints,optimizedWaypoints,distance,duration,polyline,cached).services/routeOptimizationService.tsoptimizeRouteViaApi), deterministic waypoint-set caching (getWaypointSetCacheKey), HTTP 429 rate-limit handling, Haversine distance/duration calculation, and polyline coordinate generation (buildRoutePolyline).hooks/useRouteOptimization.tsRouteOptimizationResultwithpolyline,distance,duration,isCached,addWaypoint,removeWaypoint,reorder/reorderWaypoints,reset, and asyncoptimizeRoute.hooks/__tests__/useRouteOptimization.test.tsRouteOptimizationResultpolyline output, function-call waypoint reordering, adding/removing waypoints, waypoint-set route caching, and rate-limit handling.🚚 Issue #832 — Enhancement: Add Waypoint Drag-and-Drop Reordering to FleetMap
components/fleet/FleetMapClient.tsxWaypointDragDropLayer(consuminguseRouteOptimization) andfindNearestSnapIndexwhile preserving existingDriverClusterLayerbehavior.border-dashed) while dragging, highlights valid drop targets, updates connection lines in real time during drag and after drop, and smoothly snaps markers to valid drop positions.components/fleet/__tests__/FleetMapClient.test.tsxVerification Results
Acceptance Criteria
Issue #429 — Frontend: Toast Notification Queue Manager
Issue #487 — [Test] Component: View Estimated Delivery Date Map Logic & UI
__tests__/components/shipments/TrackingMapEta.test.tsx)Issue #831 — Hook:
useRouteOptimizationfor Waypoint Reordering and Route CalculationRouteOptimizationResultwithpolylinereorder/reorderWaypoints) and added/removed (addWaypoint/removeWaypoint)Issue #832 — Enhancement: Add Waypoint Drag-and-Drop Reordering to FleetMap