This commit is contained in:
Julian Chang 2026-10-02 04:42:04 -04:00
commit fb80e6eb60
No known key found for this signature in database
7 changed files with 27 additions and 74 deletions

View file

@ -42,7 +42,6 @@ impl Component for TilesRow {
}; };
let hero = hero_tile( let hero = hero_tile(
IconType::ClockRewind,
"Total playtime", "Total playtime",
format_duration(stats.total_secs), format_duration(stats.total_secs),
format!( format!(
@ -53,32 +52,15 @@ impl Component for TilesRow {
); );
let mut rest = vec![ let mut rest = vec![
stat_tile(IconType::Play, "Sessions", stats.session_count.to_string()), stat_tile("Sessions", stats.session_count.to_string()),
stat_tile("Avg / session", format_duration(avg_session)),
stat_tile( stat_tile(
IconType::Sliders04,
"Avg / session",
format_duration(avg_session),
),
stat_tile(
IconType::Maximize01,
"Longest session", "Longest session",
format_duration(stats.longest_session_secs), format_duration(stats.longest_session_secs),
), ),
stat_tile( stat_tile("Day streak", streak_value(stats.current_streak)),
IconType::Rocket02, stat_tile("Best streak", streak_value(stats.longest_streak)),
"Day streak", stat_tile("Days played", stats.active_days.to_string()),
streak_value(stats.current_streak),
),
stat_tile(
IconType::CheckCircle,
"Best streak",
streak_value(stats.longest_streak),
),
stat_tile(
IconType::Calendar,
"Days played",
stats.active_days.to_string(),
),
]; ];
let mut root = rect().vertical().width(Size::fill()).spacing(TILE_GAP); let mut root = rect().vertical().width(Size::fill()).spacing(TILE_GAP);
@ -135,18 +117,7 @@ fn streak_value(days: usize) -> String {
format!("{days}d") format!("{days}d")
} }
fn icon_chip(icon: IconType, size: f32, tint: Color) -> Element { fn hero_tile(caption: &str, value: String, note: String) -> Element {
rect()
.width(Size::px(size))
.height(Size::px(size))
.corner_radius(CornerRadius::new_all(size * 0.5))
.background(tint.with_a(38))
.center()
.child(Icon::new(icon).size(size * 0.52).color(tint))
.into_element()
}
fn hero_tile(icon: IconType, caption: &str, value: String, note: String) -> Element {
card() card()
.width(Size::fill()) .width(Size::fill())
.height(Size::fill()) .height(Size::fill())
@ -154,18 +125,11 @@ fn hero_tile(icon: IconType, caption: &str, value: String, note: String) -> Elem
.background(colors::brand().with_a(18)) .background(colors::brand().with_a(18))
.border(border_all_color(1., colors::brand().with_a(90))) .border(border_all_color(1., colors::brand().with_a(90)))
.child( .child(
rect() label()
.horizontal() .text(caption.to_string())
.cross_align(Alignment::Center) .font_size(12.)
.spacing(8.) .font_weight(FontWeight::MEDIUM)
.child(icon_chip(icon, 24., colors::brand())) .color(colors::fg_secondary()),
.child(
label()
.text(caption.to_string())
.font_size(12.)
.font_weight(FontWeight::MEDIUM)
.color(colors::fg_secondary()),
),
) )
.child( .child(
rect() rect()
@ -193,25 +157,18 @@ fn hero_tile(icon: IconType, caption: &str, value: String, note: String) -> Elem
.into_element() .into_element()
} }
fn stat_tile(icon: IconType, caption: &str, value: String) -> Element { fn stat_tile(caption: &str, value: String) -> Element {
card() card()
.width(Size::fill()) .width(Size::fill())
.height(Size::fill()) .height(Size::fill())
.main_align(Alignment::SpaceBetween) .main_align(Alignment::SpaceBetween)
.child( .child(
rect() label()
.horizontal() .text(caption.to_string())
.cross_align(Alignment::Center) .font_size(12.)
.spacing(8.) .max_lines(1)
.child(icon_chip(icon, 24., colors::fg_secondary())) .width(Size::fill())
.child( .color(colors::fg_secondary()),
label()
.text(caption.to_string())
.font_size(12.)
.max_lines(1)
.width(Size::fill())
.color(colors::fg_secondary()),
),
) )
.child( .child(
label() label()

View file

@ -184,7 +184,7 @@ pub fn wide_card(card: WideCard) -> Element {
.cross_align(Alignment::Center) .cross_align(Alignment::Center)
.spacing(14.) .spacing(14.)
.child(marker(selected, false)) .child(marker(selected, false))
.child(Icon::new(icon).size(20.).color(if selected { .child(Icon::new(icon).size(25.).color(if selected {
colors::fg_primary() colors::fg_primary()
} else { } else {
colors::fg_secondary() colors::fg_secondary()

View file

@ -157,7 +157,7 @@ impl Component for CreateInstanceModal {
shell(Shell { shell(Shell {
rail: wizard_rail(wizard, &picks), rail: wizard_rail(wizard, &picks),
eyebrow: picks.progress(), eyebrow: None,
title: title.to_string(), title: title.to_string(),
subtitle, subtitle,
body: steps::body(wizard, &picks), body: steps::body(wizard, &picks),

View file

@ -78,10 +78,6 @@ impl Picks {
(Some(loader), None) => loader.to_string(), (Some(loader), None) => loader.to_string(),
} }
} }
pub fn progress(&self) -> String {
format!("Step {} of {}", self.index + 1, self.steps.len())
}
} }
fn matches_filter(kind: GameVersionKind, filter: u8) -> bool { fn matches_filter(kind: GameVersionKind, filter: u8) -> bool {

View file

@ -116,7 +116,7 @@ impl Component for EditInstanceModal {
), ),
tags, tags,
}), }),
eyebrow: "Instance details".to_string(), eyebrow: Some("Instance details".to_string()),
title: "Edit the instance".to_string(), title: "Edit the instance".to_string(),
subtitle: "Only how it is presented changes here. The version, loader and installed content stay as they are." subtitle: "Only how it is presented changes here. The version, loader and installed content stay as they are."
.to_string(), .to_string(),

View file

@ -11,7 +11,7 @@ pub const PANE_PADDING: f32 = 24.;
pub struct Shell { pub struct Shell {
pub rail: Element, pub rail: Element,
pub eyebrow: String, pub eyebrow: Option<String>,
pub title: String, pub title: String,
pub subtitle: String, pub subtitle: String,
pub body: Element, pub body: Element,
@ -101,7 +101,7 @@ pub fn shell(parts: Shell) -> Element {
.into_element() .into_element()
} }
fn header(eyebrow: String, title: String, subtitle: String, on_close: EventHandler<()>) -> Element { fn header(eyebrow: Option<String>, title: String, subtitle: String, on_close: EventHandler<()>) -> Element {
rect() rect()
.horizontal() .horizontal()
.width(Size::fill()) .width(Size::fill())
@ -114,14 +114,14 @@ fn header(eyebrow: String, title: String, subtitle: String, on_close: EventHandl
.vertical() .vertical()
.width(Size::flex(1.0)) .width(Size::flex(1.0))
.spacing(5.) .spacing(5.)
.child( .maybe_child(eyebrow.map(|eyebrow| {
label() label()
.text(eyebrow) .text(eyebrow)
.font_size(11.) .font_size(11.)
.font_weight(FontWeight::MEDIUM) .font_weight(FontWeight::MEDIUM)
.letter_spacing(1.6) .letter_spacing(1.6)
.color(colors::fg_secondary()), .color(colors::fg_secondary())
) }))
.child( .child(
label() label()
.text(title) .text(title)

View file

@ -57,7 +57,7 @@ fn type_step(mut wizard: Wizard, picks: &Picks) -> Element {
let cards = [ let cards = [
( (
TypeChoice::OneClient, TypeChoice::OneClient,
IconType::Rocket02, IconType::IconLogo,
"OneClient", "OneClient",
Some("Recommended"), Some("Recommended"),
"The most bleeding edge performance, QoL mods and world hosting in one instance.", "The most bleeding edge performance, QoL mods and world hosting in one instance.",