|
@@ -28,7 +28,7 @@ use crate::{
|
|
|
mesh::{COLOR_CYAN, COLOR_TEAL},
|
|
mesh::{COLOR_CYAN, COLOR_TEAL},
|
|
|
prop::{PropertyAtomicGuard, PropertyBool, PropertyFloat32, Role},
|
|
prop::{PropertyAtomicGuard, PropertyBool, PropertyFloat32, Role},
|
|
|
scene::{SceneNodePtr, Slot},
|
|
scene::{SceneNodePtr, Slot},
|
|
|
- shape,
|
|
|
|
|
|
|
+ shape, text,
|
|
|
theme::wire_color,
|
|
theme::wire_color,
|
|
|
ui::{Button, Layer, Text, TokenTable, VectorArt, VectorShape},
|
|
ui::{Button, Layer, Text, TokenTable, VectorArt, VectorShape},
|
|
|
util::i18n::I18nBabelFish,
|
|
util::i18n::I18nBabelFish,
|
|
@@ -269,15 +269,44 @@ pub async fn make(
|
|
|
|
|
|
|
|
let mut y = HEADER_HEIGHT;
|
|
let mut y = HEADER_HEIGHT;
|
|
|
|
|
|
|
|
- // Balance display
|
|
|
|
|
- let node = create_text("wallet_balance");
|
|
|
|
|
|
|
+ // Balance display: "DRK" label + amount side by side.
|
|
|
|
|
+ let scale = window_scale.get();
|
|
|
|
|
+ let drk_layout =
|
|
|
|
|
+ text::make_layout("DRK", COLOR_CYAN, MAIN_BALANCE_FONTSIZE, 1.0, scale, None, &[]);
|
|
|
|
|
+ let drk_width = drk_layout.width();
|
|
|
|
|
+
|
|
|
|
|
+ let node = create_text("wallet_balance_drk");
|
|
|
let prop = node.get_property("rect").unwrap();
|
|
let prop = node.get_property("rect").unwrap();
|
|
|
prop.set_default_f32(0, PADDING_X).unwrap();
|
|
prop.set_default_f32(0, PADDING_X).unwrap();
|
|
|
prop.set_default_f32(1, y + TITLE_PADDING).unwrap();
|
|
prop.set_default_f32(1, y + TITLE_PADDING).unwrap();
|
|
|
|
|
+ prop.set_default_f32(2, drk_width).unwrap();
|
|
|
|
|
+ prop.set_default_f32(3, MAIN_BALANCE_FONTSIZE).unwrap();
|
|
|
|
|
+ node.get_property("font_size").unwrap().set_default_f32(0, MAIN_BALANCE_FONTSIZE).unwrap();
|
|
|
|
|
+ node.set_property_str(atom, Role::App, "text", "DRK").unwrap();
|
|
|
|
|
+ let prop = node.get_property("text_color").unwrap();
|
|
|
|
|
+ prop.set_default_f32_multi(&[0., 0.94, 1., 1.]).unwrap();
|
|
|
|
|
+ node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
|
|
|
|
|
+ let node = node
|
|
|
|
|
+ .setup(|me| {
|
|
|
|
|
+ Text::new(
|
|
|
|
|
+ me,
|
|
|
|
|
+ window_scale.clone(),
|
|
|
|
|
+ app.renderer.clone(),
|
|
|
|
|
+ i18n_fish.clone(),
|
|
|
|
|
+ app.redraw_trigger.clone(),
|
|
|
|
|
+ )
|
|
|
|
|
+ })
|
|
|
|
|
+ .await;
|
|
|
|
|
+ main_layer.link(node);
|
|
|
|
|
+
|
|
|
|
|
+ let node = create_text("wallet_balance");
|
|
|
|
|
+ let prop = node.get_property("rect").unwrap();
|
|
|
|
|
+ prop.set_default_f32(0, PADDING_X + drk_width + MAIN_BALANCE_TOKEN_SPACING).unwrap();
|
|
|
|
|
+ prop.set_default_f32(1, y + TITLE_PADDING).unwrap();
|
|
|
prop.set_default_f32(2, 1000.).unwrap();
|
|
prop.set_default_f32(2, 1000.).unwrap();
|
|
|
- prop.set_default_f32(3, TITLE_FONTSIZE).unwrap();
|
|
|
|
|
- node.get_property("font_size").unwrap().set_default_f32(0, TITLE_FONTSIZE).unwrap();
|
|
|
|
|
- node.set_property_str(atom, Role::App, "text", "DRK 0").unwrap();
|
|
|
|
|
|
|
+ prop.set_default_f32(3, MAIN_BALANCE_FONTSIZE).unwrap();
|
|
|
|
|
+ node.get_property("font_size").unwrap().set_default_f32(0, MAIN_BALANCE_FONTSIZE).unwrap();
|
|
|
|
|
+ node.set_property_str(atom, Role::App, "text", "0").unwrap();
|
|
|
// Class wiring: the wallet title follows the shared text token.
|
|
// Class wiring: the wallet title follows the shared text token.
|
|
|
let theme = app.sg_root.lookup_node("/theme").unwrap();
|
|
let theme = app.sg_root.lookup_node("/theme").unwrap();
|
|
|
wire_color(&node, "text_color", &theme, "text_color").unwrap();
|
|
wire_color(&node, "text_color", &theme, "text_color").unwrap();
|
|
@@ -295,7 +324,27 @@ pub async fn make(
|
|
|
.await;
|
|
.await;
|
|
|
main_layer.link(node);
|
|
main_layer.link(node);
|
|
|
|
|
|
|
|
- y += TITLE_PADDING * 2. + TITLE_FONTSIZE + 1.;
|
|
|
|
|
|
|
+ let node = create_vector_art("wallet_balance_bg");
|
|
|
|
|
+ let prop = node.get_property("rect").unwrap();
|
|
|
|
|
+ prop.set_default_f32(0, 0.).unwrap();
|
|
|
|
|
+ prop.set_default_f32(1, y + 0.5).unwrap();
|
|
|
|
|
+ prop.set_default_expr(2, expr::load_var("w")).unwrap();
|
|
|
|
|
+ prop.set_default_f32(3, TITLE_PADDING * 2. + MAIN_BALANCE_FONTSIZE + 0.5).unwrap();
|
|
|
|
|
+ node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
|
|
|
|
|
+ let mut shape = VectorShape::new();
|
|
|
|
|
+ shape.add_filled_box(
|
|
|
|
|
+ expr::const_f32(0.),
|
|
|
|
|
+ expr::const_f32(0.),
|
|
|
|
|
+ expr::load_var("w"),
|
|
|
|
|
+ expr::load_var("h"),
|
|
|
|
|
+ [0., 0.0157, 0.1569, 0.6],
|
|
|
|
|
+ );
|
|
|
|
|
+ node.set_property_shape(atom, Role::App, "shape", shape).unwrap();
|
|
|
|
|
+ let node =
|
|
|
|
|
+ node.setup(|me| VectorArt::new(me, app.renderer.clone(), app.redraw_trigger.clone())).await;
|
|
|
|
|
+ main_layer.link(node);
|
|
|
|
|
+
|
|
|
|
|
+ y += TITLE_PADDING * 2. + MAIN_BALANCE_FONTSIZE + 1.;
|
|
|
|
|
|
|
|
create_separator(app, atom, &main_layer, "wallet_balance_separator", &mut y, false).await;
|
|
create_separator(app, atom, &main_layer, "wallet_balance_separator", &mut y, false).await;
|
|
|
|
|
|