Skip to content

Commit

Permalink
misc refined
Browse files Browse the repository at this point in the history
  • Loading branch information
mhfan committed Jan 7, 2025
1 parent 6528ecd commit 48039db
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ version = "0.1.6"
license = "MIT OR Apache-2.0"
authors = ["MeiHui FAN <mhfan@ustc.edu>"]
homepage = "https://mhfan.github.io/inperiod"
categories = ["science", "web-programming", "wasm"]
repository = "https://github.com/mhfan/inperiod"
categories = ["science", "web-programming", "wasm"]
description = "Modern fancy interactive online periodic table of chemistry elements"
keywords = ["periodic", "periodic-table", "elements", "chemistry-elements", "dioxus"]

Expand Down
5 changes: 2 additions & 3 deletions assets/aufbau.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
<body id="main"> <!--div id="main"></div-->
<div class="spin-container" id="spinner">
<style>
.spin-container { position: absolute;
display: flex; flex-direction: column;
justify-content: center; align-items: center;
min-height: 100vh; width: 100vw;
.spin-container { position: absolute; display: flex;
justify-content: center; align-items: center; min-height: 100vh; width: 100vw;
}

@keyframes spin { to { transform: rotate(360deg); } }
Expand Down
17 changes: 9 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ fn PeriodicTable() -> Element {
use_context_provider(|| Signal::new(Localization::new()));
let mut coloring = use_context::<Signal<Coloring>>();
let mut lang = use_context::<Signal<Localization>>();

//use_context_provider(|| Signal::new(Selection { r#type: SelType::None, val: 0, }));
//let mut group_sel = use_context::<Signal<Selection>>(); // move to ahead of rsx!

let bg_lan = COLORING_CLASSES[ElemClass::Lanthanoids as usize].0;
let bg_act = COLORING_CLASSES[ElemClass::Actinoids as usize].0;
let style_blk = "self-start text-center text-lg/6 rounded-sm";
Expand Down Expand Up @@ -130,18 +130,19 @@ fn PeriodicTable() -> Element {
}

ElemTile { ordinal: 1 } p { class: style_grp, "IIA - 2" }
div { class: "empty col-span-2" } // XXX: can be moved on cell left on needed
div { class: "empty col-span-2" } // XXX: can be moved one cell left on needed
ElemTile { ordinal: 43, annot: Some(true) } div { class: "empty col-span-2" }
div { class: "relative col-span-5", div { class: "absolute h-[150%] w-full flex",
if !diag_is_loaded(*diag.read()) { div {
class: "absolute self-center w-full flex justify-center", LoadSpinner {}
} } {match diag.read().0 { 0 => rsx! { AufbauPrincipal {} },
} } {match diag.read().0 { 0 => rsx! { AufbauPrinciple {} },
// https://www.nagwa.com/en/explainers/809139094679/
//0 => rsx! { img { src: "assets/Aufbau.svg" } },

// https://commons.wikimedia.org/wiki/File:Binding_energy_curve_-_common_isotopes.svg
1 => rsx! { img { src: "assets/Binding_energy_isotopes.svg", onload: load_diag } },

1 => rsx! { img { src: "assets/Binding_energy_isotopes.svg",
class: "h-[108%] relative -top-[4%]", onload: load_diag,
} },
// https://commons.wikimedia.org/wiki/File:Isotopic_Abundance_bubble_chart.png
2 => rsx! { img { src: "assets/Isotopic_Abundance_bubble.png",
class: "h-[130%] relative -top-[15%] -left-[10%]", onload: load_diag,
Expand Down Expand Up @@ -307,8 +308,8 @@ text-shadow: -1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black, 1px 1px 0 bl
a { href: "https://www.webelements.com/periodicity/contents/", "WebElements" } ", "
a { href: "https://en.wikipedia.org/wiki/Periodic_table", "Wikipedia" } ", " br{}
a { href: "https://www.vertex42.com/ExcelTemplates/periodic-table-of-elements.html",
"Vertex42" } ", and "
a { href: "https://github.com/lmmentel/mendeleev", "mendeleev" }
"Vertex42" } ", "
a { href: "https://github.com/lmmentel/mendeleev", "mendeleev" } ", etc."
}
}

Expand Down Expand Up @@ -768,7 +769,7 @@ fn PhysConsts() -> Element {
} }
}

fn AufbauPrincipal() -> Element {
fn AufbauPrinciple() -> Element {
let lang = use_context::<Signal<Localization>>();
rsx! { svg { width: "500", height: "300", xmlns: "http://www.w3.org/2000/svg",
"font-size": "small", "font-family": "sans", //title { {title} }
Expand Down
8 changes: 4 additions & 4 deletions src/syncd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{error::Error, fs::{self, File}, io::Write, path::Path};
use scraper::{Html, Selector};
use inperiod::ChemElem;

/// cargo r --bin syncd -F syncdep
/// cargo r --bin syncd -F syncdep --no-default-features
#[tokio::main] async fn main() -> Result<(), Box<dyn Error>> {
//let mut rt = tokio::runtime::Runtime::new()?; rt.block_on(async { ... })
//for elem in ChemElem::iter() { println!("{}", elem.name_ch()); } return Ok(());
Expand Down Expand Up @@ -182,9 +182,9 @@ async fn parse_nist_asd() -> Result<(), Box<dyn Error>> {
fil2.write_all(b" Og => (\"1\", \"S\" , \"0\"),\n")?;
}

file.write_all(b" _ => return None\n })\n }\n}\n\n")?;
fil2.write_all(b" _ => return None\n })\n }\n}\n\n")?;
fil2.flush()?; file.flush()?; Ok(())
let tail = b" _ => return None\n })\n }\n}\n\n";
fil2.write_all(tail)?; fil2.flush()?;
file.write_all(tail)?; file.flush()?; Ok(())
}

/// XXX: https://ciaaw.org/atomic-weights.htm
Expand Down

0 comments on commit 48039db

Please sign in to comment.