Skip to content

Commit

Permalink
upgrade to latest version of dioxus
Browse files Browse the repository at this point in the history
  • Loading branch information
waozixyz committed Dec 13, 2024
1 parent d2f6e9e commit c12bcaf
Show file tree
Hide file tree
Showing 11 changed files with 1,380 additions and 1,149 deletions.
2,478 changes: 1,349 additions & 1,129 deletions Cargo.lock

Large diffs are not rendered by default.

27 changes: 19 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,32 @@ image = { version = "0.25.2", features = ["png", "jpeg"] }
uuid = { version = "1.4", features = ["v4", "serde"] }
serde_yaml = "0.9"
serde_json = "1.0"
dioxus-logger = "0.5.1"
log = "0.4.6"
chrono = "0.4"
rfd = "0.15.0"
brotli = "6.0.0"
brotli = "7.0.0"
base64 = "0.22.1"
webp = "0.3"
rand = "0.8.5"
rusttype = "0.9.3"
imageproc = "0.25.0"
hex_color = "3.0.0"
qrcode = "0.14.1"
usvg = "0.43.0"
resvg = "0.43.0"
usvg = "0.44.0"
resvg = "0.44.0"
tiny-skia = "0.11.4"

tracing = "0.1.41"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
dioxus = { version = "0.5", features = ["desktop", "router"] }
dioxus = { version = "0.6.0", features = ["desktop", "router"] }
tokio = { version = "1.0", features = ["time"] }
dioxus-desktop = "0.5.6"
dioxus-desktop = "0.6.0"
arboard = "3.4.1"
image = { version = "0.25.2", features = ["webp"] }


[target.'cfg(target_arch = "wasm32")'.dependencies]
dioxus = { version = "0.5", features = ["web", "router"] }
dioxus = { version = "0.6.0", features = ["web", "router"] }
wasm-logger = "0.2.0"
console_error_panic_hook = "0.1.7"
futures-channel = "0.3"
Expand All @@ -51,3 +50,15 @@ js-sys = "0.3.70"

[target.'cfg(all(target_os = "linux", not(target_arch = "wasm32")))'.dependencies]
wl-clipboard-rs = "0.9.0"

[profile]

[profile.wasm-dev]
inherits = "dev"
opt-level = 1

[profile.server-dev]
inherits = "dev"

[profile.android-dev]
inherits = "dev"
4 changes: 1 addition & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#![allow(non_snake_case)]

use dioxus_logger::tracing::{info, Level};

use dioxus::prelude::*;
use tracing::info;

mod app;
mod models;
Expand All @@ -14,7 +13,6 @@ mod utils;
mod yaml_manager;

fn main() {
dioxus_logger::init(Level::INFO).expect("logger failed to init");

info!("starting app");
launch(app::App);
Expand Down
3 changes: 2 additions & 1 deletion src/state_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use crate::models::{MyLifeApp, Yaml};
#[cfg(target_arch = "wasm32")]
use crate::utils::compression::decode_and_decompress;
use crate::yaml_manager::{get_yaml, get_yaml_manager};
use dioxus_logger::tracing::error;
use dioxus::prelude::*;
use tracing::error;

pub fn initialize_state(y: &str) -> (Yaml, MyLifeApp) {
let yaml_state = if !y.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/edit_legend_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::utils::date_utils::is_valid_date;
use crate::yaml_manager::update_yaml;
use chrono::{Local, NaiveDate};
use dioxus::prelude::*;
use dioxus_logger::tracing::{debug, warn};
use tracing::{debug, warn};

fn is_valid_hex_color(color: &str) -> bool {
color.len() == 7 && color.starts_with('#') && color[1..].chars().all(|c| c.is_ascii_hexdigit())
Expand Down
2 changes: 1 addition & 1 deletion src/ui/lifetime_view.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::models::{CellData, LifePeriod, SizeInfo, Yaml};
use chrono::{Duration, Local, NaiveDate};
use dioxus::prelude::*;
use dioxus_logger::tracing::{debug, error};
use tracing::{debug, error};
use uuid::Uuid;

fn calculate_grid_dimensions(size_info: &SizeInfo, life_expectancy: u32) -> (usize, usize) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/top_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::yaml_manager::{export_yaml, get_available_yamls, get_yaml_manager, im
#[cfg(not(target_arch = "wasm32"))]
use arboard::Clipboard;
use dioxus::prelude::*;
use dioxus_logger::tracing::error;
use tracing::error;
use qrcode::render::svg;
use qrcode::QrCode;

Expand Down
2 changes: 1 addition & 1 deletion src/ui/window_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ pub fn WindowSizeManager() -> Element {

provide_context(size_info);

None
return rsx! {}
}
3 changes: 2 additions & 1 deletion src/utils/compression.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _};
use brotli::enc::BrotliEncoderParams;
use dioxus::prelude::*;
#[cfg(target_arch = "wasm32")]
use brotli::Decompressor;
#[cfg(target_arch = "wasm32")]
use dioxus_logger::tracing::error;
use tracing::error;
use serde_json;
use serde_yaml;
#[cfg(target_arch = "wasm32")]
Expand Down
4 changes: 2 additions & 2 deletions src/utils/image_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use crate::models::LegendItem;
#[cfg(not(target_arch = "wasm32"))]
use dioxus_logger::tracing::error;
use dioxus_logger::tracing::info;
use tracing::error;
use tracing::info;

use hex_color::HexColor;
#[cfg(target_arch = "wasm32")]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/screenshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::models::{LegendItem, Yaml};
use crate::utils::image_utils::*;
use base64::{engine::general_purpose, Engine as _};
use dioxus::prelude::*;
use dioxus_logger::tracing::{error, info};
use tracing::{error, info};
use uuid::Uuid;

#[cfg(target_arch = "wasm32")]
Expand Down

0 comments on commit c12bcaf

Please sign in to comment.