Skip to content

Commit

Permalink
ui: Show count of output attr
Browse files Browse the repository at this point in the history
Useful in large flakes nixpkgs. The latter has >18k legacy packages, for instance.
  • Loading branch information
srid committed Dec 1, 2023
1 parent 0a430ed commit 83746cc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/flake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ pub fn FlakeView(cx: Scope, flake: Flake) -> Element {
}

#[component]
pub fn SectionHeading(cx: Scope, title: &'static str) -> Element {
pub fn SectionHeading(cx: Scope, title: &'static str, extra: Option<String>) -> Element {
render! {
h3 { class: "p-2 mt-4 mb-2 font-bold bg-gray-300 border-b-2 border-l-2 border-black text-l",
"{title}"
match extra {
Some(v) => render! { span { class: "text-xs text-gray-500 ml-1", "(", "{v}", ")" } },
None => render! { "" }
}
}
}
}
Expand Down Expand Up @@ -129,7 +133,7 @@ pub fn BtreeMapView<'a>(
) -> Element {
render! {
div {
SectionHeading { title: title }
SectionHeading { title: title, extra: tree.len().to_string() }
BtreeMapBodyView { tree: tree }
}
}
Expand Down

0 comments on commit 83746cc

Please sign in to comment.