feat(deployment): add bid-expiry countdown to the configure header#3379
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3379 +/- ##
==========================================
- Coverage 69.80% 68.44% -1.37%
==========================================
Files 1100 1010 -90
Lines 26925 24592 -2333
Branches 6455 5997 -458
==========================================
- Hits 18795 16831 -1964
+ Misses 7142 6805 -337
+ Partials 988 956 -32
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
ed6e63d to
a70fb5e
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughAdds a block-anchored quote-expiry hook and wires it into the deployment header. The header now shows expiry countdown state and changes CTA labels and actions based on quote expiration and closing phase, with updated tests. ChangesQuote Expiry Feature
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/deploy-web/src/components/deployments/ConfigureDeployment/useQuoteExpiry/useQuoteExpiry.ts`:
- Around line 7-8: The quote expiry calculation in useQuoteExpiry is using dseq
as if it were a creation timestamp, which causes the timer logic to break.
Update the hook and any callers so it receives the actual deployment creation
time field instead of dseq, and keep dseq only as the deployment sequence
identifier. In useQuoteExpiry, add a guard for missing or non-numeric timestamp
input before computing the remaining time so the rendered timer never becomes
NaN:NaN.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 003d27b3-5bac-4bb8-b23e-3003983c6c6e
📒 Files selected for processing (4)
apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentHeader/ConfigureDeploymentHeader.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentHeader/ConfigureDeploymentHeader.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/useQuoteExpiry/useQuoteExpiry.spec.tsapps/deploy-web/src/components/deployments/ConfigureDeployment/useQuoteExpiry/useQuoteExpiry.ts
a70fb5e to
99c152b
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/deploy-web/src/components/deployments/ConfigureDeployment/useQuoteExpiry/useQuoteExpiry.ts`:
- Around line 46-47: The quote expiry hook only refetches the latest block, so
an empty initial result from useListBids can leave the countdown stuck because
the bid query never updates. Update useQuoteExpiry to explicitly poll
useListBids while the quote window is active by adding a refetch interval or
equivalent polling on bidsQuery, alongside the existing useBlock latest polling,
so the hook can detect newly closed bids and transition from null promptly.
- Around line 62-80: The useQuoteExpiry hook can briefly report expired when
expiresAt changes from null to a value because secondsLeft still carries the
previous 0 during the first render. Fix this in useQuoteExpiry by either
deriving the current secondsLeft directly from secondsUntil(expiresAt) during
render, or by reinitializing the state when expiresAt becomes non-null so
isExpired cannot flash true. Keep the ticking logic in the tickUntilExpiry
effect and ensure the returned object from useQuoteExpiry always reflects the
fresh deadline state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b4e56a30-4a86-4e3a-8aee-6196b221f916
📒 Files selected for processing (4)
apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentHeader/ConfigureDeploymentHeader.spec.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentHeader/ConfigureDeploymentHeader.tsxapps/deploy-web/src/components/deployments/ConfigureDeployment/useQuoteExpiry/useQuoteExpiry.spec.tsapps/deploy-web/src/components/deployments/ConfigureDeployment/useQuoteExpiry/useQuoteExpiry.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/deploy-web/src/components/deployments/ConfigureDeployment/useQuoteExpiry/useQuoteExpiry.spec.ts
- apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentHeader/ConfigureDeploymentHeader.spec.tsx
- apps/deploy-web/src/components/deployments/ConfigureDeployment/ConfigureDeploymentHeader/ConfigureDeploymentHeader.tsx
99c152b to
a03bdb8
Compare
Once the first bid arrives, show a countdown to bid expiry under the deployment cost, derived from the deployment's creation timestamp (~5 minutes, matching the legacy builder): muted, turning red in the final minute. When the window elapses the header's primary CTA becomes "Close and Edit", closing the deployment and returning to editing.
a03bdb8 to
d30e27d
Compare
Why
Once quotes arrive, users need to see what the deployment will cost in USD in the configure header,
and how long the current quotes stay valid before bids expire.
Closes CON-522.
What
Two additions to the configure-flow header, both driven by the live on-chain bids:
Deployment cost
otherwise it contributes the cheapest–priciest range of its open bids, otherwise
0until it bids.min – maxhourly USD total that collapses to a single value when thebounds match, and shows
—until the first bid.Quote-expiry countdown
⏱ expires in M:SS,muted, turning red in the final minute. The window is the deployment's creation time + ~5 minutes
(matching the legacy builder, including its 20s create→bid buffer).
and returns to editing) — the recovery path the legacy builder offered once bids closed.
Implementation notes
useDeploymentCostanduseQuoteExpiryboth read the shared, dseq-keyedlistBidsquery themarketplace already polls (React Query dedupes by key) — no extra fetch or polling.
PricePerTimeUnit's per-block→hourly factor isextracted into a shared
perBlockToHourlyhelper, andPriceValuedoes USD formatting (ACT is 1:1 USD).behavior and the reference screenshot.
Testing
useDeploymentCost: range over an unselected placement's open bids, fixed contribution for a selectedbid, multi-placement sum,
0contribution before a placement bids,nullbefore any bid, closed-bidfiltering, fallback to the open range when a selected bid is no longer open.
useQuoteExpiry: seconds-left from the dseq creation time, expiry past the deadline, ticking once asecond, inert when disabled or before a deployment exists.
ConfigureDeploymentHeader: cost single value / range /—; the countdown appears on the first bid,turns red under 60s, and is hidden before any bid; the CTA flips to Close and Edit on expiry; and the
sdl/selectionsare threaded into the cost hook.perBlockToHourly: per-block → hourly conversion.Summary by CodeRabbit