tui: drop the F9 menu that restates F6 and F7
All checks were successful
ci / test (pull_request) Successful in 7m40s
ci / sdk (pull_request) Successful in 1m42s

The Wallets & Settings screen only named keys that already work. F6 is the
wallet, F7 is the node, and p on the roster or chat opens peer payments.
Profile, backup and wipe stay composer commands, named in help.
This commit is contained in:
agent 2026-10-08 11:03:28 -04:00
commit 4e13242a44
No known key found for this signature in database
5 changed files with 391 additions and 1147 deletions

View file

@ -1,4 +1,4 @@
//! Peer payment history screen (F9 → `payments` row).
//! Peer payment history screen (`p` on Main, roster or chat).
//!
//! The screen renders what `Node::list_payments` returns for the friend the rest
//! of the TUI acts on: signed `/pay` invoices, `/tip` receipts and tips, with
@ -11,9 +11,9 @@
use onionwire::Payment;
use onionwire::tui::{
PeerPaymentRow, PeerPaymentsState, WalletMenuState, cell_width, draw_peer_payments,
peer_payments_footer_hint, peer_payments_lines, peer_payments_text, status_footer,
wallets_settings_menu_text,
Pane, PeerPaymentRow, PeerPaymentsState, cell_width, draw_peer_payments,
main_opens_peer_payments, peer_payments_footer_hint, peer_payments_lines, peer_payments_text,
status_footer,
};
use ratatui::Terminal;
use ratatui::backend::TestBackend;
@ -342,73 +342,38 @@ fn peer_payments_columns_drop_before_they_wrap() {
}
#[test]
fn wallets_settings_menu_offers_the_peer_payments_row() {
let st = WalletMenuState {
transfers: 3,
peer: "lance".into(),
peer_payments: Some(3),
..menu_state_defaults()
};
let body = wallets_settings_menu_text(78, &st);
let row = body
.lines()
.find(|l| l.contains("payments"))
.expect("payments row");
assert!(row.contains("lance"), "row does not name the peer: {row:?}");
assert!(row.contains('p'), "row does not name its key: {row:?}");
// The wallet's own transfer list keeps its F6 row; it is retitled so the
// two histories cannot be mistaken for each other.
assert!(
body.lines().any(|l| l.contains("transfers")),
"wallet transfer row lost:\n{body}"
fn peer_payments_opens_from_main_and_the_frame_is_the_history() {
use ratatui::crossterm::event::KeyCode;
// The binding, not a menu row. Composer focus still types the letter.
assert!(main_opens_peer_payments(Pane::Roster, KeyCode::Char('p')));
assert!(main_opens_peer_payments(Pane::Chat, KeyCode::Char('p')));
assert!(!main_opens_peer_payments(Pane::Composer, KeyCode::Char('p')));
let history = render(80, 24, &peer_state());
assert!(history.contains("lance"), "peer missing:\n{history}");
assert!(history.contains("lunch money"), "history missing:\n{history}");
assert!(history.contains("payments"), "title missing:\n{history}");
// Not a menu row named `payments` beside a key column.
assert!(!history.contains("F9"));
assert!(!history.lines().any(|l| l.contains("F7 ctrl")));
let empty = render(
80,
24,
&PeerPaymentsState {
peer: String::new(),
rows: Vec::new(),
error: None,
selected: 0,
},
);
// No friend selected: the row is dim and offers no key that would do
// nothing.
let st = WalletMenuState {
peer: String::new(),
peer_payments: None,
..menu_state_defaults()
};
let body = wallets_settings_menu_text(78, &st);
let row = body
.lines()
.find(|l| l.contains("payments"))
.expect("payments row");
assert!(row.contains("no friend"), "{row:?}");
// A friend with no payment rows is the empty state, not an error.
let st = WalletMenuState {
peer: "lance".into(),
peer_payments: Some(0),
..menu_state_defaults()
};
let body = wallets_settings_menu_text(78, &st);
let row = body
.lines()
.find(|l| l.contains("payments"))
.expect("payments row");
assert!(row.contains("no history"), "{row:?}");
}
/// The F9 menu state with a healthy wallet, as `tests/tui_spec.rs` builds it.
fn menu_state_defaults() -> WalletMenuState {
WalletMenuState {
configured: true,
connected: true,
wallet_error: None,
receive_addr: ADDR.into(),
balance: "0.250000000000".into(),
transfers: 3,
child_state: "ready".into(),
child_source: "local node".into(),
child_error: None,
nickname: Some("lance".into()),
bio_set: true,
xmr_set: true,
me_fp: FP.into(),
peer: String::new(),
peer_payments: None,
assert!(
empty.contains("no friend selected"),
"empty-friend line missing:\n{empty}"
);
for line in empty.lines().chain(history.lines()) {
assert!(cell_width(line) <= 80, "wider than 80: {line:?}");
}
}