Skip to content

Commit 7fc4e82

Browse files
committed
fix: keep usage tab navigation first
1 parent 1eb5438 commit 7fc4e82

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

crates/jackin-capsule/src/tui/components/dialog.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,11 @@ impl Dialog {
539539
if *selected == UsageDialogTab::Instance {
540540
return Some(Self::usage_instance_state(view, scroll.clone()));
541541
}
542-
let mut rows = vec![
542+
let mut rows = Vec::new();
543+
if let Some(tabs) = Self::usage_tabs_label(view) {
544+
rows.push(jackin_tui::components::ContainerInfoRow::new("Tabs", tabs));
545+
}
546+
rows.extend([
543547
jackin_tui::components::ContainerInfoRow::new(
544548
"Focused",
545549
Self::usage_focused_label(view),
@@ -561,10 +565,7 @@ impl Dialog {
561565
Self::usage_status_label(view.status),
562566
),
563567
jackin_tui::components::ContainerInfoRow::new("Updated", view.updated_label.clone()),
564-
];
565-
if let Some(tabs) = Self::usage_tabs_label(view) {
566-
rows.push(jackin_tui::components::ContainerInfoRow::new("Tabs", tabs));
567-
}
568+
]);
568569
if let Some(plan) = &view.account.plan_label {
569570
rows.push(jackin_tui::components::ContainerInfoRow::new(
570571
"Plan",

crates/jackin-capsule/src/tui/components/dialog/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,7 @@ fn usage_dialog_rows_render_meters_spend_and_source() {
10121012
.map(jackin_tui::components::ContainerInfoRow::value)
10131013
.collect();
10141014

1015+
assert_eq!(state.rows()[0].label(), "Tabs");
10151016
assert!(values.contains(&"codex · OpenAI · alexey@example.com"));
10161017
assert!(values.iter().any(|value| {
10171018
value.starts_with("████████████····")

0 commit comments

Comments
 (0)