Skip to content

UI improvements#69

Merged
arkanoider merged 4 commits into
mainfrom
ui-improvements
May 15, 2026
Merged

UI improvements#69
arkanoider merged 4 commits into
mainfrom
ui-improvements

Conversation

@arkanoider
Copy link
Copy Markdown
Collaborator

@arkanoider arkanoider commented May 14, 2026

Summary

Improves how My Trades and order timelines behave when success arrives before DMs, tightens flow step labels (including pending / bond phases), adjusts enter-handler behavior, and avoids CantDo trade DMs from driving order upserts.

Motivation

  • Empty or misleading My Trades rows when Success lands before a real DM-backed OrderMessage.
  • Order state / step UI did not reflect early lifecycle states well (e.g. pending, waiting for taker bond).
  • CantDo in the trade DM path could confuse persisted order state; align with NewOrder (no-op for hydration).

Changes (vs main)

  1. Placeholder OrderMessage from OrderSuccess — synthetic row for the sidebar without fake take-buy / take-sell actions that break Messages-tab Enter (src/ui/orders.rs).
  2. Timeline / compact labels — e.g. Pending, pending-order step enums for buy/sell flows (src/ui/orders.rs).
  3. Startup / main / order channel wiring tweaks (src/main.rs, src/ui/helpers/startup.rs, src/util/dm_utils/order_ch_mng.rs).
  4. Enter handlers — small message/flow fixes (src/ui/key_handler/enter_handlers.rs).
  5. DM handler — skip CantDo like NewOrder in handle_trade_dm_for_order (src/util/dm_utils/mod.rs).

Summary by CodeRabbit

  • New Features

    • Placeholder "My Trades" messages now auto-generate for pending orders before direct message confirmation arrives.
    • New "Pending Order" status label and timeline milestone for orders awaiting taker bonds.
  • Bug Fixes

    • Invoice popup visualization state now correctly adjusts based on order status.
    • Enhanced message selection UI clarity with improved action labeling.

Review Change Stack

arkanoider and others added 3 commits May 13, 2026 16:02
CantDo messages should not drive order row upserts; treat them like NewOrder
and return early from handle_trade_dm_for_order.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Warning

Rate limit exceeded

@arkanoider has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 45 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3744188f-62d5-4bed-918a-2c3adca663c0

📥 Commits

Reviewing files that changed from the base of the PR and between 15bb744 and 9290736.

📒 Files selected for processing (1)
  • src/ui/orders.rs

Walkthrough

This PR adds synthetic placeholder messages when trade orders arrive before corresponding DM rows exist, refactors timeline step enums for both buy and sell listings, and updates message display logic to use compact action labels with status-dependent popup state.

Changes

Order Placeholder Messages and Timeline Display

Layer / File(s) Summary
Placeholder Message Construction
src/ui/orders.rs
New try_placeholder_order_message_from_success derives placeholder Action from order status and maker/taker role, constructs minimal SmallOrder, and synthesizes OrderMessage timestamped and marked as read.
Placeholder Insertion into Operation Result Handler
src/util/dm_utils/order_ch_mng.rs
maybe_insert_my_trade_placeholder_message checks for existing DM entries and conditionally appends synthesized placeholder; integrated into handle_operation_result when OrderSuccess is received.
Timeline Step Enum and Status Mapping Refactoring
src/ui/orders.rs
Adds StepPendingOrder = 0 to both StepLabelsBuy and StepLabelsSell, shifting subsequent indices. Updates status-to-timeline mappings: Pending and WaitingTakerBond → pending step; WaitingPayment → seller-payment step; CompletedByAdmin → pending step for buy.
Placeholder and Timeline Step Tests
src/ui/orders.rs
New order_success_placeholder_tests module validates placeholder message generation for maker/taker cases and static-header requirement; timeline step tests add PayBondInvoice with WaitingTakerBond mapping to pending step for buy and sell.
Message Display and Popup State Updates
src/ui/key_handler/enter_handlers.rs, src/ui/helpers/startup.rs
handle_enter_normal_mode uses message_action_compact_label_for_message for popup text; db_order_to_history_message sets auto_popup_shown based on order status, disabling for WaitingBuyerInvoice.
DM Processing Condition and Documentation Refinements
src/main.rs, src/util/dm_utils/mod.rs
Broadens early-return in handle_trade_dm_for_order to include Action::CantDo; documents that resync_my_trades_from_db is triggered only by OrderHistoryDeleted to rehydrate messages without interfering with per-order history sync.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • MostroP2P/mostrix#42: Both PRs touch src/util/dm_utils/mod.rs's handle_trade_dm_for_order DM-processing path (main PR tweaks an early-return condition for Action::CantDo, while retrieved PR restructures handle_trade_dm_for_order under the new subscription-driven listener).

  • MostroP2P/mostrix#68: The main PR's src/ui/orders.rs changes to timeline/step mapping for Status::WaitingTakerBond and PayBondInvoice are directly in the same UI step-labeling path as PR #68's PayBondInvoice/WaitingTakerBond timeline handling.

