ui: fix network scroll and title paddings, fix title buttons hovering, set resolution on app start, update metrics translation.

This commit is contained in:
ardocrat 2023-07-11 21:02:36 +03:00
parent 917b4b743d
commit 9d97d466ff
5 changed files with 23 additions and 9 deletions

View file

@ -3,7 +3,7 @@ screen_accounts:
network:
self: Network
node: Integrated node
metrics: Chain metrics
metrics: Metrics
mining: Mining
settings: Node settings
enable_node: Enable node
@ -47,7 +47,7 @@ network_node:
size: Size (GB)
peers: Peers
network_metrics:
loading: Chain metrics will be available after the synchronization
loading: Metrics will be available after the synchronization
emission: Emission
inflation: Inflation
supply: Supply

View file

@ -3,7 +3,7 @@ screen_accounts:
network:
self: Сеть
node: Встроенный узел
metrics: Показатели цепи
metrics: Показатели
mining: Майнинг
settings: Настройки узла
enable_node: Включить узел
@ -47,7 +47,7 @@ network_node:
size: Размер (ГБ)
peers: Пиры
network_metrics:
loading: Показатели цепи будут доступны после синхронизации
loading: Показатели будут доступны после синхронизации
emission: Эмиссия
inflation: Инфляция
supply: Предложение

View file

@ -149,7 +149,12 @@ impl NetworkContainer {
egui::CentralPanel::default()
.frame(egui::Frame {
stroke: View::DEFAULT_STROKE,
inner_margin: Margin::same(4.0),
inner_margin: Margin {
left: 4.0,
right: 4.0,
top: 3.0,
bottom: 4.0,
},
fill: Colors::WHITE,
..Default::default()
})
@ -229,15 +234,16 @@ impl NetworkContainer {
fn title_text_ui(&self, builder: StripBuilder) {
builder
.size(Size::remainder())
.size(Size::exact(32.0))
.size(Size::exact(30.0))
.vertical(|mut strip| {
strip.cell(|ui| {
ui.add_space(2.0);
ui.add_space(3.0);
ui.vertical_centered(|ui| {
ui.label(RichText::new(self.current_tab.get_type().name().to_uppercase())
.size(18.0)
.color(Colors::TITLE));
});
ui.add_space(1.0);
});
strip.cell(|ui| {
ui.centered_and_justified(|ui| {

View file

@ -78,9 +78,15 @@ impl View {
/// Title button with transparent background fill color, contains only icon.
pub fn title_button(ui: &mut egui::Ui, icon: &str, action: impl FnOnce()) {
ui.scope(|ui| {
// Disable stroke around title buttons on hover
// Disable stroke around title buttons on click.
ui.style_mut().visuals.widgets.active.bg_stroke = Stroke::NONE;
// Disable rounding on hover.
ui.style_mut().visuals.widgets.hovered.rounding = Rounding::none();
// Disable stroke color on hover.
ui.style_mut().visuals.widgets.hovered.bg_stroke = Self::DEFAULT_STROKE;
// Setup text.
let wt = RichText::new(icon.to_string()).size(24.0).color(Colors::TITLE);
// Draw button.
let br = Button::new(wt)
.fill(Colors::TRANSPARENT)
.ui(ui);

View file

@ -21,6 +21,7 @@ use winit::platform::android::activity::AndroidApp;
pub use settings::{AppConfig, Settings};
use crate::gui::{App, PlatformApp};
use crate::gui::platform::PlatformCallbacks;
use crate::node::Node;
i18n!("locales");
@ -59,7 +60,7 @@ fn android_main(app: AndroidApp) {
}
pub fn app_creator<T: 'static>(app: PlatformApp<T>) -> eframe::AppCreator
where PlatformApp<T>: eframe::App {
where PlatformApp<T>: eframe::App, T: PlatformCallbacks {
Box::new(|cc| {
App::setup_visuals(&cc.egui_ctx);
App::setup_fonts(&cc.egui_ctx);
@ -71,6 +72,7 @@ pub fn app_creator<T: 'static>(app: PlatformApp<T>) -> eframe::AppCreator
pub fn start(mut options: eframe::NativeOptions, app_creator: eframe::AppCreator) {
options.default_theme = eframe::Theme::Light;
options.renderer = eframe::Renderer::Wgpu;
options.initial_window_size = Some(egui::Vec2::new(1200.0, 720.0));
setup_i18n();