Skip to content

Commit

Permalink
app: show alt quality on items
Browse files Browse the repository at this point in the history
closes: #24
  • Loading branch information
Dav1dde committed Jan 27, 2024
1 parent 24f1ec2 commit 4e38c5a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/src/components/pob_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ pub fn PobItem<'a, G: Html>(cx: Scope<'a>, item: pob::Item<'a>) -> View<G> {
.map(|mods| view! { cx, Mods(mods) })
.collect_view();

let mut stats = Vec::new();
if let Some(alt_quality) = item.alt_quality {
stats.push(render_property(
cx,
format!("Quality ({alt_quality}):"),
format!("+{}%", item.quality),
))
}

let mut unmet = Vec::new();
if item.split {
unmet.push(view! { cx, li(style="color: #88f") { "Split" } });
Expand Down Expand Up @@ -66,6 +75,7 @@ pub fn PobItem<'a, G: Html>(cx: Scope<'a>, item: pob::Item<'a>) -> View<G> {
(influence2)
}
div(class="p-2 pt-1") {
Mods(stats)
Mods(enchants)
Mods(implicits)
(explicits)
Expand All @@ -85,6 +95,13 @@ pub fn Mods<G: Html>(cx: Scope, mods: Vec<View<G>>) -> View<G> {
view! { cx, ul { (content) } }
}

fn render_property<G: Html>(cx: Scope<'_>, key: String, value: String) -> View<G> {
view! { cx,
span(style="color: #7f7f7f", class="pr-1") { (key) }
span(style="color: #88f") { (value) }
}
}

fn rarity_str(rarity: pob::Rarity) -> &'static str {
match rarity {
pob::Rarity::Normal => "White",
Expand Down

0 comments on commit 4e38c5a

Please sign in to comment.