commit ce9f4bb751e42d6bd190e92c544e7bac2765bd06
parent 321e528d8fd11eb64296cd22f36bc5015f5af560
Author: triesap <tyson@radroots.org>
Date: Sat, 6 Jun 2026 22:46:10 -0700
app: return issue submits to order detail
Diffstat:
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/crates/desktop/src/window.rs b/crates/desktop/src/window.rs
@@ -192,6 +192,13 @@ fn farmer_order_detail_focus_after_open(
}
}
+fn buyer_receipt_issue_focus_after_submit(
+ runtime_changed: bool,
+ order_id: OrderId,
+) -> Option<HomeFocusedView> {
+ runtime_changed.then_some(HomeFocusedView::BuyerOrderDetail(order_id))
+}
+
pub fn home_window_options(cx: &mut App) -> WindowOptions {
let (launch_width_px, launch_height_px) = home_window_launch_size_px();
let (minimum_width_px, minimum_height_px) = home_window_minimum_size_px();
@@ -2417,11 +2424,15 @@ impl HomeView {
};
match self.runtime.publish_buyer_order_receipt(order_id, issue) {
- Ok(true) => {
- self.buyer_receipt_issue_form = None;
- cx.notify();
+ Ok(runtime_changed) => {
+ if let Some(focused_view) =
+ buyer_receipt_issue_focus_after_submit(runtime_changed, order_id)
+ {
+ self.buyer_receipt_issue_form = None;
+ self.focused_view = Some(focused_view);
+ cx.notify();
+ }
}
- Ok(false) => {}
Err(runtime_error) => {
error!(
target: "personal_orders",
@@ -13795,8 +13806,8 @@ mod tests {
about_conflict_detail_rows, about_conflict_review_body_key, about_manual_refresh_enabled,
about_runtime_rows, about_status_rows, app_text,
buyer_order_coordination_notice_forces_redraw, buyer_order_detail_focus_after_open,
- buyer_orders_retry_action_visible, buyer_receipt_status_key,
- farm_setup_onboarding_card_spec, farmer_home_farm_state,
+ buyer_orders_retry_action_visible, buyer_receipt_issue_focus_after_submit,
+ buyer_receipt_status_key, farm_setup_onboarding_card_spec, farmer_home_farm_state,
farmer_order_detail_focus_after_open, farmer_pack_day_available, home_auto_focus_target,
home_content_scroll_id, home_saved_farm, home_sidebar_navigation_sections, home_stage,
home_window_launch_size_px, home_window_minimum_size_px,
@@ -14072,6 +14083,20 @@ mod tests {
}
#[test]
+ fn buyer_receipt_issue_submit_returns_to_order_detail() {
+ let order_id = OrderId::new();
+
+ assert_eq!(
+ buyer_receipt_issue_focus_after_submit(true, order_id),
+ Some(HomeFocusedView::BuyerOrderDetail(order_id))
+ );
+ assert_eq!(
+ buyer_receipt_issue_focus_after_submit(false, order_id),
+ None
+ );
+ }
+
+ #[test]
fn buyer_browse_refresh_failure_uses_typed_visible_notice() {
let (mut view, paths, home_dir) = test_home_view("buyer_notice");
block_shared_local_events_database(&paths);