mirror of
https://github.com/jwinterm/grim.git
synced 2026-10-20 23:28:31 +02:00
ui: window resize, update egui (waiting for window dragging/resizing patch), pull to refresh widget, colors optimization, min window size, root panels switch optimization
This commit is contained in:
@@ -103,16 +103,19 @@ impl WalletsContent {
|
||||
let wallet_panel_width = self.wallet_panel_width(ui, empty_list, dual_panel, show_wallet);
|
||||
let content_width = ui.available_width();
|
||||
|
||||
let root_dual_panel = Root::is_dual_panel_mode(ui);
|
||||
|
||||
// Flag to check if wallet list is hidden on the screen.
|
||||
let list_hidden = content_width == 0.0 || empty_list || create_wallet
|
||||
|| (dual_panel && show_wallet && !self.show_wallets_at_dual_panel)
|
||||
|| (!dual_panel && show_wallet) ||
|
||||
(!Root::is_dual_panel_mode(ui) && Root::is_network_panel_open());
|
||||
(!root_dual_panel && Root::is_network_panel_open());
|
||||
|
||||
// Show title panel.
|
||||
self.title_ui(ui, dual_panel, create_wallet, show_wallet);
|
||||
|
||||
// Show wallet panel content.
|
||||
let wallet_panel_opened = self.wallet_panel_opened();
|
||||
egui::SidePanel::right("wallet_panel")
|
||||
.resizable(false)
|
||||
.exact_width(wallet_panel_width)
|
||||
@@ -129,11 +132,11 @@ impl WalletsContent {
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.show_animated_inside(ui, self.wallet_panel_opened(), |ui| {
|
||||
// Do not draw content on zero width.
|
||||
if content_width == 0.0 {
|
||||
return;
|
||||
}
|
||||
.show_animated_inside(ui, wallet_panel_opened, |ui| {
|
||||
// // Do not draw content on zero width.
|
||||
// if content_width == 0.0 {
|
||||
// return;
|
||||
// }
|
||||
if create_wallet || !show_wallet {
|
||||
// Show wallet creation content.
|
||||
self.creation_content.ui(ui, cb, |wallet| {
|
||||
@@ -180,24 +183,6 @@ impl WalletsContent {
|
||||
top: View::TAB_ITEMS_PADDING,
|
||||
bottom: View::get_bottom_inset() + View::TAB_ITEMS_PADDING,
|
||||
},
|
||||
outer_margin: if View::is_desktop() {
|
||||
Margin {
|
||||
left: if !dual_panel {
|
||||
-0.5
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
right: if !self.wallet_panel_opened() {
|
||||
-0.5
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
top: 0.0,
|
||||
bottom: -0.5,
|
||||
}
|
||||
} else {
|
||||
Margin::ZERO
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.show_inside(ui, |ui| {
|
||||
@@ -221,6 +206,20 @@ impl WalletsContent {
|
||||
egui::Frame::default()
|
||||
} else {
|
||||
egui::Frame {
|
||||
outer_margin: Margin {
|
||||
left: if !root_dual_panel {
|
||||
-0.5
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
right: if !wallet_panel_opened {
|
||||
-0.5
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
top: 0.0,
|
||||
bottom: 0.0,
|
||||
},
|
||||
stroke: View::item_stroke(),
|
||||
fill: Colors::fill_deep(),
|
||||
inner_margin: Margin {
|
||||
@@ -301,8 +300,7 @@ impl WalletsContent {
|
||||
};
|
||||
|
||||
// Draw title panel.
|
||||
let show_title = Root::is_dual_panel_mode(ui) || !Root::is_network_panel_open();
|
||||
TitlePanel::ui(title_content, show_title, |ui| {
|
||||
TitlePanel::ui(title_content, |ui| {
|
||||
if show_wallet && !dual_panel {
|
||||
View::title_button_big(ui, ARROW_LEFT, |_| {
|
||||
self.wallets.select(None);
|
||||
|
||||
@@ -87,8 +87,11 @@ impl WalletContent {
|
||||
|
||||
// Show wallet balance panel not on Settings tab with selected non-repairing
|
||||
// wallet, when there is no error and data is not empty.
|
||||
let show_balance = self.current_tab.get_type() != WalletTabType::Settings && !data_empty
|
||||
let mut show_balance = self.current_tab.get_type() != WalletTabType::Settings && !data_empty
|
||||
&& !wallet.sync_error() && !wallet.is_repairing() && !wallet.is_closing();
|
||||
if wallet.get_current_ext_conn().is_none() && !Node::is_running() {
|
||||
show_balance = false;
|
||||
}
|
||||
egui::TopBottomPanel::top(Id::from("wallet_balance").with(wallet.identifier()))
|
||||
.frame(egui::Frame {
|
||||
fill: Colors::fill(),
|
||||
@@ -100,13 +103,17 @@ impl WalletContent {
|
||||
bottom: 0.0,
|
||||
},
|
||||
outer_margin: Margin {
|
||||
left: 0.0,
|
||||
right: 0.0,
|
||||
top: 0.0,
|
||||
bottom: if !dual_panel {
|
||||
0.0
|
||||
left: if !dual_panel {
|
||||
-0.5
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
right: -0.5,
|
||||
top: 0.0,
|
||||
bottom: if dual_panel {
|
||||
-1.0
|
||||
} else {
|
||||
-0.5
|
||||
},
|
||||
},
|
||||
..Default::default()
|
||||
@@ -124,6 +131,7 @@ impl WalletContent {
|
||||
});
|
||||
|
||||
// Show wallet tabs panel.
|
||||
let show_tabs = !Self::block_navigation_on_sync(wallet);
|
||||
egui::TopBottomPanel::bottom("wallet_tabs")
|
||||
.frame(egui::Frame {
|
||||
fill: Colors::fill(),
|
||||
@@ -133,23 +141,9 @@ impl WalletContent {
|
||||
top: View::TAB_ITEMS_PADDING,
|
||||
bottom: View::get_bottom_inset() + View::TAB_ITEMS_PADDING,
|
||||
},
|
||||
outer_margin: if View::is_desktop() {
|
||||
Margin {
|
||||
left: if dual_panel {
|
||||
0.0
|
||||
} else {
|
||||
-0.5
|
||||
},
|
||||
right: -0.5,
|
||||
top: 0.0,
|
||||
bottom: -0.5,
|
||||
}
|
||||
} else {
|
||||
Margin::ZERO
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.show_animated_inside(ui, !Self::block_navigation_on_sync(wallet), |ui| {
|
||||
.show_animated_inside(ui, show_tabs, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
// Draw wallet tabs.
|
||||
View::max_width_ui(ui, Root::SIDE_PANEL_WIDTH * 1.3, |ui| {
|
||||
@@ -161,6 +155,16 @@ impl WalletContent {
|
||||
// Show tab content panel.
|
||||
egui::CentralPanel::default()
|
||||
.frame(egui::Frame {
|
||||
outer_margin: Margin {
|
||||
left: if !dual_panel {
|
||||
-0.5
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
right: -0.5,
|
||||
top: 0.0,
|
||||
bottom: 0.0,
|
||||
},
|
||||
stroke: View::item_stroke(),
|
||||
fill: Colors::white_or_black(false),
|
||||
..Default::default()
|
||||
|
||||
@@ -17,7 +17,6 @@ use std::thread;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use egui::{Align, Id, Layout, Margin, RichText, Rounding, ScrollArea};
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui_pull_to_refresh::PullToRefresh;
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
use grin_util::ToHex;
|
||||
use grin_wallet_libwallet::{Error, Slate, SlateState, TxLogEntryType};
|
||||
@@ -26,7 +25,7 @@ use parking_lot::RwLock;
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{ARROW_CIRCLE_DOWN, ARROW_CIRCLE_UP, ARROW_CLOCKWISE, BRIDGE, BROOM, CALENDAR_CHECK, CHAT_CIRCLE_TEXT, CHECK, CHECK_CIRCLE, CLIPBOARD_TEXT, COPY, DOTS_THREE_CIRCLE, FILE_ARCHIVE, FILE_TEXT, GEAR_FINE, HASH_STRAIGHT, PROHIBIT, QR_CODE, SCAN, X_CIRCLE};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{CameraContent, FilePickButton, Modal, QrCodeContent, Root, View};
|
||||
use crate::gui::views::{CameraContent, FilePickButton, Modal, PullToRefresh, QrCodeContent, Root, View};
|
||||
use crate::gui::views::types::ModalPosition;
|
||||
use crate::gui::views::wallets::types::WalletTab;
|
||||
use crate::gui::views::wallets::wallet::types::{GRIN, SLATEPACK_MESSAGE_HINT, WalletTabType};
|
||||
|
||||
Reference in New Issue
Block a user