Show the champion's sheet on hover and keyboard focus (#73)
The sheet covers the card with the Season's Matches, Wins, best Placement and Attempts, and the date of the first top 1 for a Completed champion. Its lines are prepared in Card::from_row; only the shown cards build it. The grid keeps the hovered card and one focus handle per card id, and handles Tab and Shift-Tab itself, scrolling the next card's row into view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bd9f1c7c98
commit
796fae11b7
5 files changed
+520
-8
No files matched your search
@@ -16,6 +16,14 @@ pub fn stored(count: usize) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// A Placement as the sheet writes it: « 1ᵉʳ », « 2ᵉ », « 3ᵉ »…
|
||||
pub fn ordinal(placement: u8) -> String {
|
||||
match placement {
|
||||
1 => "1ᵉʳ".into(),
|
||||
n => format!("{n}ᵉ"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn state_label(state: Option<ChampionState>) -> &'static str {
|
||||
match state {
|
||||
Some(ChampionState::Completed) => "Validé",
|
||||
@@ -69,6 +77,13 @@ mod tests {
|
||||
assert_eq!(decimal(2.0 / 3.0, 1), "0,7");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn placements_are_written_as_french_ordinals() {
|
||||
assert_eq!(ordinal(1), "1ᵉʳ");
|
||||
assert_eq!(ordinal(2), "2ᵉ");
|
||||
assert_eq!(ordinal(8), "8ᵉ");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stored_matches_are_pluralised() {
|
||||
assert_eq!(stored(0), "Aucune Partie enregistrée");
|
||||
|
||||
Reference in new issue
Block a user