Skip to content

Commit

Permalink
dark mode on desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
HardhatChad committed Mar 27, 2024
1 parent 581934c commit 8781f9f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ore-app"
version = "0.0.8"
version = "0.0.9"
description = "Ore is a digital currency you can mine from anywhere, at home or on your phone."
edition = "2021"
license = "Apache-2.0"
Expand All @@ -11,7 +11,7 @@ readme = "./README.md"
keywords = ["solana", "crypto", "mining"]

[features]
default = ["web"]
default = []
bundle = []
desktop = [
"async-tungstenite",
Expand Down Expand Up @@ -108,7 +108,7 @@ solana-extra-wasm = { version = "1.17.4", git = "https://github.com/HardhatChad/
[package.metadata.bundle]
name = "Ore"
identifier = "com.ore.app"
version = "0.0.8"
version = "0.0.9"
resources = ["public"]
copyright = "Copyright (c) Hardhat Chad 2024. All rights reserved."
category = "Finance"
Expand Down
2 changes: 1 addition & 1 deletion src/components/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dioxus::prelude::*;
use crate::components::CodeBlock;

const DESKTOP_DOWNLOAD_MAC: &str =
"https://github.com/HardhatChad/ore-app/releases/download/0.0.8/Ore-MacOS.zip";
"https://github.com/HardhatChad/ore-app/releases/download/0.0.9/Ore-MacOS.zip";

#[component]
pub fn Download(cx: Scope) -> Element {
Expand Down
11 changes: 9 additions & 2 deletions src/components/navbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@ use dioxus_router::prelude::*;
use crate::{
components::{Banner, BannerType, Footer, OreLogoIcon, OreWordmarkIcon, PieIcon, UserBubble},
gateway::AsyncResult,
hooks::use_ping,
hooks::{use_appearance, use_ping},
route::Route,
};

use super::Appearance;

#[component]
pub fn Navbar(cx: Scope) -> Element {
let ping = use_ping(cx);
let appearance = use_appearance(cx);
let dark = match *appearance.read() {
Appearance::Dark => "dark",
Appearance::Light => "",
};
render! {
div {
class: "relative min-h-screen flex flex-col text-black dark:bg-black dark:text-white",
class: "relative min-h-screen flex flex-col text-black dark:bg-black dark:text-white {dark}",
if let AsyncResult::Error(_) = ping {
render! {
Banner {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/use_sol_balance.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dioxus::prelude::*;
use dioxus_std::utils::rw::use_rw;
#[cfg(feature = "deskstop")]
#[cfg(feature = "desktop")]
use std::time::Duration;
#[cfg(feature = "web")]
use web_time::Duration;
Expand Down
20 changes: 0 additions & 20 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,6 @@ fn App(cx: Scope) -> Element {
use_ore_balance_provider(cx);
use_sol_balance_provider(cx);

// Dark mode appearance
#[cfg(feature = "web")]
{
let appearance = use_appearance(cx);
use_effect(cx, appearance, |_| {
if let Some(window) = window() {
if let Some(document) = window.document() {
if let Some(body) = document.body() {
let classname = match *appearance.read() {
Appearance::Dark => "dark",
Appearance::Light => "",
};
body.set_class_name(classname);
}
}
}
async move {}
});
}

// Render
render! {
Router::<Route> {}
Expand Down

0 comments on commit 8781f9f

Please sign in to comment.