Suggested reviewers

  • mostronatorcoder
  • grunch

Poem

🐰 A trade awaits, but no message appears,
So we craft placeholders to calm the fears!
Timeline steps now pendulum at zero,
Each status mapped like a digital hero.
With labels compact and states so clear,
The orders bloom in the UI sphere!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'UI improvements' is overly vague and generic, failing to describe the specific main changes such as placeholder order messages, timeline steps, or DM handling improvements. Consider a more descriptive title that captures the primary change, such as 'Add placeholder order message for early OrderSuccess with pending timeline step' or 'Improve UI state handling for early order lifecycle events'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ui-improvements

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@mostronatorcoder mostronatorcoder Bot left a comment

Choose a reason for hiding this comment

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

I reviewed this strictly and I found a blocker in the new timeline-state mapping.

Blocker

listing_step_from_status() now regresses terminal-status handling in two ways.

In src/ui/orders.rs:

Status::Canceled
| Status::CanceledByAdmin
| Status::CooperativelyCanceled
| Status::Expired
| Status::Dispute
| Status::SettledByAdmin
| Status::CompletedByAdmin => {
    Some(FlowStep::BuyFlowStep(StepLabelsBuy::StepPendingOrder))
}

and in the Kind::Sell arm the same terminal statuses now return:

Some(FlowStep::BuyFlowStep(StepLabelsBuy::StepPendingOrder))

That creates two separate problems:

  1. Canceled / expired / dispute / admin-settled trades now render as if they were still in the initial pending phase, instead of yielding no active progress step.
  2. In the sell branch, terminal statuses return a BuyFlowStep instead of a SellFlowStep, which is plainly inconsistent with the kind-specific timeline model.

Before this change, those terminal non-success statuses returned None, which was much safer and semantically correct for a timeline that represents active trade progression.

So this PR currently makes terminal failed/canceled states look like fresh pending trades, and also crosses buy/sell flow types in the sell branch.

Because this affects user-visible state interpretation in the trade timeline, I am marking this as request changes.

@arkanoider
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 `@src/ui/orders.rs`:
- Around line 724-726: The sell-status mapping incorrectly returns a buy flow
step: in the Kind::Sell branch where Status::CompletedByAdmin currently maps to
FlowStep::BuyFlowStep(StepLabelsBuy::StepPendingOrder), change it to return the
corresponding sell variant—i.e., FlowStep::SellFlowStep(...) using the
appropriate StepLabelsSell::StepPendingOrder (or the correct sell label) so sell
terminal statuses use the SellFlowStep path.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fafd2138-a426-45b1-8d20-b13d5e136419

📥 Commits

Reviewing files that changed from the base of the PR and between 4006ca1 and 15bb744.

📒 Files selected for processing (6)
  • src/main.rs
  • src/ui/helpers/startup.rs
  • src/ui/key_handler/enter_handlers.rs
  • src/ui/orders.rs
  • src/util/dm_utils/mod.rs
  • src/util/dm_utils/order_ch_mng.rs

Comment thread src/ui/orders.rs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@mostronatorcoder
Copy link
Copy Markdown
Contributor

Thanks, the sell-branch BuyFlowStep bug is fixed now.

But the main semantic blocker is still present: terminal non-success statuses are still being mapped to StepPendingOrder in both branches.

That means states like:

  • Canceled
  • CanceledByAdmin
  • CooperativelyCanceled
  • Expired
  • Dispute
  • SettledByAdmin
  • CompletedByAdmin

still render like an initial pending trade instead of yielding no active progression step.

So the type mismatch is gone, but the timeline regression itself is still there. I still think those terminal non-success states should not map to the pending column.

Copy link
Copy Markdown
Contributor

@mostronatorcoder mostronatorcoder Bot left a comment

Choose a reason for hiding this comment

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

Re-reviewed with the clarified UI semantics in mind.

Given that the terminal non-success outcome is already surfaced explicitly through the persisted-status warning/header path, I no longer consider the StepPendingOrder mapping here a blocker by itself. In that full UI context, the timeline is acting as a neutral “no active progress completed” baseline rather than the sole carrier of the final state.

The earlier sell-branch BuyFlowStep bug was fixed, checks are green, and I do not see another blocker in the current version.

So with that interpretation, I am comfortable approving this PR.

@arkanoider arkanoider merged commit 87ad4f2 into main May 15, 2026
11 checks passed
@arkanoider arkanoider deleted the ui-improvements branch May 15, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant