Skip to content

Commit

Permalink
markdown changes
Browse files Browse the repository at this point in the history
  • Loading branch information
1vipulgupta committed Nov 3, 2023
1 parent 7032f41 commit d865dcf
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
46 changes: 46 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ dioxus-signals = { git = "https://github.com/DioxusLabs/dioxus.git", rev = "6478
# https://github.com/DioxusLabs/dioxus-std/pull/17
dioxus-std = { git = "https://github.com/ealmloff/dioxus-std.git", branch="storage", features = ["storage"] }
fermi = { git = "https://github.com/DioxusLabs/dioxus.git", rev = "c7963a03440d5a050bf229f91665d60a0d108a8a" }
dioxus_markdown = { git = "https://github.com/1vipulgupta/markdown.git", rev = "2942507f77216286904bc3a23a68bf10345367f0" }
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
packages = with pkgs; [
just
nixci
pkg-config
# For when we start using Tauri
cargo-tauri
trunk
Expand Down
22 changes: 21 additions & 1 deletion src/app/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,49 @@
use dioxus::prelude::*;
use nix_health::traits::{Check, CheckResult};

use dioxus_markdown::Markdown;
use crate::{app::state::AppState, app::widget::Loader};

pub fn renderMarkDown<'a>(cx: Scope<'a>, string: &'a str) -> Element<'a> {
cx.render(rsx! {
link {
rel: "stylesheet",
href: "https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css",
}
div {
Markdown {
class: "content",
content: string,
}
}
})
}

/// Nix health checks
pub fn Health(cx: Scope) -> Element {
let state = AppState::use_state(cx);
let health_checks = state.health_checks.read();
let title = "Nix Health";
render! {
renderMarkDown(cx, "# Markdown Working")
h1 { class: "text-5xl font-bold", title }
if health_checks.is_loading_or_refreshing() {
render! { Loader {} }
}
health_checks.render_with(cx, |checks| render! {
div { class: "flex flex-col items-stretch justify-start space-y-8 text-left",
for check in checks {
println!("{:?}", check)
ViewCheck { check: check.clone() }
renderMarkDown(cx, "# hello \n - ok")
}
}
})
}
}



#[component]
fn ViewCheck(cx: Scope, check: Check) -> Element {
render! {
Expand Down

0 comments on commit d865dcf

Please sign in to comment.