mirror of
https://github.com/veeso/termscp.git
synced 2026-04-02 00:02:17 -07:00
feat: simplify progress bar layout to single component
This commit is contained in:
@@ -175,7 +175,7 @@ impl FileTransferActivity {
|
||||
Id::SaveAsPopup,
|
||||
Id::SymlinkPopup,
|
||||
Id::FileInfoPopup,
|
||||
Id::ProgressBarPartial,
|
||||
Id::TransferProgressBar,
|
||||
Id::DeletePopup,
|
||||
Id::ReplacePopup,
|
||||
Id::DisconnectPopup,
|
||||
@@ -204,19 +204,11 @@ impl FileTransferActivity {
|
||||
f.render_widget(Clear, popup);
|
||||
self.app.view(popup_id, f, popup);
|
||||
}
|
||||
// Dual-component progress bar
|
||||
Id::ProgressBarPartial => {
|
||||
Id::TransferProgressBar => {
|
||||
let popup =
|
||||
Popup(Size::Percentage(50), Size::Percentage(20)).draw_in(f.area());
|
||||
Popup(Size::Percentage(50), Size::Percentage(15)).draw_in(f.area());
|
||||
f.render_widget(Clear, popup);
|
||||
let popup_chunks = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints(
|
||||
[Constraint::Percentage(50), Constraint::Percentage(50)].as_ref(),
|
||||
)
|
||||
.split(popup);
|
||||
self.app.view(&Id::ProgressBarFull, f, popup_chunks[0]);
|
||||
self.app.view(&Id::ProgressBarPartial, f, popup_chunks[1]);
|
||||
self.app.view(&Id::TransferProgressBar, f, popup);
|
||||
}
|
||||
// Wait popup with dynamic line count
|
||||
Id::WaitPopup => {
|
||||
@@ -368,8 +360,7 @@ impl FileTransferActivity {
|
||||
Id::MkdirPopup,
|
||||
Id::NewfilePopup,
|
||||
Id::OpenWithPopup,
|
||||
Id::ProgressBarFull,
|
||||
Id::ProgressBarPartial,
|
||||
Id::TransferProgressBar,
|
||||
Id::ExplorerFind,
|
||||
Id::QuitPopup,
|
||||
Id::RenamePopup,
|
||||
|
||||
@@ -426,34 +426,19 @@ impl FileTransferActivity {
|
||||
&mut self,
|
||||
root_name: String,
|
||||
) {
|
||||
let prog_color_full = self.theme().transfer_progress_bar_full;
|
||||
let prog_color_partial = self.theme().transfer_progress_bar_partial;
|
||||
let prog_color = self.theme().transfer_progress_bar_full;
|
||||
ui_result(self.app.remount(
|
||||
Id::ProgressBarFull,
|
||||
Box::new(components::ProgressBarFull::new(
|
||||
0.0,
|
||||
"",
|
||||
&root_name,
|
||||
prog_color_full,
|
||||
Id::TransferProgressBar,
|
||||
Box::new(components::TransferProgressBar::new(
|
||||
0.0, "", &root_name, prog_color,
|
||||
)),
|
||||
vec![],
|
||||
));
|
||||
ui_result(self.app.remount(
|
||||
Id::ProgressBarPartial,
|
||||
Box::new(components::ProgressBarPartial::new(
|
||||
0.0,
|
||||
"",
|
||||
"Please wait",
|
||||
prog_color_partial,
|
||||
)),
|
||||
vec![],
|
||||
));
|
||||
ui_result(self.app.active(&Id::ProgressBarPartial));
|
||||
ui_result(self.app.active(&Id::TransferProgressBar));
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::filetransfer) fn umount_progress_bar(&mut self) {
|
||||
let _ = self.app.umount(&Id::ProgressBarPartial);
|
||||
let _ = self.app.umount(&Id::ProgressBarFull);
|
||||
let _ = self.app.umount(&Id::TransferProgressBar);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::filetransfer) fn mount_file_sorting(&mut self) {
|
||||
|
||||
Reference in New Issue
Block a user