Repository navigation
feat: bidding hook, contract countdown, dispute resolution portal, reputation reviews grid - #914
Merged
Conversation
…portal, reputation grid Implements four assigned issues following the Component -> Hook -> Service layering used elsewhere in the app: - useBidding (SwiftChainn#839): TanStack Query hook fetching bidding contracts and bid history, submitting bids via a mutation, and polling bid status while any bid is pending. - useContractCountdown + BiddingBoard (SwiftChainn#840): per-contract live countdowns with urgency-based coloring, a one-time "expiring soon" toast, and automatic removal of contracts once past their grace period. The timer pauses via the Page Visibility API while the tab is hidden. - DisputeResolutionPortal, EvidenceMediaDropzone, and useEvidenceUpload (SwiftChainn#846): no dispute-resolution UI existed yet in this codebase to write tests against, so this adds a minimal real implementation (reason selection, evidence upload with image compression, review/submit steps backed by a new disputeResolutionService), plus a test suite covering it (61 tests total across this batch; DisputeResolutionPortal, EvidenceMediaDropzone, and useEvidenceUpload are at 97-100% statement coverage). - ReputationReviewGrid (SwiftChainn#847): filterable grid of driver reviews with on-chain verification badges, backed by a new useReputationReviews hook and reputationReviewService. Also fixes components/ui/ThemeToggle.tsx, which imported the app's broken custom useTheme hook (hooks/useTheme.ts calls methods that don't exist on services/themeService.ts, and its own return shape doesn't match what ThemeToggle destructures). That 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. Adds date-fns as a dependency for countdown formatting (named in SwiftChainn#840's technical scope but not previously installed). Pre-existing, unrelated to this PR: app/page.tsx has an unbalanced JSX tag at line 178 that fails both `next build` and `tsc --noEmit`, blocking production builds repo-wide. 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. Closes SwiftChainn#839 Closes SwiftChainn#840 Closes SwiftChainn#846 Closes SwiftChainn#847
|
@iamthebestofcourse 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! 🚀 |
…putation-grid-839-840-846-847
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.
Summary
Closes #839
Closes #840
Closes #846
Closes #847
Implements four assigned issues following this repo's Component -> Hook -> Service layering.
#839: useBidding
types/bidding.ts,services/biddingService.ts,hooks/useBidding.tsGET /driver/bidding/contracts) and bid history (GET /driver/bidding/history), submitting bids via a mutation (POST /driver/bidding/bids), and polling bid status every 10s while any bid is pending.#840: contract expiration countdowns
hooks/useContractCountdown.ts,components/driver/BiddingBoard.tsx#846: dispute resolution portal + tests
No dispute-resolution UI existed yet in this codebase to write tests against (the acceptance criteria assume
DisputeResolutionPortalanduseEvidenceUploadalready exist), so this PR builds a minimal real implementation first, then tests it:types/disputeResolution.ts,services/disputeResolutionService.ts,hooks/useEvidenceUpload.tscomponents/escrow/DisputeResolutionPortal.tsx(reason selection -> evidence upload -> review -> submit) andcomponents/escrow/EvidenceMediaDropzone.tsx(drag-and-drop + keyboard-accessible file picker, client-side type/size validation, image compression via the existingimageCompressionService)__tests__/components/escrow/DisputeResolutionPortal.test.tsxand__tests__/hooks/useEvidenceUpload.test.ts: 30 tests, 97-100% statement coverage on the new files (well over the issue's 12-test/85%-coverage bar)This is deliberately not built on
escrow/DisputeForm.tsx/hooks/useDisputeForm.ts/services/escrowService.ts:escrowService.tsimportsstellar-sdk, which is not installed in this repo, so that code cannot run in the real app despite its own Jest tests passing (the tests mock the service, so the broken import is never actually loaded). Flagging this as a pre-existing issue; not fixed here since it's unrelated to this PR's scope.#847: reputation reviews grid
types/reputationReview.ts,services/reputationReviewService.ts,hooks/useReputationReviews.ts,components/fleet/ReputationReviewGrid.tsxAlso included: ThemeToggle fix (blocking issue for screenshots)
components/ui/ThemeToggle.tsximportedhooks/useTheme.ts, which calls methods (getThemeFromStorage,syncThemeToAPI, etc.) that don't exist onservices/themeService.ts, and whose own return shape ({ theme, setTheme }) doesn't even match whatThemeToggledestructures ({ resolvedTheme, toggleTheme }). SinceThemeToggleis rendered fromapp/layout.tsx, this broke every route in both dev and prod (confirmed pre-existing via a clean checkout of this branch's base commit). RedirectedThemeToggleto importuseThemefrom thenext-themespackage instead, matching whatcomponents/shared/ThemeProvider.tsxalready uses elsewhere in the app.hooks/useTheme.tsandservices/themeService.tsthemselves are untouched; they're orphaned, dead code and fixing them is out of scope here.Dependency
Added
date-fns(named in #840's "Technical Scope" but not previously installed) for countdown time-difference formatting.Pre-existing issues found (not fixed, out of scope for this PR)
app/page.tsx:178has an unbalanced JSX tag that failsnext buildandtsc --noEmit, blocking production builds for the entire repo. 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.tsare broken due to the missingstellar-sdkdependency (see Test: Dispute Resolution Portal and Evidence Dropzone Tests #846 section above).Test plan
npx jeston all new/touched test files: 5 suites, 61 tests passingnpx tsc --noEmit: no new errors (only the two pre-existing, unrelated failures noted above)npx eslinton all new/touched files: 0 errors (a few pre-existing-style warnings from an unused-vars rule flagging documentation-only parameter names in function-type signatures, consistent with warnings already present elsewhere in the codebase)git stashagainst a clean checkout, not introduced by this PRScreenshots
Test suite passing:
Components rendered (BiddingBoard, DisputeResolutionPortal, ReputationReviewGrid):