fix(tui): make browse retry work and de-jargon the copy
- Retry actually retries: 'r' in the browse popup re-requests a timed-out user (previously the 'Press b to retry' hint did nothing — b wasn't handled inside the popup). BrowseTabs::retry_active is unit-tested. - Friendlier timeout copy that explains the likely cause: "Couldn't reach <user>. They may be offline, or their connection can't be reached (both of you may be behind a router/firewall). Press r to try again." - Replace protocol terminology in user-facing labels: 'Peer slots' -> 'Free slots', 'Peer upload speed' -> 'Upload speed'.
This commit is contained in:
@@ -388,6 +388,7 @@ impl MainTui {
|
||||
("Enter", "open/download"),
|
||||
("d", "download folder"),
|
||||
("Tab", "switch user"),
|
||||
("r", "retry"),
|
||||
("w", "close tab"),
|
||||
("Esc", "hide"),
|
||||
]
|
||||
@@ -631,6 +632,13 @@ impl MainTui {
|
||||
self.sync_browse_selection();
|
||||
return;
|
||||
}
|
||||
KeyCode::Char('r') => {
|
||||
// Retry a timed-out browse.
|
||||
if let Some(username) = self.state.browse.retry_active() {
|
||||
let _ = self.client.browse_user(&username);
|
||||
}
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,10 +90,18 @@ fn render_browse_one(
|
||||
frame.render_widget(Paragraph::new(text).block(block), area);
|
||||
}
|
||||
BrowseStatus::TimedOut => {
|
||||
let text = Line::styled(
|
||||
"Timed out waiting for the file list. Press b to retry.",
|
||||
error_style(),
|
||||
);
|
||||
let text = vec![
|
||||
Line::styled(
|
||||
format!("Couldn't reach {}.", browse.username),
|
||||
error_style(),
|
||||
),
|
||||
Line::raw(""),
|
||||
Line::raw(
|
||||
"They may be offline, or their connection can't be \
|
||||
reached (both of you may be behind a router/firewall).",
|
||||
),
|
||||
Line::raw("Press r to try again."),
|
||||
];
|
||||
frame.render_widget(Paragraph::new(text).block(block), area);
|
||||
}
|
||||
BrowseStatus::Loaded => {
|
||||
|
||||
@@ -104,12 +104,12 @@ fn build_info_lines(
|
||||
} else {
|
||||
"all busy".to_string()
|
||||
};
|
||||
lines.push(label_value("Peer slots", &slot_text));
|
||||
lines.push(label_value("Free slots", &slot_text));
|
||||
}
|
||||
|
||||
if let Some(speed) = download.metadata.peer_upload_speed {
|
||||
lines.push(label_value(
|
||||
"Peer upload speed",
|
||||
"Upload speed",
|
||||
&format_speed(f64::from(speed)),
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user