Skip to content

Commit

Permalink
toolbar layout
Browse files Browse the repository at this point in the history
  • Loading branch information
HardhatChad committed Mar 23, 2024
1 parent 1608fc6 commit 711531f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "./README.md"
keywords = ["solana", "crypto", "mining"]

[features]
default = []
default = ["web"]
bundle = []
desktop = [
"async-tungstenite",
Expand Down
30 changes: 18 additions & 12 deletions src/components/miner_toolbar/miner_toolbar_active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn MinerToolbarActive(cx: Scope<MinerToolbarActiveProps>) -> Element {
_ => None
}
p {
class: "font-mono text-sm truncate opacity-80",
class: "font-mono text-sm truncate shrink opacity-80",
"{miner_display_hash}"
}
}
Expand All @@ -91,44 +91,50 @@ pub fn MinerToolbarActive(cx: Scope<MinerToolbarActiveProps>) -> Element {
} else {
render! {
div {
class: "flex flex-row w-full justify-between my-auto px-4 sm:px-8",
class: "flex flex-row gap-2 max-w-screen w-screen justify-start my-auto px-4 sm:px-8 object-contain",
div {
class: "flex flex-row gap-2 my-auto",
class: "flex-shrink-0 flex-none my-auto",
ActivityIndicator {}
p {
class: "font-semibold text-white",
"Mining"
}
}
p {
class: "font-semibold text-white flex-shrink-0 flex-none my-auto",
"Mining"
}
div {
class: "flex-shrink flex-auto truncate my-auto",
match miner_status_message {
MinerStatusMessage::Searching => {
render! {
p {
class: "font-mono text-sm truncate opacity-80 my-auto ml-2",
class: "font-mono text-sm truncate flex-shrink flex-auto opacity-80 my-auto ml-2",
"{miner_display_hash}"
}
}
}
MinerStatusMessage::Submitting => {
render! {
p {
class: "text-sm text-white opacity-80 my-auto ml-2",
class: "truncate flex-shrink flex-auto text-sm text-white opacity-80 my-auto ml-2",
"Submitting hash for validation..."
}
}
}
MinerStatusMessage::Error => {
render! {
p {
class: "text-sm text-white opacity-80 my-auto ml-2",
class: "truncate flex-shrink flex-auto text-sm text-white opacity-80 my-auto ml-2",
"Error submitting transaction"
}
}
}
_ => None
}
}
StopButton {
miner: cx.props.miner.clone()
div {
class: "flex-shrink-0 flex-none ml-auto my-auto",
StopButton {
miner: cx.props.miner.clone()
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/miner_toolbar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub fn MinerToolbar(cx: Scope<MinerToolbarProps>, hidden: bool) -> Element {

render! {
div {
class: "{class} {height} {bg} {display}",
class: "{class} {height} {bg} {display} w-screen",
onclick: move |_e| {
*is_toolbar_open.write() = IsToolbarOpen(true);
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/stop_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn StopButton(cx: Scope, miner: UseState<Miner>) -> Element {
let is_toolbar_open = use_shared_state::<IsToolbarOpen>(cx).unwrap();
render! {
button {
class: "transition transition-colors flex w-10 h-10 justify-center rounded-full hover:bg-green-600 active:bg-green-700",
class: "transition transition-colors flex-shrink-0 flex w-10 h-10 justify-center rounded-full hover:bg-green-600 active:bg-green-700",
title: "Stop mining",
onclick: move |_e| {
track(AppEvent::StopMiner, None);
Expand Down
1 change: 0 additions & 1 deletion src/hooks/use_transfers_websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use crate::{components::ActivityFilter, gateway::AsyncResult};

use super::use_pubkey;

// const URL: &str = "ws://54.86.50.170:3001/ws";
const URL: &str = "wss://ore-websockets.onrender.com/ws";

// TODO Attempt reconnect if connection is lost
Expand Down
8 changes: 6 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#[cfg(feature = "desktop")]
pub fn asset_path(relative_path: &str) -> String {
format!("public/{}", relative_path)
if cfg!(feature = "bundle") {
format!("public/{}", relative_path)
} else {
relative_path.to_string()
}
}

#[cfg(not(feature = "desktop"))]
#[cfg(feature = "web")]
pub fn asset_path(relative_path: &str) -> String {
relative_path.to_string()
}

0 comments on commit 711531f

Please sign in to comment.