Replace the home header with the banner and the ring (#84)
CI / core (pull_request) Successful in 1m32s
CI / core (pull_request) Successful in 1m32s
The banner shows the ring, a cached view with one tick per champion of the Challenge in a fixed order, the Season, the « N / total champions validés » title, the last Completed champion and the last Match, over the splash of the last Completed champion, faded into the band. In a narrow window the ring goes above the text and the splash covers the banner. Hovering a card lights its tick. The banner reads its splash through its own cache: two at most, the one replaced given back from the GPU atlas too, none while « Statistiques » is shown or without an illustration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WYQB8paBcLk67XoAUYARBK
This commit is contained in:
1 parent
e28aefc3bc
commit
d256dd61d2
9 files changed
+1397
-102
No files matched your search
+37
-1
@@ -1,6 +1,6 @@
|
||||
//! French display helpers shared by the page and the table.
|
||||
|
||||
use arena_tracker_core::{ChampionState, SyncProgress};
|
||||
use arena_tracker_core::{ChampionState, Date, SyncProgress};
|
||||
|
||||
/// Fixed decimals with a decimal comma: `1,96`.
|
||||
pub fn decimal(value: f64, digits: usize) -> String {
|
||||
@@ -38,6 +38,27 @@ pub fn ordinal(placement: u8) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// An Attempt's rank, feminine: « 1ʳᵉ », « 2ᵉ »…
|
||||
pub fn attempt_ordinal(attempt: usize) -> String {
|
||||
match attempt {
|
||||
1 => "1ʳᵉ".into(),
|
||||
n => format!("{n}ᵉ"),
|
||||
}
|
||||
}
|
||||
|
||||
/// A day as the banner writes it: « 20 nov. », « 3 mai ».
|
||||
pub fn short_date(date: Date) -> String {
|
||||
const MONTHS: [&str; 12] = [
|
||||
"janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.",
|
||||
"déc.",
|
||||
];
|
||||
let month = MONTHS
|
||||
.get(usize::from(date.month).wrapping_sub(1))
|
||||
.copied()
|
||||
.unwrap_or_default();
|
||||
format!("{} {month}", date.day)
|
||||
}
|
||||
|
||||
pub fn state_label(state: Option<ChampionState>) -> &'static str {
|
||||
match state {
|
||||
Some(ChampionState::Completed) => "Validé",
|
||||
@@ -105,6 +126,21 @@ mod tests {
|
||||
assert_eq!(ordinal(1), "1ᵉʳ");
|
||||
assert_eq!(ordinal(2), "2ᵉ");
|
||||
assert_eq!(ordinal(8), "8ᵉ");
|
||||
assert_eq!(attempt_ordinal(1), "1ʳᵉ");
|
||||
assert_eq!(attempt_ordinal(3), "3ᵉ");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn short_dates_have_the_french_month_abbreviations() {
|
||||
let date = |month, day| Date {
|
||||
year: 2026,
|
||||
month,
|
||||
day,
|
||||
};
|
||||
assert_eq!(short_date(date(11, 20)), "20 nov.");
|
||||
assert_eq!(short_date(date(2, 1)), "1 févr.");
|
||||
assert_eq!(short_date(date(5, 3)), "3 mai");
|
||||
assert_eq!(short_date(date(8, 31)), "31 août");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user