Skip to content

feat: driver assignment drag-and-drop, load matching board, dispute resolution portal, dispute service - #916

Merged
johdanike merged 2 commits into
SwiftChainn:mainfrom
theladyanina:fix/live-tracker-auth-refresh-mobile-driver-834-838-842-845
Oct 5, 2026
Merged

johdanike merged 2 commits into
SwiftChainn:mainfrom
theladyanina:fix/live-tracker-auth-refresh-mobile-driver-834-838-842-845

Conversation

@theladyanina

Copy link
Copy Markdown
Contributor

Summary

Closes #834
Closes #838
Closes #842
Closes #845

Implements four assigned issues following this repo's Component -> Hook -> Service layering.

#834: DriverAssignmentPanel (drag-and-drop shipment assignment)

  • types/driverAssignment.ts, services/driverAssignmentService.ts, hooks/useDriverAssignment.ts, components/fleet/DriverAssignmentPanel.tsx
  • Built on @dnd-kit/core (added as a dependency; named in the issue's technical scope but not previously installed). Pending shipments render as draggable cards, drivers as drop zones. Dropping a shipment on a driver opens a confirmation modal before the assignment API call fires, and a success notification appears afterward. Falls back to a stacked list layout on mobile (lg:hidden / hidden lg:grid) instead of the drag-and-drop grid.

#838: BiddingBoard (courier load matching with bid negotiation)

  • types/loadMatching.ts, services/loadMatchingService.ts, hooks/useLoadMatching.ts, components/driver/BiddingBoard.tsx
  • Board of bulk delivery contracts (cargo type, route, timeline, base rate) with a custom bid form (numeric validation on amount, required timeline) and a cargo type / region / rate-range filter bar. The underlying TanStack Query hook uses keepPreviousData, so the filter bar and existing results stay visible while a new filter combination loads rather than the whole board unmounting to a loading state on every filter change. Once a bid exists for a contract, its status badge (submitted/accepted/rejected/expired) replaces the bid form.

#842: DisputeResolutionPortal + EvidenceDropzone (evidence upload media dropzone)

  • components/escrow/DisputeResolutionPortal.tsx, components/escrow/EvidenceDropzone.tsx
  • Multi-step flow (issue selection -> evidence upload -> confirmation) using react-dropzone (already a declared dependency in package.json, just not yet installed) for drag-and-drop or click-to-upload of images and video up to 10MB, with previews and per-file removal. Shows a prominent escrow-freeze warning before submission and the assigned case ID afterward.

#845: disputeService

  • types/dispute.ts, services/disputeService.ts, hooks/useDisputeCase.ts
  • fileDispute, uploadEvidence (axios onUploadProgress wired to a 0-100 percentage callback), freezeEscrow, getDisputeStatus, resolveDispute, each typed and each rejecting with a normalized APIError ({ message, statusCode, code }) instead of a raw axios error, per the issue's acceptance criteria.

Also included: ThemeToggle fix (blocking issue for screenshots)

components/ui/ThemeToggle.tsx imported hooks/useTheme.ts, which calls methods that don't exist on services/themeService.ts, and whose own return shape doesn't match what ThemeToggle destructures. Since ThemeToggle is rendered from app/layout.tsx, this broke every route in both dev and prod. Redirected ThemeToggle to import useTheme from the next-themes package instead, matching what components/shared/ThemeProvider.tsx already uses elsewhere in the app. hooks/useTheme.ts and services/themeService.ts themselves are untouched; they're orphaned, dead code and fixing them is out of scope here. (This is the same fix as a companion PR on this same upstream repo, since both hit the identical pre-existing break.)

Pre-existing issues found (not fixed, out of scope for this PR)

  • app/page.tsx has an unbalanced JSX tag that fails both next build and tsc --noEmit, blocking production builds for the entire repo even after the ThemeToggle fix above. Reproduced on a clean checkout of this branch's base commit, unrelated to any file touched here.
  • escrow/DisputeForm.tsx / hooks/useDisputeForm.ts / services/escrowService.ts are broken due to a missing stellar-sdk dependency. The new dispute-resolution code in this PR does not build on that precedent.

Test plan

  • npx jest on all new/touched test files: 9 suites, 62 tests passing, 97%+ statement coverage across all new files
  • npx tsc --noEmit: no new errors (only the pre-existing, unrelated app/page.tsx and CheckoutFlow.keyboard.test.tsx failures noted above)
  • npx eslint: 0 errors on all touched files (a few pre-existing-style warnings from an unused-vars rule flagging documentation-only parameter names in function-type signatures)
  • Manually rendered all four new components together in a local preview route (screenshot below) and confirmed no runtime errors; the "Network Error" shown for BiddingBoard there is the intended error-state UI, since this sandbox has no live backend for that endpoint
  • Confirmed both pre-existing issues above via git stash against a clean checkout, not introduced by this PR

Screenshots

Test suite passing (62/62, coverage table):

tests passing

Components rendered (DriverAssignmentPanel, BiddingBoard, DisputeResolutionPortal):

components rendered

…hing board, dispute portal, dispute service

Implements four assigned issues following the Component -> Hook -> Service
layering used elsewhere in the app:

- DriverAssignmentPanel (SwiftChainn#834): drag-and-drop interface for assigning
  pending shipments to drivers, built on @dnd-kit/core (added as a
  dependency, named in the issue's technical scope but not previously
  installed). Dropping a shipment card on a driver opens a confirmation
  modal before the assignment API call fires; a success notification
  appears afterward. Falls back to a stacked list layout on mobile instead
  of the drag-and-drop grid.
- BiddingBoard (SwiftChainn#838): board of bulk delivery contracts with cargo type,
  route, timeline, and base rate, a custom bid form with numeric
  validation, and a cargo type/region/rate-range filter bar. The
  underlying TanStack Query hook uses keepPreviousData so the filter bar
  and existing results stay visible while a new filter combination loads,
  rather than the whole board unmounting to a loading state on every
  keystroke.
- DisputeResolutionPortal and EvidenceDropzone (SwiftChainn#842): multi-step dispute
  filing flow (issue selection, evidence upload, confirmation) using
  react-dropzone (already a declared dependency, not yet installed) for
  drag-and-drop or click-to-upload of images and video up to 10MB, with
  previews and per-file removal. Shows an escrow-freeze warning before
  submission and the assigned case ID afterward.
- disputeService (SwiftChainn#845): fileDispute, uploadEvidence (with axios
  onUploadProgress wired to a 0-100 percentage callback), freezeEscrow,
  getDisputeStatus, and resolveDispute, each typed and each rejecting with
  a normalized APIError ({ message, statusCode, code }) instead of a raw
  axios error.

Also fixes components/ui/ThemeToggle.tsx, the same pre-existing break
found and fixed in a companion PR on this same upstream repo: it imported
the broken custom hooks/useTheme.ts (which calls methods that don't exist
on services/themeService.ts, and whose own return shape doesn't match what
ThemeToggle destructures), which broke app/layout.tsx and therefore every
route in both dev and prod. Redirected it to next-themes' own useTheme,
which is what components/shared/ThemeProvider.tsx already uses elsewhere
in the app. hooks/useTheme.ts and services/themeService.ts are untouched
and still orphaned, dead code; out of scope here.

Pre-existing, unrelated to this PR: app/page.tsx has an unbalanced JSX tag
that fails both `next build` and `tsc --noEmit`, blocking production
builds repo-wide even after the ThemeToggle fix above. Reproduced on a
clean checkout of this branch's base commit. escrow/DisputeForm.tsx,
hooks/useDisputeForm.ts, and services/escrowService.ts also remain broken
(escrowService.ts imports the uninstalled stellar-sdk package); the new
dispute-resolution code in this PR does not build on that precedent.

62 new tests across 9 suites, 97%+ statement coverage on all new files.

Closes SwiftChainn#834
Closes SwiftChainn#838
Closes SwiftChainn#842
Closes SwiftChainn#845
@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

@theladyanina 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! 🚀

Learn more about application limits

@johdanike

Copy link
Copy Markdown
Contributor

Multiple merge conflicts, please resolve.
Thank you for contributing to Swiftchainn

…uilt features at colliding paths

Three different contributors independently built real, non-overlapping
features and happened to name components identically, producing 5
add/add conflicts:

- components/fleet/DriverAssignmentPanel.tsx, hooks/useDriverAssignment.ts,
  services/driverAssignmentService.ts: this branch's version implements
  real drag-and-drop via @dnd-kit/core, the literal requirement of issue
  SwiftChainn#834. The version already on main (from an earlier, different PR) used
  click-to-assign as a stated workaround for dnd-kit not being a
  dependency at the time. Kept this branch's version; removed its
  now-superseded test at the old click-to-assign API shape.

- components/driver/BiddingBoard.tsx and components/escrow/
  DisputeResolutionPortal.tsx: these paths collided with a different,
  already-merged feature (by a third contributor, closing different
  issues SwiftChainn#840/SwiftChainn#846) that is functionally unrelated to this branch's
  bulk-contract load-matching board (SwiftChainn#838) and dispute-case portal
  (SwiftChainn#842). Restored the already-merged versions at their original paths
  (byte-identical to upstream/main) and renamed this branch's versions
  to LoadMatchingBoard.tsx / DisputeCasePortal.tsx (plus their
  co-located tests) so both real features coexist. Their supporting
  hooks/services/types (useLoadMatching, useDisputeCase,
  loadMatchingService, disputeService, types/loadMatching,
  types/dispute) were already uniquely named and merged without
  conflict.

Verified: the 4 directly affected test suites (LoadMatchingBoard,
DisputeCasePortal, DriverAssignmentPanel, and the restored
DisputeResolutionPortal) pass in full (47/47). Remaining typecheck/test
failures elsewhere in the repo are pre-existing on upstream/main,
confirmed unrelated to any file this resolution touched.

@johdanike johdanike left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extensive work done, thanks for contributing to Swiftchainn

@johdanike
johdanike merged commit c7baa93 into SwiftChainn:main Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants