app: put automatic recording at the center of the window
The titlebar offered "Start recording" although the recorder starts with a game; Settings takes that button's place. The two-tab sidebar becomes a status bar that also names the encoder, and the blue square beside the name is gone. Match cards show a champion tile: initials on a colour derived from the name until there is an image cache. History, review and settings lists get a scrollbar that follows the viewport in the same frame. Settings keeps the one switch a player can act on, launch at startup, and says in plain words that recording starts with a game. The recorder's own toggles and the client poll interval move to Advanced.
This commit is contained in:
1 parent
01a92f1edf
commit
e7a36c3129
6 files changed
+328
-265
No files matched your search
+77
-32
@@ -112,15 +112,17 @@ pub fn view(app: &App, p: Paint) -> El {
|
||||
.child(filters),
|
||||
)
|
||||
.child(
|
||||
col()
|
||||
.key("list-scroller")
|
||||
.w_full()
|
||||
.grow(1.0)
|
||||
.min_h(0.0)
|
||||
.scroll(rune::ScrollSpec {
|
||||
stick_bottom: false,
|
||||
})
|
||||
.child(list),
|
||||
app.scroll.follow(
|
||||
col()
|
||||
.key("list-scroller")
|
||||
.w_full()
|
||||
.grow(1.0)
|
||||
.min_h(0.0)
|
||||
.scroll(rune::ScrollSpec {
|
||||
stick_bottom: false,
|
||||
})
|
||||
.child(list),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -236,30 +238,37 @@ fn game_card(p: Paint, game: &Timeline, index: usize) -> El {
|
||||
.center_y()
|
||||
.justify_between()
|
||||
.child(
|
||||
col()
|
||||
row()
|
||||
.key("identity")
|
||||
.gap(2.0)
|
||||
.gap(space::S3)
|
||||
.center_y()
|
||||
.child(portrait(p, game.champion().as_deref()))
|
||||
.child(
|
||||
text(champion)
|
||||
.key("champion")
|
||||
.font(heading(16.0))
|
||||
.color(p.t.text),
|
||||
)
|
||||
.child(
|
||||
text(format!(
|
||||
"{} · {}",
|
||||
game.queue_label(),
|
||||
format::duration(duration)
|
||||
))
|
||||
.key("queue")
|
||||
.font(body(11.5))
|
||||
.color(p.muted()),
|
||||
)
|
||||
.child(
|
||||
text(format::relative_time(game.start_time))
|
||||
.key("when")
|
||||
.font(body(11.0))
|
||||
.color(p.muted()),
|
||||
col()
|
||||
.key("identity-labels")
|
||||
.gap(2.0)
|
||||
.child(
|
||||
text(champion)
|
||||
.key("champion")
|
||||
.font(heading(16.0))
|
||||
.color(p.t.text),
|
||||
)
|
||||
.child(
|
||||
text(format!(
|
||||
"{} · {}",
|
||||
game.queue_label(),
|
||||
format::duration(duration)
|
||||
))
|
||||
.key("queue")
|
||||
.font(body(11.5))
|
||||
.color(p.muted()),
|
||||
)
|
||||
.child(
|
||||
text(format::relative_time(game.start_time))
|
||||
.key("when")
|
||||
.font(body(11.0))
|
||||
.color(p.muted()),
|
||||
),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
@@ -290,7 +299,6 @@ fn game_card(p: Paint, game: &Timeline, index: usize) -> El {
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn stat(p: Paint, value: &str, label: &str) -> El {
|
||||
col()
|
||||
.key(format!("stat-{label}"))
|
||||
@@ -304,3 +312,40 @@ fn stat(p: Paint, value: &str, label: &str) -> El {
|
||||
)
|
||||
.child(text(label).key("label").font(body(10.5)).color(p.muted()))
|
||||
}
|
||||
|
||||
/// A square champion tile. There is no Data Dragon image cache yet, so the tile carries the
|
||||
/// champion's initials on a colour derived from the name: the same champion always gets the
|
||||
/// same tile.
|
||||
fn portrait(p: Paint, champion: Option<&str>) -> El {
|
||||
let name = champion.unwrap_or_default();
|
||||
let hue = name
|
||||
.bytes()
|
||||
.fold(2166136261u32, |hash, byte| {
|
||||
hash.wrapping_mul(16777619) ^ byte as u32
|
||||
})
|
||||
.rem_euclid(360) as f32;
|
||||
let fill = rune::oklch(0.36, 0.075, hue);
|
||||
let ink = rune::oklch(0.94, 0.02, hue);
|
||||
el().key("portrait")
|
||||
.size(52.0, 52.0)
|
||||
.radius(radius::MD)
|
||||
.fill(fill)
|
||||
.border(p.hair, ink.alpha(0.18))
|
||||
.a11y_hidden()
|
||||
.child(text(initials(name)).font(heading(17.0)).color(ink).center())
|
||||
}
|
||||
|
||||
/// Up to two letters from the champion's name: `Kai'Sa` is KS, `Jinx` is J.
|
||||
fn initials(name: &str) -> String {
|
||||
let letters: Vec<char> = name
|
||||
.split(|c: char| !c.is_alphanumeric())
|
||||
.filter(|word| !word.is_empty())
|
||||
.filter_map(|word| word.chars().next())
|
||||
.take(2)
|
||||
.collect();
|
||||
if letters.is_empty() {
|
||||
"?".into()
|
||||
} else {
|
||||
letters.into_iter().collect()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user