Skip to content

Commit

Permalink
wip - loading progress, misc
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Jan 10, 2024
1 parent 91a0324 commit fb1c00d
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 29 deletions.
79 changes: 62 additions & 17 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<base data-trunk-public-url />

<link data-trunk rel="copy-dir" href="../resources/icons" />
<link data-trunk rel="copy-file" href="../resources/images/kaspa-ng.svg" />
<link data-trunk rel="icon" href="../resources/icons/favicon.ico">

<link data-trunk rel="copy-file" href="./pwa.js" />
Expand Down Expand Up @@ -86,40 +87,84 @@
}

/* ---------------------------------------------- */
/* Loading animation from https://loading.io/css/ */
.lds-dual-ring {

.lds-ellipsis {
display: inline-block;
width: 24px;
height: 24px;
position: relative;
width: 80px;
height: 80px;
}

.lds-dual-ring:after {
content: " ";
display: block;
width: 24px;
height: 24px;
margin: 0px;
.lds-ellipsis div {
position: absolute;
top: 33px;
width: 13px;
height: 13px;
border-radius: 50%;
border: 3px solid #fff;
border-color: #fff transparent #fff transparent;
animation: lds-dual-ring 1.2s linear infinite;
background: #fff;
animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.lds-ellipsis div:nth-child(1) {
left: 8px;
animation: lds-ellipsis1 0.6s infinite;
}

.lds-ellipsis div:nth-child(2) {
left: 8px;
animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(3) {
left: 32px;
animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(4) {
left: 56px;
animation: lds-ellipsis3 0.6s infinite;
}

@keyframes lds-ellipsis1 {
0% {
transform: scale(0);
}

100% {
transform: scale(1);
}
}

@keyframes lds-dual-ring {
@keyframes lds-ellipsis3 {
0% {
transform: rotate(0deg);
transform: scale(1);
}

100% {
transform: rotate(360deg);
transform: scale(0);
}
}

@keyframes lds-ellipsis2 {
0% {
transform: translate(0, 0);
}

100% {
transform: translate(24px, 0);
}
}
</style>
</head>

<body>
<canvas id="kaspa-ng"></canvas>
<div class="centered" id="loading">
<p style="font-size:16px">
<img src="kaspa-ng.svg" alt="Kaspa NG" width="50%">
</p>
<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>
</div>
<!-- script>
// Caching is disabled during the development.
if ('serviceWorker' in navigator && window.location.hash !== "#dev") {
Expand All @@ -130,4 +175,4 @@
</script -->
</body>

</html>
</html>
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ features = [
'Document',
'VisibilityState',
'Window',
'Element',
]


Expand Down
6 changes: 6 additions & 0 deletions core/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ cfg_if! {

pub async fn kaspa_ng_main(_wallet_api : Option<Arc<dyn WalletApi>>) -> Result<()> {
use wasm_bindgen::prelude::*;
use workflow_dom::utils::document;

// ------------------------------------------------------------
// ------------------------------------------------------------
Expand Down Expand Up @@ -302,6 +303,11 @@ cfg_if! {
// wasm_bindgen_futures::spawn_local(async {
use workflow_log::*;
log_info!("Welcome to Kaspa NG! Have a great day!");

if let Some(element) = document().get_element_by_id("loading") {
element.remove();
}

eframe::WebRunner::new()
.start(
"kaspa-ng",
Expand Down
3 changes: 0 additions & 3 deletions core/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,6 @@ impl Core {
self.metrics = Some(snapshot);
}
Events::MempoolSize { mempool_size } => {
// println!("mempool_size: {} tps: {}", mempool_size,self.settings.node.network.tps());
let load = mempool_size as f32 / self.settings.node.network.tps() as f32;
self.network_load_samples.push_back(load);
if self.network_load_samples.len() > MAX_NETWORK_LOAD_SAMPLES {
Expand All @@ -649,8 +648,6 @@ impl Core {
let network_load = self.network_load_samples.iter().sum::<f32>()
/ self.network_load_samples.len() as f32;
self.state.network_load.replace(network_load);

// println!("network_load: {}", network_load);
}
Events::Exit => {
cfg_if! {
Expand Down
2 changes: 1 addition & 1 deletion core/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Device {
orientation: Orientation::default(),
orientation_forced: None,
screen_size: Vec2::ZERO,
top_offset: if window_frame { 0.0 } else { 32.0 },
top_offset: if window_frame { 32.0 } else { 0.0 },
}
}

Expand Down
12 changes: 6 additions & 6 deletions core/src/modules/overview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,27 +255,27 @@ impl Overview {
.show(ui, |ui| {
ui.vertical(|ui|{
ui.label("Rusty Kaspa");
ui.label("Copyright (c) 2023 Kaspa Developers");
ui.label("Copyright (c) 2024 Kaspa Developers");
ui.label("License: ISC");
ui.hyperlink_url_to_tab("https://github.com/kaspanet/rusty-kaspa");
ui.label("");
ui.label("Kaspa NG");
ui.label("Copyright (c) 2023 ASPECTRON");
ui.label("Restricted MIT or Apache 2.0 License");
ui.label("Copyright (c) 2024 ASPECTRON");
ui.label("License: MIT (RESTRICTED)");
ui.hyperlink_url_to_tab("https://github.com/aspectron/kaspa-ng");
ui.label("");
ui.label("WORKFLOW-RS");
ui.label("Copyright (c) 2023 ASPECTRON");
ui.label("Copyright (c) 2024 ASPECTRON");
ui.label("License: MIT or Apache 2.0");
ui.hyperlink_url_to_tab("https://github.com/workflow-rs/workflow-rs");
ui.label("");
ui.label("EGUI");
ui.label("Copyright (c) 2023 Rerun");
ui.label("Copyright (c) 2024 Rerun");
ui.label("License: MIT or Apache 2.0");
ui.hyperlink_url_to_tab("https://github.com/emilk/egui");
ui.label("");
ui.label("PHOSPHOR ICONS");
ui.label("Copyright (c) 2023 ");
ui.label("Copyright (c) 2024 ");
ui.label("License: MIT");
ui.hyperlink_url_to_tab("https://phosphoricons.com/");
ui.label("");
Expand Down
1 change: 0 additions & 1 deletion core/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ impl Network {

pub fn tps(&self) -> u64 {
let params = Params::from(*self);
// println!("{}, bps: {}, block mass: {} tx size: {} tx/block : {}",self, params.bps(), params.max_block_mass, MAXIMUM_STANDARD_TRANSACTION_MASS, params.max_block_mass / MAXIMUM_STANDARD_TRANSACTION_MASS);
params.max_block_mass / BASIC_TRANSACTION_MASS * params.bps()
}
}
6 changes: 5 additions & 1 deletion core/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ impl<'core> Status<'core> {
.color(theme_color().icon_syncing_color),
);
ui.separator();
ui.label(i18n("CONNECTED"));
ui.label(i18n("CONNECTED")).on_hover_ui(|ui| {
ui.horizontal(|ui| {
ui.label(self.settings().node.wrpc_url.clone());
});
});
ui.separator();
self.render_network_selector(ui);

Expand Down

0 comments on commit fb1c00d

Please sign in to comment.