Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
miralandlabs committed Jun 20, 2024
1 parent 857e5b3 commit 1801016
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 67 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/vercel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ jobs:
with:
use-cross: true
command: install
args: dioxus-cli
# args: dioxus-cli --version 0.5.2
args: dioxus-cli # args: dioxus-cli --version 0.5.2

- name: Build web pages
run: dx build --release && cp ./dist/index.html ./dist/404.html
Expand Down
8 changes: 4 additions & 4 deletions src/components/balance.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
// use solana_extra_wasm::program::spl_token::amount_to_ui_amount;
use solana_extra_wasm::program::spl_token::amount_to_ui_amount;

use crate::{
components::MarsIcon,
Expand Down Expand Up @@ -50,8 +50,8 @@ pub fn UnclaimedRewards() -> Element {
if let Some(proof) = *proof.read() {
if let Ok(proof) = proof {
if proof.claimable_rewards.gt(&0) {
let rewards =
(proof.claimable_rewards as f64) / (10f64.powf(mars::TOKEN_DECIMALS as f64));
// let rewards =
// (proof.claimable_rewards as f64) / (10f64.powf(mars::TOKEN_DECIMALS as f64));
return rsx! {
div {
class: "flex flex-row grow justify-between mt-4 -mr-2",
Expand All @@ -68,7 +68,7 @@ pub fn UnclaimedRewards() -> Element {
}
p {
class: "font-semibold",
"{rewards}"
"{amount_to_ui_amount(proof.claimable_rewards, mars::TOKEN_DECIMALS)}"
}
}
}
Expand Down
33 changes: 16 additions & 17 deletions src/components/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,29 @@ pub fn Download(cx: Scope) -> Element {
class: "text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold font-hero",
"Download"
}
p {
class: "text-lg sm:text-xl md:text-2xl lg:text-3xl font-bold mt-8 font-hero",
"Desktop"
}
p {
"Use the Mars desktop app to avoid the limitations of browser-based mining and get the most out of your machine. "
}
// MI
// p {
// class: "text-lg sm:text-xl md:text-2xl lg:text-3xl font-bold mt-8 font-hero",
// "Desktop"
// }
// p {
// "Use the Mars desktop app to avoid the limitations of browser-based mining and get the most out of your machine. "
// }
// li {
// a {
// class: "font-semibold hover:underline hover:text-orange-500",
// href: "{DESKTOP_DOWNLOAD_MAC}",
// "Download for Mac"
// }
// }
li {
"MacOS (coming soon...)"
}
li {
"Linux (coming soon...)"
}
li {
"Windows (coming soon...)"
}
// li {
// "MacOS (coming soon...)"
// }
// li {
// "Linux (coming soon...)"
// }
// li {
// "Windows (coming soon...)"
// }
p {
class: "text-lg sm:text-xl md:text-2xl lg:text-3xl font-bold mt-8 font-hero",
"CLI"
Expand Down
14 changes: 1 addition & 13 deletions src/components/landing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ fn Block(title: String, title2: String, detail: String, section: Section) -> Ele
match section {
// MI
// Section::A => rsx! { SectionA {} },
Section::A => None,
Section::B => rsx! { SectionB {} },
_ => None
}
Expand Down Expand Up @@ -383,16 +384,3 @@ fn MarsValue(title: String, amount: String) -> Element {

}
}

#[component]
fn QuestionBreak() -> Element {
rsx! {
div {
class: "bg-orange-500 text-white w-full py-16",
p {
class: "text-xl sm:text-2xl md:text-3xl lg:text-4xl font-bold font-hero text-center",
"How much will you mine?"
}
}
}
}
2 changes: 1 addition & 1 deletion src/components/miner_toolbar/insufficient_sol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn MinerToolbarInsufficientBalanceOpen() -> Element {
class: "flex flex-col gap-2",
p {
class: "text-3xl md:text-4xl lg:text-5xl font-bold",
"As miner, top up your wallet to pay transaction fees"
"Top up your wallet to pay mining transaction fees"
}
p {
class: "text-lg",
Expand Down
2 changes: 1 addition & 1 deletion src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod backup_keypair_warning;
mod balance;
// mod banner;
mod claim;
mod code_block;
// mod code_block;
mod copyable;
// mod download;
mod export_key;
Expand Down
43 changes: 18 additions & 25 deletions src/components/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ use std::str::FromStr;
use dioxus::prelude::*;
use mars::BUS_ADDRESSES;
use solana_client_wasm::solana_sdk::pubkey::Pubkey;
// use solana_extra_wasm::program::spl_token::amount_to_ui_amount;
use solana_extra_wasm::program::spl_token::amount_to_ui_amount;

use crate::{
components::{
ActivityTable, BackButton, BusBubble, Copyable, MarsIcon, SendButton, TreasuryBubble,
UserBubble,
},
gateway::GatewayResult,
hooks::{
use_explorer_account_url, use_mars_balance_user, use_pubkey, use_user_proof,
use_user_transfers,
Expand All @@ -36,13 +35,6 @@ pub fn User(id: String) -> Element {
let balance = use_mars_balance_user(user_id);
let explorer_url = use_explorer_account_url(id.clone());
let proof = use_user_proof(user_id);
let claimable_rewards = match *proof.read() {
Some(GatewayResult::Ok(proof)) => {
(proof.claimable_rewards as f64) / 10f64.powf(mars::TOKEN_DECIMALS as f64)
}
_ => 0.0,
};

let title = if let Some(index) = BUS_ADDRESSES
.iter()
.enumerate()
Expand Down Expand Up @@ -152,23 +144,24 @@ pub fn User(id: String) -> Element {
}
}
}
if claimable_rewards.gt(&0.0) {
div {
class: "{container_class}",
p {
class: "{title_class}",
"Unclaimed rewards"
}
span {
class: "flex flex-row gap-1.5",
MarsIcon {
class: "w-3.5 h-3.5 my-auto",
}
if let Some(Ok(proof)) = proof.cloned() {
if proof.claimable_rewards.gt(&0) {
div {
class: "{container_class}",
p {
class: "{value_class} truncate",
"{claimable_rewards}"
// "{amount_to_ui_amount(claimable_rewards, mars::TOKEN_DECIMALS)}"
}
class: "{title_class}",
"Unclaimed rewards"
}
span {
class: "flex flex-row gap-1.5",
MarsIcon {
class: "w-3.5 h-3.5 my-auto",
}
p {
class: "{value_class} truncate",
"{amount_to_ui_amount(proof.claimable_rewards, mars::TOKEN_DECIMALS)}"
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::io::{self, ErrorKind, Read, Write};
use std::path::PathBuf;

fn filepath() -> PathBuf {
if let Some(proj_dirs) = ProjectDirs::from("com", "mars", "app") {
if let Some(proj_dirs) = ProjectDirs::from("com", "mars", "coin") {
// This gives you a platform-specific config directory
// For example, on Windows, this might be C:\Users\Username\AppData\Roaming\YourCompany\YourApp\config
// On Linux, /home/username/.config/YourApp, and on macOS, /Users/username/Library/Application Support/com.YourCompany.YourApp
Expand Down
4 changes: 2 additions & 2 deletions src/miner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ lazy_static! {
// MI, only 1 web worker for current algorithm
fn fetch_logical_processors() -> usize {
// MI
// let _window = window().expect("should have a window");
let _window = window().expect("should have a window");
// let navigator = window.navigator();
// navigator.hardware_concurrency() as usize
1
1 as usize
}

/// Miner encapsulates the logic needed to efficiently mine for valid hashes according to the application runtime and hardware.
Expand Down
2 changes: 1 addition & 1 deletion src/miner/web_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn worker_options() -> WorkerOptions {
}

pub fn create_web_worker(cx: UseChannel<WebWorkerResponse>) -> Worker {
log::info!("Creating worker...");
log::info!("Creating webworker...");
let worker = Worker::new_with_options("worker.js", &worker_options()).unwrap();

// On message
Expand Down

0 comments on commit 1801016

Please sign in to comment.