Skip to content

Commit

Permalink
cleanup imports
Browse files Browse the repository at this point in the history
  • Loading branch information
HardhatChad committed Mar 20, 2024
1 parent 547d522 commit 5946382
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 229 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ keywords = ["solana", "crypto", "mining"]

[features]
default = []
bundle = []
desktop = [
"async-tungstenite",
"dioxus-desktop",
Expand Down
42 changes: 1 addition & 41 deletions src/components/miner_toolbar/miner_toolbar_active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use dioxus::prelude::*;
use dioxus_router::prelude::Link;

use crate::{
components::{
ActivityIndicator, IsToolbarOpen, MinerDisplayHash, OreIcon, Spinner, StopButton, Tooltip,
TooltipDirection, WarningIcon,
},
components::{ActivityIndicator, IsToolbarOpen, MinerDisplayHash, Spinner, StopButton},
hooks::{use_power_level, use_priority_fee, PowerLevel, PriorityFee},
metrics::{track, AppEvent},
miner::Miner,
Expand Down Expand Up @@ -224,43 +221,6 @@ pub fn PowerLevelConfig(cx: Scope) -> Element {
}
}

#[component]
pub fn MinerDataOre<'a>(cx: Scope, title: &'a str, tooltip: &'a str, amount: String) -> Element {
let container_class = "flex flex-col gap-0 shrink h-min";
let header_container_class = "flex flex-row justify-start gap-1.5";
let header_class = "font-medium text-xs z-0 text-nowrap opacity-80";
let value_class = "font-medium text-white h-8";
render! {
div {
class: "{container_class} w-full",
div {
class: "{header_container_class}",
p {
class: "{header_class}",
"{title}"
}
Tooltip {
text: "{tooltip}",
direction: TooltipDirection::Right
}
}
div {
class: "flex flex-row gap-8",
p {
class: "{value_class} flex flex-row flex-nowrap text-nowrap place-items-baseline",
OreIcon {
class: "w-4 h-4 my-auto",
}
span {
class: "ml-1.5 my-auto",
"{amount}"
}
}
}
}
}
}

#[component]
fn DownloadLink(cx: Scope) -> Element {
if cfg!(feature = "web") {
Expand Down
4 changes: 0 additions & 4 deletions src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ mod miner_toolbar;
mod navbar;
mod ore_economics;
mod page_not_found;
mod power_bar;
mod send;
mod settings;
mod spinner;
mod stop_button;
mod tooltip;
mod tutorial;
mod tx;
mod user;
Expand All @@ -50,12 +48,10 @@ pub use miner_toolbar::*;
pub use navbar::*;
pub use ore_economics::*;
pub use page_not_found::*;
pub use power_bar::*;
pub use send::*;
pub use settings::*;
pub use spinner::*;
pub use stop_button::*;
pub use tooltip::*;
pub use tutorial::*;
pub use tx::*;
pub use user::*;
Expand Down
137 changes: 0 additions & 137 deletions src/components/power_bar.rs

This file was deleted.

36 changes: 0 additions & 36 deletions src/components/tooltip.rs

This file was deleted.

4 changes: 0 additions & 4 deletions src/hooks/use_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ use std::time::Duration;
use dioxus::prelude::*;
use dioxus_std::utils::rw::{use_rw, UseRw};
use ore::utils::AccountDeserialize;
#[cfg(feature = "desktop")]
use solana_account_decoder::UiAccountData;
#[cfg(feature = "desktop")]
use solana_client::pubsub_client::PubsubClient;
#[cfg(feature = "web")]
use solana_client_wasm::solana_sdk::pubkey::Pubkey;
#[cfg(feature = "desktop")]
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/use_sol_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use dioxus_std::utils::rw::use_rw;
#[cfg(feature = "desktop")]
use solana_client::pubsub_client::PubsubClient;

use crate::gateway::AsyncResult;
#[cfg(feature = "desktop")]
use crate::gateway::RPC_WSS_URL;
use crate::{gateway::AsyncResult, metrics::track};

use super::{use_gateway, use_pubkey};

Expand Down
2 changes: 0 additions & 2 deletions src/hooks/use_transfers_websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use futures::StreamExt;
use gloo::net::websocket::{futures::WebSocket, Message, WebSocketError};
use ore_types::Transfer;
#[cfg(feature = "desktop")]
use solana_sdk::pubkey::Pubkey;
#[cfg(feature = "desktop")]
use url::Url;

#[cfg(feature = "web")]
Expand Down
5 changes: 2 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(feature = "bundle", windows_subsystem = "windows")]
#![allow(non_snake_case)]
use std::rc::Rc;

Expand Down Expand Up @@ -38,10 +39,8 @@ fn main() {
#[cfg(feature = "desktop")]
fn main() {
env_logger::init();
// dioxus_desktop::launch_cfg(
dioxus_desktop::launch::launch(
dioxus_desktop::launch_cfg(
App,
vec![],
dioxus_desktop::Config::new()
.with_custom_head(r#"<link rel="stylesheet" href="public/tailwind.css">"#.to_string()),
);
Expand Down
7 changes: 6 additions & 1 deletion src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ extern "C" {
fn trackEvent(name: &str, value: Option<u32>) -> Result<(), JsValue>;
}

#[cfg(feature = "web")]
pub fn track(event: AppEvent, value: Option<u32>) {
#[cfg(feature = "web")]
trackEvent(event.to_string().as_str(), value).ok();
}

#[cfg(feature = "desktop")]
pub fn track(_event: AppEvent, _value: Option<u32>) {
// Noop
}

0 comments on commit 5946382

Please sign in to comment.