Skip to content

Commit

Permalink
content asset path
Browse files Browse the repository at this point in the history
  • Loading branch information
HardhatChad committed Mar 23, 2024
1 parent 9049b15 commit 1608fc6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 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.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ore-app"
version = "0.0.4"
version = "0.0.5"
description = "Ore is a digital currency you can mine from anywhere, at home or on your phone."
edition = "2021"
license = "Apache-2.0"
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.1"
version = "0.0.5"
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.4/Ore-MacOS.zip";
"https://github.com/HardhatChad/ore-app/releases/download/0.0.5/Ore-MacOS.zip";

#[component]
pub fn Download(cx: Scope) -> Element {
Expand Down
4 changes: 3 additions & 1 deletion src/components/landing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::{
components::{ActivityFilter, ActivityIndicator, Footer, OreIcon, OreLogoIcon},
gateway::AsyncResult,
hooks::{use_is_onboarded, use_ore_supply, use_transfers, use_treasury},
utils::asset_path,
Route,
};

Expand Down Expand Up @@ -69,10 +70,11 @@ fn Navbar(cx: Scope) -> Element {

#[component]
fn Hero(cx: Scope) -> Element {
let bg_img = asset_path("smoke.jpg");
render! {
div {
class: "flex flex-col w-full h-screen z-20 bg-cover bg-center",
style: "background-image: url(/smoke.jpg)",
style: "background-image: url({bg_img})",
Navbar {}
div {
class: "flex flex-col gap-y-8 sm:gap-y-10 md:gap-y-12 mx-auto my-auto pb-24 px-4 sm:px-8",
Expand Down
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod hooks;
mod metrics;
mod miner;
mod route;
mod utils;
#[cfg(feature = "web")]
mod worker;

Expand All @@ -38,11 +39,13 @@ fn main() {

#[cfg(feature = "desktop")]
fn main() {
use utils::asset_path;
env_logger::init();
let tailwind_path = asset_path("tailwind.css");
let custom_head = format!(r#"<link rel="stylesheet" href="{}">"#, tailwind_path);
dioxus_desktop::launch_cfg(
App,
dioxus_desktop::Config::new()
.with_custom_head(r#"<link rel="stylesheet" href="tailwind.css">"#.to_string()),
dioxus_desktop::Config::new().with_custom_head(custom_head),
);
}

Expand Down
9 changes: 9 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[cfg(feature = "desktop")]
pub fn asset_path(relative_path: &str) -> String {
format!("public/{}", relative_path)
}

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

0 comments on commit 1608fc6

Please sign in to comment.