Author SHA1 Message Date
nessarandClaude Fable 5.2 e5478948c9 Fix the review findings of the living animations (#173)
CI / core (pull_request) Successful in 2m12s
CI / relay (pull_request) Successful in 55s
CI / core (push) Successful in 1m59s
CI / relay (push) Successful in 47s
- Nothing moves over the ring out of sight: with the window hidden,
  « Paramètres » in front or on « Statistiques », what was asked for shows
  its end state at once and asks for no frame.
- A pointer moving along the crown tells the page only when it sets the
  wave moving, not at each move while it asks for its own frames.
- The light of a switch of screens turns the way of the screen arriving,
  whichever side a veil already laid holds on to.
- A champion Completed flares its tick bright again; gold is a new Mark's.
- The ring's layers share their point on the crown, their tails, their
  twinkles and their polylines, and work out each tick's height once.
- The veil says what it does with the banner's text (`Fade::banner_text`,
  `BannerCover`), the ring's scope and its lap have their own types.
- Tests for the fill and the dimming over the cached ring, the banner's
  text, a champ select scrolled, the veil of a Live Match's start and end
  and of the exit from « Sélection »; no name left from the prototypes.
- docs: the gesture tempo, the ring out of sight, the card's hop, the
  import's arc gliding.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 21:00:08 +01:00
nessarandClaude Fable 5.2 bbf118996c Give the cards and the champ select the same tempo, and drop the prototypes (#171)
CI / relay (pull_request) Successful in 48s
CI / core (pull_request) Successful in 59s
A card rises in 260 ms to 17 px, going a little past before it lands, and
settles back in 520 ms: a gesture answers at once and lingers as it goes.
The champ select's entry and exit last twice their base duration, as every
event's animation now does.

The two prototypes of docs/ are deleted: the app has outgrown them and
docs/interface.md is the only reference. The comments that cited them say
what they mean on their own.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3CngkUQ89GV1gnHkTY
2026-12-01 00:36:53 +01:00
nessarandClaude Fable 5.2 2ebb8e8112 Make the end of a Match and the import ones to notice (#172)
CI / relay (pull_request) Successful in 45s
CI / core (pull_request) Successful in 1m13s
The comet's trail thins and goes out behind it; at the landing of a first
top 1, sparks and a shock leave the tick, a wave runs through the ticks
Completed, ticks twinkle and the crown bounces higher, while the counter
rolls past its place before landing. It all lasts twice its base duration,
as an event's animation does.

The import's arc glides to each new value in the ring's live layer, the part
not reached yet painted over it, so the ring is still told at most once a
second; a light goes round when the arc goes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3CngkUQ89GV1gnHkTY
2026-12-01 00:27:27 +01:00
nessarandClaude Fable 5.2 8f512f8d20 Make the ring live over its cached view (#170)
CI / relay (pull_request) Successful in 41s
CI / core (pull_request) Successful in 1m2s
The lit tick pops and goes out in a trail, a wave follows the pointer along
the crown, a light goes round with the veil of a switch of screens, the ring
fills from noon for another Account or Season, its ticks go dim at a champ
select, and ticks twinkle while the light or the fill lasts.

All of it is a layer the page draws over the ring, from what moves and since
when: the ring is drawn again for none of it, and no frame is asked for at
rest, a pointer resting on the crown included. The end of a Match moves to
its own module of the ring.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3CngkUQ89GV1gnHkTY
2026-12-01 00:23:40 +01:00
nessar 05949f3ea3 Merge remote-tracking branch 'origin/develop' into feat/169-directional-veil
CI / relay (pull_request) Successful in 1m1s
CI / core (pull_request) Successful in 1m20s
2026-11-30 23:49:23 +01:00
nessarandClaude Fable 5.2 0ef37a1768 Decide once what the veil does with the banner, and fix the review findings (#169)
The banner stays out of the veil only if it is in its place on the screen
leaving and on the one arriving, decided when the transition starts: a
banner scrolled away on either no longer comes in or goes at once at the
exchange. A veil taking over from one already laid is one method of the
veil, where three callers repeated it. Structural tests cover the banner
kept in sight and its text fading beside the ring.

Still type-checked and linted only: the tests were not run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3CngkUQ89GV1gnHkTY
2026-11-30 23:49:21 +01:00
nessarandClaude Fable 5.2 d05419fe82 Orient the veil between screens and keep the banner in place (#169)
The veil of a switch between screens becomes a wipe with a soft edge that
crosses the screen the way of the top bar, « Statistiques » standing at
« Défi »'s place, in 200 + 480 ms. The four tabs share the banner, now as
wide on « Parties » as elsewhere: the veil starts under it, and its text
fades only when a phase's banner says something else. The tab chosen lights
up in a short fade.

The veil moves to its own module with the tempo of an event's animation and
the rebound curve the next slices reuse (#168).

Type-checked and linted from WSL against x86_64-pc-windows-gnu only: the
tests were not run, this PC has no MSVC linker since 2026-11-29.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3CngkUQ89GV1gnHkTY
2026-11-30 23:43:37 +01:00
nessarandClaude Opus 5.5 f5c4207903 Open « Parties » on a champion's Matches from its card (#166)
CI / relay (pull_request) Successful in 41s
CI / core (pull_request) Successful in 1m0s
CI / relay (push) Successful in 38s
CI / core (push) Successful in 59s
A click, or Enter on the focused card, of the Challenge or of either grid
of a champ select shows « Parties » filtered on that champion by its id:
the search field shows its name until the player edits it, Placement goes
back to « Tous », Season and Format stay those of « Statistiques ». The end
of a Match's recap clears it with the other filters. No card opens
anything while the hand leaves or before a dealt card is in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:11:28 +01:00
nessarandClaude Opus 5.5 ee1d344283 Drop the « Non mis à jour » note beside the Account selector
CI / relay (pull_request) Successful in 29s
CI / core (pull_request) Successful in 2m30s
CI / relay (push) Successful in 31s
CI / core (push) Successful in 2m25s
It did not say what was stale nor why, and opening an Account's last Match
refreshes it anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 22:14:36 +01:00
nessarandClaude Opus 5.5 a23e7ffbac Bring the window forward at the end of a game, as at a champ select
CI / relay (pull_request) Successful in 30s
CI / core (pull_request) Successful in 2m1s
CI / relay (push) Successful in 38s
CI / core (push) Successful in 56s
Every end of a game the page decides on (recap opened, Challenge with the
preference off, or a game left without its block) emits MatchEndShown,
formerly RecapOpened: « Paramètres » gives way and the window is raised
above the others without taking the focus, through tray::reveal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 21:17:36 +01:00
nessarandClaude Opus 5.5 1f0e92194a Center the player's row on the Match chosen when « Parties » opens
The Match the screen or a filter chooses now centers the displayed
Account's row, as a click in the list already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 21:17:36 +01:00
nessarandClaude Fable 5.2 88acc1b0df Prove a changed PUUID by champion and Placement, and fix the review findings (#150, #140)
CI / relay (pull_request) Successful in 41s
CI / core (pull_request) Successful in 58s
CI / relay (push) Successful in 42s
CI / core (push) Successful in 2m13s
A champion is unique only within a team of an Arena Match, so the proof
of a changed PUUID now requires the same champion and Placement in the
shared Match. A Friend's Riot ID resolution waits for the follower
again before each retry. The page resolves the signed-in Account once
per change instead of at each progress message, the arc's circle is
kept across counts, and the ring's paint no longer returns a value only
a test reads. Tests: a real import of twelve Matches drives the arc,
the structural test hovers a card and scrolls the grid, and Death
Recaps, blocks and Provisional Matches are read after a rekey.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 20:06:41 +01:00
nessarandClaude Fable 5.2 7b0b9863e0 Fix the verification findings of the rekey and the import arc (#150, #140)
The proof of a changed PUUID also requires the same champion in the
shared Match: anyone who played in it passed before, so a Friend whose
stale Riot ID was taken by a co-player could be merged into them. A
quota wait on a Friend's Riot ID resolution is told. The arc's paths
are built once per size and progress instead of at each paint of the
ring, and a signed-in Account the page has not read yet shows no arc.
Tests now cover the session state and the sync mark of a rekey.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 19:51:52 +01:00
nessarandClaude Fable 5.2 5343e49996 Show the import on the ring and the Riot quota wait (#140)
An import of 10 Matches or more of the Account shown draws a thin arc
around the ring's ticks, filled from noon as Matches arrive and gone
when the import ends. The ring stays a cached view, told at most once a
second. While the import waits for a 429's Retry-After, the progress
carries the wait and the status line counts it down each second
(« Quota Riot atteint : reprise dans 12 s »), on a timer that only
exists during the wait.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 19:32:12 +01:00
nessarandClaude Fable 5.2 6140bc34fb Follow an Account to its new PUUID on proof of identity (#150)
A PUUID depends on the Riot application of the API key, so the relay's
production key gives every stored Account another one. Before a request
that carries a stored PUUID (a sync, a Friend's import), the Riot ID is
resolved; when its PUUID differs and a stored published Match is among
the new PUUID's, the Account, its Matches (stored Riot responses
included), Mastery, sync mark, platform, last active mark and Friend
status move to it in one transaction. A new PUUID already stored is
merged, the published Match winning. Without proof nothing changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 19:21:52 +01:00
93 changed files with 5073 additions and 1716 deletions

No files matched your search

+15 -5
View File
@@ -149,25 +149,35 @@ impl MarkFill {
}
/// How high a card rises: less for a greyed one, which cannot be picked.
const RISE: f32 = 10.;
const GREYED_RISE: f32 = 4.;
const RISE: f32 = 17.;
const GREYED_RISE: f32 = 7.;
/// How far past its height a card goes on its way, as a part of that height (#171).
const REBOUND: f32 = 0.6;
/// How much the illustration zooms in, inside the card.
const ZOOM: f32 = 0.07;
/// How far the sheet slides up, and the caption down.
const SHEET_SLIDE: f32 = 14.;
const CAPTION_SLIDE: f32 = 6.;
const CAPTION_BOTTOM: f32 = 12.;
/// The hand's veil on the other cards, as the mockup's `rgba(9, 11, 24, .42)`.
/// The hand's veil on the other cards: `rgba(9, 11, 24, .42)`.
const VEIL: u32 = 0x090b18;
const VEIL_OPACITY: f32 = 0.42;
/// How high a card `progress` of its way up is, as a part of its height: it goes a little past
/// before it lands, and takes a little hop before it settles back. Only its height does: the
/// rest of its pose follows `progress`.
fn rebound(progress: f32) -> f32 {
// A parabola rather than a sine: it is exactly 0 at both ends, so the card lands exactly.
progress * (1. + REBOUND * 4. * progress * (1. - progress))
}
impl Pose {
/// How many pixels the card is above its place.
pub fn rise(&self, card: &Card) -> f32 {
if !self.moves {
return 0.;
}
self.progress * if card.greyed() { GREYED_RISE } else { RISE }
rebound(self.progress) * if card.greyed() { GREYED_RISE } else { RISE }
}
fn zoom(&self) -> f32 {
@@ -359,7 +369,7 @@ fn face(root: Div, card: &Card, pose: Option<Pose>, cx: &App) -> Div {
.object_fit(ObjectFit::Cover)
.grayscale(greyed)
}))
// Stands for the mockup's `brightness(.72)`, which the image element cannot do.
// Stands for a `brightness(.72)` filter, which the image element cannot do.
.when(greyed, |el| {
el.child(
div()
+1 -1
View File
@@ -8,7 +8,7 @@ use super::{
};
use crate::theme::{LOGO_GOLD, ON_GOLD};
/// Over the lower half of the card, as the mockup's `.sheet`: the name, then a line per figure,
/// The sheet, over the lower half of the card: the name, then a line per figure,
/// on a shade that darkens from its top. Only a lifted card builds it.
pub(super) fn sheet(card: &Card) -> Div {
let id = card.id;
+7 -1
View File
@@ -25,7 +25,7 @@ use geometry::{MAX_COLUMNS, Metrics, rows_in_view};
pub use geometry::{MAX_WIDTH, TAKEN_DROP};
mod layout;
pub use layout::{CardHovered, DrawnCard, DrawnCards, Paging, PutDown, RevealRow};
pub use layout::{CardChosen, CardHovered, DrawnCard, DrawnCards, Paging, PutDown, RevealRow};
pub struct CardGrid {
/// All the cards in the order the page gives (the chosen sort); replaced when the statistics
@@ -62,6 +62,7 @@ pub struct CardGrid {
pub(crate) set_cards_calls: usize,
}
impl EventEmitter<CardChosen> for CardGrid {}
impl EventEmitter<CardHovered> for CardGrid {}
impl EventEmitter<PutDown> for CardGrid {}
impl EventEmitter<RevealRow> for CardGrid {}
@@ -291,6 +292,11 @@ impl CardGrid {
.on_hover(cx.listener(move |grid, hovered: &bool, _, cx| {
grid.set_hovered(id, *hovered, cx)
}))
// GPUI clicks a focused element on Enter and Space too.
.on_click(cx.listener(move |_, _, _, cx| cx.emit(CardChosen { id })))
.cursor_pointer()
.role(Role::Button)
.aria_label(format!("Voir les Parties de {}", data.name))
.into_any_element(),
);
}
+4 -4
View File
@@ -4,7 +4,7 @@ use gpui_kit::component::scroll::Scrollbar;
use crate::card::ASPECT;
use crate::page::PAGE_PADDING;
/// The widest content column of the home, as in the mockup.
/// The widest content column of the home.
pub const MAX_WIDTH: f32 = 1264.;
/// How much lower than the others a card of the hand taken by an ally rests (#87).
@@ -13,8 +13,8 @@ pub const TAKEN_DROP: f32 = 8.;
/// The most cards a row holds.
pub(super) const MAX_COLUMNS: usize = 6;
/// How many cards fit a row of a window `width` wide, with the mockup's breakpoints: its
/// `max-width` rules apply up to and including 1000, 720 and 480 px.
/// How many cards fit a row of a window `width` wide: the breakpoints apply up to and
/// including 1000, 720 and 480 px.
pub(super) fn columns(width: Pixels) -> usize {
match width.as_f32() {
w if w > 1000. => MAX_COLUMNS,
@@ -24,7 +24,7 @@ pub(super) fn columns(width: Pixels) -> usize {
}
}
/// Smaller gaps in the narrow layouts, as in the mockup.
/// Smaller gaps in the narrow layouts.
fn gap(columns: usize) -> f32 {
if columns >= 4 { 14. } else { 10. }
}
+6
View File
@@ -12,6 +12,12 @@ pub struct CardHovered {
pub by_keyboard: bool,
}
/// A card was chosen, with a click or with Enter on it.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct CardChosen {
pub id: u32,
}
/// None of the grid's cards stays lifted, at once: a wheel turned over them, or they are no
/// longer shown.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+1 -1
View File
@@ -5,7 +5,7 @@ use super::geometry::{Metrics, columns, rows_in_view};
use crate::card::ASPECT;
#[test]
fn the_columns_follow_the_mockups_breakpoints() {
fn the_columns_follow_the_widths_breakpoints() {
for (width, expected) in [
(2560., 6),
(1280., 6),
+6 -4
View File
@@ -11,10 +11,12 @@ use gpui_kit::*;
use crate::card::{CARD_RADIUS, Card, MarkFill, Pose, lifted, veil_color};
use crate::card_grid::{DrawnCard, DrawnCards};
use crate::card_images::CardImages;
use crate::motion::{MATCH_SETTLE, ease_out};
use crate::motion::{MATCH_SETTLE, ease_out, release};
/// How long a card takes to rise all the way, or to settle back.
const RISE: Duration = Duration::from_millis(350);
/// How long a card takes to rise all the way: a gesture's answer, at once (#171).
const RISE: Duration = Duration::from_millis(260);
/// How long it takes to settle back: it lingers.
const SETTLE: Duration = release(260);
/// How long the hand's veil takes to lay on its cards, or to lift.
const VEIL: Duration = Duration::from_millis(300);
@@ -110,7 +112,7 @@ impl<G: Copy + PartialEq> Lifts<G> {
}
for entry in self.cards.iter_mut() {
if entry.grid == grid && Some(entry.id) != id && entry.lift.to != 0. {
entry.lift = entry.lift.toward(0., RISE, now);
entry.lift = entry.lift.toward(0., SETTLE, now);
}
}
if let Some(id) = id {
+17 -14
View File
@@ -23,26 +23,27 @@ fn progress(lifts: &Lifts<u32>, id: u32, now: Instant) -> Option<f32> {
}
#[test]
fn a_hovered_card_rises_in_350_ms_and_settles_back_in_as_long_once_left() {
fn a_hovered_card_rises_in_260_ms_and_settles_back_in_twice_as_long_once_left() {
let start = Instant::now();
let mut lifts = Lifts::new();
lifts.hover(GRID, on(7), false, start);
assert_eq!(progress(&lifts, 7, start), Some(0.));
let half = progress(&lifts, 7, at(start, 175)).unwrap();
// Fast at first, then settling, as the reference's cubic-bezier(.2, .8, .2, 1).
let half = progress(&lifts, 7, at(start, 130)).unwrap();
// Fast at first, then settling: close to cubic-bezier(.2, .8, .2, 1) (`ease_out`).
assert!(half > 0.5 && half < 1., "{half}");
assert_eq!(progress(&lifts, 7, at(start, 350)), Some(1.));
assert!(lifts.animating(at(start, 349)));
assert!(!lifts.animating(at(start, 350)));
assert_eq!(progress(&lifts, 7, at(start, 260)), Some(1.));
assert!(lifts.animating(at(start, 259)));
assert!(!lifts.animating(at(start, 260)));
lifts.hover(GRID, None, false, at(start, 400));
assert_eq!(progress(&lifts, 7, at(start, 400)), Some(1.));
assert!(progress(&lifts, 7, at(start, 600)).unwrap() > 0.);
assert_eq!(progress(&lifts, 7, at(start, 750)), Some(0.));
// It lingers: still on its way down after the time it took to rise.
assert!(progress(&lifts, 7, at(start, 800)).unwrap() > 0.);
assert_eq!(progress(&lifts, 7, at(start, 920)), Some(0.));
// Back at rest, the card is the grid's own again.
lifts.tidy(at(start, 750));
assert_eq!(progress(&lifts, 7, at(start, 750)), None);
assert!(!lifts.animating(at(start, 750)));
lifts.tidy(at(start, 920));
assert_eq!(progress(&lifts, 7, at(start, 920)), None);
assert!(!lifts.animating(at(start, 920)));
}
#[test]
@@ -55,7 +56,7 @@ fn a_card_left_or_taken_back_during_its_animation_starts_from_where_it_is() {
// Left on its way up: it settles from there, with no jump, and sooner than from the top.
lifts.hover(GRID, None, false, at(start, 100));
assert_eq!(progress(&lifts, 7, at(start, 100)), Some(midway));
let back = at(start, 100 + (350. * midway).ceil() as u64);
let back = at(start, 100 + (520. * midway).ceil() as u64);
assert_eq!(progress(&lifts, 7, back), Some(0.));
// Taken back on its way down: it rises again from there, still one card.
@@ -65,7 +66,7 @@ fn a_card_left_or_taken_back_during_its_animation_starts_from_where_it_is() {
let low = progress(&lifts, 7, at(start, 200)).unwrap();
assert!(low > 0. && low < midway, "{low}");
assert_eq!(lifts.lifted(GRID, at(start, 200)).count(), 1);
assert_eq!(progress(&lifts, 7, at(start, 550)), Some(1.));
assert_eq!(progress(&lifts, 7, at(start, 460)), Some(1.));
}
#[test]
@@ -95,7 +96,9 @@ fn in_the_hand_a_veil_lays_on_the_other_cards_while_one_is_lifted() {
assert_eq!(lifts.veil(GRID, start), 0.);
assert!(lifts.veil(GRID, at(start, 150)) > 0.);
assert_eq!(lifts.veil(GRID, at(start, 300)), 1.);
assert!(lifts.animating(at(start, 340)));
// The card is up before the veil is laid, which still moves.
assert!(lifts.animating(at(start, 299)));
assert!(!lifts.animating(at(start, 300)));
// From card to card, it stays.
lifts.hover(GRID, on(8), true, at(start, 400));
+8 -4
View File
@@ -38,7 +38,7 @@ use gpui_kit::base::async_util::unbounded;
use gpui_kit::component::*;
use gpui_kit::*;
use page::{ChampionSortChosen, Launch, LiveMatchStarted, Page, RecapOpened};
use page::{ChampionSortChosen, Launch, LiveMatchStarted, MatchEndShown, Page};
use settings::{SettingsEvent, SettingsForm, SettingsStore, apply_theme};
use title_bar::{MIN_WINDOW_SIZE, refresh_button, settings_button, title_bar, update_button};
use worker::{CatalogRefresh, spawn_follower};
@@ -133,9 +133,13 @@ impl RootView {
}
},
);
// The end of a Match showed its recap: « Paramètres » gives way as for a champ select,
// but the window stays as it is, hidden, minimised or behind League: never in front.
let recap = cx.subscribe_in(&page, window, |this, _, _: &RecapOpened, window, cx| {
// The end of a game showed its recap or the Challenge: as for a champ select, « Paramètres »
// gives way and the window comes above the others, League keeping the keyboard.
let recap = cx.subscribe_in(&page, window, |this, _, _: &MatchEndShown, window, cx| {
if let Some(hwnd) = tray::window_hwnd(window) {
cx.spawn(async move |_, _| tray::reveal(hwnd, true))
.detach();
}
if this.screen == Screen::Settings {
this.show_page(window, cx);
}
+42 -112
View File
@@ -1,6 +1,7 @@
//! What decides whether the app animates, and when (#86): the Windows setting followed into
//! `App::reduce_motion`, the animations waiting for « Défi » to be visible, and the veil of the
//! switch between tabs. The page says when « Défi » is visible.
//! `App::reduce_motion`, the animations waiting for « Défi » to be visible, the tempo and the
//! curves they share, and the veil of the switch between screens (`veil`). The page says when
//! « Défi » is visible.
use std::time::{Duration, Instant};
@@ -15,22 +16,39 @@ use windows::Win32::UI::WindowsAndMessaging::{
use crate::tray::window_hwnd;
/// How long the screen leaving takes to go under the veil.
const FADE_OUT: Duration = Duration::from_millis(130);
/// How long the screen arriving takes to come out of it.
const FADE_IN: Duration = Duration::from_millis(280);
mod veil;
pub(crate) use arena_tracker_core::MatchEnd;
pub(crate) use veil::{BannerCover, Fade, FadePhase, LAP, Side, wipe};
/// The comet's flight to the nearest tick, just after noon.
const COMET_SHORTEST: f32 = 0.65;
/// How many times its base duration an event's animation lasts (#168): the app is seldom looked
/// at, so what it shows of itself takes its time to catch the eye.
const EVENT_TEMPO: u64 = 2;
/// How long an event's animation of `ms` milliseconds at the base tempo lasts.
pub(crate) const fn event(ms: u64) -> Duration {
Duration::from_millis(ms * EVENT_TEMPO)
}
/// How many times its base duration a gesture's answer takes to settle back: it rises at once,
/// at the base tempo, and lingers as it goes.
const RELEASE_TEMPO: u64 = 2;
/// How long what answered a gesture takes to settle back, for `ms` milliseconds at the base
/// tempo.
pub(crate) const fn release(ms: u64) -> Duration {
Duration::from_millis(ms * RELEASE_TEMPO)
}
/// The comet's flight to the nearest tick, just after noon, in seconds: as the durations below,
/// an event's, at twice its base (`event`).
const COMET_SHORTEST: f32 = 0.65 * EVENT_TEMPO as f32;
/// What the flight takes longer per turn of the ring, up to the last tick.
const COMET_PER_TURN: f32 = 0.55;
const COMET_PER_TURN: f32 = 0.55 * EVENT_TEMPO as f32;
/// How long the tick, the card and the splash take to settle once the comet lands, or from the
/// start without a comet, in seconds.
pub(crate) const MATCH_SETTLE: f32 = 1.2;
pub(crate) const MATCH_SETTLE: f32 = 1.2 * EVENT_TEMPO as f32;
/// How long the counter's roll and the fade in of the « Dernière Partie » line take, in seconds.
pub(crate) const COUNTER_ROLL: f32 = 0.7;
pub(crate) const COUNTER_ROLL: f32 = 0.7 * EVENT_TEMPO as f32;
/// The end of a followed Match being played: what it brought, on which tick, from when. Fixed
/// when it starts; the ring, the banner and the card read their frame from it.
@@ -114,83 +132,22 @@ impl<A: Ord> Deferred<A> {
}
}
/// The screen leaving « Défi » or « Statistiques » goes under a veil of the page's background,
/// then the one arriving comes out of it. A veil rather than the content's own opacity or
/// position: either is part of a cached view's key, so fading or sliding the content would draw
/// the grid, the ring and the charts again at each frame and build the cards again (rule #1).
pub(crate) struct Fade {
phase: FadePhase,
/// The veil's opacity when the phase started: a switch during a transition starts again from
/// where the veil is.
from: f32,
start: Instant,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub(crate) enum FadePhase {
/// The screen leaving goes under the veil.
Out,
/// The screen arriving comes out of it.
In,
}
impl Fade {
pub fn covering(from: f32, start: Instant) -> Self {
Fade {
phase: FadePhase::Out,
from,
start,
}
}
pub fn uncovering(from: f32, start: Instant) -> Self {
Fade {
phase: FadePhase::In,
from,
start,
}
}
pub fn phase(&self) -> FadePhase {
self.phase
}
/// The veil's opacity, 0 to 1.
pub fn veil(&self, now: Instant) -> f32 {
let progress = self.progress(now);
match self.phase {
FadePhase::Out => self.from + (1. - self.from) * ease_in(progress),
FadePhase::In => self.from * (1. - ease_out(progress)),
}
}
pub fn finished(&self, now: Instant) -> bool {
self.progress(now) >= 1.
}
fn duration(&self) -> Duration {
match self.phase {
FadePhase::Out => FADE_OUT,
FadePhase::In => FADE_IN,
}
}
fn progress(&self, now: Instant) -> f32 {
let elapsed = now.saturating_duration_since(self.start);
(elapsed.as_secs_f32() / self.duration().as_secs_f32()).min(1.)
}
}
/// Close to CSS's `ease-in`.
pub(crate) fn ease_in(t: f32) -> f32 {
t * t
}
/// Close to the reference's `cubic-bezier(.2, .8, .2, 1)`.
/// Close to `cubic-bezier(.2, .8, .2, 1)`.
pub(crate) fn ease_out(t: f32) -> f32 {
1. - (1. - t).powi(3)
}
/// Goes past its target then comes back to it: the rebound of what arrives.
pub(crate) fn ease_out_back(t: f32) -> f32 {
let u = t - 1.;
1. + 3.4 * u * u * u + 2.4 * u * u
}
/// Follows the Windows « Show animations » setting while the app runs. gpui-base reads it into
/// `App::reduce_motion` at start (`gpui_kit::init`) but not on its change, which Windows
/// broadcasts to every top-level window: the window's own messages are watched for it, with no
@@ -257,13 +214,11 @@ fn animation_setting_changed(message: u32, wparam: usize) -> bool {
#[cfg(test)]
mod tests {
use std::time::{Duration, Instant};
use windows::Win32::UI::WindowsAndMessaging::{
SPI_SETCLIENTAREAANIMATION, SPI_SETMOUSESPEED, WM_SETTINGCHANGE, WM_SIZE,
};
use super::{Deferred, Fade, animation_setting_changed};
use super::{Deferred, animation_setting_changed, ease_out_back};
#[test]
fn an_animation_asked_for_while_visible_plays_at_once() {
@@ -282,36 +237,11 @@ mod tests {
assert_eq!(deferred.shown(), None);
}
fn at(start: Instant, ms: u64) -> Instant {
start + Duration::from_millis(ms)
}
#[test]
fn the_veil_covers_the_screen_leaving_in_130_ms_and_uncovers_the_one_arriving_in_280_ms() {
let start = Instant::now();
let out = Fade::covering(0., start);
assert_eq!(out.veil(start), 0.);
assert!(!out.finished(at(start, 129)));
assert!(out.finished(at(start, 130)));
assert_eq!(out.veil(at(start, 130)), 1.);
// Slow at first, as the reference's ease-in.
assert!(out.veil(at(start, 65)) < 0.5);
let arrival = Fade::uncovering(1., start);
assert_eq!(arrival.veil(start), 1.);
assert!(!arrival.finished(at(start, 279)));
assert!(arrival.finished(at(start, 280)));
assert_eq!(arrival.veil(at(start, 280)), 0.);
// Fast at first, then settling.
assert!(arrival.veil(at(start, 140)) < 0.5);
}
#[test]
fn a_switch_during_a_transition_starts_from_where_the_veil_is() {
let start = Instant::now();
assert_eq!(Fade::covering(0.4, start).veil(start), 0.4);
assert_eq!(Fade::uncovering(0.4, start).veil(start), 0.4);
assert_eq!(Fade::uncovering(0.4, start).veil(at(start, 280)), 0.);
fn the_rebound_goes_past_its_target_then_lands_on_it() {
assert_eq!(ease_out_back(0.), 0.);
assert_eq!(ease_out_back(1.), 1.);
assert!(ease_out_back(0.6) > 1.);
}
#[test]
+328
View File
@@ -0,0 +1,328 @@
//! The veil of the switch between screens (#169): how far it covers the screen, from which
//! side, and what it does with the banner. The page lays it over the screen shown; nothing
//! under it moves.
use std::time::{Duration, Instant};
use super::{ease_in, ease_out, ease_out_back, event};
/// How long the screen leaving takes to go under the veil.
const FADE_OUT: Duration = event(100);
/// How long the screen arriving takes to come out of it.
const FADE_IN: Duration = event(240);
/// How long the light that goes round the ring with a veil takes: a little longer than the
/// veil itself, so that it lands after the screen arrived.
pub(crate) const LAP: Duration = event(420);
/// How wide the soft edge of a veil with a direction is, in widths of the screen.
const EDGE: f32 = 0.35;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub(crate) enum Side {
Left,
Right,
}
impl Side {
pub fn opposite(self) -> Side {
match self {
Side::Left => Side::Right,
Side::Right => Side::Left,
}
}
}
/// What the veil does with the banner, from the least covered: a veil already laid keeps the
/// most covered of what it did and what the new switch asks for.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
pub(crate) enum BannerCover {
/// It stays in place and says the same: the veil covers what is under it.
Kept,
/// It stays in place, and its text fades with the veil: the screen arriving says something
/// else.
Retold,
/// It goes under the veil with the rest of the screen.
Covered,
}
/// The screen leaving goes under a veil of the page's background, then the one arriving comes
/// out of it. A veil rather than the content's own opacity or position: either is part of a
/// cached view's key, so fading or sliding the content would draw the grid, the ring and the
/// charts again at each frame and build the cards again (rule #1).
///
/// Between two screens of the top bar the veil has a direction: its soft edge crosses the screen
/// from the side of the screen arriving, the same way as it covers and as it lifts.
pub(crate) struct Fade {
phase: FadePhase,
/// How much of the screen the veil covered when the phase started: a switch during a
/// transition starts again from where the veil is.
from: f32,
start: Instant,
/// The side its solid part holds on to; none for a veil without a direction, which fades
/// evenly.
anchor: Option<Side>,
banner: BannerCover,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub(crate) enum FadePhase {
/// The screen leaving goes under the veil.
Out,
/// The screen arriving comes out of it.
In,
}
impl Fade {
/// A veil without a direction, over the whole screen.
pub fn covering(from: f32, start: Instant) -> Self {
Fade {
phase: FadePhase::Out,
from,
start,
anchor: None,
banner: BannerCover::Covered,
}
}
/// The same veil, lifting off the screen arriving.
pub fn uncovering(from: f32, start: Instant) -> Self {
Fade {
phase: FadePhase::In,
..Fade::covering(from, start)
}
}
/// Holding on to `anchor`: covering, it comes in from there; lifting, it leaves that way.
pub fn anchored(mut self, anchor: Option<Side>) -> Self {
self.anchor = anchor;
self
}
pub fn with_banner(mut self, banner: BannerCover) -> Self {
self.banner = banner;
self
}
/// Takes over from the veil already `laid`, if any, so that it goes on from where it is:
/// it keeps the side that one holds on to, and the most covered of what both do with the
/// banner.
pub fn continuing(mut self, laid: Option<&Fade>) -> Self {
if let Some(laid) = laid {
self.anchor = laid.anchor;
self.banner = self.banner.max(laid.banner);
}
self
}
pub fn phase(&self) -> FadePhase {
self.phase
}
pub fn anchor(&self) -> Option<Side> {
self.anchor
}
pub fn banner(&self) -> BannerCover {
self.banner
}
/// How much of the screen the veil covers, 0 to 1: its opacity without a direction, else
/// how far its edge has crossed (`wipe`).
pub fn veil(&self, now: Instant) -> f32 {
let progress = self.progress(now);
match self.phase {
FadePhase::Out => self.from + (1. - self.from) * ease_in(progress),
FadePhase::In => self.from * (1. - ease_out(progress)),
}
}
pub fn finished(&self, now: Instant) -> bool {
self.progress(now) >= 1.
}
/// How long the veil has been covering the screen leaving; none once it lifts.
pub fn covering_for(&self, now: Instant) -> Option<Duration> {
(self.phase == FadePhase::Out).then(|| now.saturating_duration_since(self.start))
}
/// How far the screen arriving has come out, 0 to 1 at an even pace; none while the veil
/// still covers the one leaving.
fn arrival(&self, now: Instant) -> Option<f32> {
(self.phase == FadePhase::In).then(|| self.progress(now))
}
/// The banner's text under this veil: how visible it is, 0 to 1, and how far under its
/// place it still is as it comes back, 1 to 0, going a little over. It only moves when the
/// screen arriving says something else: it fades with the veil, then comes back rising.
pub fn banner_text(&self, now: Instant) -> (f32, f32) {
if self.banner != BannerCover::Retold {
return (1., 0.);
}
let below = self
.arrival(now)
.map_or(0., |arrived| 1. - ease_out_back(arrived));
(1. - self.veil(now), below)
}
fn duration(&self) -> Duration {
match self.phase {
FadePhase::Out => FADE_OUT,
FadePhase::In => FADE_IN,
}
}
fn progress(&self, now: Instant) -> f32 {
let elapsed = now.saturating_duration_since(self.start);
(elapsed.as_secs_f32() / self.duration().as_secs_f32()).min(1.)
}
}
/// The parts of a veil with a direction that covers `covered` of the screen, in widths of the
/// screen from the side it holds on to: where its solid part ends (below 0 while only its edge
/// is in) and where its soft edge ends (beyond 1 once the solid part nears the other side).
pub(crate) fn wipe(covered: f32) -> (f32, f32) {
let reach = covered * (1. + EDGE);
(reach - EDGE, reach)
}
#[cfg(test)]
mod tests {
use std::time::{Duration, Instant};
use super::{BannerCover, EDGE, Fade, Side, wipe};
fn at(start: Instant, ms: u64) -> Instant {
start + Duration::from_millis(ms)
}
#[test]
fn the_veil_covers_the_screen_leaving_in_200_ms_and_uncovers_the_one_arriving_in_480_ms() {
let start = Instant::now();
let out = Fade::covering(0., start);
assert_eq!(out.veil(start), 0.);
assert!(!out.finished(at(start, 199)));
assert!(out.finished(at(start, 200)));
assert_eq!(out.veil(at(start, 200)), 1.);
// Slow at first.
assert!(out.veil(at(start, 100)) < 0.5);
let arrival = Fade::uncovering(1., start);
assert_eq!(arrival.veil(start), 1.);
assert!(!arrival.finished(at(start, 479)));
assert!(arrival.finished(at(start, 480)));
assert_eq!(arrival.veil(at(start, 480)), 0.);
// Fast at first, then settling.
assert!(arrival.veil(at(start, 240)) < 0.5);
}
#[test]
fn a_switch_during_a_transition_starts_from_where_the_veil_is() {
let start = Instant::now();
assert_eq!(Fade::covering(0.4, start).veil(start), 0.4);
assert_eq!(Fade::uncovering(0.4, start).veil(start), 0.4);
assert_eq!(Fade::uncovering(0.4, start).veil(at(start, 480)), 0.);
}
#[test]
fn a_veil_has_no_direction_and_covers_the_banner_unless_told() {
let start = Instant::now();
let plain = Fade::covering(0., start);
assert_eq!(
(plain.anchor(), plain.banner()),
(None, BannerCover::Covered)
);
let told = Fade::uncovering(1., start)
.anchored(Some(Side::Left))
.with_banner(BannerCover::Kept);
assert_eq!(
(told.anchor(), told.banner()),
(Some(Side::Left), BannerCover::Kept)
);
assert_eq!(Side::Left.opposite(), Side::Right);
}
#[test]
fn a_veil_taking_over_keeps_the_side_held_and_the_most_covered_banner() {
let start = Instant::now();
let laid = Fade::covering(0., start)
.anchored(Some(Side::Right))
.with_banner(BannerCover::Retold);
let next = |banner| {
Fade::uncovering(0.4, start)
.anchored(Some(Side::Left))
.with_banner(banner)
.continuing(Some(&laid))
};
assert_eq!(next(BannerCover::Kept).anchor(), Some(Side::Right));
assert_eq!(next(BannerCover::Kept).banner(), BannerCover::Retold);
assert_eq!(next(BannerCover::Covered).banner(), BannerCover::Covered);
// With no veil laid it is as it was told.
let fresh = Fade::covering(0., start)
.anchored(Some(Side::Left))
.continuing(None);
assert_eq!(
(fresh.anchor(), fresh.banner()),
(Some(Side::Left), BannerCover::Covered)
);
}
#[test]
fn the_edge_of_a_veil_with_a_direction_crosses_the_whole_screen() {
// Nothing of it is in at the start, and its solid part is the whole screen at the end.
assert_eq!(wipe(0.), (-EDGE, 0.));
assert_eq!(wipe(1.).0, 1.);
// On the way the soft edge leads the solid part by its width.
let (solid, reach) = wipe(0.5);
assert!(solid > 0. && solid < reach && reach < 1.);
assert!((reach - solid - EDGE).abs() < 1e-6);
}
#[test]
fn the_veil_says_how_long_it_has_covered_then_how_far_the_screen_arriving_is() {
let start = Instant::now();
let out = Fade::covering(0., start);
assert_eq!(
out.covering_for(at(start, 60)),
Some(Duration::from_millis(60))
);
assert_eq!(out.arrival(at(start, 60)), None);
let arrival = Fade::uncovering(1., start);
assert_eq!(arrival.covering_for(at(start, 60)), None);
assert_eq!(arrival.arrival(at(start, 240)), Some(0.5));
}
// #169: the banner's text fades and comes back only if it changes.
#[test]
fn the_banners_text_fades_and_comes_back_rising_only_when_it_changes() {
let start = Instant::now();
let veils = |banner| {
(
Fade::covering(0., start).with_banner(banner),
Fade::uncovering(1., start).with_banner(banner),
)
};
// The same text, or a banner under the veil: it does not move.
for banner in [BannerCover::Kept, BannerCover::Covered] {
let (out, arrival) = veils(banner);
for ms in [0, 100, 200] {
assert_eq!(out.banner_text(at(start, ms)), (1., 0.), "{banner:?}");
assert_eq!(arrival.banner_text(at(start, ms)), (1., 0.), "{banner:?}");
}
}
// Another text: it fades in its place as the veil comes, and is gone under the full one.
let (out, arrival) = veils(BannerCover::Retold);
assert_eq!(out.banner_text(start), (1., 0.));
let (shown, below) = out.banner_text(at(start, 150));
assert!(shown > 0. && shown < 1. && below == 0., "{shown} {below}");
assert_eq!(out.banner_text(at(start, 200)), (0., 0.));
// The new one comes back from below, goes a little over its place, and lands in it.
assert_eq!(arrival.banner_text(start), (0., 1.));
let (shown, below) = arrival.banner_text(at(start, 120));
assert!(
shown > 0. && shown < 1. && below > 0. && below < 1.,
"{shown} {below}"
);
assert!(arrival.banner_text(at(start, 300)).1 < 0.);
let (shown, below) = arrival.banner_text(at(start, 480));
assert!(shown == 1. && below.abs() < 1e-6, "{shown} {below}");
}
}
+51 -8
View File
@@ -7,7 +7,7 @@ use crate::card::Card;
use crate::card_grid::{CardGrid, CardHovered, Paging};
use crate::card_lift::Lifts;
use crate::champion_table::ChampionTable;
use crate::motion::{Deferred, Fade, MatchAnimation, MatchEnd};
use crate::motion::{BannerCover, Deferred, Fade, MatchAnimation, MatchEnd, Side};
use crate::ring::Ring;
use crate::stage::{Entry, Leave, Taken};
use crate::worker::{LiveChampSelect, Msg, RefreshGate};
@@ -22,6 +22,7 @@ use gpui_kit::*;
use profiling::shown;
use scrollbar::PageScrollbar;
use statistics::ChartsRow;
use std::cell::Cell;
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::Arc;
@@ -34,6 +35,7 @@ mod displayed;
mod friends;
mod home;
mod hover;
mod import_view;
mod in_game;
mod lifecycle;
mod links;
@@ -42,6 +44,7 @@ mod navigation;
mod playback;
mod profiling;
mod ring_hover;
mod ring_live;
mod scrollbar;
mod setup;
mod statistics;
@@ -112,10 +115,10 @@ pub struct ChampSelectTransition {
}
impl EventEmitter<ChampSelectTransition> for Page {}
/// The end of a Match opened its recap in « Parties »: « Paramètres » gives way, as for a champ
/// select, but the window is left as it is (#129).
pub struct RecapOpened;
impl EventEmitter<RecapOpened> for Page {}
/// The end of a game was decided: « Parties » opened its recap, or « Défi » shows. As for a champ
/// select, « Paramètres » gives way and the window comes above the others (#129).
pub struct MatchEndShown;
impl EventEmitter<MatchEndShown> for Page {}
/// The player chose a sort for the cards: to be saved with the other preferences.
pub struct ChampionSortChosen(pub ChampionSort);
@@ -150,6 +153,36 @@ impl Tab {
matches!(self, Tab::ChampSelect | Tab::InGame)
}
/// The side of `to` seen from this screen, in the top bar's order; none at the same place,
/// which « Statistiques », the Challenge's detail page, shares with « Défi ». The veil
/// between two screens goes that way (#169).
fn side_of(self, to: Tab) -> Option<Side> {
let place = |tab| match tab {
Tab::Challenge | Tab::Statistics => 0,
Tab::Matches => 1,
Tab::ChampSelect => 2,
Tab::InGame => 3,
};
match place(to).cmp(&place(self)) {
std::cmp::Ordering::Less => Some(Side::Left),
std::cmp::Ordering::Equal => None,
std::cmp::Ordering::Greater => Some(Side::Right),
}
}
/// What the veil from this screen to `to` does with the banner (#169). The four tabs share
/// it, so it stays in place, its text fading when a phase's banner says something else;
/// « Statistiques » has none.
fn banner_to(self, to: Tab) -> BannerCover {
if self == Tab::Statistics || to == Tab::Statistics {
BannerCover::Covered
} else if self == to || !(self.is_phase() || to.is_phase()) {
BannerCover::Kept
} else {
BannerCover::Retold
}
}
/// Whether the screen shows the home's statistics (its Account and Season), not the scope
/// of « Statistiques ».
fn home_scoped(self) -> bool {
@@ -234,6 +267,7 @@ pub struct Page {
/// The Account of the last requested statistics.
shown: Option<String>,
progress: Option<SyncProgress>,
import_view: import_view::ImportView,
refresh: RefreshGate,
stats_job: RefreshGate,
stats_generation: u64,
@@ -251,6 +285,12 @@ pub struct Page {
fade: Option<Fade>,
/// A frame of the transition is asked for.
frame_asked: bool,
/// Where the banner is, written at each of its prepaints (no render, no notification): the
/// veil that spares it starts under it.
banner_at: Rc<Cell<Bounds<Pixels>>>,
/// Where the screen under the header is, written likewise: the banner is in its place at
/// its top.
screen_at: Rc<Cell<Bounds<Pixels>>>,
/// The cards lifted over their grid, by grid: the one under the pointer or the keyboard, and
/// those settling back (#88).
lifts: Lifts<EntityId>,
@@ -315,6 +355,8 @@ pub struct Page {
lit_by: Option<EntityId>,
/// The champion the pointer aims at on the ring.
ring_hover: ring_hover::RingHover,
/// What moves over the ring, and since when (#170).
ring_live: ring_live::RingLive,
/// The banner's illustration, its own: given back while the banner is not shown.
banner_art: Entity<BannerArt>,
/// The home's own filter and search: never persisted, « Tous » at each launch.
@@ -374,9 +416,10 @@ pub struct Page {
open_recap_at_match_end: bool,
/// The latest game whose end chose the screen shown: it is decided once (#129).
decided_game: Option<u64>,
/// Lights the ring's tick of the card hovered in « Autres champions », lifts it, and scrolls the
/// champ select to the card the keyboard reaches; its grid is made again at each fold.
others_hover: [Subscription; 3],
/// Lights the ring's tick of the card hovered in « Autres champions », lifts it, shows the
/// Matches of the card chosen, and scrolls the champ select to the card the keyboard reaches;
/// its grid is made again at each fold.
others_hover: [Subscription; 4],
_subscriptions: Vec<Subscription>,
_listener: Task<()>,
}
+12 -9
View File
@@ -8,26 +8,29 @@ use std::rc::Rc;
impl Page {
/// A new grid for « Autres champions », whose hover lights the ring as the others do. The
/// one it replaces puts out the tick it lit.
fn new_others_grid(&mut self, cx: &mut Context<Self>) {
fn new_others_grid(&mut self, window: &Window, cx: &mut Context<Self>) {
let replaced = self.others_grid.entity_id();
// The new grid is not laid out: the old one's place is not its own.
self.paging.top.set(None);
let paging = self.paging.clone();
self.others_grid = cx.new(|_| CardGrid::paged(paging));
self.others_hover = Self::light_and_reveal(&self.others_grid, cx);
self.others_hover = Self::light_and_reveal(&self.others_grid, window, cx);
self.lifts.drop_grid(replaced);
self.light(replaced, None, cx);
}
/// What `light_on_hover` does for the grid of « Autres champions », and scrolls the champ
/// select to the row the keyboard reaches: the grid holds no scrolling of its own.
/// What `light_on_hover` and `show_matches_on_choice` do for the grid of « Autres
/// champions », and scrolls the champ select to the row the keyboard reaches: the grid holds
/// no scrolling of its own.
pub(in crate::page) fn light_and_reveal(
grid: &Entity<CardGrid>,
window: &Window,
cx: &mut Context<Self>,
) -> [Subscription; 3] {
) -> [Subscription; 4] {
let [hovered, put_down] = Self::light_on_hover(grid, cx);
let chosen = Self::show_matches_on_choice(grid, window, cx);
let reveal = cx.subscribe(grid, |this, _, row: &RevealRow, cx| this.reveal(*row, cx));
[hovered, put_down, reveal]
[hovered, put_down, chosen, reveal]
}
/// Scrolls the champ select the least that shows the row of « Autres champions » the
@@ -152,12 +155,12 @@ impl Page {
}
/// Opens or folds « Autres champions »; folded, it gives its cards back.
pub(in crate::page) fn toggle_others(&mut self, cx: &mut Context<Self>) {
pub(in crate::page) fn toggle_others(&mut self, window: &Window, cx: &mut Context<Self>) {
self.others_open = !self.others_open;
if self.others_open {
self.prepare_others(cx);
} else {
self.new_others_grid(cx);
self.new_others_grid(window, cx);
}
cx.notify();
}
@@ -166,7 +169,7 @@ impl Page {
pub(in crate::page) fn fold_others(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if self.others_open {
self.others_open = false;
self.new_others_grid(cx);
self.new_others_grid(window, cx);
}
self.others_search = ChampionSearch::new("");
self.others_search_input
+6 -1
View File
@@ -85,7 +85,12 @@ impl Page {
self.lifted_by_keyboard = None;
self.leave = Some(leave);
let veil_from = if cards == 0 { now } else { now + BEFORE_VEIL };
self.fade = Some(Fade::covering(veil, veil_from));
// Whichever screen the end chooses, its banner says something else. A veil already on
// its way keeps the side it holds on to, and what it covers.
let fade = Fade::covering(veil, veil_from)
.with_banner(self.banner_through(Tab::Challenge))
.continuing(self.fade.as_ref());
self.fade = Some(fade);
self.next_fade_frame(window, cx);
cx.notify();
}
+1 -1
View File
@@ -179,7 +179,7 @@ impl Page {
.debug_selector(|| "others-toggle".into())
.child(Icon::new(chevron).small().text_color(muted))
.child(heading(cx).child(title))
.on_click(cx.listener(|this, _, _, cx| this.toggle_others(cx))),
.on_click(cx.listener(|this, _, window, cx| this.toggle_others(window, cx))),
)
.when(open, |section| {
section
+26 -19
View File
@@ -1,6 +1,6 @@
use super::{PAGE_PADDING, Page, Tab, shown};
use crate::stage;
use crate::text::{CLIENT_ABSENT, official_differs, sync_line};
use crate::text::{CLIENT_ABSENT, official_differs};
#[cfg(test)]
use arena_tracker_core::{ChampionSort, StateFilter};
use arena_tracker_core::{ProgressCheck, UpdateProblem};
@@ -9,6 +9,8 @@ use gpui_kit::component::select::Select;
use gpui_kit::component::{ActiveTheme as _, Sizable as _, StyledExt as _};
use gpui_kit::prelude::FluentBuilder as _;
use gpui_kit::*;
use std::cell::Cell;
use std::rc::Rc;
impl Page {
/// One line each, the most important first; the stored data stays visible under all.
@@ -47,7 +49,8 @@ impl Page {
.collect()
}
/// The veil's opacity over the screen shown, 0 at rest.
/// How much of the screen shown the veil covers, 0 at rest: its opacity without a
/// direction, else how far its edge has crossed.
pub(in crate::page) fn veil(&self, cx: &App) -> f32 {
self.fade
.as_ref()
@@ -65,6 +68,14 @@ impl Page {
}
}
/// Fills its parent and writes where it is into `at`, at each prepaint: no render, no
/// notification.
pub(in crate::page) fn placed_at(at: Rc<Cell<Bounds<Pixels>>>) -> impl IntoElement {
canvas(move |bounds, _, _| at.set(bounds), |_, _, _, _| {})
.absolute()
.inset_0()
}
impl Render for Page {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
// A card lifting or settling asks for the next frame, and none once they are still.
@@ -94,6 +105,15 @@ impl Render for Page {
window.request_animation_frame();
}
}
// What moves over the ring goes on, and asks for the next frame while it does (#170):
// not out of sight, behind « Paramètres » or on « Statistiques », which has no ring.
if !self.may_animate(window, cx) || self.shown_tab == Tab::Statistics {
self.ring_live.still();
}
self.ring_live.step(now);
if self.ring_live.moving() {
window.request_animation_frame();
}
self.lifts.tidy(now);
if self.lifts.animating(now) {
window.request_animation_frame();
@@ -105,11 +125,7 @@ impl Render for Page {
.and_then(|entry| entry.sweep(now))
.map(|progress| stage::sweep(progress, window.viewport_size(), cx));
let muted = cx.theme().muted_foreground;
let busy = self.busy();
let status_line = (!busy)
.then(|| self.friend_status())
.flatten()
.unwrap_or_else(|| sync_line(busy, self.progress, self.crashed, self.stored).into());
let status_line = self.status_line(now);
div()
// The pointer takes over from the keyboard: the card it lifted goes down.
@@ -149,14 +165,7 @@ impl Render for Page {
.disabled(self.in_phase())
.w(px(260.))
.min_w(px(150.)),
)
.children(self.stale().then(|| {
div()
.text_sm()
.whitespace_nowrap()
.text_color(muted)
.child("Non mis à jour")
})),
),
)
.child(
div().h_flex().items_center().gap_3().flex_shrink_0().child(
@@ -182,6 +191,7 @@ impl Render for Page {
.flex_1()
.min_h_0()
.gap_3()
.child(placed_at(self.screen_at.clone()))
.children(match self.shown_tab {
Tab::Challenge => self.home_content(window, cx),
Tab::Statistics => self.statistics_content(cx),
@@ -189,10 +199,7 @@ impl Render for Page {
Tab::ChampSelect => self.champ_select_content(window, cx),
Tab::InGame => self.in_game_content(window, cx),
})
.when(self.fade.is_some(), |screen| {
let veil = cx.theme().background.opacity(self.veil(cx));
screen.child(div().absolute().inset_0().bg(veil))
}),
.children(self.veil_layer(cx)),
)
// The band of light of a champ select's entry, over the whole window.
.children(sweep)
+1 -12
View File
@@ -70,6 +70,7 @@ impl Page {
self.home_filter = StateFilter::All;
}
self.rescope(window, cx);
self.show_import(true, cx);
}
/// The Account whose data the page shows: during a champ select or a Live Match the one
@@ -82,18 +83,6 @@ impl Page {
self.viewed()
}
/// Whether the Account shown is not the one being updated (or none is), so only stored
/// data is shown. Unknown until the follower's first round has reported.
pub(in crate::page) fn stale(&self) -> bool {
!self.pending_round
&& self.displayed().is_some_and(|viewed| {
self.status
.updating
.as_ref()
.is_none_or(|updating| updating.puuid != viewed.puuid)
})
}
/// The game's own count, only meaningful for the Account being updated in the current Season,
/// whether the page shows it as the home's Challenge or as the selected Season.
pub(in crate::page) fn official(&self) -> Option<&ProgressCheck> {
+55
View File
@@ -2,6 +2,7 @@
//! takes a Riot ID, and the import of a Friend's history. Nothing here runs on a timer: a Friend's
//! Matches are fetched when it is added, when it is chosen in the selector and on « Actualiser ».
use super::import_view::wait_until;
use super::{AccountItem, AccountList, Page, RELOAD_EVERY};
use crate::input_frame::input_frame;
use crate::text::friend_sync_line;
@@ -39,11 +40,23 @@ struct Import {
/// Asked for while another ran: the latest Friend asked for wins.
queued: Option<String>,
line: Option<SharedString>,
/// The last progress of the import running.
progress: Option<SyncProgress>,
/// The Friend whose last import failed, and why.
error: Option<(String, String)>,
}
impl Friends {
/// The puuid of the Friend whose import runs.
pub(super) fn import_running(&self) -> Option<&str> {
self.import.running.as_deref()
}
/// The last progress of the import running, if it has told one.
pub(super) fn import_progress(&self) -> Option<SyncProgress> {
self.import.progress
}
pub(super) fn new(window: &mut Window, cx: &mut Context<Page>) -> (Friends, Subscription) {
let input = cx.new(|cx| InputState::new(window, cx).placeholder("Pseudo#TAG"));
let enter = cx.subscribe(&input, |page, _, event: &InputEvent, cx| {
@@ -213,6 +226,7 @@ impl Page {
let import = &mut self.friends.import;
import.error.take_if(|(failed, _)| *failed == puuid);
import.queued = None;
import.progress = None;
import.line = self
.accounts
.iter()
@@ -230,9 +244,14 @@ impl Page {
window: &mut Window,
cx: &mut Context<Self>,
) {
let puuid = self.current_puuid(puuid, window, cx);
let puuid = puuid.as_str();
if self.friends.import.running.as_deref() != Some(puuid) {
return;
}
let now = cx.background_executor().now();
self.import_view.friend_until = wait_until(progress, now);
self.friends.import.progress = Some(progress);
self.friends.import.line = self
.accounts
.iter()
@@ -251,9 +270,11 @@ impl Page {
window: &mut Window,
cx: &mut Context<Self>,
) {
let puuid = self.current_puuid(&puuid, window, cx);
let import = &mut self.friends.import;
import.running = None;
import.line = None;
import.progress = None;
if let Err(message) = outcome {
import.error = Some((puuid.clone(), message));
}
@@ -265,6 +286,40 @@ impl Page {
}
}
/// What an import message names may have changed PUUID since the import started (a new Riot
/// key, `Tracker::replaced_puuid`): the Accounts are read again, so the page follows it.
fn current_puuid(
&mut self,
puuid: &str,
window: &mut Window,
cx: &mut Context<Self>,
) -> String {
let Some(new) = self.tracker.replaced_puuid(puuid) else {
return puuid.into();
};
if self.friends.import.running.as_deref() == Some(puuid) {
self.reload_accounts(window, cx);
}
new
}
/// The PUUIDs the page holds follow the ones that replaced them (see `current_puuid`), so
/// the Account shown stays the same.
pub(in crate::page) fn follow_replaced_puuids(&mut self) {
let import = &mut self.friends.import;
let held = [
self.pinned.as_mut(),
import.running.as_mut(),
import.queued.as_mut(),
import.error.as_mut().map(|(puuid, _)| puuid),
];
for puuid in held.into_iter().flatten() {
if let Some(new) = self.tracker.replaced_puuid(puuid) {
*puuid = new;
}
}
}
/// A Friend's addition or import panicked: nothing is known to run any more.
pub(in crate::page) fn friend_crashed(&mut self) {
self.friends.pending = false;
+32
View File
@@ -332,3 +332,35 @@ async fn a_friend_who_signs_in_to_the_client_stays_a_friend_and_is_not_imported(
assert_eq!(items, [("Alice", false), ("Bob", false), ("Carl", true)]);
});
}
#[gpui::test]
async fn a_friend_shown_while_its_puuid_changes_stays_shown_and_its_import_goes_on(
cx: &mut TestAppContext,
) {
let (page, mut window, handles) = on_carl(cx).await;
handles.new_key.store(true, Ordering::SeqCst);
handles.third.store(true, Ordering::SeqCst);
handles.gate.set(false);
// Chosen again, Carl is rekeyed before its new Match is awaited.
pick(&page, &mut window, "Carl");
cx.condition(&page, |p, _| p.pinned.as_deref() == Some("Carl2"))
.await;
page.read_with(&window, |p, _| {
assert_eq!(p.friends.import.running.as_deref(), Some("Carl2"));
assert_eq!(p.viewed().map(|a| a.puuid.as_str()), Some("Carl2"));
assert_eq!(
p.friend_status().as_deref(),
Some("Import de Carl : 0 / 1 Parties")
);
});
assert_eq!(selected(&page, &mut window).as_deref(), Some("Carl2"));
handles.gate.set(true);
imported(&page, cx, 3).await;
assert_eq!(status_line(&page, &mut window), None);
page.read_with(&window, |p, _| {
assert_eq!(p.pinned.as_deref(), Some("Carl2"));
assert!(p.friends.ids.contains("Carl2") && p.friend_error().is_none());
});
}
+3 -3
View File
@@ -133,8 +133,8 @@ impl Page {
})
}
/// The centred column of « Défi », « Sélection » and « En partie », as wide as the mockup's,
/// with the banner on top.
/// The centred column of « Défi », « Parties », « Sélection » and « En partie », at most
/// `MAX_WIDTH` wide, with the banner on top.
pub(in crate::page) fn banner_column(
&self,
window: &mut Window,
@@ -220,7 +220,7 @@ impl Page {
}
/// « Mes champions » with how many cards are shown, and on the right the search, the filters
/// and the sort, as the mockup's `.tools`.
/// and the sort.
fn home_heading(&self, cx: &mut Context<Page>) -> impl IntoElement {
let theme = cx.theme();
let (muted, border) = (theme.muted_foreground, theme.border);
+26 -6
View File
@@ -7,8 +7,9 @@ use gpui_kit::*;
use super::{Line, NO_SEASON, Page};
use crate::banner_art::BannerArt;
use crate::motion::{COUNTER_ROLL, ease_out};
use crate::motion::{COUNTER_ROLL, ease_out_back};
use crate::page::Tab;
use crate::page::display::placed_at;
use crate::theme::{banner_band, gold_ink, heading};
impl Page {
@@ -43,6 +44,12 @@ impl Page {
.filter(|t| (0. ..COUNTER_ROLL).contains(t))
.map(|t| t / COUNTER_ROLL);
let aimed = self.ring_hover.aimed.as_ref();
// Between two screens whose banners say something else, the text fades with the veil
// that spares the banner, then comes back rising (#169).
let (text_opacity, below) =
(self.fade.as_ref()).map_or((1., 0.), |fade| fade.banner_text(now));
let rise = RETOLD_RISE * below;
let banner_at = self.banner_at.clone();
let theme = cx.theme();
let (band, muted, foreground, ink) = (
banner_band(theme),
@@ -78,6 +85,8 @@ impl Page {
let copy = div()
.v_flex()
.min_w_0()
.opacity(text_opacity)
.when(rise != 0., |copy| copy.relative().top(px(rise)))
.when(!layout.narrow, |copy| copy.max_w(relative(0.46)))
// Full width in a narrow window: its last lines keep clear of the corner icon.
.when(layout.narrow && !self.shown_tab.is_phase(), |copy| {
@@ -121,6 +130,8 @@ impl Page {
div()
.text_sm()
.text_color(muted)
// It comes in as the pointer enters the crown, or leaves it.
.opacity(self.ring_live.line(now))
.child(name(aimed.map_or(&text.detail, |aimed| &aimed.line))),
)
.children(text.last_match.as_ref().map(|line| {
@@ -157,12 +168,16 @@ impl Page {
.px(px(layout.padding))
.py(px(BANNER_PADDING_Y))
.debug_selector(|| "banner".into())
.child(placed_at(banner_at))
.child(self.banner_art.clone())
// Cached: only a change of its ticks or of the lit one draws the ring again.
.child(self.ring_slot(layout.ring, now, cx))
.child(self.ring_slot(layout.ring, (!layout.narrow).then_some(band), now, cx))
.child(copy)
// A phase's banner is about the phase only.
.children((!self.shown_tab.is_phase()).then(|| self.statistics_button(ink, layout, cx)))
.children(
(!self.shown_tab.is_phase())
.then(|| self.statistics_button(ink, text_opacity, layout, cx)),
)
}
/// « Statistiques », a chart icon in the banner's bottom-right corner, over the
@@ -171,6 +186,7 @@ impl Page {
fn statistics_button(
&self,
ink: Hsla,
opacity: f32,
layout: BannerLayout,
cx: &mut Context<Page>,
) -> impl IntoElement {
@@ -179,6 +195,7 @@ impl Page {
let (ring, hover, hover_foreground) = (theme.ring, theme.accent, theme.accent_foreground);
BaseButton::new("statistics-link")
.absolute()
.opacity(opacity)
.right(px(layout.padding))
.bottom(px(BANNER_PADDING_Y))
.p_1()
@@ -196,14 +213,16 @@ impl Page {
}
}
/// How far below its place the text of a banner that says something else comes back from.
const RETOLD_RISE: f32 = 10.;
/// The banner's vertical padding.
const BANNER_PADDING_Y: f32 = 24.;
/// The banner's rounded corners.
const RADIUS: f32 = 16.;
/// The banner's measures, from the window width as the reference page's `clamp` and `vw` give
/// them.
/// The banner's measures, from the window width as CSS's `clamp` and `vw` would give them.
#[derive(Clone, Copy, Debug, PartialEq)]
struct BannerLayout {
/// At most 680 px: the ring goes above the text.
@@ -253,7 +272,8 @@ fn rolling_count(layout: TextLayout, title: Line, ink: Hsla, t: f32) -> impl Int
let line = window
.text_system()
.shape_line(count.into(), font_size, &[run], None);
let rise = px(10. * (1. - ease_out(t)));
// It rises past its place, then lands on it.
let rise = px(10. * (1. - ease_out_back(t)));
let _ = line.paint(
origin + point(px(0.), rise),
layout.line_height(),
+17 -1
View File
@@ -2,6 +2,7 @@
//! the illustration of each screen that has a banner.
use super::BannerContent;
use crate::page::ring_live::Scope;
use crate::page::{Page, Tab};
use crate::ring::{self, Tick};
use arena_tracker_core::Splash;
@@ -33,7 +34,17 @@ impl Page {
self.name_other_account();
self.champ_select_splashes = splashes;
self.reaim();
let has_ticks = !ticks.is_empty();
self.ring.update(cx, |ring, cx| ring.set_ticks(ticks, cx));
// Its ticks for another Account or Season: the ring fills from noon (#170).
if has_ticks {
let scope = Scope {
account: self.shown.clone(),
season: self.home_season.clone(),
};
let now = cx.background_executor().now();
(self.ring_live).shows(scope, !cx.reduce_motion(), now);
}
if self.shown_tab == Tab::InGame {
// « En partie » reads the same statistics, prepared only while shown (rule #1).
self.prepare_in_game(cx);
@@ -61,7 +72,12 @@ impl Page {
let anvil = (self.live_champ_select())
.filter(|_| selecting)
.and_then(|pick| pick.anvil_champions.as_deref());
// The ticks without an anvil go dim rather than out at once (#170).
let dims = anvil.is_some() && !self.ring.read(cx).dims();
self.ring.update(cx, |ring, cx| ring.set_anvil(anvil, cx));
if dims && !cx.reduce_motion() {
self.ring_live.dim(cx.background_executor().now());
}
let playing = self.shown_tab == Tab::InGame;
let browsing = self.shown_tab == Tab::Matches;
let held = self.playback.active() && (self.playback.on_matches || !browsing);
@@ -81,7 +97,7 @@ impl Page {
self.lit_by.is_none().then_some(None)
};
if let Some(lit) = lit {
self.ring.update(cx, |ring, cx| ring.set_lit(lit, cx));
self.light_ring(lit, cx);
}
if let Some((_, splash)) = aimed {
self.banner_art
+1 -2
View File
@@ -152,8 +152,7 @@ impl Page {
// The pointer cannot be on a card and on the ring, but one's leaving may come after the
// other's entering.
let aimed = self.ring_hover.aimed.as_ref().map(|aimed| aimed.id);
self.ring
.update(cx, |ring, cx| ring.set_lit(id.or(aimed), cx));
self.light_ring(id.or(aimed), cx);
if self.shown_tab == Tab::ChampSelect {
self.select_art(id, cx);
}
+178
View File
@@ -0,0 +1,178 @@
//! What an import shows beyond its count (#140): the arc around the ring and the status line's
//! countdown while the Riot quota makes it wait. No timer runs outside a wait, and the ring is
//! told at most once a second (rule #1).
use std::time::{Duration, Instant};
use arena_tracker_core::{SyncProgress, account_riot_id};
use gpui_kit::*;
use super::Page;
use crate::motion::LAP;
use crate::ring::arc_fraction;
use crate::text::{quota_line, sync_line};
/// An import of fewer Matches than this shows no arc: a short sync must not flash it.
const ARC_FROM: usize = 10;
const EVERY: Duration = Duration::from_secs(1);
#[derive(Default)]
pub(super) struct ImportView {
/// When the quota wait told by the own sync, or by the Friend's import, ends.
pub(super) own_until: Option<Instant>,
pub(super) friend_until: Option<Instant>,
/// The countdown's timer, while a wait is on: dropped, it stops.
counting: Option<Task<()>>,
/// The signed-in Riot ID and the puuid of the Account it names, once resolved: forgotten
/// when the Accounts are read again.
pub(super) signed_in: Option<(std::sync::Arc<str>, Option<String>)>,
/// What the ring was given last, and when.
arc: Option<(usize, usize)>,
arc_at: Option<Instant>,
}
/// When the wait `progress` tells ends, from `now`.
pub(super) fn wait_until(progress: SyncProgress, now: Instant) -> Option<Instant> {
progress.quota_wait.map(|wait| now + wait)
}
impl Page {
/// The header's status line: the quota wait, else the import or sync going on, else the
/// last result.
pub(super) fn status_line(&self, now: Instant) -> SharedString {
if let Some(secs) = self.quota_secs_left(now) {
return quota_line(secs).into();
}
let busy = self.busy();
(!busy)
.then(|| self.friend_status())
.flatten()
.unwrap_or_else(|| sync_line(busy, self.progress, self.crashed, self.stored).into())
}
/// The seconds left, rounded up, of the quota wait the status line tells: the own sync's,
/// which comes first as its line does, else the Friend's.
fn quota_secs_left(&self, now: Instant) -> Option<u64> {
let (progress, until) = if self.busy() {
(self.progress?, self.import_view.own_until?)
} else {
(
self.friends.import_progress()?,
self.import_view.friend_until?,
)
};
progress.quota_wait?;
let left = until.checked_duration_since(now).filter(|d| !d.is_zero())?;
Some(left.as_millis().div_ceil(1000) as u64)
}
/// After a message of an import or a change of the Account shown: starts the countdown if a
/// wait is on, and gives the ring what it shows.
pub(super) fn show_import(&mut self, force: bool, cx: &mut Context<Self>) {
self.count_down(cx);
self.show_arc(force, cx);
}
/// One timer for the whole wait: it draws the status line again each second and ends with it.
fn count_down(&mut self, cx: &mut Context<Self>) {
if self
.quota_secs_left(cx.background_executor().now())
.is_none()
{
self.import_view.counting = None;
return;
}
if self.import_view.counting.is_some() {
return;
}
self.import_view.counting = Some(cx.spawn(async move |page, cx| {
loop {
cx.background_executor().timer(EVERY).await;
let more = page.update(cx, |page, cx| {
cx.notify();
page.show_arc(false, cx);
let more = page
.quota_secs_left(cx.background_executor().now())
.is_some();
if !more {
page.import_view.counting = None;
}
more
});
if !more.unwrap_or(false) {
return;
}
}
}));
}
/// (fetched, to fetch) of the import of the Account shown, once it is long enough to show.
fn arc_wanted(&mut self) -> Option<(usize, usize)> {
let own = self.progress.filter(|p| p.to_fetch >= ARC_FROM);
if own.is_some() {
self.resolve_signed_in();
}
let shown = self.displayed()?.puuid.as_str();
let friend = (self.friends.import_running() == Some(shown))
.then(|| self.friends.import_progress())
.flatten();
let progress = friend.or_else(|| {
// The Account the follower or the refresh imports is the one signed in to the client;
// one not read yet shows no arc, rather than the previous Account's.
let imported = match &self.import_view.signed_in {
Some((_, puuid)) => puuid.as_deref(),
None => self.active_account().map(|a| a.puuid.as_str()),
};
(imported? == shown).then_some(own?)
})?;
(progress.to_fetch >= ARC_FROM).then_some((progress.fetched, progress.to_fetch))
}
/// Resolves the Account of the signed-in Riot ID when it changes, so an own import builds no
/// Riot ID per Account at each message (see `phase_account`).
fn resolve_signed_in(&mut self) {
let Some(id) = self.tracker.signed_in_riot_id_folded() else {
self.import_view.signed_in = None;
return;
};
if self
.import_view
.signed_in
.as_ref()
.is_none_or(|(known, _)| *known != id)
{
let named = (self.accounts.iter()).find(|a| account_riot_id(a).to_lowercase() == *id);
self.import_view.signed_in = Some((id, named.map(|a| a.puuid.clone())));
}
}
/// Gives the ring the arc: at once when it appears, disappears or `force`, else at most once
/// a second.
fn show_arc(&mut self, force: bool, cx: &mut Context<Self>) {
let wanted = self.arc_wanted();
let now = cx.background_executor().now();
let view = &mut self.import_view;
let toggled = wanted.is_some() != view.arc.is_some();
let due = view.arc_at.is_none_or(|at| now.duration_since(at) >= EVERY);
if wanted == view.arc || !(force || toggled || due) {
return;
}
let was = std::mem::replace(&mut view.arc, wanted);
view.arc_at = Some(now);
self.ring
.update(cx, |ring, cx| ring.set_progress(wanted, cx));
if cx.reduce_motion() {
return;
}
match (was, wanted) {
// The arc glides to its new value rather than jumping there (#172).
(Some((had, of)), Some((fetched, to_fetch))) => {
self.ring_live
.glide(arc_fraction(had, of), arc_fraction(fetched, to_fetch), now)
}
// The arc goes with the import: a light goes round the ring.
(Some(_), None) => self.ring_live.lap(true, LAP, now),
_ => {}
}
}
}
+5 -3
View File
@@ -1,11 +1,11 @@
//! The end of a Match opens its recap (#129): when its end-of-game block arrives, « Parties »
//! shows the new Match, from any screen, never bringing the window forward nor taking the focus.
//! shows the new Match, from any screen; the window comes forward without taking the focus.
//! With the preference off, or when the game ended without a block, the Challenge shows instead.
//! The animation of the end of the Match plays on « Parties » then (#110). Each game's end is
//! decided once: nothing brings the player back to either screen afterwards.
//! During a Live Match, « En partie » stays until the block or the lobby (#109).
use crate::page::{ALL_SEASONS, Page, RecapOpened, Tab};
use crate::page::{ALL_SEASONS, MatchEndShown, Page, Tab};
use crate::worker::MatchEntry;
use arena_tracker_core::{FollowedMatch, GameEnd, SeasonScope};
use gpui_kit::component::IndexPath;
@@ -54,6 +54,7 @@ impl Page {
self.show_account(None, window, cx);
}
self.set_tab(Tab::Challenge, window, cx);
cx.emit(MatchEndShown);
}
return;
}
@@ -82,6 +83,7 @@ impl Page {
self.show_account(None, window, cx);
}
self.set_tab(Tab::Challenge, window, cx);
cx.emit(MatchEndShown);
}
}
@@ -118,7 +120,7 @@ impl Page {
// Already drawn, the screen does not open again by itself: an earlier recap goes.
self.open_matches(cx);
}
cx.emit(RecapOpened);
cx.emit(MatchEndShown);
}
/// The Season and Format of « Statistiques » hide the Match that just ended: to its Season
+102 -19
View File
@@ -15,6 +15,7 @@ use gpui_kit::*;
use super::list::{MatchRow, Outcome};
use super::shown::Champions;
use crate::card_grid::{CardChosen, CardGrid};
use crate::input_frame::input_frame;
use crate::page::{Page, Tab};
use crate::text::ordinal;
@@ -50,12 +51,33 @@ impl PlacementFilter {
}
}
/// What the search field keeps.
enum Search {
/// Every champion: the field is empty.
Off,
/// The champions its text finds by name or alias.
Text(ChampionSearch),
/// The champion whose card was chosen, by its id, whose name the field shows (#166): Vi
/// alone, without Viego nor Viktor. Typing or emptying the field searches its text again.
Champion(u32),
}
impl Search {
fn keeps(&self, champions: &Champions, entry: &MatchEntry) -> bool {
match self {
Search::Off => true,
Search::Text(search) => {
champions.found_by(search, entry.champion_id, &entry.champion_name)
}
Search::Champion(id) => entry.champion_id == *id,
}
}
}
/// The filters of the list that « Statistiques » does not have.
pub(super) struct Filters {
pub(super) placement: PlacementFilter,
pub(super) search: ChampionSearch,
/// The search has a query: the champions are only looked up then.
searching: bool,
search: Search,
pub(super) input: Entity<InputState>,
/// The Season table, oldest first: the periods of the Seasons come from it.
seasons: Vec<Season>,
@@ -66,8 +88,7 @@ impl Filters {
pub(super) fn new(seasons: &[Season], window: &mut Window, cx: &mut App) -> Filters {
Filters {
placement: PlacementFilter::All,
search: ChampionSearch::new(""),
searching: false,
search: Search::Off,
input: cx.new(|cx| InputState::new(window, cx).placeholder("Rechercher")),
seasons: seasons.to_vec(),
}
@@ -76,14 +97,22 @@ impl Filters {
/// Back to « Tous » and an empty search, as at launch.
pub(super) fn clear(&mut self, window: &mut Window, cx: &mut App) {
self.placement = PlacementFilter::All;
if self.searching {
self.search = ChampionSearch::new("");
self.searching = false;
if !matches!(self.search, Search::Off) {
self.search = Search::Off;
self.input
.update(cx, |input, cx| input.set_value("", window, cx));
}
}
/// Only the Matches of the champion `id`, whose `name` the field shows, in every Placement.
fn only_champion(&mut self, id: u32, name: SharedString, window: &mut Window, cx: &mut App) {
self.placement = PlacementFilter::All;
self.search = Search::Champion(id);
// No change is emitted: the name stays in the field without searching its text.
self.input
.update(cx, |input, cx| input.set_value(name, window, cx));
}
/// The period of `season`; none for a Season the table does not know.
fn period(&self, season: &str) -> Range<i64> {
arena_tracker_core::period(&self.seasons, season).unwrap_or(0..0)
@@ -106,12 +135,7 @@ impl Page {
.is_none_or(|p| p.contains(&entry.started_at_ms))
&& self.format.is_none_or(|format| entry.format == format)
&& filters.placement.keeps(entry)
&& (!filters.searching
|| champions.found_by(
&filters.search,
entry.champion_id,
&entry.champion_name,
))
&& filters.search.keeps(champions, entry)
})
.map(|(ix, _)| ix)
.collect()
@@ -160,7 +184,8 @@ impl Page {
.list
.update(cx, |list, cx| list.set_rows(rows, selected.as_deref(), cx));
if choose {
self.request_recap(false);
// The Match chosen for the player, as one they click, shows their row.
self.request_recap(true);
}
self.dress_banner(cx);
}
@@ -184,12 +209,56 @@ impl Page {
/// The search field's text changed.
pub(super) fn matches_searched(&mut self, cx: &mut Context<Self>) {
let query = self.matches.filters.input.read(cx).value();
let filters = &mut self.matches.filters;
filters.search = ChampionSearch::new(&query);
filters.searching = !query.is_empty();
self.matches.filters.search = if query.is_empty() {
Search::Off
} else {
Search::Text(ChampionSearch::new(&query))
};
self.filtered(cx);
}
/// A card of the Challenge or of a champ select was chosen in `grid` (#166): « Parties »
/// shows its champion's Matches, the most recent chosen. The Season and Format stay those of
/// « Statistiques », which the selectors show, unlike the end of a Match (#129): here no one
/// Match has to show.
fn show_champion_matches(
&mut self,
grid: &Entity<CardGrid>,
id: u32,
window: &mut Window,
cx: &mut Context<Self>,
) {
// As for its lift: nothing while the hand leaves, nor before a card dealt is in place.
let now = cx.background_executor().now();
if self.leave.is_some() || self.dealing(grid, id, now, cx) {
return;
}
let name = (grid.read(cx).cards().iter())
.find(|card| card.id == id)
.map(|card| card.name.clone());
let Some(name) = name else {
return;
};
self.matches.filters.only_champion(id, name, window, cx);
// Its opening writes the list with the filters.
self.set_tab(Tab::Matches, window, cx);
}
/// A card chosen in `grid` shows its champion's Matches.
pub(in crate::page) fn show_matches_on_choice(
grid: &Entity<CardGrid>,
window: &Window,
cx: &mut Context<Self>,
) -> Subscription {
cx.subscribe_in(
grid,
window,
|page, grid, chosen: &CardChosen, window, cx| {
page.show_champion_matches(grid, chosen.id, window, cx)
},
)
}
/// Above the list: the Season and Format of « Statistiques » (the same selectors), the
/// Placement and the search. Plain elements of the page, a few of them.
pub(super) fn matches_filters(&self, cx: &mut Context<Page>) -> impl IntoElement {
@@ -301,7 +370,7 @@ pub(super) fn no_result(muted: Hsla) -> impl IntoElement {
#[cfg(test)]
mod tests {
use super::{MatchEntry, PlacementFilter, Season};
use super::{ChampionSearch, Champions, MatchEntry, PlacementFilter, Search, Season};
use arena_tracker_core::{Date, Format};
fn entry(placement: u8, win: bool) -> MatchEntry {
@@ -341,6 +410,20 @@ mod tests {
assert_eq!(kept(PlacementFilter::Wins), [true, true, false]);
}
#[test]
fn a_champion_chosen_keeps_its_own_matches_where_its_name_finds_others() {
let of = |id, name: &str| MatchEntry {
champion_id: id,
champion_name: name.into(),
..entry(1, true)
};
let (vi, viego) = (of(254, "Vi"), of(234, "Viego"));
let champions = Champions::of(None);
let kept = |search: &Search| [&vi, &viego].map(|entry| search.keeps(&champions, entry));
assert_eq!(kept(&Search::Text(ChampionSearch::new("Vi"))), [true, true]);
assert_eq!(kept(&Search::Champion(254)), [true, false]);
}
#[test]
fn a_season_runs_to_the_next_ones_start_and_the_last_is_open() {
let (a, b) = (season("A", 1), season("B", 6));
+3 -6
View File
@@ -3,8 +3,8 @@
use super::Recap;
use super::filters::no_result;
use crate::page::Page;
use crate::page::home::{StatsNotice, notice_line};
use crate::page::{Page, shown};
use crate::text::stored;
use gpui_kit::base::Button as BaseButton;
use gpui_kit::component::{ActiveTheme as _, Icon, IconName, Sizable as _, StyledExt as _};
@@ -43,11 +43,8 @@ impl Page {
.then_some(matches.error.as_ref())
.flatten()
.map(|error| self.matches_error(error, cx));
let column = div().id("matches").v_flex().flex_1().min_h_0().gap_3();
let column = match shown("banner") {
true => column.child(self.banner(window, cx)),
false => column,
};
// As wide as « Défi » and « Sélection »: the banner is in the same place on each.
let column = self.banner_column(window, cx).id("matches");
vec![
column
.child(
+168 -12
View File
@@ -6,11 +6,15 @@
//! « Défi » (#129); nothing else moves the player.
use super::{Page, Tab};
use crate::motion::{Fade, FadePhase};
use crate::motion::{BannerCover, Fade, FadePhase, LAP, Side, wipe};
use gpui_kit::base::Button as BaseButton;
use gpui_kit::component::{ActiveTheme as _, StyledExt as _};
use gpui_kit::prelude::FluentBuilder as _;
use gpui_kit::*;
use std::time::Duration;
/// How long the tab chosen takes to light up, and the one it replaces to go out.
const TAB_LIGHT: Duration = Duration::from_millis(120);
impl Page {
/// The tabs as buttons: they take the keyboard focus, and Enter or Space activates them.
@@ -37,12 +41,24 @@ impl Page {
.into_iter()
.chain(champ_select)
.chain(in_game);
// The tab chosen lights up as the one it replaces goes out, while the veil comes in.
let now = cx.background_executor().now();
let lighting = (self.fade.as_ref())
.and_then(|fade| fade.covering_for(now))
.map(|since| since.as_secs_f32() / TAB_LIGHT.as_secs_f32())
.filter(|lit| *lit < 1.);
let leaving = self.shown_tab;
div()
.h_flex()
.gap_1()
.flex_shrink_0()
.children(tabs.map(|(id, label, tab)| {
let current = self.lit(tab);
let light = match lighting {
Some(lit) if current && !lights(leaving, tab) => lit,
Some(lit) if !current && lights(leaving, tab) => 1. - lit,
_ => f32::from(current),
};
BaseButton::new(id)
.px_3()
.py_1()
@@ -55,8 +71,12 @@ impl Page {
.focus_visible(|style| {
style.border_color(if current { active_foreground } else { ring })
})
.text_color(if current { active_foreground } else { muted })
.when(current, |button| button.bg(active))
.text_color(if light >= 0.5 {
active_foreground
} else {
muted
})
.when(light > 0., |button| button.bg(active.opacity(light)))
.when(!current, |button| {
button.hover(|style| style.bg(hover).text_color(hover_foreground))
})
@@ -69,10 +89,7 @@ impl Page {
/// Whether the top bar lights `tab`: the one chosen, « Défi » on « Statistiques » too.
pub(super) fn lit(&self, tab: Tab) -> bool {
match self.tab {
Tab::Statistics => tab == Tab::Challenge,
chosen => chosen == tab,
}
lights(self.tab, tab)
}
pub(super) fn set_tab(&mut self, tab: Tab, window: &mut Window, cx: &mut Context<Self>) {
@@ -91,20 +108,48 @@ impl Page {
// Nothing to see: the end state at once.
self.end_fade(window, cx);
} else {
// From where the veil is: a switch during a transition does not wait for it.
// From where the veil is: a switch during a transition does not wait for it,
// and the veil laid keeps the side it holds on to. A new one comes in from the
// side of the screen arriving.
let now = cx.background_executor().now();
let veil = self.veil(cx);
self.fade = Some(if self.shown_tab == tab {
let fade = if self.shown_tab == tab {
Fade::uncovering(veil, now)
} else {
Fade::covering(veil, now)
});
};
let fade = fade
.anchored(self.shown_tab.side_of(tab))
.with_banner(self.banner_through(tab))
.continuing(self.fade.as_ref().filter(|_| veil > 0.));
// With the banner in sight, a light goes round the ring the way of the screen
// arriving, whichever side a veil already laid holds on to.
let lap =
(self.shown_tab.side_of(tab)).filter(|_| fade.banner() != BannerCover::Covered);
self.fade = Some(fade);
if let Some(side) = lap {
self.ring_live.lap(side == Side::Right, LAP, now);
}
self.next_fade_frame(window, cx);
}
cx.notify();
}
}
/// What the veil from the screen shown to `tab` does with the banner, decided once for the
/// transition: it spares the banner only if it is in its place, at the top of the screen,
/// on both. « Sélection » keeps its scrolling while another screen is shown; the others
/// come back at their top.
pub(super) fn banner_through(&self, tab: Tab) -> BannerCover {
let in_place = at_top(self.banner_at.get(), self.screen_at.get());
let scrolled = tab == Tab::ChampSelect && self.paging.scroll.offset().y != px(0.);
if in_place && !scrolled {
self.shown_tab.banner_to(tab)
} else {
BannerCover::Covered
}
}
/// Draws the screen of the tab chosen.
fn show_tab(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if self.shown_tab == self.tab {
@@ -200,13 +245,24 @@ impl Page {
if fade.finished(now) {
match fade.phase() {
FadePhase::Out => {
let (leaving, covered) = (self.shown_tab, fade.banner());
// The champ select that ended leaves under the full veil: its end chooses
// « Défi », which comes out of it, as after a switch of tabs.
if self.leave.is_some() {
let exit = self.leave.is_some();
if exit {
self.finish_exit(window, cx);
}
self.show_tab(window, cx);
self.fade = Some(Fade::uncovering(1., now));
// The veil's edge goes on the same way as it lifts; the end of a champ
// select, which chose the screen under the veil, has no direction.
let anchor =
(leaving.side_of(self.shown_tab).filter(|_| !exit)).map(Side::opposite);
let banner = covered.max(leaving.banner_to(self.shown_tab));
self.fade = Some(
Fade::uncovering(1., now)
.anchored(anchor)
.with_banner(banner),
);
}
FadePhase::In => return self.end_fade(window, cx),
}
@@ -214,4 +270,104 @@ impl Page {
self.next_fade_frame(window, cx);
cx.notify();
}
/// The veil over the screen shown, while a transition runs: of the page's background, it
/// fades evenly without a direction, else its soft edge crosses the screen from the side it
/// holds on to (three rectangles: solid, a two-stop gradient, nothing). Painted over the
/// screen, it draws none of the cached views under it again (rule #1).
///
/// The banner it spares stays out of it only where every screen draws it, at the top:
/// scrolled away, it goes under with the rest.
pub(super) fn veil_layer(&self, cx: &App) -> Option<impl IntoElement + use<>> {
let fade = self.fade.as_ref()?;
let covered = fade.veil(cx.background_executor().now());
let (anchor, spares) = (fade.anchor(), fade.banner() != BannerCover::Covered);
let color = cx.theme().background;
let banner_at = self.banner_at.clone();
let layer = canvas(
|_, _, _| {},
move |bounds, _, window, _| {
let area = veiled(bounds, banner_at.get(), spares);
let Some(side) = anchor else {
return window.paint_quad(fill(area, color.opacity(covered)));
};
// From the side the veil holds on to, in widths of the screen.
let span = |from: f32, to: f32| {
let (from, to) = (area.size.width * from, area.size.width * to);
let left = match side {
Side::Left => area.left() + from,
Side::Right => area.right() - to,
};
Bounds::new(point(left, area.top()), size(to - from, area.size.height))
};
let (solid, reach) = wipe(covered);
if solid > 0. {
window.paint_quad(fill(span(0., solid), color));
}
let (near, far) = (color, color.opacity(0.));
let edge = match side {
Side::Left => linear_gradient(
90.,
linear_color_stop(near, 0.),
linear_color_stop(far, 1.),
),
Side::Right => linear_gradient(
90.,
linear_color_stop(far, 0.),
linear_color_stop(near, 1.),
),
};
// The edge is wider than what is left to cross at either end.
window.with_content_mask(Some(ContentMask { bounds: area }), |window| {
window.paint_quad(fill(span(solid, reach), edge))
});
},
);
Some(layer.absolute().inset_0())
}
}
/// Whether `banner` is in its place, at the top of `screen`, where every screen draws it.
fn at_top(banner: Bounds<Pixels>, screen: Bounds<Pixels>) -> bool {
(banner.top() - screen.top()).abs() < px(1.)
}
/// What the veil covers of the screen in `bounds`: all of it, or only what is under the banner
/// it `spares`, when the banner is where every screen draws it, at the top of the screen.
fn veiled(bounds: Bounds<Pixels>, banner: Bounds<Pixels>, spares: bool) -> Bounds<Pixels> {
if !spares || !at_top(banner, bounds) {
return bounds;
}
let top = banner.bottom().min(bounds.bottom());
Bounds::from_corners(point(bounds.left(), top), bounds.bottom_right())
}
/// Whether the top bar lights `tab` when `chosen` is: « Défi » on « Statistiques » too.
fn lights(chosen: Tab, tab: Tab) -> bool {
match chosen {
Tab::Statistics => tab == Tab::Challenge,
chosen => chosen == tab,
}
}
#[cfg(test)]
mod tests {
use super::veiled;
use gpui_kit::{Bounds, point, px, size};
#[test]
fn the_veil_starts_under_a_banner_in_its_place_and_covers_one_scrolled_away() {
let screen = Bounds::new(point(px(12.), px(60.)), size(px(1200.), px(700.)));
let banner = |top: f32| Bounds::new(point(px(12.), px(top)), size(px(1200.), px(300.)));
// In its place, at the top of the screen: the veil covers what is under it.
let under = veiled(screen, banner(60.), true);
assert_eq!((under.top(), under.bottom()), (px(360.), px(760.)));
assert_eq!((under.left(), under.right()), (px(12.), px(1212.)));
// Scrolled away, or a veil that does not spare it: the whole screen.
assert_eq!(veiled(screen, banner(-80.), true), screen);
assert_eq!(veiled(screen, banner(60.), false), screen);
// A banner taller than the screen leaves nothing to cover, and nothing below the screen.
let tall = Bounds::new(point(px(12.), px(60.)), size(px(1200.), px(900.)));
assert_eq!(veiled(screen, tall, true).size.height, px(0.));
}
}
+43 -10
View File
@@ -1,6 +1,8 @@
//! The ring under the pointer (#112): it aims at the tick nearest by angle, lights it and has the
//! banner present its champion, over the rest state of the screen shown (`dress_banner`). Nothing
//! is touched until the aimed tick changes (rule #1), and nothing outside the ring.
//! banner present its champion, over the rest state of the screen shown (`dress_banner`). The
//! ring and the banner are touched only when the aimed tick changes, and nothing outside the
//! ring; along the crown the wave follows the pointer in the page's layer, which asks for its
//! frames while it moves and for none once it has caught up (rule #1, #170).
use std::cell::Cell;
use std::rc::Rc;
@@ -9,7 +11,9 @@ use arena_tracker_core::{ChampionRow, Splash};
use gpui_kit::*;
use super::Page;
use super::display::placed_at;
use super::home::Line;
use crate::ring::Live;
use crate::text::{ordinal, short_date};
/// The champion aimed at, with what the banner shows for it, prepared when the aim changes.
@@ -51,14 +55,17 @@ fn champion_line(row: &ChampionRow) -> Line {
}
impl Page {
/// The ring's slot of the banner, `size` wide: the cached ring, the end of a Match over it,
/// and the pointer's listeners, which are not the ring's (it stays cached).
/// The ring's slot of the banner, `size` wide: the cached ring, what moves over it (what
/// makes it live, then the end of a Match), and the pointer's listeners, which are not the
/// ring's (it stays cached). `cover` is the colour behind the ring, when it is plain.
pub(in crate::page) fn ring_slot(
&self,
size: f32,
cover: Option<Hsla>,
now: std::time::Instant,
cx: &mut Context<Page>,
) -> impl IntoElement {
let live = self.ring_live.frame(now);
let bounds = self.ring_hover.bounds.clone();
div()
.id("ring-slot")
@@ -75,16 +82,15 @@ impl Page {
page.leave_ring(cx);
}
}))
.child(
canvas(move |at, _, _| bounds.set(at), |_, _, _, _| {})
.absolute()
.inset_0(),
)
.child(placed_at(bounds))
.child(
self.ring
.clone()
.cached(StyleRefinement::default().size_full()),
)
.children(
(live != Live::default()).then(|| self.ring.read(cx).live_layer(live, cover, cx)),
)
.children(
(self.playback.animation)
.map(|a| self.ring.read(cx).match_layer(a, a.elapsed(now), cx)),
@@ -99,7 +105,17 @@ impl Page {
return;
}
let bounds = self.ring_hover.bounds.get();
let id = (self.ring.read(cx)).champion_at(at - bounds.origin, bounds.size);
let ring = self.ring.read(cx);
let at = at - bounds.origin;
let (id, angle) = (
ring.champion_at(at, bounds.size),
ring.angle_at(at, bounds.size),
);
// The wave follows the pointer along the crown, whichever tick it aims at: the page is
// told when it starts to move, not at each move while it does.
if !cx.reduce_motion() && self.ring_live.aim(angle, cx.background_executor().now()) {
cx.notify();
}
if id == self.ring_hover.aimed.as_ref().map(|aimed| aimed.id) {
return;
}
@@ -111,12 +127,29 @@ impl Page {
/// The pointer left the ring's slot, or the end of a Match starts: the banner is at rest
/// again.
pub(in crate::page) fn leave_ring(&mut self, cx: &mut Context<Self>) {
if self.ring_live.aim(None, cx.background_executor().now()) {
cx.notify();
}
if self.ring_hover.aimed.take().is_some() {
self.dress_banner(cx);
cx.notify();
}
}
/// Lights the tick of `lit` on the ring, or none: the one it replaces goes out in a trail,
/// and the new one pops (#170).
pub(in crate::page) fn light_ring(&mut self, lit: Option<u32>, cx: &mut Context<Self>) {
let was = self.ring.read(cx).lit();
if was == lit {
return;
}
if !cx.reduce_motion() {
(self.ring_live).relit(was, lit, cx.background_executor().now());
cx.notify();
}
self.ring.update(cx, |ring, cx| ring.set_lit(lit, cx));
}
/// New statistics: the champion aimed at, if any, is presented from them.
pub(in crate::page) fn reaim(&mut self) {
let id = self.ring_hover.aimed.as_ref().map(|aimed| aimed.id);
+470
View File
@@ -0,0 +1,470 @@
//! What makes the ring live (#170): when its lit tick changed, the ticks going out, the wave
//! following the pointer, the light of a switch of screens, the ring filling for another
//! Account or Season, its ticks going dim at a champ select. Only what moves and since when:
//! the ring's layer draws it (`Ring::live_layer`), and nothing is kept once it is still.
use std::f32::consts::{PI, TAU};
use std::time::{Duration, Instant};
use gpui_kit::SharedString;
use crate::motion::{ease_out, event, release};
use crate::ring::{Light, Live, TWINKLE_LIFE};
/// How long the lit tick takes to pop: a gesture's answer, at its base duration.
const POP: Duration = Duration::from_millis(260);
/// How long a tick takes to go out behind the pointer.
const TRAIL: Duration = release(320);
/// At most this many ticks go out at once: the oldest are dropped.
const TRAIL_LENGTH: usize = 24;
/// How long the banner's line takes to come in when the pointer enters or leaves the crown.
const LINE: Duration = Duration::from_millis(140);
/// How long the ring takes to fill for another Account or Season.
const FILL: Duration = event(850);
/// How long the import's arc takes to glide to its new value.
const GLIDE: Duration = event(300);
/// How long the ticks without an anvil take to go dim.
const DIM: Duration = event(250);
/// How long the wave takes to rise under the pointer, or to settle once it left, in seconds.
const WAVE_RISE: f32 = 0.18;
/// The spring that pulls the wave to the pointer: it follows with a little delay, and goes a
/// little past.
const PULL: f32 = 320.;
const DRAG: f32 = 20.;
/// The spring moves in steps of at most this long, so that it settles the same whatever the
/// display's rate; a frame later than `LATE` only catches up that much.
const STEP: f32 = 1. / 120.;
const LATE: f32 = 2.;
/// The wave under the pointer.
#[derive(Default)]
struct Wave {
/// Where the pointer aims, in radians clockwise from noon; none off the crown.
aim: Option<f32>,
at: f32,
speed: f32,
/// 0 at rest, 1 under the pointer.
height: f32,
stepped: Option<Instant>,
}
impl Wave {
/// How far the wave is from where the pointer aims, the short way round.
fn behind(&self) -> f32 {
let away = self.aim.map_or(0., |aim| aim - self.at).rem_euclid(TAU);
if away > PI { away - TAU } else { away }
}
fn step(&mut self, now: Instant) {
let since = self.stepped.replace(now);
let mut left = since.map_or(0., |since| {
now.saturating_duration_since(since).as_secs_f32().min(LATE)
});
let to = if self.aim.is_some() { 1. } else { 0. };
while left > 0. {
let dt = left.min(STEP);
left -= dt;
self.speed += (self.behind() * PULL - self.speed * DRAG) * dt;
self.at = (self.at + self.speed * dt).rem_euclid(TAU);
let rise = (dt / WAVE_RISE).min((to - self.height).abs());
self.height += rise.copysign(to - self.height);
}
if !self.moving() {
self.stepped = None;
}
}
fn moving(&self) -> bool {
match self.aim {
Some(_) => self.height < 1. || self.speed.abs() > 0.01 || self.behind().abs() > 0.003,
None => self.height > 0.,
}
}
}
/// The Account and the Season the ring's ticks were made for.
#[derive(Clone, PartialEq)]
pub(in crate::page) struct Scope {
pub account: Option<String>,
pub season: Option<SharedString>,
}
/// The light of a switch of screens, going once round the crown.
#[derive(Clone, Copy)]
struct Lap {
since: Instant,
lasting: Duration,
clockwise: bool,
}
#[derive(Default)]
pub(in crate::page) struct RingLive {
/// When the tick lit now lit up.
lit_at: Option<Instant>,
/// The ticks going out: their champion, and since when.
trail: Vec<(u32, Instant)>,
wave: Wave,
lap: Option<Lap>,
fill: Option<Instant>,
dim: Option<Instant>,
/// The import's arc gliding: from how much of the turn, to how much, since when (#172).
glide: Option<(f32, f32, Instant)>,
/// When the banner's line changed for the pointer entering or leaving the crown.
line_at: Option<Instant>,
scope: Option<Scope>,
}
/// How far `duration` is gone since `start`, 0 to 1.
fn progress(start: Instant, duration: Duration, now: Instant) -> f32 {
(now.saturating_duration_since(start).as_secs_f32() / duration.as_secs_f32()).min(1.)
}
impl RingLive {
/// The lit tick changed from `was`: it goes out in a trail, and the new one pops.
pub fn relit(&mut self, was: Option<u32>, lit: Option<u32>, now: Instant) {
if let Some(was) = was {
self.trail.retain(|(id, _)| *id != was);
self.trail.push((was, now));
let extra = self.trail.len().saturating_sub(TRAIL_LENGTH);
self.trail.drain(..extra);
}
// A tick lit again while it was going out is lit, not both.
self.trail.retain(|(id, _)| Some(*id) != lit);
self.lit_at = lit.map(|_| now);
}
/// The pointer aims at `angle` on the crown, or left it. The wave rises where the pointer
/// comes in, and follows it from there. Whether the page has a frame to ask for: not for
/// the same aim, nor while the wave moves already and asks for its own (rule #1).
pub fn aim(&mut self, angle: Option<f32>, now: Instant) -> bool {
if angle == self.wave.aim {
return false;
}
if angle.is_some() != self.wave.aim.is_some() {
self.line_at = Some(now);
}
if let Some(angle) = angle
&& self.wave.height == 0.
{
(self.wave.at, self.wave.speed) = (angle, 0.);
}
self.wave.aim = angle;
let resting = self.wave.stepped.is_none();
self.wave.stepped.get_or_insert(now);
resting
}
/// A light goes once round the crown in `lasting`, the way of the veil.
pub fn lap(&mut self, clockwise: bool, lasting: Duration, now: Instant) {
self.lap = Some(Lap {
since: now,
lasting,
clockwise,
});
}
/// The ring's ticks are those of `scope`: for another Account or Season than the one they
/// were, the ring fills from noon. The first ones are simply there.
pub fn shows(&mut self, scope: Scope, animated: bool, now: Instant) {
if self.scope.as_ref().is_some_and(|shown| *shown != scope) && animated {
self.fill = Some(now);
}
self.scope = Some(scope);
}
/// The import's arc goes from `was` of the turn to `to`: it glides there, from where it is
/// if it was gliding already.
pub fn glide(&mut self, was: f32, to: f32, now: Instant) {
let from = self.gliding(now).map_or(was, |(reached, _)| reached);
self.glide = Some((from, to, now));
}
/// How much of the turn the gliding arc has reached, and where it goes.
fn gliding(&self, now: Instant) -> Option<(f32, f32)> {
self.glide.map(|(from, to, since)| {
(
from + (to - from) * ease_out(progress(since, GLIDE, now)),
to,
)
})
}
/// The ticks without an anvil go dim.
pub fn dim(&mut self, now: Instant) {
self.dim = Some(now);
}
/// Lets go of what is over, and moves the wave on.
pub fn step(&mut self, now: Instant) {
self.trail
.retain(|(_, since)| progress(*since, TRAIL, now) < 1.);
self.lit_at = self.lit_at.filter(|since| progress(*since, POP, now) < 1.);
self.lap = self.lap.filter(|lap| {
now.saturating_duration_since(lap.since).as_secs_f32()
< lap.lasting.as_secs_f32() + TWINKLE_LIFE
});
self.fill = self.fill.filter(|since| {
now.saturating_duration_since(*since).as_secs_f32() < FILL.as_secs_f32() + TWINKLE_LIFE
});
self.dim = self.dim.filter(|since| progress(*since, DIM, now) < 1.);
self.glide = (self.glide).filter(|(_, _, since)| progress(*since, GLIDE, now) < 1.);
self.line_at = self
.line_at
.filter(|since| progress(*since, LINE, now) < 1.);
if self.wave.stepped.is_some() {
self.wave.step(now);
}
}
/// Whether anything still moves: the page asks for the next frame while it does.
pub fn moving(&self) -> bool {
self.lit_at.is_some()
|| !self.trail.is_empty()
|| self.lap.is_some()
|| self.fill.is_some()
|| self.dim.is_some()
|| self.glide.is_some()
|| self.line_at.is_some()
|| self.wave.stepped.is_some()
}
/// Shows the end state at once: the Windows « Show animations » setting is off.
pub fn still(&mut self) {
let scope = self.scope.take();
*self = RingLive {
scope,
..RingLive::default()
};
}
/// How visible the banner's line is while it comes in, 0 to 1.
pub fn line(&self, now: Instant) -> f32 {
self.line_at
.map_or(1., |since| 0.25 + 0.75 * progress(since, LINE, now))
}
/// What the ring's layer draws now.
pub fn frame(&self, now: Instant) -> Live {
let seconds = |since: Instant| now.saturating_duration_since(since).as_secs_f32();
let lap = self.lap;
let fill = self.fill.map(|since| (progress(since, FILL, now), since));
Live {
pop: self.lit_at.map(|since| progress(since, POP, now)),
trail: (self.trail.iter())
.map(|(id, since)| (*id, 1. - progress(*since, TRAIL, now)))
.collect(),
wave: (self.wave.height > 0.).then_some((self.wave.at, self.wave.height)),
light: lap
.map(|lap| (lap, progress(lap.since, lap.lasting, now)))
.filter(|(_, turn)| *turn < 1.)
.map(|(lap, turn)| {
let turned = ease_out(turn) * TAU;
Light {
head: if lap.clockwise { turned } else { TAU - turned },
clockwise: lap.clockwise,
glow: 0.95 * (PI * turn).sin(),
}
}),
filled: fill
.filter(|(reached, _)| *reached < 1.)
.map(|(reached, _)| reached * TAU),
dimming: self.dim.map(|since| 1. - progress(since, DIM, now)),
arc: self.gliding(now).filter(|(reached, to)| reached < to),
// The latest event makes the ticks twinkle.
sparkle: match (fill, lap) {
(Some((_, since)), _) => Some((seconds(since), FILL.as_secs_f32())),
(None, Some(lap)) => Some((seconds(lap.since), lap.lasting.as_secs_f32())),
(None, None) => None,
},
}
}
}
#[cfg(test)]
mod tests {
use std::time::{Duration, Instant};
use super::{RingLive, Scope, TRAIL_LENGTH};
use crate::ring::Live;
fn after(start: Instant, ms: u64) -> Instant {
start + Duration::from_millis(ms)
}
#[test]
fn at_rest_nothing_moves_and_nothing_is_drawn() {
let mut live = RingLive::default();
let now = Instant::now();
live.step(now);
assert!(!live.moving());
assert_eq!(live.frame(now), Live::default());
assert_eq!(live.line(now), 1.);
}
#[test]
fn the_lit_tick_pops_and_the_one_it_replaces_goes_out_in_a_trail() {
let mut live = RingLive::default();
let start = Instant::now();
live.relit(None, Some(1), start);
assert_eq!(live.frame(start).pop, Some(0.));
assert!(live.frame(start).trail.is_empty());
// Another tick: the first goes out, twice as long as a tick takes to pop.
live.relit(Some(1), Some(2), after(start, 100));
let frame = live.frame(after(start, 420));
assert_eq!(frame.trail, [(1, 0.5)]);
live.step(after(start, 420));
assert!(live.moving());
assert_eq!(live.frame(after(start, 420)).pop, None);
live.step(after(start, 740));
assert!(!live.moving());
// A tick lit again while it goes out is lit, not both.
live.relit(Some(2), Some(1), after(start, 800));
live.relit(Some(1), Some(2), after(start, 810));
assert_eq!(live.frame(after(start, 810)).trail, [(1, 1.)]);
}
#[test]
fn a_long_sweep_keeps_only_its_latest_ticks_going_out() {
let mut live = RingLive::default();
let start = Instant::now();
for id in 0..40 {
live.relit(Some(id), Some(id + 1), start);
}
let trail = live.frame(start).trail;
assert_eq!(trail.len(), TRAIL_LENGTH);
assert_eq!(trail.last().map(|(id, _)| *id), Some(39));
}
#[test]
fn the_wave_rises_where_the_pointer_comes_in_follows_it_and_settles() {
let mut live = RingLive::default();
let start = Instant::now();
assert!(live.aim(Some(1.), start));
// The same aim again, or another while the wave moves: its frames are asked for already.
assert!(!live.aim(Some(1.), start));
assert!(!live.aim(Some(1.1), start) && !live.aim(Some(1.), start));
// The banner's line comes in with it.
assert!(live.line(start) < 1.);
let mut now = start;
for _ in 0..20 {
now += Duration::from_millis(16);
live.step(now);
}
assert_eq!(live.frame(now).wave, Some((1., 1.)));
// Under a still pointer, no frame is asked for.
assert!(!live.moving());
// The pointer moves on: the wave follows with a delay, then catches up.
assert!(live.aim(Some(1.5), now));
now += Duration::from_millis(16);
live.step(now);
let (at, _) = live.frame(now).wave.unwrap();
assert!(at > 1. && at < 1.5, "{at}");
assert!(live.moving());
for _ in 0..120 {
now += Duration::from_millis(16);
live.step(now);
}
let (at, _) = live.frame(now).wave.unwrap();
assert!((at - 1.5).abs() < 0.01, "{at}");
assert!(!live.moving());
// The pointer leaves: the wave settles, and nothing is left.
assert!(live.aim(None, now));
assert!(!live.aim(None, now));
for _ in 0..40 {
now += Duration::from_millis(16);
live.step(now);
}
assert_eq!(live.frame(now), Live::default());
assert!(!live.moving());
}
#[test]
fn a_light_goes_once_round_the_way_of_the_veil_and_the_ticks_twinkle() {
let mut live = RingLive::default();
let start = Instant::now();
let lasting = Duration::from_millis(800);
live.lap(true, lasting, start);
let early = live.frame(after(start, 100)).light.unwrap();
let late = live.frame(after(start, 600)).light.unwrap();
assert!(early.clockwise && early.head < late.head);
assert!(live.frame(after(start, 100)).sparkle.is_some());
// The other way, it turns back from noon.
live.lap(false, lasting, start);
let back = live.frame(after(start, 100)).light.unwrap();
assert!(!back.clockwise);
assert!((back.head + early.head - std::f32::consts::TAU).abs() < 1e-4);
// The light is gone at the end; the last twinkles go out a little after, then rest.
live.step(after(start, 900));
assert!(live.moving());
assert_eq!(live.frame(after(start, 900)).light, None);
live.step(after(start, 1600));
assert!(!live.moving());
assert_eq!(live.frame(after(start, 1600)), Live::default());
}
#[test]
fn the_ring_fills_for_another_account_or_season_only() {
let mut live = RingLive::default();
let start = Instant::now();
let scope = |account: &str| Scope {
account: Some(account.to_owned()),
season: Some("Saison 2".into()),
};
// The first ticks are simply there, and so are the same Account's new ones.
live.shows(scope("a"), true, start);
live.shows(scope("a"), true, start);
assert_eq!(live.frame(start).filled, None);
// Another Account: the ring fills from noon.
live.shows(scope("b"), true, start);
let half = live.frame(after(start, 850)).filled.unwrap();
assert!((half - std::f32::consts::PI).abs() < 0.01, "{half}");
live.step(after(start, 3000));
assert!(!live.moving());
// With the animations off, they are simply there.
live.shows(scope("a"), false, after(start, 3000));
assert_eq!(live.frame(after(start, 3000)).filled, None);
}
#[test]
fn the_imports_arc_glides_to_its_new_value_from_where_it_is() {
let mut live = RingLive::default();
let start = Instant::now();
live.glide(0.2, 0.6, start);
// At first all of the new part is still to reach, then less, then none.
assert_eq!(live.frame(start).arc, Some((0.2, 0.6)));
let (reached, to) = live.frame(after(start, 300)).arc.unwrap();
assert!(reached > 0.4 && reached < 0.6 && to == 0.6, "{reached}");
// A new value meanwhile: it goes on from where it is.
live.glide(0.6, 0.9, after(start, 300));
assert_eq!(live.frame(after(start, 300)).arc, Some((reached, 0.9)));
live.step(after(start, 900));
assert!(!live.moving());
assert_eq!(live.frame(after(start, 900)), Live::default());
}
#[test]
fn the_setting_turned_off_stills_everything_and_remembers_the_scope() {
let mut live = RingLive::default();
let start = Instant::now();
let scope = Scope {
account: Some("a".to_owned()),
season: None,
};
live.shows(scope.clone(), true, start);
live.relit(Some(1), Some(2), start);
live.aim(Some(1.), start);
live.dim(start);
live.lap(true, Duration::from_millis(800), start);
live.still();
assert!(!live.moving());
assert_eq!(live.frame(start), Live::default());
// The same scope does not fill the ring afterwards.
live.shows(scope, true, start);
assert_eq!(live.frame(start).filled, None);
}
}
+8 -1
View File
@@ -87,12 +87,15 @@ impl Page {
let others_focus = cx.focus_handle().tab_stop(true);
let ring = cx.new(|_| Ring::new());
let banner_art = BannerArt::new(cx);
let others_hover = Self::light_and_reveal(&others_grid, cx);
let others_hover = Self::light_and_reveal(&others_grid, window, cx);
let matches = super::matches::Matches::new(&season_table, window, cx);
let mut subscriptions = Vec::new();
subscriptions.extend(Self::light_on_hover(&home_grid, cx));
subscriptions.extend(Self::light_on_hover(&anvil_grid, cx));
for grid in [&home_grid, &anvil_grid] {
subscriptions.push(Self::show_matches_on_choice(grid, window, cx));
}
subscriptions.extend([
friend_field,
// The Windows setting turned off: a transition running ends, a card lifting is
@@ -217,6 +220,7 @@ impl Page {
pinned: None,
shown: None,
progress: None,
import_view: Default::default(),
refresh: RefreshGate::default(),
stats_job: RefreshGate::default(),
stats_generation: 0,
@@ -229,6 +233,9 @@ impl Page {
shown_tab: Tab::Challenge,
fade: None,
frame_asked: false,
banner_at: Rc::default(),
ring_live: Default::default(),
screen_at: Rc::default(),
lifts: Lifts::new(),
lifted_by_keyboard: None,
covered: false,
+2
View File
@@ -32,6 +32,7 @@ impl Page {
self.accounts.clone_from(&directory.accounts);
self.last_active.clone_from(&directory.last_active);
self.friends.ids.clone_from(&directory.friends);
self.follow_replaced_puuids();
if self.pinned.as_ref() == self.status.updating.as_ref().map(|a| &a.puuid) {
self.pinned = None;
}
@@ -41,6 +42,7 @@ impl Page {
if changed {
// The live champ select's Account may now be in the list: resolve it again.
self.phase_riot_id = None;
self.import_view.signed_in = None;
}
if changed {
(self.account_select).update(cx, |select, cx| {
+4
View File
@@ -18,6 +18,8 @@ pub(crate) mod client_fixtures;
pub(crate) mod friends_fixtures;
mod grid;
mod home;
mod import_arc;
mod import_quota;
mod in_game;
mod in_game_end;
mod in_game_fixtures;
@@ -28,6 +30,7 @@ mod matches;
mod matches_auto_open;
mod matches_banner;
mod matches_bubble;
mod matches_by_champion;
mod matches_death_recap;
mod matches_details;
mod matches_end_animation;
@@ -40,6 +43,7 @@ mod navigation;
pub(crate) mod page_fixtures;
mod portraits;
mod ring_hover;
mod ring_live;
mod sorting;
mod sorting_fixtures;
mod statistics_tiles;
+1 -1
View File
@@ -177,7 +177,7 @@ async fn the_tick_stays_with_the_grid_that_lit_it(cx: &mut TestAppContext) {
// Folding « Autres champions » under a still pointer leaves the Anvil champion's tick
// lit: the grid it replaces only puts out a tick it lit.
page.update(cx, |page, cx| page.toggle_others(cx));
cx.update(|window, cx| page.update(cx, |page, cx| page.toggle_others(window, cx)));
draw(cx);
assert!(!others_open(&page, cx));
assert_eq!(lit(cx), Some(233));
+15 -9
View File
@@ -33,6 +33,12 @@ fn the_sheet_shows_on_hover_with_the_date_of_a_completed_champion_only(cx: &mut
);
}
/// Whether a card that rests 17 px up is on its way there or back: off its place, not at that
/// height, and no higher than the rebound of its height takes it (#171).
fn on_its_way(rise: f32) -> bool {
rise > 0. && rise != 17. && rise < 19.3
}
// The card under the pointer rises over the grid, from where the grid placed it, and settles
// back once left: the grid stays cached through it all, no card is built and no statistics
// are computed, and no frame is asked for once the cards are still.
@@ -56,20 +62,20 @@ fn hovering_a_card_lifts_it_over_the_grid_which_is_not_drawn_again(cx: &mut Test
assert_eq!(rise(cx, 2), Some(0.), "it jumped");
frame_after(cx, 100);
let rising = rise(cx, 2).expect("the card is not lifted");
assert!(rising > 0. && rising < 10., "{rising}");
assert!(on_its_way(rising), "{rising}");
// Its sheet slides up while it rises.
assert!(cx.debug_bounds("sheet-2").is_some());
settle(cx);
assert_eq!(rise(cx, 2), Some(10.));
assert_eq!(rise(cx, 2), Some(17.));
// To the next card: it rises while the one left settles back.
hover(cx, "card-3");
frame_after(cx, 100);
assert!(rise(cx, 2).is_some_and(|rise| rise > 0. && rise < 10.));
assert!(rise(cx, 3).is_some_and(|rise| rise > 0. && rise < 10.));
assert!(rise(cx, 2).is_some_and(on_its_way));
assert!(rise(cx, 3).is_some_and(on_its_way));
settle(cx);
assert_eq!(rise(cx, 2), None, "the card left stayed lifted");
assert_eq!(rise(cx, 3), Some(10.));
assert_eq!(rise(cx, 3), Some(17.));
cx.simulate_mouse_move(point(px(5.), px(5.)), None, Modifiers::none());
draw(cx);
@@ -97,7 +103,7 @@ fn a_greyed_card_rises_less_with_the_same_sheet(cx: &mut TestAppContext) {
hover(cx, "card-1");
assert_eq!(sheet_ids(cx, 12), [1]);
assert_eq!(sheet(cx, 1), Some(true));
assert_eq!(rise(cx, 1), Some(4.));
assert_eq!(rise(cx, 1), Some(7.));
}
#[gpui::test]
@@ -133,7 +139,7 @@ fn a_lifted_card_shows_its_figures_as_they_change(cx: &mut TestAppContext) {
hover(cx, "card-2");
assert_eq!(sheet_ids(cx, 12), [2]);
assert_eq!(sheet(cx, 2), Some(false));
assert_eq!(rise(cx, 2), Some(10.));
assert_eq!(rise(cx, 2), Some(17.));
let mut rows = sheet_champions(12);
rows[1].state = Some(ChampionState::Completed);
@@ -142,7 +148,7 @@ fn a_lifted_card_shows_its_figures_as_they_change(cx: &mut TestAppContext) {
draw(cx);
assert_eq!(sheet_ids(cx, 12), [2]);
assert_eq!(sheet(cx, 2), Some(true));
assert_eq!(rise(cx, 2), Some(4.));
assert_eq!(rise(cx, 2), Some(7.));
}
// A card the keyboard lifted goes down as soon as the pointer moves.
@@ -173,7 +179,7 @@ fn a_wheel_puts_the_card_down_even_at_the_end_of_the_list(cx: &mut TestAppContex
draw(cx);
hover(cx, "card-2");
settle(cx);
assert_eq!(rise(cx, 2), Some(10.));
assert_eq!(rise(cx, 2), Some(17.));
let at = center(cx, "card-2");
cx.simulate_event(ScrollEvent {
position: at,
@@ -254,7 +254,7 @@ pub(super) fn start_leaving(page: &Entity<Page>, window: &mut VisualTestContext)
/// Lets the champ select's entry or exit end, and the veil lift.
pub(super) fn finish_motion(page: &Entity<Page>, window: &mut VisualTestContext) {
for _ in 0..60 {
for _ in 0..120 {
let moving = page.read_with(window, |p, cx| {
p.leave.is_some() || p.fade.is_some() || p.stage_moving(cx)
});
@@ -17,7 +17,7 @@ use std::time::Duration;
// #87 on the Arena capture, step by step: the band of light and the title at once, then
// the Anvil champions (A to Z: Briar, Lee Sin, Rumble, Soraka, Xin Zhao) from the bottom of
// the window, the first at 380 ms then one every 110 ms, each in 700 ms. The hand's grid
// the window, the first at 760 ms then one every 220 ms, each in 1400 ms. The hand's grid
// stays cached through it all, and nothing is computed again.
#[gpui::test]
async fn the_entry_sweeps_the_window_brings_the_title_in_and_deals_the_hand(
@@ -39,31 +39,31 @@ async fn the_entry_sweeps_the_window_brings_the_title_in_and_deals_the_hand(
assert_eq!(below(cx, id), None, "{id} is dealt already");
}
// 400 ms: Briar comes up from the bottom of the window, Lee Sin waits.
frame_after(cx, 400);
// 800 ms: Briar comes up from the bottom of the window, Lee Sin waits.
frame_after(cx, 800);
let briar = below(cx, 233).expect("Briar is not dealt");
assert!(briar > 100., "{briar}");
assert_eq!(below(cx, 64), None);
let (opacity, rise) = title(cx).unwrap();
assert!(opacity > 0.5 && rise < 4., "{opacity} {rise}");
// 500 ms: Briar is higher, Lee Sin on its way.
frame_after(cx, 100);
// 1000 ms: Briar is higher, Lee Sin on its way.
frame_after(cx, 200);
assert!(below(cx, 233).unwrap() < briar);
assert!(below(cx, 64).is_some());
// 900 ms: the band of light is gone, the title in its place.
frame_after(cx, 400);
// 1800 ms: the band of light is gone, the title in its place.
frame_after(cx, 800);
assert!(cx.debug_bounds("sweep").is_none());
assert_eq!(title(cx), Some((1., 0.)));
// 1100 ms: Briar is in its place, the grid's own card; Xin Zhao is still on its way.
frame_after(cx, 200);
// 2200 ms: Briar is in its place, the grid's own card; Xin Zhao is still on its way.
frame_after(cx, 400);
assert_eq!(below(cx, 233), None);
assert!(below(cx, 5).is_some());
// 1600 ms: the whole hand is dealt, and the entry over.
frame_after(cx, 500);
// 3200 ms: the whole hand is dealt, and the entry over.
frame_after(cx, 1000);
for id in ANVIL_A_TO_Z {
assert_eq!(below(cx, id), None, "{id} is still moving");
}
@@ -78,17 +78,17 @@ async fn a_card_still_dealt_is_lifted_once_in_its_place(cx: &mut TestAppContext)
let cx = &mut window;
let lit = |cx: &mut VisualTestContext| page.read_with(cx, |p, cx| p.ring.read(cx).lit());
// Xin Zhao, the last card, leaves the bottom at 820 ms and is in its place at 1520.
frame_after(cx, 400);
hover(cx, "card-5");
// Xin Zhao, the last card, leaves the bottom at 1640 ms and is in its place at 3040.
frame_after(cx, 800);
hover(cx, "card-5");
frame_after(cx, 1600);
assert_eq!(rise(cx, 5), None);
assert_eq!(lit(cx), None);
frame_after(cx, 400);
frame_after(cx, 800);
settle(cx);
// Not offered: greyed, it rises less.
assert_eq!(rise(cx, 5), Some(4.));
assert_eq!(rise(cx, 5), Some(7.));
assert_eq!(lit(cx), Some(5));
}
@@ -100,10 +100,10 @@ async fn a_card_waited_for_is_lifted_even_when_it_lands_just_after_a_frame(
) {
let (page, mut window) = entering(cx, &frames()[0]).await;
let cx = &mut window;
frame_after(cx, 400);
frame_after(cx, 800);
hover(cx, "card-5");
// Xin Zhao is in its place at 1520 ms: the frame reads 1519, the draw 1520.
cx.executor().advance_clock(Duration::from_millis(1119));
// Xin Zhao is in its place at 3040 ms: the frame reads 3039, the draw 3040.
cx.executor().advance_clock(Duration::from_millis(2239));
cx.update(|window, cx| {
window.simulate_next_frame(cx);
cx.background_executor()
@@ -114,7 +114,7 @@ async fn a_card_waited_for_is_lifted_even_when_it_lands_just_after_a_frame(
frame_after(cx, 16);
assert!(page.read_with(cx, |p, _| p.hover_waiting.is_none()));
settle(cx);
assert_eq!(rise(cx, 5), Some(4.));
assert_eq!(rise(cx, 5), Some(7.));
assert_eq!(page.read_with(cx, |p, cx| p.ring.read(cx).lit()), Some(5));
}
@@ -129,8 +129,8 @@ async fn a_card_dealt_out_of_sight_is_not_built(cx: &mut TestAppContext) {
let hand = bounds(cx);
assert!(hand.iter().all(|card| card.top() >= px(340.)), "{hand:?}");
// 700 ms: Briar, Lee Sin and Rumble on their way, out of sight.
frame_after(cx, 700);
// 1400 ms: Briar, Lee Sin and Rumble on their way, out of sight.
frame_after(cx, 1400);
for id in ANVIL_A_TO_Z {
assert_eq!(below(cx, id), None, "{id} is built out of sight");
}
@@ -148,8 +148,8 @@ async fn the_pointer_moving_cancels_the_card_the_keyboard_waits_for(cx: &mut Tes
let cx = &mut window;
let lit = |cx: &mut VisualTestContext| page.read_with(cx, |p, cx| p.ring.read(cx).lit());
// 400 ms: Briar, the first card, is on its way.
frame_after(cx, 400);
// 800 ms: Briar, the first card, is on its way.
frame_after(cx, 800);
// Nothing precedes the Anvil row in the tab order: shift-tab from « Autres champions »
// lands on its last card.
let others = page.read_with(cx, |p, _| p.others_focus.clone());
@@ -176,7 +176,7 @@ async fn reasons_coming_during_the_deal_show_on_their_card_without_dealing_again
) {
let (page, mut window) = entering(cx, &frames()[0]).await;
let cx = &mut window;
frame_after(cx, 450);
frame_after(cx, 900);
let entry = page.read_with(cx, |p, _| p.entry);
let briar = below(cx, 233).unwrap();
@@ -218,10 +218,10 @@ async fn an_allys_confirmation_lowers_its_card_8_px_and_nothing_else_moves(
assert_eq!(below(cx, id), None, "{id} moved");
}
frame_after(cx, 175);
frame_after(cx, 350);
let halfway = below(cx, 233).unwrap();
assert!(halfway > -8. && halfway < 0., "{halfway}");
frame_after(cx, 350);
frame_after(cx, 700);
assert_eq!(below(cx, 233), None);
assert_eq!(hand.read_with(cx, |grid, _| grid.renders), renders);
assert_at_rest(cx);
@@ -235,24 +235,24 @@ async fn an_allys_confirmation_lowers_the_card_under_the_pointer_too(cx: &mut Te
let cx = &mut window;
hover(cx, "card-233");
settle(cx);
// Offered, it rises 10 px.
assert_eq!(rise(cx, 233), Some(10.));
// Offered, it rises 17 px.
assert_eq!(rise(cx, 233), Some(17.));
send(&page, cx, &with_bans_and_ally(&[], 233));
draw(cx);
// Greyed, it rises 4 px, from 8 px above its new place; as it was, where it was.
assert_eq!(rise(cx, 233), Some(12.));
// Greyed, it rises 7 px, from 8 px above its new place; as it was, where it was.
assert_eq!(rise(cx, 233), Some(15.));
let before = cx
.debug_bounds("lifted-before-233")
.expect("the card as it was");
let place = cx.debug_bounds("card-233").unwrap();
assert_eq!((place.origin.y - before.origin.y).as_f32(), 18.);
assert_eq!((place.origin.y - before.origin.y).as_f32(), 25.);
frame_after(cx, 175);
let halfway = rise(cx, 233).unwrap();
assert!(halfway > 4. && halfway < 12., "{halfway}");
frame_after(cx, 350);
assert_eq!(rise(cx, 233), Some(4.));
let halfway = rise(cx, 233).unwrap();
assert!(halfway > 7. && halfway < 15., "{halfway}");
frame_after(cx, 700);
assert_eq!(rise(cx, 233), Some(7.));
assert!(cx.debug_bounds("lifted-before-233").is_none());
assert_at_rest(cx);
}
@@ -269,7 +269,7 @@ async fn the_hand_leaves_from_the_last_card_then_the_home_comes_back_under_the_v
draw(cx);
assert!(page.read_with(cx, |p, _| p.in_champ_select()));
frame_after(cx, 100);
frame_after(cx, 200);
assert!(below(cx, 5).unwrap() > 0.);
assert_eq!(below(cx, 233), Some(0.));
assert_eq!(veil(&page, cx), 0.);
@@ -277,11 +277,11 @@ async fn the_hand_leaves_from_the_last_card_then_the_home_comes_back_under_the_v
hover(cx, "card-64");
assert_eq!(rise(cx, 64), None);
// From 240 ms, the veil covers the champ select; at 370 ms the home is under it.
frame_after(cx, 200);
// From 480 ms, the veil covers the champ select; at 680 ms the home is under it.
frame_after(cx, 400);
assert!(veil(&page, cx) > 0.);
assert!(cx.debug_bounds("anvil-row").is_some());
frame_after(cx, 100);
frame_after(cx, 150);
assert!(!page.read_with(cx, |p, _| p.in_champ_select()));
assert!(cx.debug_bounds("anvil-row").is_none());
assert!(veil(&page, cx) > 0.5);
@@ -300,8 +300,8 @@ async fn the_hand_leaves_from_the_last_card_then_the_home_comes_back_under_the_v
async fn the_cards_on_their_way_leave_from_where_they_are(cx: &mut TestAppContext) {
let (page, mut window) = entering(cx, &frames()[0]).await;
let cx = &mut window;
// 700 ms: Briar, Lee Sin and Rumble on their way, Soraka and Xin Zhao waiting.
frame_after(cx, 700);
// 1400 ms: Briar, Lee Sin and Rumble on their way, Soraka and Xin Zhao waiting.
frame_after(cx, 1400);
let on_their_way = [233, 64, 68].map(|id| below(cx, id).expect("not on its way"));
for id in [16, 5] {
assert_eq!(below(cx, id), None, "{id} is dealt already");
@@ -313,7 +313,7 @@ async fn the_cards_on_their_way_leave_from_where_they_are(cx: &mut TestAppContex
[233, 64, 68].map(|id| below(cx, id)),
on_their_way.map(Some)
);
frame_after(cx, 200);
frame_after(cx, 400);
for (id, was) in [233, 64, 68].into_iter().zip(on_their_way) {
let now = below(cx, id).unwrap_or_else(|| panic!("{id} is no longer seen"));
assert!(now > was, "{id} did not go down: {was} then {now}");
@@ -333,8 +333,8 @@ async fn a_lifted_or_lowered_card_leaves_from_where_it_is(cx: &mut TestAppContex
let cx = &mut window;
hover(cx, "card-64");
settle(cx);
// Greyed, Lee Sin rises 4 px.
assert_eq!(rise(cx, 64), Some(4.));
// Greyed, Lee Sin rises 7 px.
assert_eq!(rise(cx, 64), Some(7.));
// Briar taken by an ally 100 ms before the end: still above its new place.
send(&page, cx, &with_bans_and_ally(&[], 233));
draw(cx);
@@ -345,13 +345,13 @@ async fn a_lifted_or_lowered_card_leaves_from_where_it_is(cx: &mut TestAppContex
start_leaving(&page, cx);
draw(cx);
// Where they were, at once.
assert_eq!(rise(cx, 64), Some(4.));
assert_eq!(rise(cx, 64), Some(7.));
assert_eq!(below(cx, 233), Some(lowering));
// Then down from there.
frame_after(cx, 200);
frame_after(cx, 400);
let lee_sin = rise(cx, 64).expect("Lee Sin is no longer seen");
assert!(lee_sin < 4., "{lee_sin}");
assert!(lee_sin < 7., "{lee_sin}");
let briar = below(cx, 233).expect("Briar is no longer seen");
assert!(briar > lowering, "{lowering} then {briar}");
finish_motion(&page, cx);
@@ -439,10 +439,10 @@ async fn one_card_is_lifted_at_a_time_across_the_grids(cx: &mut TestAppContext)
};
hover(cx, Box::leak(format!("card-{id}").into_boxed_str()));
settle(cx);
assert_eq!(rise(cx, id), Some(10.));
assert_eq!(rise(cx, id), Some(17.));
hover(cx, "card-103");
settle(cx);
assert_eq!(rise(cx, 103), Some(10.));
assert_eq!(rise(cx, 103), Some(17.));
assert_eq!(rise(cx, id), None, "the hand's card stayed lifted");
assert_eq!(veil(cx), 0.);
}
@@ -465,10 +465,11 @@ async fn a_grid_no_longer_shown_asks_for_no_frame(cx: &mut TestAppContext) {
(p.lifts.lifted(hand, now).count(), p.lifts.veil(hand, now))
});
assert_eq!(lifting, (0, 0.));
// The home's card now under the still pointer rises in its turn, and its banner's splash
// fades in, then nothing moves.
// The home's card now under the still pointer rises in its turn, its banner's splash fades
// in and its ring fills for the Account it comes back to (#170), then nothing moves.
settle(cx);
settle(cx);
frame_after(cx, 3000);
frame_after(cx, 16);
let asked = cx.update(|window, cx| window.simulate_next_frame(cx));
assert_eq!(asked, 0, "a frame is asked for");
@@ -111,7 +111,7 @@ async fn in_the_hand_a_veil_lays_on_the_other_cards(cx: &mut TestAppContext) {
};
hover(cx, Box::leak(format!("card-{id}").into_boxed_str()));
settle(cx);
assert_eq!(rise(cx, id), Some(10.));
assert_eq!(rise(cx, id), Some(17.));
assert_eq!(veil(cx, &hand), 1.);
assert_eq!(hand.read_with(cx, |grid, _| grid.renders), renders);
@@ -126,6 +126,6 @@ async fn in_the_hand_a_veil_lays_on_the_other_cards(cx: &mut TestAppContext) {
let others = page.read_with(cx, |p, _| p.others_grid.clone());
hover(cx, "card-103");
settle(cx);
assert_eq!(rise(cx, 103), Some(10.));
assert_eq!(rise(cx, 103), Some(17.));
assert_eq!(veil(cx, &others), 0.);
}
@@ -1,10 +1,13 @@
//! The champ select scrolls as one page: the banner, the Anvil champions and « Autres
//! champions » move together, and the grid of the section builds only the rows in view.
use super::champ_select_fixtures::{click_others, frames, send};
use super::page_fixtures::{champions, draw, open_page_in_season, press, show, statistics};
use super::champ_select_fixtures::{click_others, finish_motion, frames, send};
use super::page_fixtures::{
champions, draw, open_page_in_season, press, show, start_switch, statistics,
};
use crate::card_grid::RevealRow;
use crate::page::Page;
use crate::motion::BannerCover;
use crate::page::{Page, Tab};
use gpui_kit::{
Entity, Pixels, ScrollDelta, ScrollEvent, TestAppContext, VisualTestContext, point, px,
};
@@ -143,3 +146,31 @@ async fn tab_from_the_search_enters_a_grid_below_the_window(cx: &mut TestAppCont
"{card:?}"
);
}
// #169: the veil spares the banner only where every screen draws it, at the top. A champ select
// scrolled takes it under the veil with the rest, as it leaves and as it comes back: it keeps
// its scrolling while another screen is shown.
#[gpui::test]
async fn the_veil_covers_the_banner_of_a_champ_select_scrolled(cx: &mut TestAppContext) {
let (page, mut window) = open_others(cx);
let cx = &mut window;
finish_motion(&page, cx);
let through = |cx: &mut VisualTestContext, tab: Tab| {
start_switch(&page, cx, tab);
let banner = page.read_with(cx, |p, _| p.fade.as_ref().map(|fade| fade.banner()));
finish_motion(&page, cx);
draw(cx);
banner
};
// At its top the banner stays in place, its text fading for the other screen's.
assert_eq!(through(cx, Tab::Challenge), Some(BannerCover::Retold));
assert_eq!(through(cx, Tab::ChampSelect), Some(BannerCover::Retold));
wheel(cx, -300.);
assert_eq!(through(cx, Tab::Challenge), Some(BannerCover::Covered));
assert_eq!(through(cx, Tab::ChampSelect), Some(BannerCover::Covered));
assert_eq!(scrolled(&page, cx), px(300.));
wheel(cx, 300.);
assert_eq!(through(cx, Tab::Challenge), Some(BannerCover::Retold));
}
@@ -11,6 +11,7 @@ use super::page_fixtures::{
switch_tab, veil,
};
use crate::card::Reason;
use crate::motion::FadePhase;
use crate::page::{Page, Tab};
use gpui_kit::{Entity, Modifiers, TestAppContext, VisualTestContext};
@@ -156,6 +157,22 @@ async fn the_selection_tab_goes_after_the_hand_leaves(app: &mut TestAppContext)
assert_eq!(shown_tab(&page, cx), Tab::ChampSelect);
assert!(cx.debug_bounds("anvil-row").is_some());
// The end chose the screen under the veil: it has no direction, as it covers and as it
// lifts off « Défi » (#169).
let mut lifting = 0;
for _ in 0..120 {
let veil = page.read_with(cx, |p, _| {
(p.fade.as_ref()).map(|fade| (fade.anchor(), fade.phase()))
});
if let Some((anchor, phase)) = veil {
assert_eq!(anchor, None, "{phase:?}");
lifting += usize::from(phase == FadePhase::In);
} else if page.read_with(cx, |p, _| p.leave.is_none()) {
break;
}
frame_after(cx, 50);
}
assert!(lifting > 0, "no veil lifted off « Défi »");
finish_motion(&page, cx);
assert_eq!(tab(&page, cx), Tab::Challenge);
assert_eq!(shown_tab(&page, cx), Tab::Challenge);
@@ -203,10 +220,15 @@ async fn an_end_during_a_switch_lets_the_hand_leave_under_the_veil_as_it_is(
) {
let (page, mut window) = page_in_champ_select(app, &frames()[0]).await;
let cx = &mut window;
let ring = page.read_with(cx, |p, _| p.ring.clone());
start_switch(&page, cx, Tab::Challenge);
let drawn = ring.read_with(cx, |ring, _| ring.renders);
frame_after(cx, 60);
let before = veil(&page, cx);
assert!(before > 0. && before < 1., "{before}");
// The banner stays in sight and its text fades for « Défi »'s (#169): beside it, the ring
// is not drawn again.
assert_eq!(ring.read_with(cx, |ring, _| ring.renders), drawn);
start_leaving(&page, cx);
assert!(page.read_with(cx, |p, _| p.leave.is_some()));
+38 -7
View File
@@ -1,6 +1,6 @@
//! The Riot source of the Friends' tests: Alice and Bob as in `TwoAccounts`, and Carl (a Friend
//! of the app's region, two Matches) and Dora (another region). A gate holds Carl's Matches
//! back, so a test sees an import under way.
//! back the first time each is fetched, so a test sees an import under way.
use super::client_fixtures::FakeClient;
use super::matches_fixtures::TwoAccounts;
@@ -43,6 +43,15 @@ pub(in crate::page) struct Handles {
pub(in crate::page) third: Arc<AtomicBool>,
/// The relay is down: it answers for no Riot ID.
pub(in crate::page) relay_down: Arc<AtomicBool>,
/// Carl has twelve Matches, `long` ones, instead: an import long enough to draw the arc.
pub(in crate::page) many: Arc<AtomicBool>,
/// Riot's key changed: Carl is now `Carl2`, his Matches the same.
pub(in crate::page) new_key: Arc<AtomicBool>,
}
/// The id of Carl's `i`th long Match.
fn long(i: usize) -> String {
format!("EUW1_92000000{i:02}")
}
struct Riot {
@@ -56,6 +65,11 @@ impl MatchHistorySource for Riot {
return Err(SourceError::Unavailable);
}
match game_name {
"Carl" if self.handles.new_key.load(Ordering::SeqCst) => Ok(Account {
puuid: "Carl2".into(),
game_name: game_name.into(),
tag_line: tag_line.into(),
}),
"Alice" | "Bob" | "Carl" | "Dora" => self.inner.resolve_account(game_name, tag_line),
_ => Err(SourceError::NotFound),
}
@@ -69,27 +83,42 @@ impl MatchHistorySource for Riot {
count: usize,
since: Option<i64>,
) -> Result<Vec<String>, SourceError> {
if puuid != "Carl" {
if !matches!(puuid, "Carl" | "Carl2") {
return self.inner.match_ids(puuid, queue_id, start, count, since);
}
if queue_id != 1750 || start != 0 {
return Ok(Vec::new());
}
if self.handles.many.load(Ordering::SeqCst) {
return Ok((0..12).map(long).collect());
}
let skip = usize::from(!self.handles.third.load(Ordering::SeqCst));
Ok(CARL[skip..].iter().map(|id| id.to_string()).collect())
}
fn fetch_match(&self, id: &str) -> Result<String, SourceError> {
let Some(at) = CARL.iter().position(|carl| *carl == id) else {
let long_at = (0..12).find(|i| long(*i) == id);
let Some(at) = CARL.iter().position(|carl| *carl == id).or(long_at) else {
return self.inner.fetch_match(id);
};
self.handles.gate.pass();
// A Match fetched again (the proof of a changed PUUID) is not one the import waits for.
if !self.handles.fetched.lock().unwrap().iter().any(|f| f == id) {
self.handles.gate.pass();
}
self.handles.fetched.lock().unwrap().push(id.into());
let start = ["1794000000000", "1792000000000", "1790000000000"][at];
let carl = if self.handles.new_key.load(Ordering::SeqCst) {
"Carl2"
} else {
"Carl"
};
let start = match long_at {
Some(i) => (1_790_000_000_000_i64 + i as i64 * 1000).to_string(),
None => ["1794000000000", "1792000000000", "1790000000000"][at].into(),
};
Ok(MATCH_1750
.replace("EUW1_9000000006", id)
.replace("1794763752767", start)
.replace("fixture-puuid-self", "Carl"))
.replace("1794763752767", &start)
.replace("fixture-puuid-self", carl))
}
fn account_platform(&self, puuid: &str) -> Result<String, SourceError> {
@@ -111,7 +140,9 @@ pub(in crate::page) fn tracker() -> (Tracker, Arc<Mutex<String>>, Handles) {
}),
fetched: Arc::default(),
third: Arc::default(),
many: Arc::default(),
relay_down: Arc::default(),
new_key: Arc::default(),
};
let client = FakeClient::new("Alice");
let source = Riot {
+284
View File
@@ -0,0 +1,284 @@
//! The import's arc on the ring (#140): shown for the import of the Account displayed, once it
//! is 10 Matches long, and the ring stays a cached view while it advances. The Riot source of
//! the Friend's import is simulated (`friends_fixtures`); the own sync's progress arrives as the
//! follower's does, through `Page::apply`.
use super::banner_fixtures::ring_renders;
use super::friends_fixtures::{Handles, tracker};
use super::page_fixtures::{champions, draw, open_page_with_tracker, show, statistics};
use crate::card_grid::CardHovered;
use crate::page::Page;
use crate::worker::Msg;
use arena_tracker_core::SyncProgress;
use gpui_kit::{
Entity, Modifiers, ScrollDelta, ScrollEvent, TestAppContext, VisualTestContext, point, px,
};
use std::cell::Cell;
use std::rc::Rc;
use std::sync::atomic::Ordering;
use std::time::Duration;
/// The page on Alice (signed in to the client), Carl stored as a Friend and not imported yet.
pub(super) async fn on_alice(
cx: &mut TestAppContext,
) -> (Entity<Page>, VisualTestContext, Handles) {
cx.executor().allow_parking();
let (tracker, _, handles) = tracker();
tracker.add_friend("Carl#EUW").unwrap();
let (page, window) = open_page_with_tracker(cx, tracker);
cx.condition(&page, |p, _| p.stats.is_some() && !p.pending_round)
.await;
(page, window, handles)
}
pub(super) fn progress(fetched: usize, to_fetch: usize) -> SyncProgress {
SyncProgress {
fetched,
to_fetch,
..Default::default()
}
}
/// A message of the worker, as the page receives it.
pub(super) fn tell(page: &Entity<Page>, cx: &mut VisualTestContext, msg: Msg) {
cx.update(|window, cx| page.update(cx, |page, cx| page.apply(msg, window, cx)));
}
pub(super) fn arc(page: &Entity<Page>, cx: &mut VisualTestContext) -> Option<(usize, usize)> {
page.read_with(cx, |p, cx| p.ring.read(cx).progress())
}
pub(super) fn choose(page: &Entity<Page>, cx: &mut VisualTestContext, puuid: &str) {
cx.update(|window, cx| page.update(cx, |p, cx| p.choose_account(puuid, window, cx)));
}
/// One second of the test clock, the timers having fired.
pub(super) fn second(cx: &mut VisualTestContext) {
cx.executor().advance_clock(Duration::from_secs(1));
cx.run_until_parked();
draw(cx);
}
fn round(page: &Entity<Page>, cx: &mut VisualTestContext) -> Msg {
Msg::Round {
status: page.read_with(cx, |p, _| p.tracker.status()),
reload: false,
matches: Vec::new(),
game_end: None,
}
}
#[gpui::test]
async fn the_own_sync_of_the_account_shown_draws_the_arc_until_it_ends(cx: &mut TestAppContext) {
let (page, mut window, _) = on_alice(cx).await;
let cx = &mut window;
assert_eq!(arc(&page, cx), None);
// A sync of fewer than 10 Matches never flashes it.
tell(&page, cx, Msg::Progress(progress(1, 9)));
assert_eq!(arc(&page, cx), None);
tell(&page, cx, Msg::Progress(progress(0, 12)));
assert_eq!(arc(&page, cx), Some((0, 12)));
second(cx);
tell(&page, cx, Msg::Progress(progress(5, 12)));
assert_eq!(arc(&page, cx), Some((5, 12)));
// It goes with the sync, and does not come back for the next short one.
let end = round(&page, cx);
tell(&page, cx, end);
assert_eq!(arc(&page, cx), None);
tell(&page, cx, Msg::Progress(progress(1, 2)));
assert_eq!(arc(&page, cx), None);
}
#[gpui::test]
async fn the_sync_of_another_account_than_the_one_shown_draws_no_arc(cx: &mut TestAppContext) {
let (page, mut window, _) = on_alice(cx).await;
let cx = &mut window;
choose(&page, cx, "Bob");
tell(&page, cx, Msg::Progress(progress(2, 12)));
assert_eq!(arc(&page, cx), None);
// Back on Alice, whose sync it is: the arc is there at once.
choose(&page, cx, "Alice");
assert_eq!(arc(&page, cx), Some((2, 12)));
choose(&page, cx, "Bob");
assert_eq!(arc(&page, cx), None);
}
#[gpui::test]
async fn a_friends_import_draws_the_arc_while_the_friend_is_shown_and_ends_with_it(
cx: &mut TestAppContext,
) {
let (page, mut window, handles) = on_alice(cx).await;
handles.gate.set(false);
choose(&page, &mut window, "Carl");
cx.condition(&page, |p, _| {
p.friend_status().as_deref() == Some("Import de Carl : 0 / 2 Parties")
})
.await;
let cx = &mut window;
// Two Matches: no arc.
assert_eq!(arc(&page, cx), None);
let friend = |progress| Msg::FriendProgress {
puuid: "Carl".into(),
progress,
};
tell(&page, cx, friend(progress(3, 12)));
assert_eq!(arc(&page, cx), Some((3, 12)));
second(cx);
tell(&page, cx, friend(progress(4, 12)));
assert_eq!(arc(&page, cx), Some((4, 12)));
// Another Account shown: only the status line tells the import goes on.
choose(&page, cx, "Alice");
assert_eq!(arc(&page, cx), None);
choose(&page, cx, "Carl");
assert_eq!(arc(&page, cx), Some((4, 12)));
handles.gate.set(true);
cx.condition(&page, |p, _| p.friends.import_running().is_none())
.await;
assert_eq!(arc(&page, &mut window), None);
}
// The worker runs the import, the simulated Riot source gives Carl twelve Matches.
#[gpui::test]
async fn a_real_import_of_twelve_matches_draws_the_arc_while_it_runs_and_not_after(
cx: &mut TestAppContext,
) {
let (page, mut window, handles) = on_alice(cx).await;
handles.many.store(true, Ordering::SeqCst);
handles.gate.set(false);
choose(&page, &mut window, "Carl");
cx.condition(&page, |p, cx| p.ring.read(cx).progress() == Some((0, 12)))
.await;
handles.gate.set(true);
cx.condition(&page, |p, _| p.friends.import_running().is_none())
.await;
assert_eq!(arc(&page, &mut window), None);
assert_eq!(handles.fetched.lock().unwrap().len(), 12);
}
#[gpui::test]
async fn a_crash_takes_the_arc_away(cx: &mut TestAppContext) {
let (page, mut window, _) = on_alice(cx).await;
let cx = &mut window;
tell(&page, cx, Msg::Progress(progress(0, 12)));
assert_eq!(arc(&page, cx), Some((0, 12)));
tell(&page, cx, Msg::Crashed);
assert_eq!(arc(&page, cx), None);
}
// Rule #1: the ring is drawn again for the arc appearing, disappearing and a new count at most
// once a second, never by a second of waiting, a hover or a scroll elsewhere.
#[gpui::test]
async fn the_ring_is_drawn_again_only_for_the_arc_and_at_most_once_a_second(
cx: &mut TestAppContext,
) {
let (page, mut window, _) = on_alice(cx).await;
let cx = &mut window;
show(&page, cx, statistics(0, 170, champions(170)));
draw(cx);
let renders = ring_renders(&page, cx);
let tessellations = |page: &Entity<Page>, cx: &mut VisualTestContext| {
page.read_with(cx, |p, cx| p.ring.read(cx).tessellations.get())
};
tell(&page, cx, Msg::Progress(progress(1, 12)));
draw(cx);
assert_eq!(ring_renders(&page, cx), renders + 1);
// Two messages within the same second: no more drawing.
tell(&page, cx, Msg::Progress(progress(2, 12)));
tell(&page, cx, Msg::Progress(progress(3, 12)));
draw(cx);
assert_eq!(ring_renders(&page, cx), renders + 1);
// The pointer on a card lights its tick, once; elsewhere on the card nothing changes.
let grid = page.read_with(cx, |p, _| p.home_grid.clone());
let card = cx.debug_bounds("card-1").unwrap();
cx.simulate_mouse_move(card.center(), None, Modifiers::none());
draw(cx);
assert_eq!(page.read_with(cx, |p, cx| p.ring.read(cx).lit()), Some(1));
assert_eq!(ring_renders(&page, cx), renders + 2);
cx.simulate_mouse_move(
card.center() + point(px(10.), px(10.)),
None,
Modifiers::none(),
);
draw(cx);
assert_eq!(ring_renders(&page, cx), renders + 2);
// The grid scrolls under the pointer: the ring is drawn again only for each change of the
// card under it, and the arc is not tessellated again.
let changes = Rc::new(Cell::new(0));
let _subscription = cx.update(|_, cx| {
let changes = changes.clone();
cx.subscribe(&grid, move |_, _: &CardHovered, _| {
changes.set(changes.get() + 1)
})
});
let at = card.center();
let made = tessellations(&page, cx);
for _ in 0..3 {
let (was_changed, was_drawn) = (changes.get(), ring_renders(&page, cx));
cx.simulate_event(ScrollEvent {
position: at,
delta: ScrollDelta::Pixels(point(px(0.), px(-200.))),
..Default::default()
});
draw(cx);
assert_eq!(
ring_renders(&page, cx) - was_drawn,
changes.get() - was_changed
);
}
assert!(
changes.get() > 0,
"no scroll changed the card under the pointer"
);
assert!(grid.read_with(cx, |grid, _| grid.scrolled()) > px(0.));
assert_eq!(tessellations(&page, cx), made);
let scrolled = ring_renders(&page, cx);
// The next second brings the count, once, however many messages.
second(cx);
tell(&page, cx, Msg::Progress(progress(4, 12)));
tell(&page, cx, Msg::Progress(progress(5, 12)));
draw(cx);
assert_eq!(arc(&page, cx), Some((4, 12)));
assert_eq!(ring_renders(&page, cx), scrolled + 1);
// Another tick lit draws the ring again, but tessellates nothing: the arc is kept.
let made = tessellations(&page, cx);
let lit = page.read_with(cx, |p, cx| p.ring.read(cx).lit());
let other = if lit == Some(2) { 3 } else { 2 };
cx.update(|_, cx| {
page.update(cx, |p, cx| {
p.ring.update(cx, |r, cx| r.set_lit(Some(other), cx))
})
});
draw(cx);
assert_eq!(ring_renders(&page, cx), scrolled + 2);
assert_eq!(tessellations(&page, cx), made);
// The end: it goes, once.
let end = round(&page, cx);
tell(&page, cx, end);
draw(cx);
assert_eq!(ring_renders(&page, cx), scrolled + 3);
}
// An Account signed in to the client that the page has not read yet is not the previous one.
#[gpui::test]
async fn an_import_of_a_signed_in_account_not_read_yet_draws_no_arc(cx: &mut TestAppContext) {
let (page, mut window, _) = on_alice(cx).await;
let cx = &mut window;
page.update(cx, |p, _| p.accounts.retain(|a| a.puuid != "Alice"));
tell(&page, cx, Msg::Progress(progress(0, 12)));
assert_eq!(arc(&page, cx), None);
}
+150
View File
@@ -0,0 +1,150 @@
//! The status line while the import waits for the Riot quota (#140): the seconds left, counted
//! down by one timer that exists only for the wait.
use super::banner_fixtures::ring_renders;
use super::import_arc::{arc, choose, on_alice, progress, second, tell};
use super::page_fixtures::draw;
use crate::page::Page;
use crate::worker::Msg;
use arena_tracker_core::SyncProgress;
use gpui_kit::{Entity, TestAppContext, VisualTestContext};
use std::cell::Cell;
use std::rc::Rc;
use std::time::Duration;
fn line(page: &Entity<Page>, cx: &mut VisualTestContext) -> String {
page.read_with(cx, |p, cx| {
p.status_line(cx.background_executor().now()).to_string()
})
}
fn waiting(fetched: usize, to_fetch: usize, secs: u64) -> SyncProgress {
SyncProgress {
quota_wait: Some(Duration::from_secs(secs)),
..progress(fetched, to_fetch)
}
}
/// How many times the page is told it changed from now on.
fn notifications(page: &Entity<Page>, cx: &mut VisualTestContext) -> Rc<Cell<usize>> {
let told = Rc::new(Cell::new(0));
let counted = told.clone();
cx.update(|_, cx| {
cx.observe(page, move |_, _| counted.set(counted.get() + 1))
.detach()
});
told
}
#[gpui::test]
async fn the_own_sync_counts_the_wait_down_then_the_import_line_comes_back(
cx: &mut TestAppContext,
) {
let (page, mut window, _) = on_alice(cx).await;
let cx = &mut window;
tell(&page, cx, Msg::Progress(progress(3, 12)));
assert_eq!(line(&page, cx), "Import en cours : 3 / 12 Parties");
tell(&page, cx, Msg::Progress(waiting(3, 12, 12)));
assert_eq!(line(&page, cx), "Quota Riot atteint : reprise dans 12 s");
second(cx);
assert_eq!(line(&page, cx), "Quota Riot atteint : reprise dans 11 s");
cx.executor().advance_clock(Duration::from_millis(500));
// Rounded up: 10.5 s left say 11.
assert_eq!(line(&page, cx), "Quota Riot atteint : reprise dans 11 s");
for _ in 0..10 {
second(cx);
}
assert_eq!(line(&page, cx), "Quota Riot atteint : reprise dans 1 s");
tell(&page, cx, Msg::Progress(progress(3, 12)));
assert_eq!(line(&page, cx), "Import en cours : 3 / 12 Parties");
}
#[gpui::test]
async fn a_wait_that_passed_without_news_falls_back_to_the_import_line(cx: &mut TestAppContext) {
let (page, mut window, _) = on_alice(cx).await;
let cx = &mut window;
tell(&page, cx, Msg::Progress(waiting(3, 12, 2)));
second(cx);
second(cx);
assert_eq!(line(&page, cx), "Import en cours : 3 / 12 Parties");
}
#[gpui::test]
async fn nothing_ticks_before_a_wait_nor_after_it(cx: &mut TestAppContext) {
let (page, mut window, _) = on_alice(cx).await;
let cx = &mut window;
let told = notifications(&page, cx);
for _ in 0..3 {
second(cx);
}
assert_eq!(told.get(), 0);
// The wait: the page is drawn again each second, and the ring is not.
tell(&page, cx, Msg::Progress(progress(3, 12)));
draw(cx);
let renders = ring_renders(&page, cx);
tell(&page, cx, Msg::Progress(waiting(3, 12, 30)));
let before = told.get();
for _ in 0..3 {
second(cx);
}
assert_eq!(told.get() - before, 3);
assert_eq!(ring_renders(&page, cx), renders);
assert_eq!(arc(&page, cx), Some((3, 12)));
// Resumed: the timer has ended itself.
tell(&page, cx, Msg::Progress(progress(4, 12)));
let before = told.get();
for _ in 0..3 {
second(cx);
}
assert_eq!(told.get(), before);
}
#[gpui::test]
async fn a_friends_import_tells_its_wait_too_and_the_own_sync_keeps_its_priority(
cx: &mut TestAppContext,
) {
let (page, mut window, handles) = on_alice(cx).await;
handles.gate.set(false);
choose(&page, &mut window, "Carl");
cx.condition(&page, |p, _| {
p.friend_status().as_deref() == Some("Import de Carl : 0 / 2 Parties")
})
.await;
let cx = &mut window;
let friend = |progress| Msg::FriendProgress {
puuid: "Carl".into(),
progress,
};
tell(&page, cx, friend(waiting(0, 2, 5)));
assert_eq!(line(&page, cx), "Quota Riot atteint : reprise dans 5 s");
second(cx);
assert_eq!(line(&page, cx), "Quota Riot atteint : reprise dans 4 s");
// The own sync's line comes first, waiting or not.
tell(&page, cx, Msg::Progress(progress(1, 12)));
assert_eq!(line(&page, cx), "Import en cours : 1 / 12 Parties");
tell(&page, cx, Msg::Progress(waiting(1, 12, 20)));
assert_eq!(line(&page, cx), "Quota Riot atteint : reprise dans 20 s");
// Its end brings the Friend's wait back, still counting.
let status = page.read_with(cx, |p, _| p.tracker.status());
let end = Msg::Round {
status,
reload: false,
matches: Vec::new(),
game_end: None,
};
tell(&page, cx, end);
assert_eq!(line(&page, cx), "Quota Riot atteint : reprise dans 4 s");
second(cx);
assert_eq!(line(&page, cx), "Quota Riot atteint : reprise dans 3 s");
tell(&page, cx, friend(progress(0, 2)));
assert_eq!(line(&page, cx), "Import de Carl : 0 / 2 Parties");
handles.gate.set(true);
}
+24 -1
View File
@@ -7,8 +7,9 @@ use super::in_game_fixtures::{
GAME, in_game_ready, joueur_in_champ_select, joueur_in_game, joueur_in_lobby, tell,
};
use super::matches_auto_open::tabs;
use super::page_fixtures::{draw, switch_tab};
use super::page_fixtures::{draw, frame_after, switch_tab};
use crate::card::sheet_lines;
use crate::motion::{BannerCover, Side};
use crate::page::home::IDENTIFYING;
use crate::page::{Page, Tab};
use crate::text::short_date;
@@ -427,3 +428,25 @@ async fn a_live_match_comes_out_of_the_veil_when_the_window_shows(app: &mut Test
finish_motion(&page, cx);
assert_eq!(tabs(&page, cx), (Tab::InGame, Tab::InGame));
}
// #169: « En partie » is the last tab of the top bar: the veil of the game's start comes in from
// the right, the banner in its place saying something else.
#[gpui::test]
async fn the_start_of_a_live_match_veils_the_screen_from_the_right(app: &mut TestAppContext) {
let (page, mut window, mut client, _) = joueur_in_lobby(app).await;
client.set(GamePhase::InGame, true, Some(233));
client.read(&page, &mut window);
assert_eq!(tabs(&page, &mut window), (Tab::InGame, Tab::Challenge));
let laid = page.read_with(&window, |p, _| {
(p.fade.as_ref()).map(|fade| (fade.anchor(), fade.banner()))
});
assert_eq!(laid, Some((Some(Side::Right), BannerCover::Retold)));
// Lifting, it leaves by the left.
frame_after(&mut window, 210);
assert_eq!(tabs(&page, &mut window), (Tab::InGame, Tab::InGame));
let lifting = page.read_with(&window, |p, _| {
p.fade.as_ref().and_then(|fade| fade.anchor())
});
assert_eq!(lifting, Some(Side::Left));
finish_motion(&page, &mut window);
}
+10 -1
View File
@@ -10,6 +10,7 @@ use super::matches_auto_open::{
use super::matches_fixtures::chosen;
use super::matches_provisional::{GAME, MATCH};
use super::page_fixtures::draw;
use crate::motion::{BannerCover, Side};
use crate::page::{Page, Tab};
use arena_tracker_core::GamePhase;
use gpui_kit::{Entity, VisualTestContext};
@@ -35,6 +36,12 @@ async fn the_block_of_the_live_match_opens_its_recap_in_place_of_en_partie(
let mut client = alice_plays(&page, &fake, &mut window);
game_ends(&page, &fake, &mut window);
// « Parties » is left of « En partie » in the top bar: the veil comes in from the left, the
// banner in its place saying something else (#169).
let laid = page.read_with(&window, |p, _| {
(p.fade.as_ref()).map(|fade| (fade.anchor(), fade.banner()))
});
assert_eq!(laid, Some((Some(Side::Left), BannerCover::Retold)));
settle_tabs(&page, &mut window);
assert_eq!(tabs(&page, &mut window), (Tab::Matches, Tab::Matches));
assert_eq!(opened.get(), 1);
@@ -69,11 +76,13 @@ async fn with_the_preference_off_the_block_of_the_live_match_shows_the_challenge
game_ends(&page, &fake, &mut window);
settle_tabs(&page, &mut window);
assert_eq!(tabs(&page, &mut window), (Tab::Challenge, Tab::Challenge));
assert_eq!(opened.get(), 0);
assert_eq!(opened.get(), 1);
client.lobby();
client.read(&page, &mut window);
settle_tabs(&page, &mut window);
assert_eq!(tabs(&page, &mut window), (Tab::Challenge, Tab::Challenge));
// The lobby that follows decides nothing more.
assert_eq!(opened.get(), 1);
draw(&mut window);
assert!(window.debug_bounds("tab-in-game").is_none());
}
+5 -5
View File
@@ -123,14 +123,14 @@ fn the_strongest_hidden_match_plays_on_its_own_tick_without_rebuilding_the_grid_
|cx: &mut VisualTestContext| page.read_with(cx, |p, cx| p.home_grid.read(cx).renders);
let in_flight = grid_renders(cx);
for _ in 0..3 {
frame_after(cx, 200);
frame_after(cx, 400);
}
assert_eq!(grid_renders(cx), in_flight);
// The first last-Match line can change the banner's height once, at arrival.
frame_after(cx, 200);
frame_after(cx, 400);
let arrived = grid_renders(cx);
for _ in 0..10 {
frame_after(cx, 200);
frame_after(cx, 400);
}
assert_eq!(grid_renders(cx), arrived);
assert_eq!(baseline(cx), first);
@@ -236,7 +236,7 @@ fn a_card_the_filter_leaves_out_stays_until_its_match_has_played(cx: &mut TestAp
assert_eq!(home_names(&page, cx), ["Garen", "Zyra", "Lux"]);
for _ in 0..10 {
frame_after(cx, 200);
frame_after(cx, 400);
}
assert!(page.read_with(cx, |p, _| p.playback.animation.is_none()));
assert_eq!(home_names(&page, cx), ["Zyra", "Lux"]);
@@ -304,7 +304,7 @@ fn only_the_last_match_settles_into_the_banner(cx: &mut TestAppContext) {
let (name, revealing) = shown_splash(cx);
assert_eq!((name.as_deref(), revealing), (Some(expected.0), expected.1));
for _ in 0..10 {
frame_after(cx, 200);
frame_after(cx, 400);
}
}
}
@@ -96,7 +96,7 @@ pub(super) fn home_names(
/// Frames until the comet of the animation playing lands.
pub(super) fn until_landed(page: &Entity<Page>, cx: &mut VisualTestContext) {
for _ in 0..20 {
for _ in 0..40 {
frame_after(cx, 100);
if page.read_with(cx, |p, _| p.playback.previous_banner.is_none()) {
return;
@@ -7,7 +7,7 @@ use super::matches_provisional::{GAME, LEFT_AT_MS, MATCH, block, tracker_before_
use super::page_fixtures::{draw, frame_after, open_page_with_tracker, season, switch_tab};
use crate::page::ALL_SEASONS;
use crate::page::matches::Recap;
use crate::page::{Page, RecapOpened, Tab};
use crate::page::{MatchEndShown, Page, Tab};
use crate::worker::Msg;
use arena_tracker_core::{ChampSelect, FollowedMatch, Format, GameEnd, MatchEnd, SeasonScope};
use gpui_kit::component::select::SelectEvent;
@@ -16,7 +16,7 @@ use std::cell::Cell;
use std::rc::Rc;
/// The page on Alice's Matches before the game ends, Alice's client, which holds its block, and
/// how many times the page said it opened a recap.
/// how many times the page said it showed the end of a game.
pub(super) fn before_the_end(
cx: &mut TestAppContext,
) -> (Entity<Page>, VisualTestContext, FakeClient, Rc<Cell<usize>>) {
@@ -33,7 +33,7 @@ fn before_the_end_in(
let opened = Rc::new(Cell::new(0));
let counted = opened.clone();
window.update(|_, cx| {
cx.subscribe(&page, move |_, _: &RecapOpened, _| {
cx.subscribe(&page, move |_, _: &MatchEndShown, _| {
counted.set(counted.get() + 1)
})
.detach()
@@ -84,7 +84,7 @@ fn round(page: &Entity<Page>, cx: &mut VisualTestContext, now_ms: i64) -> Vec<Fo
/// Lets the transition between the tabs end.
pub(super) fn settle_tabs(page: &Entity<Page>, cx: &mut VisualTestContext) {
for _ in 0..10 {
for _ in 0..20 {
if page.read_with(cx, |p, _| p.fade.is_none()) {
return draw(cx);
}
@@ -224,7 +224,7 @@ async fn with_the_preference_off_the_challenge_shows_and_the_match_is_listed(
settle_tabs(&page, &mut window);
assert_eq!(tabs(&page, &mut window), (Tab::Challenge, Tab::Challenge));
assert_eq!(opened.get(), 0);
assert_eq!(opened.get(), 1);
// In the history all the same: « Parties » opened by hand chooses it, the most recent.
switch_tab(&page, &mut window, Tab::Matches);
its_recap(&page, cx).await;
@@ -306,7 +306,7 @@ async fn a_game_that_ends_without_its_block_shows_the_challenge(cx: &mut TestApp
game_ends_without_its_block(&page, &mut window, 9_000_000_022);
settle_tabs(&page, &mut window);
assert_eq!(tabs(&page, &mut window), (Tab::Challenge, Tab::Challenge));
assert_eq!(opened.get(), 0);
assert_eq!(opened.get(), 2);
left_alone(&mut window, true);
}
@@ -0,0 +1,211 @@
//! A champion's card opens « Parties » on its Matches (#166): from the Challenge and from both
//! grids of a champ select, with a click or with Enter, in every Placement, the Season and
//! Format of « Statistiques » kept. The field names the champion until the player edits it.
use super::champ_select_fixtures::{
ANVIL_A_TO_Z, activate, below, click_others, finish_motion, frames, joueur_tracker_with,
page_in_champ_select, send, start_leaving, with_bans_and_ally,
};
use super::matches_auto_open::{before_the_end, game_ends, its_recap, settle_tabs, tabs};
use super::matches_filters::{click, open, search, seasons, some};
use super::matches_fixtures::{ALICE, MORE, chosen, listed, recap_id, recap_ready};
use super::matches_provisional::MATCH;
use super::page_fixtures::{
center, champions, draw, focus_sort, open_page_with_tracker, press, show, statistics,
switch_tab, tall,
};
use crate::page::{Page, Tab};
use arena_tracker_core::{Champion, SeasonScope, Statistics};
use gpui_kit::{Entity, Modifiers, SharedString, TestAppContext, VisualTestContext};
/// Irelia and Ahri on the Challenge, never played in the Season.
fn irelia_and_ahri() -> Statistics {
let mut rows = champions(2);
for (row, (id, name)) in rows.iter_mut().zip([(39, "Irelia"), (103, "Ahri")]) {
row.champion = Champion {
id,
key: name.into(),
name: name.into(),
};
}
statistics(0, 2, rows)
}
/// The Challenge shows Irelia and Ahri.
fn on_the_challenge(page: &Entity<Page>, cx: &mut VisualTestContext) {
switch_tab(page, cx, Tab::Challenge);
show(page, cx, irelia_and_ahri());
draw(cx);
}
/// Clicks the card `id`, and lets the switch to « Parties » end.
fn click_card(page: &Entity<Page>, cx: &mut VisualTestContext, id: &'static str) {
let at = center(cx, id);
cx.simulate_click(at, Modifiers::none());
settle_tabs(page, cx);
}
/// The text of the search field of « Parties ».
fn field(page: &Entity<Page>, cx: &mut VisualTestContext) -> String {
page.read_with(cx, |p, cx| {
p.matches.search_input().read(cx).value().to_string()
})
}
#[gpui::test]
async fn a_challenge_card_shows_its_champions_matches_in_every_placement(app: &mut TestAppContext) {
let (page, mut window) = open(app, seasons()).await;
let cx = &mut window;
click(cx, "matches-placement-top1");
assert_eq!(listed(&page, cx), some(&[1]));
on_the_challenge(&page, cx);
let scope = page.read_with(cx, |p, _| (p.season.clone(), p.format));
assert_eq!(scope.0, SeasonScope::Season("Saison 2".into()));
click_card(&page, cx, "card-39");
assert_eq!(tabs(&page, cx), (Tab::Matches, Tab::Matches));
// Every Placement again, in the Season and Format the selectors still show: Irelia's
// Matches of « Saison 2 », the most recent chosen.
assert_eq!(listed(&page, cx), some(&[0, 1]));
assert_eq!(
page.read_with(cx, |p, _| (p.season.clone(), p.format)),
scope
);
assert_eq!(field(&page, cx), "Irelia");
assert_eq!(chosen(&page, cx).as_deref(), Some(MORE[0]));
recap_ready(&page, app).await;
assert_eq!(recap_id(&page, &mut window).as_deref(), Some(MORE[0]));
}
#[gpui::test]
async fn the_champion_lasts_as_a_search_until_the_field_is_edited(app: &mut TestAppContext) {
let (page, mut window) = open(app, seasons()).await;
let cx = &mut window;
on_the_challenge(&page, cx);
click_card(&page, cx, "card-39");
assert_eq!(listed(&page, cx), some(&[0, 1]));
// Kept from one opening of « Parties » to the next.
switch_tab(&page, cx, Tab::Challenge);
switch_tab(&page, cx, Tab::Matches);
assert_eq!(listed(&page, cx), some(&[0, 1]));
assert_eq!(field(&page, cx), "Irelia");
// Another champion's card replaces it.
switch_tab(&page, cx, Tab::Challenge);
click_card(&page, cx, "card-103");
assert_eq!(listed(&page, cx), some(&[2]));
assert_eq!(field(&page, cx), "Ahri");
// Emptied with its cross, the field lists every Match of the Season.
let input = page.read_with(cx, |p, _| p.matches.search_input().clone());
cx.update(|window, cx| input.update(cx, |input, cx| input.clean(window, cx)));
draw(cx);
assert_eq!(listed(&page, cx), some(&[0, 1, 2]));
// Typed in, it searches its text again.
switch_tab(&page, cx, Tab::Challenge);
click_card(&page, cx, "card-103");
search(&page, cx, "irel");
assert_eq!(listed(&page, cx), some(&[0, 1]));
}
#[gpui::test]
async fn enter_on_the_card_the_keyboard_reached_does_as_a_click(app: &mut TestAppContext) {
let (page, mut window) = open(app, seasons()).await;
let cx = &mut window;
on_the_challenge(&page, cx);
focus_sort(&page, cx);
press(cx, "tab");
let grid = page.read_with(cx, |p, _| p.home_grid.clone());
let name = grid.read_with(cx, |grid, _| {
let id = grid.hovered().expect("the keyboard reached no card");
let card = grid.cards().iter().find(|card| card.id == id).unwrap();
card.name.clone()
});
activate(cx, "enter");
settle_tabs(&page, cx);
assert_eq!(tabs(&page, cx), (Tab::Matches, Tab::Matches));
assert_eq!(field(&page, cx), name.as_ref());
let names: Vec<SharedString> = page.read_with(cx, |p, cx| {
let rows = p.matches.list.read(cx).rows();
rows.iter().map(|row| row.champion.clone()).collect()
});
assert!(!names.is_empty() && names.iter().all(|listed| *listed == name));
}
// The phase only decides as it starts and ends: « Parties » stays through the champ select's
// changes, and « Sélection » shows its hand in its place again, not dealt twice.
#[gpui::test]
async fn the_cards_of_a_champ_select_show_their_matches_too(app: &mut TestAppContext) {
// Joueur is followed: « Parties » lists Joueur's Matches.
app.executor().allow_parking();
let (page, mut window) = open_page_with_tracker(app, joueur_tracker_with(true));
let cx = &mut window;
send(&page, cx, &frames()[0]);
app.condition(&page, |p, _| p.stats.is_some()).await;
draw(cx);
finish_motion(&page, cx);
// Briar, in the hand: Joueur's 4th place.
click_card(&page, cx, "card-233");
app.condition(&page, |p, _| p.matches.entries().is_some())
.await;
draw(cx);
assert_eq!(tabs(&page, cx), (Tab::Matches, Tab::Matches));
assert_eq!(field(&page, cx), "Briar");
assert_eq!(listed(&page, cx), ["EUW1_2"]);
send(&page, cx, &with_bans_and_ally(&[16], 64));
draw(cx);
assert_eq!(tabs(&page, cx), (Tab::Matches, Tab::Matches));
switch_tab(&page, cx, Tab::ChampSelect);
draw(cx);
for id in ANVIL_A_TO_Z {
assert_eq!(below(cx, id), None, "{id} is dealt again");
}
// Ahri, in « Autres champions », never played.
// A window tall enough to show the section's cards.
tall(cx);
click_others(cx);
click_card(&page, cx, "card-103");
assert_eq!(field(&page, cx), "Ahri");
assert!(listed(&page, cx).is_empty());
assert!(cx.debug_bounds("matches-no-result").is_some());
}
// The end of the champ select decides as the hand leaves: a card clicked then shows « Défi »,
// and « Parties » keeps its own filters.
#[gpui::test]
async fn a_card_of_the_hand_leaving_opens_nothing(app: &mut TestAppContext) {
let (page, mut window) = page_in_champ_select(app, &frames()[0]).await;
let cx = &mut window;
start_leaving(&page, cx);
draw(cx);
let at = center(cx, "card-233");
cx.simulate_click(at, Modifiers::none());
finish_motion(&page, cx);
assert_eq!(tabs(&page, cx), (Tab::Challenge, Tab::Challenge));
assert_eq!(field(&page, cx), "");
}
#[gpui::test]
async fn the_end_of_a_match_forgets_the_champion_chosen(app: &mut TestAppContext) {
let (page, mut window, client, _) = before_the_end(app);
let cx = &mut window;
on_the_challenge(&page, cx);
click_card(&page, cx, "card-103");
app.condition(&page, |p, _| p.matches.entries().is_some())
.await;
draw(cx);
assert_eq!(listed(&page, cx), [ALICE[1]]);
game_ends(&page, &client, cx);
settle_tabs(&page, cx);
its_recap(&page, app).await;
draw(cx);
assert_eq!(field(&page, cx), "");
let mut all = vec![MATCH.to_string()];
all.extend(ALICE.map(String::from));
assert_eq!(listed(&page, cx), all);
}
@@ -236,6 +236,26 @@ async fn the_details_are_not_kept_from_one_match_to_another(cx: &mut TestAppCont
assert_eq!(unfolded(&page, &mut window), None);
}
#[gpui::test]
async fn opening_the_screen_centers_the_displayed_accounts_row(cx: &mut TestAppContext) {
use gpui_kit::{px, size};
let (page, mut window) = open_matches(cx).await;
switch_tab(&page, &mut window, Tab::Challenge);
let banner = window.debug_bounds("banner").unwrap().size.height;
window.simulate_resize(size(px(1280.), banner + px(380.)));
switch_tab(&page, &mut window, Tab::Matches);
recap_ready(&page, cx).await;
window.run_until_parked();
draw(&mut window);
let row = window.debug_bounds("recap-account").unwrap();
let viewport = window.debug_bounds("recap-viewport").unwrap();
assert!(
(row.center().y - viewport.center().y).abs() < px(1.),
"{row:?} in {viewport:?}"
);
}
#[gpui::test]
async fn choosing_a_match_centers_the_displayed_accounts_row(cx: &mut TestAppContext) {
use gpui_kit::{px, size};
+8 -5
View File
@@ -14,7 +14,7 @@ use gpui_kit::{Entity, Modifiers, TestAppContext, VisualTestContext, px, size};
/// The Season table: « Saison 1 » from 1 Jan. 2026, « Saison 2 » from 1 Sept. 2026, the
/// current one.
fn seasons() -> Vec<Season> {
pub(super) fn seasons() -> Vec<Season> {
[("Saison 1", 1), ("Saison 2", 9)]
.map(|(name, month)| Season {
name: name.into(),
@@ -29,7 +29,10 @@ fn seasons() -> Vec<Season> {
}
/// « Parties » opened on Alice's five Matches, once its list and the recap are there.
async fn open(cx: &mut TestAppContext, seasons: Vec<Season>) -> (Entity<Page>, VisualTestContext) {
pub(super) async fn open(
cx: &mut TestAppContext,
seasons: Vec<Season>,
) -> (Entity<Page>, VisualTestContext) {
cx.executor().allow_parking();
let (page, mut window) = open_page_with_tracker(cx, tracker_in(true, seasons).0);
switch_tab(&page, &mut window, Tab::Matches);
@@ -38,7 +41,7 @@ async fn open(cx: &mut TestAppContext, seasons: Vec<Season>) -> (Entity<Page>, V
(page, window)
}
fn click(cx: &mut VisualTestContext, id: &'static str) {
pub(super) fn click(cx: &mut VisualTestContext, id: &'static str) {
let at = center(cx, id);
cx.simulate_click(at, Modifiers::none());
draw(cx);
@@ -66,7 +69,7 @@ fn pick(page: &Entity<Page>, cx: &mut VisualTestContext, selector: Selector, lab
}
/// The player types `text` in the search field of « Parties », whose text is replaced.
fn search(page: &Entity<Page>, cx: &mut VisualTestContext, text: &str) {
pub(super) fn search(page: &Entity<Page>, cx: &mut VisualTestContext, text: &str) {
let input = page.read_with(cx, |p, _| p.matches.search_input().clone());
cx.update(|window, cx| {
input.update(cx, |input, cx| {
@@ -81,7 +84,7 @@ fn search(page: &Entity<Page>, cx: &mut VisualTestContext, text: &str) {
}
/// The ids of `MORE` at these positions.
fn some(positions: &[usize]) -> Vec<&'static str> {
pub(super) fn some(positions: &[usize]) -> Vec<&'static str> {
positions.iter().map(|&ix| MORE[ix]).collect()
}
+116 -9
View File
@@ -3,6 +3,7 @@ use super::page_fixtures::{
animations, assert_at_rest, center, champions, draw, frame_after, open_page,
open_page_in_season, show, shown_tab, start_switch, statistics, switch_tab, veil,
};
use crate::motion::{BannerCover, Side};
use crate::page::Tab;
use gpui_kit::{Modifiers, TestAppContext, VisualTestContext, WindowVisibility};
@@ -89,16 +90,16 @@ fn switching_tabs_veils_the_screen_leaving_then_unveils_the_one_arriving(cx: &mu
// The navigation follows at once; the screen leaving stays, going under the veil.
assert_eq!(page.read_with(cx, |page, _| page.tab), Tab::Statistics);
assert_eq!(shown_tab(&page, cx), Tab::Challenge);
frame_after(cx, 65);
frame_after(cx, 100);
let halfway = veil(&page, cx);
assert!(halfway > 0. && halfway < 1., "{halfway}");
assert_eq!(shown_tab(&page, cx), Tab::Challenge);
// After 130 ms the other screen is under a full veil, which lifts in 280 ms.
frame_after(cx, 70);
// After 200 ms the other screen is under a full veil, which lifts in 480 ms.
frame_after(cx, 105);
assert_eq!(shown_tab(&page, cx), Tab::Statistics);
assert!(veil(&page, cx) > 0.9);
frame_after(cx, 280);
frame_after(cx, 480);
assert_eq!(veil(&page, cx), 0.);
assert_at_rest(cx);
}
@@ -156,7 +157,7 @@ fn a_switch_back_during_a_transition_starts_from_where_the_veil_is(cx: &mut Test
// « Défi » is still the screen shown: it comes back out of the veil, without a jump.
start_switch(&page, cx, Tab::Challenge);
assert_eq!(veil(&page, cx), before);
frame_after(cx, 280);
frame_after(cx, 480);
assert_eq!(shown_tab(&page, cx), Tab::Challenge);
assert_eq!(veil(&page, cx), 0.);
}
@@ -190,7 +191,7 @@ fn a_transition_neither_builds_the_cards_again_nor_recomputes_the_statistics(
// « Défi » leaves under the veil without its grid or its ring being drawn again.
start_switch(&page, cx, Tab::Statistics);
for _ in 0..5 {
for _ in 0..7 {
frame_after(cx, 30);
}
assert_eq!(shown_tab(&page, cx), Tab::Statistics);
@@ -198,7 +199,7 @@ fn a_transition_neither_builds_the_cards_again_nor_recomputes_the_statistics(
// « Statistiques » arrives: its table is drawn once, not at each frame of the veil. (The
// charts arriving play their own short entry, as after any switch.)
let arrived = table_renders(cx);
for _ in 0..8 {
for _ in 0..13 {
frame_after(cx, 40);
}
assert_eq!(veil(&page, cx), 0.);
@@ -211,7 +212,7 @@ fn a_transition_neither_builds_the_cards_again_nor_recomputes_the_statistics(
// Back to « Défi »: the table leaves without being drawn again; the grid and the ring
// are drawn once, then not again.
start_switch(&page, cx, Tab::Challenge);
for _ in 0..4 {
for _ in 0..6 {
frame_after(cx, 30);
}
assert_eq!(
@@ -222,7 +223,7 @@ fn a_transition_neither_builds_the_cards_again_nor_recomputes_the_statistics(
frame_after(cx, 30);
assert_eq!(shown_tab(&page, cx), Tab::Challenge);
let back = built(cx);
for _ in 0..8 {
for _ in 0..13 {
frame_after(cx, 40);
}
assert_eq!(veil(&page, cx), 0.);
@@ -252,3 +253,109 @@ fn a_switch_undone_under_the_veil_prepares_nothing(cx: &mut TestAppContext) {
switch_tab(&page, cx, Tab::Statistics);
assert_eq!(table.read_with(cx, |table, _| table.names()).len(), 5);
}
// #169: the veil goes the way of the top bar, « Statistiques » standing at « Défi »'s place.
#[test]
fn the_veil_goes_the_way_of_the_top_bar() {
let bar = [Tab::Challenge, Tab::Matches, Tab::ChampSelect, Tab::InGame];
for (from_place, from) in bar.into_iter().enumerate() {
for (to_place, to) in bar.into_iter().enumerate() {
let side = match to_place.cmp(&from_place) {
std::cmp::Ordering::Less => Some(Side::Left),
std::cmp::Ordering::Equal => None,
std::cmp::Ordering::Greater => Some(Side::Right),
};
assert_eq!(from.side_of(to), side, "{from:?} to {to:?}");
}
}
assert_eq!(Tab::Challenge.side_of(Tab::Statistics), None);
assert_eq!(Tab::Statistics.side_of(Tab::Challenge), None);
assert_eq!(Tab::Statistics.side_of(Tab::Matches), Some(Side::Right));
assert_eq!(Tab::InGame.side_of(Tab::Statistics), Some(Side::Left));
}
// The four tabs share the banner: it stays in place, its text fading only when a phase's
// banner says something else. « Statistiques » has none.
#[test]
fn the_veil_spares_the_banner_between_the_tabs_and_covers_it_for_statistics() {
assert_eq!(Tab::Challenge.banner_to(Tab::Matches), BannerCover::Kept);
assert_eq!(Tab::Matches.banner_to(Tab::Challenge), BannerCover::Kept);
assert_eq!(
Tab::Challenge.banner_to(Tab::ChampSelect),
BannerCover::Retold
);
assert_eq!(Tab::ChampSelect.banner_to(Tab::InGame), BannerCover::Retold);
assert_eq!(Tab::InGame.banner_to(Tab::Matches), BannerCover::Retold);
assert_eq!(
Tab::Challenge.banner_to(Tab::Statistics),
BannerCover::Covered
);
assert_eq!(
Tab::Statistics.banner_to(Tab::Matches),
BannerCover::Covered
);
}
#[gpui::test]
fn the_veil_to_parties_comes_from_the_right_and_goes_on_the_same_way(cx: &mut TestAppContext) {
let (page, cx) = open_page_in_season(cx);
let cx = &mut { cx };
show(&page, cx, statistics(0, 5, champions(5)));
draw(cx);
let laid = |cx: &mut VisualTestContext| {
page.read_with(cx, |page, _| {
(page.fade.as_ref()).map(|fade| (fade.anchor(), fade.banner()))
})
};
let (grid, ring) = page.read_with(cx, |page, _| (page.home_grid.clone(), page.ring.clone()));
let ring_draws = |cx: &mut VisualTestContext| ring.read_with(cx, |ring, _| ring.renders);
let drawn = |cx: &mut VisualTestContext| {
let ring = ring_draws(cx);
grid.read_with(cx, |grid, _| (grid.renders, grid.card_builds, ring))
};
let home = drawn(cx);
// « Parties » is right of « Défi »: the veil comes in from the right, under the banner.
start_switch(&page, cx, Tab::Matches);
assert_eq!(laid(cx), Some((Some(Side::Right), BannerCover::Kept)));
// The banner stays in sight: the veil's frames draw neither its ring nor the grid leaving
// again (rule #1).
for _ in 0..6 {
frame_after(cx, 30);
}
assert_eq!(shown_tab(&page, cx), Tab::Challenge);
assert_eq!(drawn(cx), home, "the veil drew the ring or the grid again");
frame_after(cx, 30);
assert_eq!(shown_tab(&page, cx), Tab::Matches);
// Lifting, it leaves by the left: its edge goes on the same way.
assert_eq!(laid(cx), Some((Some(Side::Left), BannerCover::Kept)));
// A switch back during the transition: the veil laid grows back from the side it holds.
let arrived = ring_draws(cx);
frame_after(cx, 100);
assert_eq!(
ring_draws(cx),
arrived,
"the veil lifting drew the ring again"
);
let before = veil(&page, cx);
start_switch(&page, cx, Tab::Challenge);
assert_eq!(veil(&page, cx), before);
assert_eq!(laid(cx), Some((Some(Side::Left), BannerCover::Kept)));
for _ in 0..20 {
frame_after(cx, 50);
}
assert_eq!(shown_tab(&page, cx), Tab::Challenge);
assert_eq!(laid(cx), None);
// « Statistiques » stands at « Défi »'s place and has no banner: no direction, and the
// whole screen under the veil, there and back.
start_switch(&page, cx, Tab::Statistics);
assert_eq!(laid(cx), Some((None, BannerCover::Covered)));
frame_after(cx, 210);
assert_eq!(shown_tab(&page, cx), Tab::Statistics);
assert_eq!(laid(cx), Some((None, BannerCover::Covered)));
frame_after(cx, 480);
assert_eq!(laid(cx), None);
assert_at_rest(cx);
}
+6 -4
View File
@@ -24,7 +24,7 @@ pub(crate) const MATCH_1750: &str =
/// Switches to a tab, and lets its transition end.
pub(in crate::page) fn switch_tab(page: &Entity<Page>, cx: &mut VisualTestContext, tab: Tab) {
cx.update(|window, cx| page.update(cx, |page, cx| page.set_tab(tab, window, cx)));
for _ in 0..10 {
for _ in 0..20 {
if page.read_with(cx, |page, _| page.fade.is_none()) {
return;
}
@@ -368,9 +368,10 @@ pub(super) fn press(cx: &mut VisualTestContext, keys: &str) {
draw(cx);
}
/// Lets the cards lifting or settling back reach where they go.
/// Lets the cards lifting or settling back reach where they go, and the ring's tick they lit
/// go out.
pub(super) fn settle(cx: &mut VisualTestContext) {
frame_after(cx, 400);
frame_after(cx, 700);
}
/// Moves the test clock on, then delivers the next frame as the display would.
@@ -407,7 +408,8 @@ pub(super) fn start_switch(page: &Entity<Page>, cx: &mut VisualTestContext, tab:
/// Nothing is drawn at rest: once gpui-kit's own short animations are over (the filters'
/// pill arrives with « Statistiques »), no frame is asked for.
pub(super) fn assert_at_rest(cx: &mut VisualTestContext) {
frame_after(cx, 1000);
// Long enough for the ring to fill and for its last ticks to twinkle (#170).
frame_after(cx, 3000);
let asked: Vec<usize> = (0..3)
.map(|_| {
cx.executor().advance_clock(Duration::from_millis(100));
+55 -9
View File
@@ -6,7 +6,9 @@ use super::banner_fixtures::{
ring_renders, ring_ticks, splash,
};
use super::match_end_fixtures::animate;
use super::page_fixtures::{animations, draw, frame_after, open_page_in_season, show, statistics};
use super::page_fixtures::{
animations, assert_at_rest, draw, frame_after, open_page_in_season, show, statistics,
};
use crate::card_images::tests::TestDir;
use crate::motion::MatchEnd;
use crate::page::Page;
@@ -129,7 +131,8 @@ fn aiming_the_ring_lights_the_tick_and_presents_its_champion_until_the_pointer_l
assert_eq!(art(&page, cx).as_deref(), Some("Ahri.50.30.jpg"));
}
// Rule #1: the ring is drawn again only for a new tick, and nothing is done off the crown.
// Rule #1: the ring is drawn again only for a new tick, the page is told of nothing more while
// the pointer stays in a tick's sector, and nothing is done off the crown.
#[gpui::test]
fn nothing_is_drawn_again_until_the_aimed_tick_changes(cx: &mut TestAppContext) {
let dir = TestDir::new("ring-hover-light");
@@ -148,17 +151,18 @@ fn nothing_is_drawn_again_until_the_aimed_tick_changes(cx: &mut TestAppContext)
.detach()
});
// Elsewhere in the same tick's sector, on the crown or not quite: no change, no frame.
// Elsewhere in the same tick's sector, on the crown or not quite: only the wave follows the
// pointer (#170), in the page's layer over the ring. The ring is not drawn again, and the
// banner says the same.
let ring = cx.debug_bounds("ring").unwrap();
let said = line(&page, cx);
for (degrees, radius) in [(80., 230.), (90., 205.), (100., 250.)] {
cx.simulate_mouse_move(
ring.origin + on_crown(degrees, radius, ring.size),
None,
Modifiers::none(),
);
move_to(cx, ring.origin + on_crown(degrees, radius, ring.size));
assert_eq!(ring_renders(&page, cx), renders + 1, "{degrees}");
assert_eq!(line(&page, cx), said, "{degrees}");
// The wave moves already and asks for its own frames: the page is told nothing more.
assert_eq!(notified.get(), 0, "{degrees}");
}
assert_eq!(ring_renders(&page, cx), renders + 1);
// Off the crown, inside the ring's square or out of it: the tick goes out, once.
move_to(cx, ring.center());
@@ -175,6 +179,48 @@ fn nothing_is_drawn_again_until_the_aimed_tick_changes(cx: &mut TestAppContext)
assert_eq!(ring_renders(&page, cx), renders + 2);
}
// #170: what moves over the ring is the page's layer. The ring is drawn again for a new tick
// only, and once the wave has caught up with a pointer resting on the crown, nothing is asked for.
#[gpui::test]
fn the_wave_and_the_trail_move_over_the_ring_and_rest_under_a_still_pointer(
cx: &mut TestAppContext,
) {
let dir = TestDir::new("ring-hover-live");
let (page, cx) = open_page_in_season(cx);
let cx = &mut { cx };
show(&page, cx, challenge(dir.path()));
draw(cx);
aim(&page, cx, 1);
let renders = ring_renders(&page, cx);
let moving = |cx: &mut VisualTestContext| page.read_with(cx, |p, _| p.ring_live.moving());
// The tick pops and the wave rises: frames are asked for, and none draws the ring.
assert!(moving(cx));
for _ in 0..6 {
frame_after(cx, 30);
}
assert_eq!(ring_renders(&page, cx), renders);
// Another tick: the ring is drawn once for it; the tick left goes out over it.
aim(&page, cx, 3);
for _ in 0..6 {
frame_after(cx, 30);
}
assert_eq!(ring_renders(&page, cx), renders + 1);
assert!(moving(cx), "the tick left went out at once");
// The pointer rests on the crown, its tick still lit: nothing moves any more.
assert_at_rest(cx);
assert!(!moving(cx));
assert!(lit(&page, cx).is_some());
assert_eq!(ring_renders(&page, cx), renders + 1);
// With the Windows setting off, nothing moves over the ring at all.
animations(cx, false);
aim(&page, cx, 1);
assert!(!moving(cx));
assert_at_rest(cx);
}
// A quick sweep of the crown asks for many illustrations and decodes the first and the last.
#[gpui::test]
fn a_sweep_holds_two_splashes_at_most_and_ends_on_the_last_aimed(cx: &mut TestAppContext) {
+161
View File
@@ -0,0 +1,161 @@
//! The ring living over its cache, at the page's level (#170): the fill for another Account and
//! the ticks going dim are the page's layer, drawn over the ring without drawing it again; the
//! light of a switch of screens turns the way of the screen arriving; out of sight nothing
//! moves over the ring.
use super::banner_fixtures::ring_renders;
use super::champ_select_fixtures::{frames, page_in_champ_select};
use super::page_fixtures::{
assert_at_rest, champions, draw, frame_after, open_page_in_season, show, shown_tab,
start_switch, statistics, switch_tab,
};
use crate::motion::Side;
use crate::page::{Page, Tab};
use crate::ring::Live;
use gpui_kit::{Entity, TestAppContext, VisualTestContext, WindowVisibility};
/// What the page's layer draws over the ring now.
fn live(page: &Entity<Page>, cx: &mut VisualTestContext) -> Live {
page.read_with(cx, |p, cx| {
p.ring_live.frame(cx.background_executor().now())
})
}
fn moving(page: &Entity<Page>, cx: &mut VisualTestContext) -> bool {
page.read_with(cx, |p, _| p.ring_live.moving())
}
/// Shows the Challenge of the Account `account`, as a change of Account does.
fn show_account(page: &Entity<Page>, cx: &mut VisualTestContext, account: &str) {
page.update(cx, |p, _| p.shown = Some(account.to_owned()));
show(page, cx, statistics(0, 5, champions(5)));
draw(cx);
}
// Rule #1: the ring is drawn once for its new ticks; its fill is the page's layer over it.
#[gpui::test]
fn the_ring_fills_for_another_account_without_being_drawn_again(cx: &mut TestAppContext) {
let (page, cx) = open_page_in_season(cx);
let cx = &mut { cx };
show(&page, cx, statistics(0, 5, champions(5)));
draw(cx);
// The first ticks are simply there.
assert_eq!(live(&page, cx), Live::default());
show_account(&page, cx, "another");
let renders = ring_renders(&page, cx);
let mut filled = live(&page, cx).filled.expect("the ring does not fill");
for _ in 0..8 {
frame_after(cx, 200);
let now = live(&page, cx).filled.expect("the fill stopped short");
assert!(now > filled, "{now} after {filled}");
filled = now;
}
assert_eq!(
ring_renders(&page, cx),
renders,
"the fill drew the ring again"
);
assert_at_rest(cx);
assert_eq!(live(&page, cx), Live::default());
assert_eq!(ring_renders(&page, cx), renders);
}
// Rule #1: the ring is drawn once without its dimmed ticks' light, which fades in the page's
// layer over it.
#[gpui::test]
async fn the_ticks_without_an_anvil_go_dim_without_drawing_the_ring_again(
app: &mut TestAppContext,
) {
let (page, mut window) = page_in_champ_select(app, &frames()[0]).await;
let cx = &mut window;
switch_tab(&page, cx, Tab::Challenge);
assert_at_rest(cx);
// « Sélection » shows under the full veil: its ticks without an anvil start to go dim.
start_switch(&page, cx, Tab::ChampSelect);
frame_after(cx, 210);
assert_eq!(shown_tab(&page, cx), Tab::ChampSelect);
let renders = ring_renders(&page, cx);
let mut left = live(&page, cx).dimming.expect("the ticks do not go dim");
for _ in 0..4 {
frame_after(cx, 100);
let now = live(&page, cx).dimming.expect("the ticks went out at once");
assert!(now < left, "{now} after {left}");
left = now;
}
assert_eq!(
ring_renders(&page, cx),
renders,
"the ticks going dim drew the ring again"
);
assert_at_rest(cx);
assert_eq!(live(&page, cx).dimming, None);
assert_eq!(ring_renders(&page, cx), renders);
}
// « Horaire vers la droite »: a switch during a transition keeps the side the veil laid holds
// on to, and the light still turns the way of the screen arriving.
#[gpui::test]
async fn the_light_turns_the_way_of_the_screen_arriving_whatever_side_the_veil_holds(
app: &mut TestAppContext,
) {
let (page, mut window) = page_in_champ_select(app, &frames()[0]).await;
let cx = &mut window;
switch_tab(&page, cx, Tab::Challenge);
let anchor = |cx: &mut VisualTestContext| {
page.read_with(cx, |p, _| p.fade.as_ref().and_then(|fade| fade.anchor()))
};
let clockwise = |cx: &mut VisualTestContext| live(&page, cx).light.map(|light| light.clockwise);
// « Parties » is right of « Défi »: clockwise.
start_switch(&page, cx, Tab::Matches);
assert_eq!(clockwise(cx), Some(true));
// « Parties » is shown, and the veil lifts holding on to the left.
frame_after(cx, 210);
assert_eq!(shown_tab(&page, cx), Tab::Matches);
assert_eq!(anchor(cx), Some(Side::Left));
// « Sélection », further right, during that: the veil keeps its side, the light its way.
start_switch(&page, cx, Tab::ChampSelect);
assert_eq!(anchor(cx), Some(Side::Left));
assert_eq!(clockwise(cx), Some(true));
// Back to the left, the other way.
switch_tab(&page, cx, Tab::ChampSelect);
start_switch(&page, cx, Tab::Challenge);
assert_eq!(clockwise(cx), Some(false));
}
// #170: on « Statistiques », which has no ring, behind « Paramètres » or with the window
// hidden, what would move over the ring shows its end state at once and asks for no frame.
#[gpui::test]
fn nothing_moves_over_the_ring_out_of_sight(cx: &mut TestAppContext) {
let (page, cx) = open_page_in_season(cx);
let cx = &mut { cx };
show(&page, cx, statistics(0, 5, champions(5)));
draw(cx);
switch_tab(&page, cx, Tab::Statistics);
show_account(&page, cx, "on statistics");
assert!(!moving(&page, cx), "the ring fills on « Statistiques »");
switch_tab(&page, cx, Tab::Challenge);
assert_at_rest(cx);
cx.update(|window, cx| page.update(cx, |p, cx| p.hidden(window, cx)));
show_account(&page, cx, "behind the settings");
assert!(!moving(&page, cx), "the ring fills behind « Paramètres »");
cx.update(|window, cx| page.update(cx, |p, cx| p.uncovered(window, cx)));
cx.simulate_visibility_change(WindowVisibility::Hidden);
show_account(&page, cx, "hidden");
assert!(!moving(&page, cx), "the ring fills in a hidden window");
assert_eq!(live(&page, cx), Live::default());
// In sight again, another Account's ring fills.
cx.simulate_visibility_change(WindowVisibility::Visible);
show_account(&page, cx, "in sight");
assert!(moving(&page, cx));
assert!(live(&page, cx).filled.is_some());
assert_at_rest(cx);
}
+4
View File
@@ -1,3 +1,4 @@
use super::import_view::wait_until;
use super::{Page, RELOAD_EVERY, Tab};
use crate::worker::{Msg, spawn_refresh};
use gpui_kit::*;
@@ -6,6 +7,8 @@ impl Page {
pub(in crate::page) fn apply(&mut self, msg: Msg, window: &mut Window, cx: &mut Context<Self>) {
match msg {
Msg::Progress(progress) => {
let now = cx.background_executor().now();
self.import_view.own_until = wait_until(progress, now);
self.progress = Some(progress);
if self.last_reload.elapsed() >= RELOAD_EVERY {
self.reload_in_background(window, cx);
@@ -148,6 +151,7 @@ impl Page {
self.mark_crashed();
}
}
self.show_import(false, cx);
cx.notify();
}
+84 -110
View File
@@ -4,7 +4,7 @@
//! two by Mastery Points (A to Z while the points are unknown, as the cards).
//!
//! A cached view (rule #1): laid out from the style its parent gives, drawn again only when its
//! ticks or the lit one change, never by a hover or a scroll elsewhere.
//! ticks, the lit one or the import's arc change, never by a hover or a scroll elsewhere.
use std::cell::RefCell;
use std::f32::consts::{FRAC_PI_2, TAU};
@@ -14,14 +14,19 @@ use arena_tracker_core::ChampionState;
use gpui_kit::component::ActiveTheme as _;
use gpui_kit::*;
use crate::motion::{MATCH_SETTLE, MatchAnimation, MatchEnd, ease_out};
use crate::motion::{MatchAnimation, MatchEnd};
use crate::theme::{ring_never, ring_played};
mod aim;
mod arc;
mod live;
mod match_layer;
mod ticks;
pub(crate) use arc::fraction as arc_fraction;
pub(crate) use live::{Light, Live, TWINKLE_LIFE};
pub use ticks::{Tick, ticks};
// The reference page's geometry, in the units of its SVG: the ring is drawn in a square
// The ring's geometry, in its own units (those of the logo's drawing): it is drawn in a square
// `BOX` wide, its centre `PAD + C` from the edges.
const C: f32 = 260.;
const R1: f32 = 214.;
@@ -30,7 +35,7 @@ const PAD: f32 = 20.;
const BOX: f32 = 2. * (C + PAD);
/// The disc under the crown.
const DISC: f32 = R1 - 18.;
/// The crown of the logo, in its own 256 wide square, placed as the reference page does.
/// The crown of the logo, in its own 256 wide square, placed in the middle of the disc.
const CROWN: [(f32, f32); 7] = [
(68., 186.),
(52., 86.),
@@ -52,7 +57,21 @@ fn shape(state: ChampionState) -> (f32, f32, f32) {
}
}
/// Maps the reference page's units into `bounds`.
/// The middle of the crown's ticks: where what goes round the crown runs.
const MIDDLE: f32 = (R1 + R2) * 0.5;
/// Draws the line through `points` into `path`.
fn trace(path: &mut PathBuilder, points: impl IntoIterator<Item = Point<Pixels>>) {
for (step, at) in points.into_iter().enumerate() {
if step == 0 {
path.move_to(at);
} else {
path.line_to(at);
}
}
}
/// Maps the ring's units into `bounds`.
#[derive(Clone, Copy)]
struct Frame {
origin: Point<Pixels>,
@@ -71,6 +90,11 @@ impl Frame {
self.origin + point(px((x + PAD) * self.scale), px((y + PAD) * self.scale))
}
/// The point `radius` from the ring's centre at `angle`, in radians clockwise from noon.
fn on_crown(self, angle: f32, radius: f32) -> Point<Pixels> {
self.point(C + radius * angle.sin(), C - radius * angle.cos())
}
/// Adds the tick `index` of `count` to `path`: a segment with round ends, as a filled shape.
fn add_tick(
self,
@@ -79,9 +103,23 @@ impl Frame {
count: usize,
state: ChampionState,
width: f32,
) {
self.add_raised_tick(path, index, count, state, width, 0.);
}
/// The same tick, its head `raise` further out.
fn add_raised_tick(
self,
path: &mut PathBuilder,
index: usize,
count: usize,
state: ChampionState,
width: f32,
raise: f32,
) {
let angle = -FRAC_PI_2 + (index as f32 + 0.5) * TAU / count as f32;
let (from, to, _) = shape(state);
let to = to + raise;
let (cos, sin) = (angle.cos(), angle.sin());
let half = width / 2.;
// Along the tick, and across it.
@@ -185,8 +223,12 @@ pub struct Ring {
ticks: Rc<[Tick]>,
/// The champion whose card is under the pointer.
lit: Option<u32>,
/// The import of the Account shown, as (fetched, to fetch): its arc is drawn around the ticks.
progress: Option<(usize, usize)>,
/// Made by the paint, for its size; forgotten with the ticks.
geometry: Rc<RefCell<Option<Geometry>>>,
/// The arc's paths, made by the paint for its size and progress.
arc: Rc<RefCell<arc::Cache>>,
/// How many times it was drawn: the tests check it stays light.
#[cfg(test)]
pub(crate) renders: usize,
@@ -201,7 +243,9 @@ impl Ring {
ticks: Rc::new([]),
anvil: None,
lit: None,
progress: None,
geometry: Rc::default(),
arc: Rc::default(),
#[cfg(test)]
renders: 0,
#[cfg(test)]
@@ -255,6 +299,14 @@ impl Ring {
}
}
/// Shows the import's arc, or none; the ring is drawn again only when it changes.
pub fn set_progress(&mut self, progress: Option<(usize, usize)>, cx: &mut Context<Self>) {
if self.progress != progress {
self.progress = progress;
cx.notify();
}
}
#[cfg(test)]
pub(crate) fn ticks(&self) -> &[Tick] {
&self.ticks
@@ -265,10 +317,26 @@ impl Ring {
self.anvil.as_deref()
}
#[cfg(test)]
pub(crate) fn progress(&self) -> Option<(usize, usize)> {
self.progress
}
pub(crate) fn lit(&self) -> Option<u32> {
self.lit
}
/// Whether the ticks without an anvil are dimmed.
pub(crate) fn dims(&self) -> bool {
self.anvil.is_some()
}
/// Where on the crown the pointer aims, in radians clockwise from noon, `at` being relative
/// to the ring's bounds, of `size`; none when it is off the crown.
pub(crate) fn angle_at(&self, at: Point<Pixels>, size: Size<Pixels>) -> Option<f32> {
aim::turn(at, size).map(|turn| turn * TAU)
}
/// The champion of the tick the pointer aims at, `at` being relative to the ring's bounds,
/// of `size`; none when it is off the crown.
pub(crate) fn champion_at(&self, at: Point<Pixels>, size: Size<Pixels>) -> Option<u32> {
@@ -277,111 +345,6 @@ impl Ring {
}
}
impl Ring {
/// The end of a followed Match, `elapsed` seconds in, over the cached ring: only the moving
/// shapes, a function of the page's render so that the ring is not drawn again (rule #1). The
/// comet and its trail fly from noon to the tick; then the tick flares, gold for a new Mark,
/// bright otherwise, and for a champion Completed the crown bounces: the ring's own crown,
/// moved, not tessellated again.
pub fn match_layer(
&self,
animation: MatchAnimation,
elapsed: f32,
cx: &App,
) -> impl IntoElement {
let theme = cx.theme();
let (gold, bright, disc) = (theme.primary, theme.foreground, theme.background);
let geometry = self.geometry.clone();
#[cfg(test)]
let tessellations = self.tessellations.clone();
canvas(
|_, _, _| {},
move |bounds, _, window, _| {
let frame = Frame::of(bounds);
let flight = animation.flight();
if elapsed < flight {
let arc = TAU * (animation.index as f32 + 0.5) / animation.count as f32
* ease_out(elapsed / flight);
let radius = (R1 + R2) * 0.5;
let at = |angle: f32| {
frame.point(C + radius * angle.sin(), C - radius * angle.cos())
};
let mut trail = PathBuilder::stroke(px(4. * frame.scale));
let tail = (arc - 0.8).max(0.);
trail.move_to(at(tail));
for i in 1..=12 {
trail.line_to(at(tail + (arc - tail) * i as f32 / 12.));
}
if let Ok(path) = trail.build() {
window.paint_path(path, gold);
}
let dot = px(8. * frame.scale);
window.paint_quad(
fill(
Bounds::centered_at(at(arc), size(dot * 2., dot * 2.)),
bright,
)
.corner_radii(dot),
);
return;
}
let t = ((elapsed - flight) / MATCH_SETTLE).clamp(0., 1.);
let pulse = (std::f32::consts::PI * t).sin();
let mut tick = PathBuilder::fill();
frame.add_tick(
&mut tick,
animation.index,
animation.count,
animation.state,
shape(animation.state).2 + 6. * pulse,
);
if let Ok(path) = tick.build() {
let ink = if animation.end == MatchEnd::Mark {
gold
} else {
bright
};
window.paint_path(path, ink.opacity(pulse));
}
if animation.has_comet() {
// Cover the resting crown inside the disc, then draw it at its bouncing height.
let radius = px(DISC * frame.scale);
window.paint_quad(
fill(
Bounds::centered_at(frame.point(C, C), size(radius * 2., radius * 2.)),
disc,
)
.corner_radii(radius),
);
let rise = 25. * (1. - t).powi(2) * (std::f32::consts::TAU * t).sin();
let by = bounds.origin - point(px(0.), px(rise * frame.scale));
// The ring painted its crown at this size, unless the layout just changed.
let geometry = geometry.borrow();
let made = geometry.as_ref().filter(|g| g.size == bounds.size);
let made_crown;
let crown = match made {
Some(made) => made.crown.as_ref(),
None => {
#[cfg(test)]
tessellations.set(tessellations.get() + 1);
made_crown = crown(Frame::of(Bounds {
origin: Point::default(),
size: bounds.size,
}));
made_crown.as_ref()
}
};
if let Some(path) = crown {
window.paint_path(moved(path, by), gold);
}
}
},
)
.absolute()
.inset_0()
}
}
impl Render for Ring {
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
#[cfg(test)]
@@ -401,8 +364,10 @@ impl Render for Ring {
]
.map(|state| (state, color(state)));
let (disc, crown, lit_color) = (theme.background, theme.primary, theme.foreground);
let (progress, rest) = (self.progress, ring_never(theme));
let ticks = self.ticks.clone();
let geometry = self.geometry.clone();
let arcs = self.arc.clone();
let anvil = self.anvil.clone();
#[cfg(test)]
let tessellations = self.tessellations.clone();
@@ -439,6 +404,15 @@ impl Render for Ring {
if let Some(path) = &geometry.crown {
window.paint_path(moved(path, bounds.origin), crown);
}
let mut arcs = arcs.borrow_mut();
if !arcs.fits(bounds.size, progress) {
#[cfg(test)]
if progress.is_some() {
tessellations.set(tessellations.get() + 1);
}
arcs.remake(bounds.size, progress);
}
arcs.paint(bounds.origin, (rest, crown), window);
// Only the lit tick is tessellated when the pointer changes card.
if let Some((index, state)) = lit {
let mut path = PathBuilder::fill();
+15 -8
View File
@@ -7,26 +7,33 @@ use gpui_kit::{Pixels, Point, Size};
use super::{BOX, C, PAD, R1, R2};
/// The band around the crown that aims, in the reference page's units: from a little inside the
/// The band around the crown that aims, in the ring's units: from a little inside the
/// longest tick's foot to a little beyond its head. The shorter ticks lie within it.
const FROM: f32 = R1 - 12.;
const TO: f32 = R2 + 10.;
/// The index of the tick of `count` the pointer at `at` aims at, `at` being relative to the
/// ring's top left corner and the ring `size`; none off the band. Tick `i` is the sector of
/// `TAU / count` it sits in the middle of, counted clockwise from noon.
pub(super) fn aimed(at: Point<Pixels>, size: Size<Pixels>, count: usize) -> Option<usize> {
/// How far round the crown the pointer at `at` aims, 0 to 1 clockwise from noon, `at` being
/// relative to the ring's top left corner and the ring `size`; none off the band.
pub(super) fn turn(at: Point<Pixels>, size: Size<Pixels>) -> Option<f32> {
let scale = size.width.min(size.height).as_f32() / BOX;
if count == 0 || scale <= 0. {
if scale <= 0. {
return None;
}
let (x, y) = (
at.x.as_f32() / scale - PAD - C,
at.y.as_f32() / scale - PAD - C,
);
if !(FROM..=TO).contains(&x.hypot(y)) {
(FROM..=TO)
.contains(&x.hypot(y))
.then(|| x.atan2(-y).rem_euclid(TAU) / TAU)
}
/// The index of the tick of `count` the pointer at `at` aims at: tick `i` is the sector of
/// `TAU / count` it sits in the middle of, counted clockwise from noon. None off the band.
pub(super) fn aimed(at: Point<Pixels>, size: Size<Pixels>, count: usize) -> Option<usize> {
if count == 0 {
return None;
}
let turn = x.atan2(-y).rem_euclid(TAU) / TAU;
let turn = turn(at, size)?;
Some(((turn * count as f32) as usize).min(count - 1))
}
+166
View File
@@ -0,0 +1,166 @@
//! The import's arc (#140): a thin circle outside the ticks, its done part from noon clockwise.
//! Pure geometry, in the ring's SVG units.
use std::f32::consts::TAU;
use gpui_kit::*;
use super::{C, Frame, moved};
/// Just outside the ticks, which end at `R2`.
const RADIUS: f32 = 256.;
pub(super) const WIDTH: f32 = 3.;
/// Segments of a full turn.
const STEPS: f32 = 120.;
/// How much of the import is done, from 0 to 1.
pub(crate) fn fraction(fetched: usize, to_fetch: usize) -> f32 {
if to_fetch == 0 {
return 0.;
}
(fetched as f32 / to_fetch as f32).clamp(0., 1.)
}
/// The polyline of the first `fraction` of the turn: from noon, clockwise. Empty for nothing.
pub(super) fn points(fraction: f32) -> Vec<(f32, f32)> {
let sweep = fraction.clamp(0., 1.) * TAU;
if sweep == 0. {
return Vec::new();
}
let steps = (sweep / TAU * STEPS).ceil();
(0..=steps as usize)
.map(|i| {
let angle = sweep * i as f32 / steps;
(C + RADIUS * angle.sin(), C - RADIUS * angle.cos())
})
.collect()
}
/// The polyline of the turn from `from` to `to` of it, clockwise: the part the arc glides
/// through (#172). Empty when there is none.
pub(super) fn span(from: f32, to: f32) -> Vec<(f32, f32)> {
let (from, to) = (from.clamp(0., 1.) * TAU, to.clamp(0., 1.) * TAU);
if to <= from {
return Vec::new();
}
let steps = ((to - from) / TAU * STEPS).ceil().max(1.);
(0..=steps as usize)
.map(|i| {
let angle = from + (to - from) * i as f32 / steps;
(C + RADIUS * angle.sin(), C - RADIUS * angle.cos())
})
.collect()
}
/// The arc's paths, made at the origin and moved where the ring is painted: the circle for a
/// size, the part done for a progress, so a paint for the same ones tessellates nothing.
#[derive(Default)]
pub(super) struct Cache {
size: Size<Pixels>,
progress: Option<(usize, usize)>,
rest: Option<Path<Pixels>>,
done: Option<Path<Pixels>>,
}
/// The polyline of the first `fraction` of the turn, stroked in `frame`.
fn stroke(frame: Frame, fraction: f32) -> Option<Path<Pixels>> {
let mut points = points(fraction).into_iter().map(|(x, y)| frame.point(x, y));
let mut stroke = PathBuilder::stroke(px(WIDTH * frame.scale));
stroke.move_to(points.next()?);
for at in points {
stroke.line_to(at);
}
stroke.build().ok()
}
impl Cache {
/// Whether what is held is what `progress` in `size` needs.
pub(super) fn fits(&self, size: Size<Pixels>, progress: Option<(usize, usize)>) -> bool {
self.progress == progress && (progress.is_none() || self.size == size)
}
/// Makes the paths for `progress` in `size`, or lets go of them without progress.
pub(super) fn remake(&mut self, size: Size<Pixels>, progress: Option<(usize, usize)>) {
let Some((fetched, to_fetch)) = progress else {
*self = Cache::default();
return;
};
let frame = Frame::of(Bounds {
origin: Point::default(),
size,
});
if self.size != size || self.rest.is_none() {
self.rest = stroke(frame, 1.);
}
self.done = stroke(frame, fraction(fetched, to_fetch));
(self.size, self.progress) = (size, progress);
}
/// Paints the whole circle in `rest`, then the part done in `done`.
pub(super) fn paint(
&self,
origin: Point<Pixels>,
(rest, done): (Hsla, Hsla),
window: &mut Window,
) {
for (path, color) in [(&self.rest, rest), (&self.done, done)] {
if let Some(path) = path {
window.paint_path(moved(path, origin), color);
}
}
}
}
#[cfg(test)]
mod tests {
use super::{C, RADIUS, WIDTH, fraction, points, span};
use crate::ring::{R2, shape};
use arena_tracker_core::ChampionState;
fn near(a: (f32, f32), b: (f32, f32)) -> bool {
(a.0 - b.0).abs() < 0.01 && (a.1 - b.1).abs() < 0.01
}
#[test]
fn the_arc_starts_at_noon_and_turns_clockwise() {
let quarter = points(0.25);
assert!(near(quarter[0], (C, C - RADIUS)));
assert!(near(*quarter.last().unwrap(), (C + RADIUS, C)));
assert!(near(*points(0.5).last().unwrap(), (C, C + RADIUS)));
// A full turn closes on noon.
let circle = points(1.);
assert!(near(circle[0], *circle.last().unwrap()));
}
#[test]
fn nothing_done_draws_no_arc_and_the_fraction_is_clamped() {
assert!(points(0.).is_empty() && points(-1.).is_empty());
assert_eq!(points(7.), points(1.));
assert_eq!(fraction(0, 12), 0.);
assert_eq!(fraction(3, 12), 0.25);
assert_eq!(fraction(20, 12), 1.);
assert_eq!(fraction(5, 0), 0.);
}
#[test]
fn the_part_the_arc_glides_through_runs_between_its_two_values() {
let part = span(0.25, 0.5);
assert!(near(part[0], *points(0.25).last().unwrap()));
assert!(near(*part.last().unwrap(), *points(0.5).last().unwrap()));
// Nothing to glide through backwards, or when it is there.
assert!(span(0.5, 0.25).is_empty() && span(0.3, 0.3).is_empty());
}
#[test]
fn the_arc_lies_just_outside_the_ticks() {
let outermost = [
ChampionState::Completed,
ChampionState::InProgress,
ChampionState::NeverPlayed,
]
.map(|state| shape(state).1)
.into_iter()
.fold(R2, f32::max);
assert!(RADIUS - WIDTH / 2. > outermost);
}
}
+339
View File
@@ -0,0 +1,339 @@
//! What moves over the cached ring (#170): the lit tick popping and going out in a trail, the
//! wave under the pointer, a light going round the crown, the ring filling from noon, its ticks
//! going dim and their twinkling. The page draws it in a layer over the ring, which is not drawn
//! again (rule #1): the shapes here are built at each frame, only while something moves.
use std::f32::consts::{PI, TAU};
use arena_tracker_core::ChampionState;
use gpui_kit::component::ActiveTheme as _;
use gpui_kit::*;
use super::{Frame, MIDDLE, R1, R2, Ring, Tick, arc, moved, shape, trace};
use crate::theme::{ring_never, ring_played};
/// How far the lit tick pops out, in the ring's units.
const POP: f32 = 9.;
/// How far the wave raises the tick the pointer aims at, and how wide it is, in radians.
const WAVE: f32 = 15.;
const WAVE_WIDTH: f32 = 0.11;
/// How far the light raises the ticks it passes, how wide, and how long its tail is.
const LIGHT: f32 = 9.;
const LIGHT_WIDTH: f32 = 0.16;
const LIGHT_TAIL: f32 = 0.9;
/// How far the ticks pop as the ring fills, and over which angle behind its front.
const FILL: f32 = 12.;
const FILL_FRONT: f32 = 0.3;
/// One tick starts to twinkle at each slot, and twinkles for a life, in seconds.
const TWINKLE_SLOT: f32 = 0.03;
pub(crate) const TWINKLE_LIFE: f32 = 0.76;
/// A light going round the crown.
#[derive(Clone, Copy, Debug, PartialEq)]
pub(crate) struct Light {
/// Where its head is, in radians clockwise from noon.
pub head: f32,
pub clockwise: bool,
/// How bright it is, 0 to 1.
pub glow: f32,
}
/// What the layer draws at one frame, prepared by the page. Angles are in radians clockwise
/// from noon.
#[derive(Clone, Debug, Default, PartialEq)]
pub(crate) struct Live {
/// How far the lit tick is into its pop, 0 to 1.
pub pop: Option<f32>,
/// The ticks going out: their champion, and how bright they still are, 1 to 0.
pub trail: Vec<(u32, f32)>,
/// The wave under the pointer: where it is and how high, 0 to 1.
pub wave: Option<(f32, f32)>,
pub light: Option<Light>,
/// The ring filling from noon: the angle its ticks are there up to.
pub filled: Option<f32>,
/// The ticks without an anvil going dim: how much of their light is left, 1 to 0.
pub dimming: Option<f32>,
/// Ticks twinkle: seconds since the event that makes them started, and for how long new
/// ones start.
pub sparkle: Option<(f32, f32)>,
/// The import's arc gliding to its new value: the part of it, from how much of the turn to
/// how much, that it has not reached yet.
pub arc: Option<(f32, f32)>,
}
/// How far a tick `away` (radians) from a bump `width` wide is raised by it, 0 to 1.
fn bump(away: f32, width: f32) -> f32 {
(-(away / width).powi(2)).exp()
}
/// The shortest way round between two angles.
pub(super) fn apart(a: f32, b: f32) -> f32 {
let d = (a - b).rem_euclid(TAU);
d.min(TAU - d)
}
/// The tick that starts to twinkle at slot `slot`, of `count`: scattered, and the same at each
/// frame.
fn twinkling(slot: u32, count: usize) -> usize {
(slot.wrapping_mul(2_654_435_761) >> 7) as usize % count
}
/// The twinkles alive `since` seconds into an event whose ticks start to twinkle for `lasting`
/// seconds: for each, its slot and how bright it is, 0 to 1.
fn twinkles(since: f32, lasting: f32) -> impl Iterator<Item = (u32, f32)> {
let first = ((since - TWINKLE_LIFE) / TWINKLE_SLOT).ceil().max(0.) as u32;
let last = (since.min(lasting) / TWINKLE_SLOT).floor().max(0.) as u32;
(first..=last).filter_map(move |slot| {
let age = (since - slot as f32 * TWINKLE_SLOT) / TWINKLE_LIFE;
(0. ..1.).contains(&age).then(|| (slot, (PI * age).sin()))
})
}
/// In how many parts a tail along the crown goes out.
const TAIL_PARTS: usize = 10;
/// The ticks' states, in the order their raised shapes are painted.
const STATES: [ChampionState; 3] = [
ChampionState::Completed,
ChampionState::InProgress,
ChampionState::NeverPlayed,
];
impl Frame {
/// Paints a tail along the crown from the angle `from`, where it has gone out, to `to`, its
/// head. `stroke` gives the width and the ink of each part, for how near the head it is, up
/// to 1.
pub(super) fn paint_tail(
self,
window: &mut Window,
from: f32,
to: f32,
stroke: impl Fn(f32) -> (f32, Hsla),
) {
let along = |part: usize| from + (to - from) * part as f32 / TAIL_PARTS as f32;
for part in 0..TAIL_PARTS {
let (width, ink) = stroke((part + 1) as f32 / TAIL_PARTS as f32);
let mut tail = PathBuilder::stroke(px(width * self.scale));
trace(
&mut tail,
[along(part), along(part + 1)].map(|angle| self.on_crown(angle, MIDDLE)),
);
if let Ok(path) = tail.build() {
window.paint_path(path, ink);
}
}
}
/// Paints the ticks of `ticks` twinkling `since` seconds into an event whose ticks start to
/// twinkle for `lasting` seconds, in `ink`.
pub(super) fn paint_twinkles(
self,
window: &mut Window,
ticks: &[Tick],
(since, lasting): (f32, f32),
ink: Hsla,
) {
if ticks.is_empty() {
return;
}
for (slot, glow) in twinkles(since, lasting) {
let index = twinkling(slot, ticks.len());
let state = ticks[index].state;
let width = shape(state).2 + 2. * glow;
let mut twinkle = PathBuilder::fill();
self.add_raised_tick(&mut twinkle, index, ticks.len(), state, width, POP * glow);
if let Ok(path) = twinkle.build() {
window.paint_path(path, ink.opacity(glow));
}
}
}
}
impl Ring {
/// What moves over the ring at this frame. `cover`, the colour behind the ring, hides the
/// ticks the filling ring has not reached yet; without it they are simply there.
pub fn live_layer(&self, live: Live, cover: Option<Hsla>, cx: &App) -> impl IntoElement {
let theme = cx.theme();
let color = {
let (done, played, never) = (theme.primary, ring_played(theme), ring_never(theme));
move |state| match state {
ChampionState::Completed => done,
ChampionState::InProgress => played,
ChampionState::NeverPlayed => never,
}
};
let (bright, rest) = (theme.foreground, ring_never(theme));
let (ticks, lit, geometry) = (self.ticks.clone(), self.lit, self.geometry.clone());
canvas(
|_, _, _| {},
move |bounds, _, window, _| {
let count = ticks.len();
if count == 0 {
return;
}
let frame = Frame::of(bounds);
let angle = |index: usize| (index as f32 + 0.5) * TAU / count as f32;
let at = |angle: f32| frame.on_crown(angle, MIDDLE);
let paint_tick =
|window: &mut Window, index: usize, width: f32, raise: f32, ink: Hsla| {
let mut path = PathBuilder::fill();
let state = ticks[index].state;
frame.add_raised_tick(&mut path, index, count, state, width, raise);
if let Ok(path) = path.build() {
window.paint_path(path, ink);
}
};
// The part of the import's arc it glides to, still in the colour of the rest.
if let Some((reached, to)) = live.arc {
let mut ahead = PathBuilder::stroke(px((arc::WIDTH + 1.) * frame.scale));
let span = arc::span(reached, to);
trace(&mut ahead, span.into_iter().map(|(x, y)| frame.point(x, y)));
if let Ok(path) = ahead.build() {
window.paint_path(path, rest);
}
}
// The ticks the filling ring has not reached yet, hidden.
if let (Some(filled), Some(cover)) = (live.filled, cover)
&& filled < TAU
{
let mut hidden = PathBuilder::stroke(px((R2 - R1 + 8.) * frame.scale));
let steps = ((TAU - filled) / TAU * 60.).ceil().max(1.) as usize;
let left = |step: usize| (TAU - filled) * step as f32 / steps as f32;
trace(&mut hidden, (0..=steps).map(|step| at(filled + left(step))));
if let Ok(path) = hidden.build() {
window.paint_path(path, cover);
}
}
// The ticks going dim: their bright shapes, the ring's own, fading over them.
if let Some(left) = live.dimming {
let geometry = geometry.borrow();
let made = geometry.as_ref().filter(|made| made.size == bounds.size);
for (state, dim, path) in made.into_iter().flat_map(|made| &made.ticks) {
if *dim {
let ink = color(*state).opacity(0.84 * left);
window.paint_path(moved(path, bounds.origin), ink);
}
}
}
// The ticks raised by the wave, the light and the front of the filling ring:
// one shape per state, each tick's height worked out once.
let raise = |index: usize| {
let angle = angle(index);
let mut raise = 0.;
if let Some((wave, height)) = live.wave {
raise += WAVE * height * bump(apart(angle, wave), WAVE_WIDTH);
}
if let Some(light) = live.light {
raise += LIGHT * light.glow * bump(apart(angle, light.head), LIGHT_WIDTH);
}
if let Some(filled) = live.filled {
let behind = (filled - angle) / FILL_FRONT;
if (0. ..1.).contains(&behind) {
raise += FILL * (PI * behind).sin();
}
}
raise
};
let mut raised = STATES.map(|state| (state, PathBuilder::fill(), false));
for (index, tick) in ticks.iter().enumerate() {
let raise = raise(index);
let hidden = live.filled.is_some_and(|filled| angle(index) > filled);
if raise > 0.5
&& !hidden
&& let Some((state, path, any)) =
(raised.iter_mut()).find(|(state, ..)| *state == tick.state)
{
let width = shape(*state).2;
frame.add_raised_tick(path, index, count, *state, width, raise);
*any = true;
}
}
for (state, path, any) in raised {
if any && let Ok(path) = path.build() {
window.paint_path(path, color(state));
}
}
// The ticks twinkling, those going out, and the lit one popping.
if let Some(sparkle) = live.sparkle {
frame.paint_twinkles(window, &ticks, sparkle, bright);
}
for (id, left) in &live.trail {
if let Some(index) = ticks.iter().position(|tick| tick.id == *id) {
paint_tick(
window,
index,
4. + 3. * left,
6. * left,
bright.opacity(0.9 * left),
);
}
}
if let Some(pop) = live.pop
&& let Some(index) = ticks.iter().position(|tick| Some(tick.id) == lit)
{
paint_tick(window, index, 7., POP * (PI * pop.sqrt()).sin(), bright);
}
// The light: its head, and a tail going out behind it.
if let Some(light) = live.light {
let back = if light.clockwise { -1. } else { 1. };
let end = light.head + back * LIGHT_TAIL;
frame.paint_tail(window, end, light.head, |near| {
(5., bright.opacity(light.glow * near.powf(1.6)))
});
}
},
)
.absolute()
.inset_0()
}
}
#[cfg(test)]
mod tests {
use std::f32::consts::{PI, TAU};
use super::{TWINKLE_LIFE, apart, bump, twinkles, twinkling};
#[test]
fn two_angles_are_apart_by_the_shortest_way_round() {
assert!((apart(0.1, TAU - 0.1) - 0.2).abs() < 1e-5);
assert!((apart(1., 3.) - 2.).abs() < 1e-5);
assert!((apart(0., PI) - PI).abs() < 1e-5);
}
#[test]
fn a_bump_raises_the_tick_under_it_most_and_none_far_away() {
assert_eq!(bump(0., 0.1), 1.);
assert!(bump(0.1, 0.1) < 0.5);
assert!(bump(1., 0.1) < 0.001);
}
#[test]
fn twinkles_start_while_the_event_lasts_and_all_go_out_a_life_after() {
// None before the first slot is over... the first tick twinkles from the start.
assert_eq!(twinkles(0., 1.).count(), 1);
// While the event lasts, a life's worth of slots twinkle at once.
let alive = twinkles(0.9, 1.).count();
assert!((20..=27).contains(&alive), "{alive}");
assert!(twinkles(0.9, 1.).all(|(_, glow)| (0. ..=1.).contains(&glow)));
// No new one after the event; the last ones go out a life later.
assert!(twinkles(1.5, 1.).count() < alive);
assert_eq!(twinkles(1. + TWINKLE_LIFE + 0.01, 1.).count(), 0);
}
#[test]
fn the_ticks_that_twinkle_are_scattered_and_the_same_at_each_frame() {
let picked: Vec<usize> = (0..40).map(|slot| twinkling(slot, 172)).collect();
assert!(picked.iter().all(|index| *index < 172));
assert_eq!(twinkling(7, 172), picked[7]);
let mut distinct = picked.clone();
distinct.sort_unstable();
distinct.dedup();
assert!(distinct.len() > 30, "{}", distinct.len());
}
}
+212
View File
@@ -0,0 +1,212 @@
//! The end of a followed Match over the cached ring (#89, #172): the comet and its trail, then
//! at its landing the flaring tick, the sparks, the shock, the wave through the ticks Completed,
//! the twinkles and the bouncing crown. Drawn by the page in a layer over the ring, which is not
//! drawn again; only the crown is the ring's own shape, moved.
use std::f32::consts::{PI, TAU};
use arena_tracker_core::ChampionState;
use gpui_kit::component::ActiveTheme as _;
use gpui_kit::*;
use super::live::{TWINKLE_LIFE, apart};
use super::{C, DISC, Frame, MIDDLE, Ring, crown, moved, shape, trace};
use crate::motion::{MATCH_SETTLE, MatchAnimation, MatchEnd, ease_out};
/// How far back the comet's trail reaches, in radians.
const TRAIL: f32 = 1.1;
/// How long the shock takes to spread from the tick and go out, in seconds, and how far.
const SHOCK: f32 = 1.04;
const SHOCK_REACH: f32 = 80.;
/// How long the sparks fly, and how many.
const SPARKS: f32 = 1.28;
const SPARK_COUNT: u32 = 12;
/// How long the wave takes to reach the tick opposite, and how long it raises each tick it
/// passes, in seconds; how far it raises them.
const RIPPLE: f32 = 1.04;
const RIPPLE_LIFE: f32 = 0.76;
const RIPPLE_RISE: f32 = 9.;
/// How high the crown bounces.
const BOUNCE: f32 = 44.;
/// A number between 0 and 1 for spark `spark`, the same at each frame.
fn scattered(spark: u32, salt: u32) -> f32 {
((spark + salt).wrapping_mul(2_654_435_761) >> 8) as f32 % 100. / 100.
}
impl Ring {
/// The end of a followed Match, `elapsed` seconds in, over the cached ring: only the moving
/// shapes, a function of the page's render so that the ring is not drawn again (rule #1). The
/// comet and its trail fly from noon to the tick; then the tick flares, gold for a new Mark,
/// bright otherwise, and for a champion Completed the ring celebrates: sparks and a shock
/// from the tick, a wave through the ticks Completed, twinkles, and the crown bouncing: the
/// ring's own crown, moved, not tessellated again.
pub fn match_layer(
&self,
animation: MatchAnimation,
elapsed: f32,
cx: &App,
) -> impl IntoElement {
let theme = cx.theme();
let (gold, bright, disc) = (theme.primary, theme.foreground, theme.background);
let (geometry, ticks) = (self.geometry.clone(), self.ticks.clone());
#[cfg(test)]
let tessellations = self.tessellations.clone();
canvas(
|_, _, _| {},
move |bounds, _, window, _| {
let frame = Frame::of(bounds);
let flight = animation.flight();
let dot = |window: &mut Window, at: Point<Pixels>, radius: f32, ink: Hsla| {
let radius = px(radius * frame.scale);
window.paint_quad(
fill(Bounds::centered_at(at, size(radius * 2., radius * 2.)), ink)
.corner_radii(radius),
);
};
let target = TAU * (animation.index as f32 + 0.5) / animation.count as f32;
if elapsed < flight {
let head = target * ease_out(elapsed / flight);
// The trail thins and goes out behind the comet.
frame.paint_tail(window, (head - TRAIL).max(0.), head, |near| {
(2. + 4. * near, gold.opacity(near.powf(1.5)))
});
dot(
window,
frame.on_crown(head, MIDDLE),
16.,
bright.opacity(0.3),
);
dot(window, frame.on_crown(head, MIDDLE), 9., bright);
return;
}
let since = elapsed - flight;
let t = (since / MATCH_SETTLE).clamp(0., 1.);
let pulse = (PI * t).sin();
let celebrates = animation.has_comet();
let mut tick = PathBuilder::fill();
frame.add_raised_tick(
&mut tick,
animation.index,
animation.count,
animation.state,
shape(animation.state).2 + 6. * pulse,
if animation.end == MatchEnd::Nothing {
4. * pulse
} else {
10. * pulse
},
);
if let Ok(path) = tick.build() {
let ink = if animation.end == MatchEnd::Mark {
gold
} else {
bright
};
window.paint_path(path, ink.opacity(pulse));
}
if !celebrates {
return;
}
// A wave spreads both ways from the tick through the ticks Completed.
let mut wave = PathBuilder::fill();
let mut any = false;
for (index, tick) in ticks.iter().enumerate() {
if tick.state != ChampionState::Completed {
continue;
}
let angle = (index as f32 + 0.5) * TAU / ticks.len() as f32;
let passed = (since - apart(angle, target) / PI * RIPPLE) / RIPPLE_LIFE;
if (0. ..1.).contains(&passed) {
let raise = RIPPLE_RISE * (PI * passed).sin();
let (state, width) = (tick.state, shape(tick.state).2);
frame.add_raised_tick(&mut wave, index, ticks.len(), state, width, raise);
any = true;
}
}
if any && let Ok(path) = wave.build() {
window.paint_path(path, gold);
}
// Ticks twinkle while the ring settles.
let sparkle = (since, MATCH_SETTLE - TWINKLE_LIFE);
frame.paint_twinkles(window, &ticks, sparkle, bright);
// The shock: a circle spreading from the tick, going out.
let landed = frame.on_crown(target, MIDDLE);
let spread = since / SHOCK;
if spread < 1. {
let reach = 10. + SHOCK_REACH * ease_out(spread);
let mut shock =
PathBuilder::stroke(px((1. + 4. * (1. - spread)) * frame.scale));
const SIDES: usize = 32;
let around = (0..=SIDES).map(|side| {
let turn = TAU * side as f32 / SIDES as f32;
landed
+ point(
px(reach * turn.cos() * frame.scale),
px(reach * turn.sin() * frame.scale),
)
});
trace(&mut shock, around);
if let Ok(path) = shock.build() {
window.paint_path(path, bright.opacity(0.9 * (1. - spread)));
}
}
// The sparks fly out of the tick, each its own way.
let flown = since / SPARKS;
if flown < 1. {
for spark in 0..SPARK_COUNT {
let turn =
TAU * (spark as f32 + 0.4 * scattered(spark, 0)) / SPARK_COUNT as f32;
let far = (40. + 64. * scattered(spark, 97)) * ease_out(flown);
let at = landed
+ point(
px(far * turn.cos() * frame.scale),
px(far * turn.sin() * frame.scale),
);
dot(window, at, 1. + 4. * (1. - flown), gold.opacity(1. - flown));
}
}
// Cover the resting crown inside the disc, then draw it at its bouncing height.
dot(window, frame.point(C, C), DISC, disc);
let rise = BOUNCE * (1. - t).powi(2) * (TAU * 1.5 * t).sin();
let by = bounds.origin - point(px(0.), px(rise * frame.scale));
// The ring painted its crown at this size, unless the layout just changed.
let geometry = geometry.borrow();
let made = geometry.as_ref().filter(|g| g.size == bounds.size);
let made_crown;
let crown = match made {
Some(made) => made.crown.as_ref(),
None => {
#[cfg(test)]
tessellations.set(tessellations.get() + 1);
made_crown = crown(Frame::of(Bounds {
origin: Point::default(),
size: bounds.size,
}));
made_crown.as_ref()
}
};
if let Some(path) = crown {
window.paint_path(moved(path, by), gold);
}
},
)
.absolute()
.inset_0()
}
}
#[cfg(test)]
mod tests {
use super::scattered;
#[test]
fn the_sparks_are_scattered_between_0_and_1_and_the_same_at_each_frame() {
let all: Vec<f32> = (0..12).map(|spark| scattered(spark, 97)).collect();
assert!(all.iter().all(|far| (0. ..1.).contains(far)));
assert_eq!(scattered(5, 97), all[5]);
assert!(all.iter().any(|far| *far < 0.4) && all.iter().any(|far| *far > 0.6));
}
}
+2 -2
View File
@@ -19,8 +19,8 @@ const CHANNELS: [(UpdateChannel, &str); 2] = [
];
const LOGON_LABEL: &str = "Lancer à l’ouverture de session Windows";
const RECAP_LABEL: &str = "Ouvrir le récapitulatif en fin de Partie";
const RECAP_HINT: &str = "À la fin d’une Partie Arena, « Parties » l’affiche, sans mettre la fenêtre \
au premier plan. Désactivé, le Défi reste affiché.";
const RECAP_HINT: &str = "À la fin d’une Partie Arena, « Parties » l’affiche et la fenêtre passe \
au premier plan. Désactivé, le Défi s’affiche.";
// Not « Disponible »: the interface word of a Pickable champion (CONTEXT.md).
const LOGON_UNAVAILABLE: &str = "Réservé à la version installée.";
+17 -15
View File
@@ -8,36 +8,38 @@ use gpui_kit::*;
use crate::card::{Card, Pose};
use crate::card_grid::TAKEN_DROP;
use crate::card_lift::{Lifted, Lowered};
use crate::motion::{ease_in, ease_out};
use crate::motion::{ease_in, ease_out, event};
use crate::theme::gold_soft;
// The champ select's entry and exit are events: each lasts twice its base duration (#171).
/// How long the band of light takes to cross the window, fading as it goes.
const SWEEP: Duration = Duration::from_millis(900);
const SWEEP: Duration = event(900);
/// How long the title takes to come in, rising.
const TITLE: Duration = Duration::from_millis(700);
const TITLE: Duration = event(700);
/// How far below its place the title starts.
const TITLE_RISE: f32 = 8.;
/// When the first card of the hand leaves the bottom of the window.
const FIRST_DEAL: Duration = Duration::from_millis(380);
const FIRST_DEAL: Duration = event(380);
/// How long after the card before it each next card leaves.
const DEAL_EVERY: Duration = Duration::from_millis(110);
const DEAL_EVERY: Duration = event(110);
/// How long a card takes from the bottom of the window to its place.
const DEAL: Duration = Duration::from_millis(700);
const DEAL: Duration = event(700);
/// How long a card of the hand takes to leave, the last one first.
const LEAVE: Duration = Duration::from_millis(320);
const LEAVE: Duration = event(320);
/// How long after the card after it each card leaves.
const LEAVE_EVERY: Duration = Duration::from_millis(35);
const LEAVE_EVERY: Duration = event(35);
/// How far down a card of the hand goes as it leaves.
const LEAVE_DROP: f32 = 48.;
/// How long the hand leaves alone before the veil of the tabs starts covering the screen.
pub(crate) const BEFORE_VEIL: Duration = Duration::from_millis(240);
pub(crate) const BEFORE_VEIL: Duration = event(240);
/// How long a card an ally just took takes to go down to its place (`card_grid::TAKEN_DROP`).
const TAKEN: Duration = Duration::from_millis(350);
const TAKEN: Duration = event(350);
/// How long it takes to grey, its new badge coming in.
const TAKEN_FADE: Duration = Duration::from_millis(500);
const TAKEN_FADE: Duration = event(500);
/// The band of light's curve, as CSS's `ease-out`.
const SWEEP_CURVE: Easing = Easing::EaseOut;
/// A card dealt's curve, the reference's `cubic-bezier(.2, 1.25, .35, 1)`: it goes a little past
/// A card dealt's curve, `cubic-bezier(.2, 1.25, .35, 1)`: it goes a little past
/// its place before settling there.
const DEAL_CURVE: Easing = Easing::CubicBezier {
x1: 0.2,
@@ -158,7 +160,7 @@ impl Entry {
}
/// A card on its way from the bottom of the window: how much of the way is left (below 0 past
/// its place, as the reference's curve goes beyond it before settling), and its opacity.
/// its place, as its curve goes beyond it before settling), and its opacity.
fn deal_pose(progress: f32) -> (f32, f32) {
let done = DEAL_CURVE.sample(progress);
(1. - done, done.clamp(0., 1.))
@@ -327,7 +329,7 @@ impl Taken {
}
/// The band of gold light crossing the window, `progress` 0 to 1, `window` its size: it goes
/// from left to right and fades as it goes, as the reference's gradient (GPUI's gradients have
/// from left to right and fades as it goes (GPUI's gradients have
/// two stops: the band is four of them side by side). Over the whole window, the title bar
/// included, and painted after everything else, the hand's moving cards too. It catches no
/// pointer.
@@ -336,7 +338,7 @@ pub(crate) fn sweep(progress: f32, window: Size<Pixels>, cx: &App) -> AnyElement
let gold = gold_soft(cx.theme());
let clear = gold.opacity(0.);
let light = hsla(0., 0., 1., 0.16);
// The reference's band, 28 % of a gradient three windows wide: 0.375 of a window to gold,
// The band is 28 % of a gradient three windows wide: 0.375 of a window to gold,
// then 0.045 to the white of its middle, and back.
let (outer, inner) = (0.375 * width, 0.045 * width);
let middle = -0.5 * width + 2. * width * progress;
+40 -39
View File
@@ -12,37 +12,37 @@ fn at(start: Instant, ms: u64) -> Instant {
}
#[test]
fn the_band_crosses_in_900_ms_and_the_title_comes_in_in_700() {
fn the_band_crosses_in_1800_ms_and_the_title_comes_in_in_1400() {
let start = Instant::now();
let entry = Entry::new(start);
assert_eq!(entry.sweep(start), Some(0.));
let halfway = entry.sweep(at(start, 450)).unwrap();
let halfway = entry.sweep(at(start, 900)).unwrap();
// Fast at first, then slowing, as CSS's ease-out.
assert!(halfway > 0.5 && halfway < 1., "{halfway}");
assert_eq!(entry.sweep(at(start, 900)), None);
assert_eq!(entry.sweep(at(start, 1800)), None);
assert_eq!(entry.title_pose(start), (0., 8.));
let (opacity, below) = entry.title_pose(at(start, 350));
let (opacity, below) = entry.title_pose(at(start, 700));
assert!(opacity > 0.5 && below < 4., "{opacity} {below}");
assert_eq!(entry.title_pose(at(start, 700)), (1., 0.));
assert_eq!(entry.title_pose(at(start, 1400)), (1., 0.));
}
#[test]
fn the_cards_leave_the_bottom_from_380_ms_then_every_110_ms() {
fn the_cards_leave_the_bottom_from_760_ms_then_every_220_ms() {
let start = Instant::now();
let mut entry = Entry::new(start);
entry.cards_arrived(start);
assert_eq!(entry.dealt(0, at(start, 379)), Dealt::Waiting);
assert_eq!(entry.dealt(0, at(start, 380)), Dealt::Moving(0.));
assert_eq!(entry.dealt(1, at(start, 489)), Dealt::Waiting);
assert_eq!(entry.dealt(1, at(start, 490)), Dealt::Moving(0.));
// Each takes 700 ms to its place.
assert!(matches!(entry.dealt(0, at(start, 1079)), Dealt::Moving(_)));
assert_eq!(entry.dealt(0, at(start, 1080)), Dealt::Landed);
assert_eq!(entry.dealt(0, at(start, 759)), Dealt::Waiting);
assert_eq!(entry.dealt(0, at(start, 760)), Dealt::Moving(0.));
assert_eq!(entry.dealt(1, at(start, 979)), Dealt::Waiting);
assert_eq!(entry.dealt(1, at(start, 980)), Dealt::Moving(0.));
// Each takes 1400 ms to its place.
assert!(matches!(entry.dealt(0, at(start, 2159)), Dealt::Moving(_)));
assert_eq!(entry.dealt(0, at(start, 2160)), Dealt::Landed);
// The fifth lands last, and the entry is over with it.
assert!(entry.animating(5, at(start, 1519)));
assert_eq!(entry.dealt(4, at(start, 1520)), Dealt::Landed);
assert!(!entry.animating(5, at(start, 1520)));
assert!(entry.animating(5, at(start, 3039)));
assert_eq!(entry.dealt(4, at(start, 3040)), Dealt::Landed);
assert!(!entry.animating(5, at(start, 3040)));
}
#[test]
@@ -50,19 +50,19 @@ fn cards_coming_late_are_dealt_from_then_and_only_once() {
let start = Instant::now();
let mut entry = Entry::new(start);
// The hand is empty while the statistics load: nothing waits for it.
assert!(!entry.animating(0, at(start, 900)));
assert_eq!(entry.dealt(0, at(start, 900)), Dealt::Landed);
entry.cards_arrived(at(start, 1000));
assert_eq!(entry.dealt(0, at(start, 1000)), Dealt::Moving(0.));
assert_eq!(entry.dealt(1, at(start, 1000)), Dealt::Waiting);
assert!(!entry.animating(0, at(start, 1800)));
assert_eq!(entry.dealt(0, at(start, 1800)), Dealt::Landed);
entry.cards_arrived(at(start, 2000));
assert_eq!(entry.dealt(0, at(start, 2000)), Dealt::Moving(0.));
assert_eq!(entry.dealt(1, at(start, 2000)), Dealt::Waiting);
// New reasons on the cards do not deal them again.
entry.cards_arrived(at(start, 1500));
assert_eq!(entry.dealt(0, at(start, 1700)), Dealt::Landed);
entry.cards_arrived(at(start, 3000));
assert_eq!(entry.dealt(0, at(start, 3400)), Dealt::Landed);
// Cards coming before the first should leave keep the entry's clock.
let mut early = Entry::new(start);
early.cards_arrived(at(start, 200));
assert_eq!(early.dealt(0, at(start, 380)), Dealt::Moving(0.));
early.cards_arrived(at(start, 400));
assert_eq!(early.dealt(0, at(start, 760)), Dealt::Moving(0.));
}
#[test]
@@ -113,16 +113,16 @@ fn leaving(down: f32, opacity: f32) -> Leaving {
}
#[test]
fn the_hand_leaves_from_the_last_card_to_the_first_in_about_a_third_of_a_second() {
fn the_hand_leaves_from_the_last_card_to_the_first_in_about_two_thirds_of_a_second() {
let start = Instant::now();
let leave = Leave::new(&hand(5), at_rest(), start);
assert_eq!(leave.pose(4, start), leaving(0., 1.));
let Leaving { down, opacity } = leave.pose(4, at(start, 160));
let Leaving { down, opacity } = leave.pose(4, at(start, 320));
assert!(down > 0. && opacity < 1.);
// The first card starts 4 × 35 ms later.
assert_eq!(leave.pose(0, at(start, 140)), leaving(0., 1.));
assert_eq!(leave.pose(4, at(start, 320)), leaving(48., 0.));
assert_eq!(leave.pose(0, at(start, 460)), leaving(48., 0.));
// The first card starts 4 × 70 ms later.
assert_eq!(leave.pose(0, at(start, 280)), leaving(0., 1.));
assert_eq!(leave.pose(4, at(start, 640)), leaving(48., 0.));
assert_eq!(leave.pose(0, at(start, 920)), leaving(48., 0.));
// In its place, seen whole.
let first = leave.card(1, 0).unwrap().1;
assert_eq!((first.left, first.opacity, first.above), (0., 1., 0.));
@@ -143,8 +143,8 @@ fn a_hand_ended_during_its_deal_leaves_from_where_each_card_was() {
let start = Instant::now();
let mut entry = Entry::new(start);
entry.cards_arrived(start);
// 700 ms: Briar, Lee Sin and Rumble on their way, the two others waiting.
let end = at(start, 700);
// 1400 ms: Briar, Lee Sin and Rumble on their way, the two others waiting.
let end = at(start, 1400);
let hand_at = HandAt {
entry: Some(entry),
..at_rest()
@@ -194,7 +194,8 @@ fn a_lifted_or_lowered_card_leaves_from_where_it_was() {
let lifted = leave.card(1, 0).unwrap().1;
assert_eq!((lifted.pose.progress, lifted.pose.veil), (1., 0.));
assert_eq!(lifted.above, 10.);
// Its 17 px, give or take the rounding of the height's rebound, which ends at sin(π).
assert_eq!(lifted.above, 17.);
assert_eq!(leave.card(2, 1).unwrap().1.pose.veil, 1.);
let lowered = leave.card(3, 2).unwrap().1;
@@ -211,9 +212,9 @@ fn a_card_taken_by_an_ally_goes_down_8_px_while_it_greys() {
let start = Instant::now();
let taken = Taken::new(7, Rc::new(card(7)), start);
assert_eq!((taken.above(start), taken.before(start)), (8., 1.));
assert_eq!(taken.above(at(start, 350)), 0.);
assert!(taken.before(at(start, 350)) > 0.);
assert!(!taken.done(at(start, 499)));
assert_eq!(taken.before(at(start, 500)), 0.);
assert!(taken.done(at(start, 500)));
assert_eq!(taken.above(at(start, 700)), 0.);
assert!(taken.before(at(start, 700)) > 0.);
assert!(!taken.done(at(start, 999)));
assert_eq!(taken.before(at(start, 1000)), 0.);
assert!(taken.done(at(start, 1000)));
}
+6 -10
View File
@@ -4,10 +4,10 @@ use std::sync::Arc;
use arena_tracker_core::{ChampionSort, Config, Preferences, RiotApi, Tracker, UpdateChannel};
use gpui_kit::{
AppContext as _, Entity, KeyDownEvent, KeyUpEvent, Keystroke, Modifiers, TestAppContext,
VisualTestContext, WindowOptions, WindowVisibility, point,
VisualTestContext, WindowOptions, point,
};
use super::{LiveMatchStarted, RecapOpened, RootView, Screen, SettingsStore, Setup};
use super::{LiveMatchStarted, MatchEndShown, RootView, Screen, SettingsStore, Setup};
use crate::card_images::tests::TestDir;
use crate::title_bar::{BAR_HEIGHT, BUTTON_WIDTH};
use crate::worker::UpdateChecked;
@@ -129,24 +129,20 @@ fn the_chosen_sort_is_saved_with_the_preferences_and_found_again_at_the_next_lau
}
#[gpui::test]
fn the_end_of_a_match_closes_the_settings_and_leaves_the_window_as_it_is(cx: &mut TestAppContext) {
fn the_end_of_a_game_closes_the_settings_without_activating_the_window(cx: &mut TestAppContext) {
let dir = TestDir::new("recap-129");
let (mut window, root) = open_app(cx, &dir.path().join("config.toml"), Config::load_or_default);
let cx = &mut window;
cx.update(|window, cx| root.update(cx, |root, cx| root.open_settings(window, cx)));
// In League, the window hidden in the notification area.
// In League: the game has the keyboard.
cx.deactivate_window();
cx.simulate_visibility_change(WindowVisibility::Hidden);
let page = root.read_with(cx, |root, _| root.page.clone());
page.update(cx, |_, cx| cx.emit(RecapOpened));
page.update(cx, |_, cx| cx.emit(MatchEndShown));
cx.run_until_parked();
assert!(root.read_with(cx, |root, _| root.screen == Screen::Page));
cx.update(|window, cx| {
assert_eq!(cx.active_window(), None, "the window was activated");
assert!(!window.is_visible(), "the window was shown");
});
cx.update(|_, cx| assert_eq!(cx.active_window(), None, "the window was activated"));
}
#[gpui::test]
+14
View File
@@ -135,6 +135,11 @@ pub fn friend_sync_line(name: &str, progress: Option<SyncProgress>) -> String {
}
}
/// The status line while the import waits for the Riot quota, `secs` left.
pub fn quota_line(secs: u64) -> String {
format!("Quota Riot atteint : reprise dans {secs} s")
}
#[cfg(test)]
mod tests {
use super::*;
@@ -229,6 +234,7 @@ mod tests {
let progress = SyncProgress {
fetched: 3,
to_fetch: 10,
..Default::default()
};
assert_eq!(
friend_sync_line("Bob", Some(progress)),
@@ -237,11 +243,18 @@ mod tests {
assert_eq!(friend_sync_line("Bob", None), "Import de Bob…");
}
#[test]
fn the_quota_line_counts_the_seconds_left() {
assert_eq!(quota_line(12), "Quota Riot atteint : reprise dans 12 s");
assert_eq!(quota_line(1), "Quota Riot atteint : reprise dans 1 s");
}
#[test]
fn the_sync_line_follows_what_is_running() {
let progress = SyncProgress {
fetched: 3,
to_fetch: 10,
..Default::default()
};
assert_eq!(
sync_line(true, Some(progress), false, Some(5)),
@@ -254,6 +267,7 @@ mod tests {
let nothing = SyncProgress {
fetched: 0,
to_fetch: 0,
..Default::default()
};
assert_eq!(
sync_line(true, Some(nothing), false, Some(5)),
+1 -1
View File
@@ -44,7 +44,7 @@ pub fn ring_played(theme: &Theme) -> Hsla {
gold_soft(theme)
}
/// The reference's soft gold: a played champion's tick, the light sweeping the window.
/// The soft gold: a played champion's tick, the light sweeping the window.
pub fn gold_soft(theme: &Theme) -> Hsla {
if theme.mode.is_dark() {
Hsla::from(rgb(LOGO_GOLD)).opacity(0.34)
+6 -3
View File
@@ -23,11 +23,14 @@ pub fn spawn_friend_import(tracker: Arc<Tracker>, puuid: String, tx: Sender<Msg>
let mut last = None;
let result = tracker.import_friend(&puuid, &mut |progress| {
let now = std::time::Instant::now();
if last.is_some_and(|last| now.duration_since(last) < std::time::Duration::from_secs(1))
{
// The start and the end of a quota wait always pass.
if last.is_some_and(|(at, wait): (_, Option<_>)| {
wait == progress.quota_wait
&& now.duration_since(at) < std::time::Duration::from_secs(1)
}) {
return;
}
last = Some(now);
last = Some((now, progress.quota_wait));
let _ = tx.try_send(Msg::FriendProgress {
puuid: puuid.clone(),
progress,
+3 -3
View File
@@ -97,10 +97,10 @@ impl ChampionSource for DataDragon {
const CARD_PORTRAIT_WIDTH: u32 = 308;
/// Height of a stored card portrait: `CARD_PORTRAIT_WIDTH / CARD_ASPECT`, rounded.
const CARD_PORTRAIT_HEIGHT: u32 = 453;
/// A card's width over its height (the mockup's `.card { aspect-ratio: .68 }`): the ratio the
/// A card's width over its height: the ratio the
/// stored card portraits are cropped to, and the one the app draws its cards at.
pub const CARD_ASPECT: f64 = 0.68;
/// Where the crop window sits in the overflow (the mockup's `object-position: 50% 24%`).
/// Where the crop window sits in the overflow, as CSS's `object-position: 50% 24%`.
const CARD_FOCUS_X: f64 = 0.5;
const CARD_FOCUS_Y: f64 = 0.24;
const CARD_JPEG_QUALITY: u8 = 85;
@@ -428,7 +428,7 @@ mod tests {
}
#[test]
fn the_crop_keeps_the_full_width_and_the_mockups_focus() {
fn the_crop_keeps_the_full_width_and_focuses_near_the_top() {
assert_eq!(CARD_PORTRAIT_HEIGHT, (308.0 / CARD_ASPECT).round() as u32);
// 24 % of the 107 px overflow.
assert_eq!(card_crop(308, 560), (0, 26, 308, 453));
+8
View File
@@ -121,6 +121,14 @@ impl Follow {
self.blocks_synced = true;
}
/// The Account's PUUID changed (`tracker/rekey.rs`): what the session holds follows it.
pub(crate) fn rekey(&mut self, old: &str, new: &str) {
if let Some(a) = self.updating.as_mut().filter(|a| a.puuid == old) {
a.puuid = new.into();
}
self.watches.iter_mut().for_each(|w| w.rekey(old, new));
}
/// The Account was deleted: nothing of it stays to keep its Riot ID from being adopted
/// again (with a full import) or its Matches from being stored again.
pub(crate) fn forget(&mut self, account: &Account) {
+6
View File
@@ -16,6 +16,12 @@ impl Watch {
pub(super) fn is_of(&self, puuid: &str) -> bool {
self.puuid == puuid
}
pub(super) fn rekey(&mut self, old: &str, new: &str) {
if self.puuid == old {
self.puuid = new.into();
}
}
}
impl Tracker {
+3 -1
View File
@@ -106,10 +106,12 @@ pub struct FollowedMatch {
pub end: MatchEnd,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct SyncProgress {
pub fetched: usize,
pub to_fetch: usize,
/// Set while the import waits for the Riot quota: how long from now.
pub quota_wait: Option<std::time::Duration>,
}
#[derive(Clone, Debug)]
+31 -83
View File
@@ -5,21 +5,24 @@ mod deletion;
mod directory;
pub use directory::AccountDirectory;
mod friends;
mod import;
mod mastery;
mod payload;
mod provisional;
mod rekey;
mod storage;
pub(crate) use blocks::StoredBlock;
pub use deletion::AccountSummary;
pub use friends::{AddFriendError, AddedFriend};
use payload::decode_match;
use std::collections::HashSet;
use std::collections::{HashMap, HashSet};
use std::ops::Range;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Condvar, Mutex, MutexGuard, PoisonError};
use std::thread;
use std::time::Duration;
use storage::store_match;
use rusqlite::{Connection, OptionalExtension, Row, params};
@@ -32,8 +35,6 @@ use crate::follow::Follow;
use crate::model::{Account, Format, Match, SyncProgress, SyncReport};
use crate::seasons::{Season, default_seasons};
/// Arena queues Riot lists Matches under (the PBE queue 1704 is left out on purpose).
const QUEUES: [u32; 4] = [1700, 1710, 1740, 1750];
const PAGE_SIZE: usize = 100;
/// A Match is published when the whole game ends, so one that started before the newest
/// stored Match (a player eliminated early who queued again) can show up later.
@@ -57,6 +58,8 @@ pub struct Tracker {
corrections: AtomicUsize,
/// Captured before selecting an account. A later deletion invalidates an in-flight lookup.
deletions: AtomicUsize,
/// The PUUIDs replaced since the tracker opened, old to new (`replaced_puuid`).
replaced: Mutex<HashMap<String, String>>,
/// Followed Matches whose Death Recap is to be fetched, for the app's background thread.
pub(crate) death_recaps: DeathRecapQueue,
}
@@ -77,6 +80,7 @@ impl Tracker {
sync_lock: Mutex::new(()),
corrections: AtomicUsize::new(0),
deletions: AtomicUsize::new(0),
replaced: Mutex::default(),
death_recaps: DeathRecapQueue::default(),
})
}
@@ -108,8 +112,13 @@ impl Tracker {
let (game_name, tag_line) =
split_riot_id(riot_id).ok_or_else(|| Error::InvalidRiotId(riot_id.into()))?;
log::info!("Sync of {riot_id} started");
let account = with_retry(|| self.history.resolve_account(game_name, tag_line))?;
// shortcut: Riot API puuids are scoped to the key's application, so the same Riot ID under the relay's production key becomes a second Account; merging them safely needs proof of identity (#150).
let account = import::told(SyncProgress::default(), on_progress, |on_wait| {
with_retry_told(
|| self.history.resolve_account(game_name, tag_line),
on_wait,
)
})?;
self.rekey(&account, &|| {})?;
{
let db = self.db();
if self.deletion_count() != deletions
@@ -153,7 +162,7 @@ impl Tracker {
/// A Match Riot does not have or that cannot be read is skipped rather than failing the
/// caller: one bad id must not block the rest.
pub(crate) fn fetch_and_store(&self, puuid: &str, match_id: &str) -> Result<Fetched, Error> {
self.fetch_match_when(puuid, match_id, &|| {})
self.fetch_match_when(puuid, match_id, &|| {}, &mut |_| {})
}
fn fetch_match_when(
@@ -161,8 +170,10 @@ impl Tracker {
puuid: &str,
match_id: &str,
before_send: &dyn Fn(),
on_wait: &mut dyn FnMut(Duration),
) -> Result<Fetched, Error> {
let raw = match with_retry(|| self.history.fetch_match_when(match_id, before_send)) {
let fetch = || self.history.fetch_match_when(match_id, before_send);
let raw = match with_retry_told(fetch, on_wait) {
Ok(raw) => raw,
Err(SourceError::NotFound) => return Ok(Fetched::NotFound),
Err(e) => return Err(e.into()),
@@ -314,7 +325,7 @@ impl Tracker {
}
/// The ids of the Account's published Matches.
fn match_ids_stored(&self, puuid: &str) -> Result<HashSet<String>, Error> {
pub(super) fn match_ids_stored(&self, puuid: &str) -> Result<HashSet<String>, Error> {
let db = self.db();
let mut stmt =
db.prepare("SELECT match_id FROM matches WHERE puuid = ?1 AND provisional = 0")?;
@@ -323,80 +334,6 @@ impl Tracker {
.collect::<Result<_, _>>()?;
Ok(ids)
}
/// Downloads each missing Match once across the ordered listing steps.
fn import_matches(
&self,
puuid: &str,
steps: impl IntoIterator<Item = Option<i64>>,
friend_gate: Option<&dyn Fn()>,
on_progress: &mut dyn FnMut(SyncProgress),
) -> Result<usize, Error> {
let before_send = friend_gate.unwrap_or(&|| {});
let friend = friend_gate.is_some();
let mut known = self.match_ids_stored(puuid)?;
let mut progress = SyncProgress {
fetched: 0,
to_fetch: 0,
};
let mut added = 0;
for (step, since_s) in steps.into_iter().enumerate() {
let mut to_fetch = self.list_match_ids(puuid, since_s, friend_gate)?;
if step == 0 {
// Looked for until Riot publishes them, like a sync does.
to_fetch.extend(self.provisional_ids(puuid)?);
}
to_fetch.retain(|id| known.insert(id.clone()));
progress.to_fetch += to_fetch.len();
on_progress(progress);
for match_id in &to_fetch {
if friend {
self.stored_account(puuid)?;
}
if self.fetch_match_when(puuid, match_id, before_send)? == Fetched::Added {
added += 1;
}
progress.fetched += 1;
on_progress(progress);
}
}
Ok(added)
}
/// Lists every queue, yielding to higher-priority requests at each dispatch.
fn list_match_ids(
&self,
puuid: &str,
since_s: Option<i64>,
friend_gate: Option<&dyn Fn()>,
) -> Result<Vec<String>, Error> {
let mut ids = Vec::new();
for queue_id in QUEUES {
let mut start = 0;
loop {
if friend_gate.is_some() {
self.stored_account(puuid)?;
}
let page = with_retry(|| {
self.history.match_ids_when(
puuid,
queue_id,
start,
PAGE_SIZE,
since_s,
friend_gate.unwrap_or(&|| {}),
)
})?;
let full_page = page.len() == PAGE_SIZE;
ids.extend(page);
if !full_page {
break;
}
start += PAGE_SIZE;
}
}
Ok(ids)
}
}
pub(crate) fn account_from_row(row: &Row) -> rusqlite::Result<Account> {
@@ -455,11 +392,22 @@ pub(crate) enum Fetched {
/// quota frees up in time, and an import must not stop for it. The source bounds each wait
/// (at least a second, at most ten minutes, see `SourceError::RateLimited`).
pub(crate) fn with_retry<T>(
call: impl FnMut() -> Result<T, SourceError>,
) -> Result<T, SourceError> {
with_retry_told(call, &mut |_| {})
}
/// `with_retry` that tells each wait to `on_wait` before sleeping it.
pub(crate) fn with_retry_told<T>(
mut call: impl FnMut() -> Result<T, SourceError>,
on_wait: &mut dyn FnMut(Duration),
) -> Result<T, SourceError> {
loop {
match call() {
Err(SourceError::RateLimited { retry_after }) => thread::sleep(retry_after),
Err(SourceError::RateLimited { retry_after }) => {
on_wait(retry_after);
thread::sleep(retry_after);
}
result => return result,
}
}
+26 -3
View File
@@ -6,7 +6,8 @@
use rusqlite::{OptionalExtension, params};
use super::{OVERLAP_S, Tracker, account_from_row, split_riot_id, with_retry};
use super::import::told;
use super::{OVERLAP_S, Tracker, account_from_row, split_riot_id, with_retry, with_retry_told};
use crate::error::{Error, SourceError};
use crate::follow::{UpdateProblem, account_riot_id, riot_id, same_riot_id, wall_clock_ms};
use crate::model::{Account, SyncProgress, SyncReport};
@@ -142,6 +143,8 @@ impl Tracker {
/// Challenge fills meanwhile. `on_progress` counts the Matches of the whole call: its
/// `to_fetch` grows when the older Matches are listed.
///
/// A new Riot key may have changed its PUUID: that is looked at first (`rekey.rs`).
///
/// Each request waits for the active Account's (a round, a refresh, a finished game's
/// Match not published yet); the relay keeps both within the quota. Blocks
/// for long: call it from a low-priority background thread, never the follower's. Fails
@@ -151,7 +154,28 @@ impl Tracker {
puuid: &str,
on_progress: &mut dyn FnMut(SyncProgress),
) -> Result<SyncReport, Error> {
let account = self.stored_account(puuid)?;
let gate = || self.wait_for_follower();
let mut account = self.stored_account(puuid)?;
// Before any request that carries the stored PUUID: a new key may have changed it.
let resolved = told(SyncProgress::default(), on_progress, |on_wait| {
let resolve = || {
gate();
(self.history).resolve_account(&account.game_name, &account.tag_line)
};
with_retry_told(resolve, on_wait)
});
match resolved {
Ok(resolved) if resolved.puuid != account.puuid => {
self.rekey(&resolved, &gate)?;
// Without proof nothing moved: the requested Account stays.
let current = self.replaced_puuid(puuid);
account = self.stored_account(current.as_deref().unwrap_or(puuid))?;
}
// The Riot ID changed: nothing tells the PUUID changed too.
Ok(_) | Err(SourceError::NotFound) => {}
Err(e) => return Err(e.into()),
}
let puuid = account.puuid.as_str();
let who = account_riot_id(&account);
log::info!("Import of {who} started");
let steps = match self.synced_until_ms(puuid)? {
@@ -162,7 +186,6 @@ impl Tracker {
season_start.into_iter().map(Some).chain([None]).collect()
}
};
let gate = || self.wait_for_follower();
let added = self.import_matches(puuid, steps, Some(&gate), on_progress)?;
self.mark_synced(puuid)?;
self.stored_account(puuid)?;
+113
View File
@@ -0,0 +1,113 @@
//! The import of an Account's Matches: listing what is missing, then fetching each Match.
use std::time::Duration;
use super::{Fetched, PAGE_SIZE, Tracker, with_retry_told};
use crate::error::Error;
use crate::model::SyncProgress;
/// Arena queues Riot lists Matches under (the PBE queue 1704 is left out on purpose).
const QUEUES: [u32; 4] = [1700, 1710, 1740, 1750];
/// Runs one request of an import: each Riot quota wait it tells is reported as `progress` with
/// the wait, and the import line comes back (`progress` alone) once the request has answered.
pub(super) fn told<T>(
progress: SyncProgress,
on_progress: &mut dyn FnMut(SyncProgress),
request: impl FnOnce(&mut dyn FnMut(Duration)) -> T,
) -> T {
let mut waited = false;
let result = request(&mut |wait| {
waited = true;
on_progress(SyncProgress {
quota_wait: Some(wait),
..progress
});
});
if waited {
on_progress(progress);
}
result
}
impl Tracker {
/// Downloads each missing Match once across the ordered listing steps.
pub(super) fn import_matches(
&self,
puuid: &str,
steps: impl IntoIterator<Item = Option<i64>>,
friend_gate: Option<&dyn Fn()>,
on_progress: &mut dyn FnMut(SyncProgress),
) -> Result<usize, Error> {
let before_send = friend_gate.unwrap_or(&|| {});
let friend = friend_gate.is_some();
let mut known = self.match_ids_stored(puuid)?;
let mut progress = SyncProgress::default();
let mut added = 0;
for (step, since_s) in steps.into_iter().enumerate() {
let mut to_fetch =
self.list_match_ids(puuid, since_s, friend_gate, progress, on_progress)?;
if step == 0 {
// Looked for until Riot publishes them, like a sync does.
to_fetch.extend(self.provisional_ids(puuid)?);
}
to_fetch.retain(|id| known.insert(id.clone()));
progress.to_fetch += to_fetch.len();
on_progress(progress);
for match_id in &to_fetch {
if friend {
self.stored_account(puuid)?;
}
let fetched = told(progress, on_progress, |on_wait| {
self.fetch_match_when(puuid, match_id, before_send, on_wait)
})?;
if fetched == Fetched::Added {
added += 1;
}
progress.fetched += 1;
on_progress(progress);
}
}
Ok(added)
}
/// Lists every queue, yielding to higher-priority requests at each dispatch.
fn list_match_ids(
&self,
puuid: &str,
since_s: Option<i64>,
friend_gate: Option<&dyn Fn()>,
progress: SyncProgress,
on_progress: &mut dyn FnMut(SyncProgress),
) -> Result<Vec<String>, Error> {
let mut ids = Vec::new();
for queue_id in QUEUES {
let mut start = 0;
loop {
if friend_gate.is_some() {
self.stored_account(puuid)?;
}
let page = told(progress, on_progress, |on_wait| {
let list = || {
self.history.match_ids_when(
puuid,
queue_id,
start,
PAGE_SIZE,
since_s,
friend_gate.unwrap_or(&|| {}),
)
};
with_retry_told(list, on_wait)
})?;
let full_page = page.len() == PAGE_SIZE;
ids.extend(page);
if !full_page {
break;
}
start += PAGE_SIZE;
}
}
Ok(ids)
}
}
+173
View File
@@ -0,0 +1,173 @@
//! Follows an Account when its PUUID changes: a PUUID depends on the Riot application of the
//! API key, so a new key gives every Account another one for the same Riot ID (#150). A stored
//! Account takes the new PUUID only on proof that it is the same Account, never on the Riot ID
//! alone (a Friend may have been renamed, its name taken by someone else); without proof
//! nothing changes.
use rusqlite::{OptionalExtension, params};
use super::{
OVERLAP_S, PAGE_SIZE, Tracker, friends::platform_key, mastery::mastery_key,
payload::decode_match, synced_until_key, with_retry,
};
use crate::error::{Error, SourceError};
use crate::follow::{account_riot_id, same_riot_id};
use crate::journal::short;
use crate::model::Account;
impl Tracker {
/// The PUUID that replaced this one since the tracker opened: the app uses it to keep
/// showing the same Account.
pub fn replaced_puuid(&self, puuid: &str) -> Option<String> {
let replaced = self.replaced.lock().unwrap_or_else(|e| e.into_inner());
replaced.get(puuid).cloned()
}
/// Moves every stored Account with the Riot ID of `resolved` (what Riot answers now) to its
/// PUUID, when the proof holds (`is_same_account`). `gate` runs before each request of it.
pub(super) fn rekey(&self, resolved: &Account, gate: &dyn Fn()) -> Result<(), Error> {
let riot_id = account_riot_id(resolved);
let stored = self.account_directory();
let stale = (stored.accounts.iter())
.filter(|a| a.puuid != resolved.puuid && same_riot_id(&account_riot_id(a), &riot_id));
for old in stale {
if self.is_same_account(&old.puuid, &resolved.puuid, gate)? {
self.move_puuid(&old.puuid, resolved)?;
}
}
Ok(())
}
/// Whether a published Match stored for `old` is listed for `new` too, and `new` has the
/// same champion and Placement in it: anyone who shared the Match would pass the first, and
/// (champion, Placement) names one participant of an Arena Match (a Placement is a team's,
/// a champion is unique within a team).
fn is_same_account(&self, old: &str, new: &str, gate: &dyn Fn()) -> Result<bool, Error> {
let newest: Option<(u32, i64)> = self
.db()
.query_row(
"SELECT queue_id, started_at_ms FROM matches
WHERE puuid = ?1 AND provisional = 0 ORDER BY started_at_ms DESC LIMIT 1",
[old],
|row| Ok((row.get(0)?, row.get(1)?)),
)
.optional()?;
let Some((queue_id, started_at_ms)) = newest else {
return Ok(false);
};
// shortcut: one page (the 100 newest Matches of that queue since the stored one), so an Account not synced for more than 100 Matches of one queue stays unproven; page through if that ever happens.
let listed = with_retry(|| {
let since_s = Some(started_at_ms / 1000 - OVERLAP_S);
(self.history).match_ids_when(new, queue_id, 0, PAGE_SIZE, since_s, gate)
})?;
let stored = self.match_ids_stored(old)?;
let Some(id) = listed.into_iter().find(|id| stored.contains(id)) else {
return Ok(false);
};
let raw = match with_retry(|| self.history.fetch_match_when(&id, gate)) {
Ok(raw) => raw,
Err(SourceError::NotFound) => return Ok(false),
Err(e) => return Err(e.into()),
};
let Ok(Some((played, _))) = decode_match(&raw, new) else {
return Ok(false);
};
let kept = self.stored_match(old, &id)?;
Ok(kept.is_some_and(|m| {
(m.champion_id, m.placement) == (played.champion_id, played.placement)
}))
}
/// Replaces the PUUID everywhere in one transaction; a new PUUID already stored is merged,
/// its own marks and published Matches winning.
fn move_puuid(&self, old: &str, resolved: &Account) -> Result<(), Error> {
let new = resolved.puuid.as_str();
let mut db = self.db();
let tx = db.transaction()?;
// Another caller may have moved it already, or it was deleted during the proof.
if !(tx.prepare("SELECT 1 FROM accounts WHERE puuid = ?1")?).exists([old])? {
return Ok(());
}
for sql in [
"DELETE FROM matches WHERE puuid = ?2 AND provisional = 1 AND match_id IN
(SELECT match_id FROM matches WHERE puuid = ?1 AND provisional = 0)",
"DELETE FROM matches WHERE puuid = ?1 AND match_id IN
(SELECT match_id FROM matches WHERE puuid = ?2)",
// The stored Riot responses name the Account's participant by PUUID (`match_recap` reads it).
"UPDATE matches SET puuid = ?2, raw = replace(raw, ?1, ?2) WHERE puuid = ?1",
"UPDATE OR IGNORE mastery SET puuid = ?2 WHERE puuid = ?1",
"UPDATE meta SET value = ?2 WHERE name = 'last_active_puuid' AND value = ?1",
] {
tx.execute(sql, params![old, new])?;
}
tx.execute("DELETE FROM mastery WHERE puuid = ?1", [old])?;
for key in [synced_until_key, mastery_key, platform_key] {
let (from, to) = (key(old), key(new));
tx.execute(
"UPDATE OR IGNORE meta SET name = ?2 WHERE name = ?1",
[&from, &to],
)?;
tx.execute("DELETE FROM meta WHERE name = ?1", [&from])?;
}
if tx
.prepare("SELECT 1 FROM accounts WHERE puuid = ?1")?
.exists([new])?
{
tx.execute(
"UPDATE accounts SET friend = MAX(friend,
(SELECT friend FROM accounts WHERE puuid = ?1)) WHERE puuid = ?2",
params![old, new],
)?;
tx.execute("DELETE FROM accounts WHERE puuid = ?1", [old])?;
} else {
tx.execute(
"UPDATE accounts SET puuid = ?2, game_name = ?3, tag_line = ?4 WHERE puuid = ?1",
params![old, new, resolved.game_name, resolved.tag_line],
)?;
}
tx.commit()?;
self.refresh_directory(&db)?;
self.follow().rekey(old, new);
(self.replaced.lock().unwrap_or_else(|e| e.into_inner())).insert(old.into(), new.into());
log::info!(
"Account {} moved to another PUUID ({} to {})",
account_riot_id(resolved),
short(old),
short(new)
);
Ok(())
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::tracker::tests::NoHistory;
use std::path::Path;
#[test]
fn moving_a_puuid_twice_or_one_not_stored_changes_nothing() {
let tracker = Tracker::open(Path::new(":memory:"), Box::new(NoHistory)).unwrap();
tracker
.db()
.execute(
"INSERT INTO accounts (puuid, game_name, tag_line, friend) VALUES ('old', 'P', 'EUW', 1)",
[],
)
.unwrap();
let new = Account {
puuid: "new".into(),
game_name: "P".into(),
tag_line: "EUW".into(),
};
tracker.move_puuid("old", &new).unwrap();
// Two callers proved the same change: the second finds nothing to move.
tracker.move_puuid("old", &new).unwrap();
tracker.move_puuid("never-stored", &new).unwrap();
assert_eq!(tracker.friends().unwrap(), [new]);
assert_eq!(tracker.replaced_puuid("old").as_deref(), Some("new"));
assert_eq!(tracker.replaced_puuid("never-stored"), None);
}
}
+1 -1
View File
@@ -152,7 +152,7 @@ fn a_database_of_the_previous_version_gains_the_provisional_flag_and_keeps_its_m
assert_eq!(open().matches("p").unwrap(), matches);
}
struct NoHistory;
pub(super) struct NoHistory;
impl MatchHistorySource for NoHistory {
fn resolve_account(&self, _: &str, _: &str) -> Result<Account, SourceError> {
+45 -2
View File
@@ -47,9 +47,17 @@ pub struct FakeHistory {
failure: Mutex<Option<SourceError>>,
/// Match requests fail with this (after the general failure) until it is cleared.
match_failure: Mutex<Option<SourceError>>,
/// Match id listings fail with this (after the general failure) until it is cleared.
listing_failure: Mutex<Option<SourceError>>,
fail_after: Option<usize>,
/// The next Match and timeline requests answer "rate limited", this many times.
rate_limits: AtomicUsize,
/// The next Match id listings answer "rate limited", this many times.
listing_rate_limits: AtomicUsize,
/// The next Riot ID resolutions answer "rate limited", this many times.
resolve_rate_limits: AtomicUsize,
/// What a "rate limited" answer asks to wait; none by default so tests do not sleep.
retry_after: Duration,
/// Lists in the order the Matches were added instead of newest first.
as_given: bool,
/// Called at the start of every fetch: announces it, then waits to be released.
@@ -84,8 +92,12 @@ impl FakeHistory {
listings: Mutex::default(),
failure: Mutex::default(),
match_failure: Mutex::default(),
listing_failure: Mutex::default(),
fail_after: None,
rate_limits: AtomicUsize::new(0),
listing_rate_limits: AtomicUsize::new(0),
resolve_rate_limits: AtomicUsize::new(0),
retry_after: Duration::ZERO,
as_given: false,
resolve_gate: None,
gate: None,
@@ -181,6 +193,12 @@ impl FakeHistory {
*self.match_failure.lock().unwrap() = error;
}
/// Every Match id listing fails with this error until `None` is set (the other requests are
/// not affected).
pub fn fail_listing_with(&self, error: Option<SourceError>) {
*self.listing_failure.lock().unwrap() = error;
}
/// Every fetch after the first `n` fails with a network error.
pub fn failing_after(mut self, n: usize) -> FakeHistory {
self.fail_after = Some(n);
@@ -198,13 +216,33 @@ impl FakeHistory {
self.rate_limits.store(n, Ordering::SeqCst);
}
/// The next `n` Match id listings answer "rate limited".
pub fn rate_limit_listing_next(&self, n: usize) {
self.listing_rate_limits.store(n, Ordering::SeqCst);
}
/// The next `n` Riot ID resolutions answer "rate limited".
pub fn rate_limit_resolution_next(&self, n: usize) {
self.resolve_rate_limits.store(n, Ordering::SeqCst);
}
/// A "rate limited" answer asks to wait this long.
pub fn retry_after(mut self, wait: Duration) -> FakeHistory {
self.retry_after = wait;
self
}
fn rate_limit(&self) -> Result<(), SourceError> {
let limited = (self.rate_limits)
self.limit_by(&self.rate_limits)
}
fn limit_by(&self, limits: &AtomicUsize) -> Result<(), SourceError> {
let limited = limits
.try_update(Ordering::SeqCst, Ordering::SeqCst, |n| n.checked_sub(1))
.is_ok();
match limited {
true => Err(SourceError::RateLimited {
retry_after: Duration::ZERO,
retry_after: self.retry_after,
}),
false => Ok(()),
}
@@ -318,6 +356,7 @@ impl FakeHistory {
impl MatchHistorySource for FakeHistory {
fn resolve_account(&self, game_name: &str, tag_line: &str) -> Result<Account, SourceError> {
self.enter(format!("account {game_name}#{tag_line}"))?;
self.limit_by(&self.resolve_rate_limits)?;
if let Some((entered, release)) = &self.resolve_gate {
entered.send(()).unwrap();
release.lock().unwrap().recv().unwrap();
@@ -342,6 +381,10 @@ impl MatchHistorySource for FakeHistory {
start_time_s: Option<i64>,
) -> Result<Vec<String>, SourceError> {
self.enter(format!("ids {puuid}"))?;
self.limit_by(&self.listing_rate_limits)?;
if let Some(error) = &*self.listing_failure.lock().unwrap() {
return Err(error.clone());
}
let mut found: Vec<_> = self
.listings
.lock()
+23 -1
View File
@@ -5,7 +5,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::Duration;
use arena_tracker_core::{
DamageSums, DeathRecap, DeathRecapState, Effect, GameCatalog, GameData, MatchRecap,
Account, DamageSums, DeathRecap, DeathRecapState, Effect, GameCatalog, GameData, MatchRecap,
SourceError, Tracker,
};
use common::{FakeHistory, RIOT_ID, SELF_PUUID, recorded_account};
@@ -318,3 +318,25 @@ fn deleting_the_last_owner_while_a_timeline_is_in_flight_discards_the_response()
));
});
}
#[test]
fn a_stored_death_recap_is_still_read_after_the_account_changes_puuid() {
let world = world();
let first = world.fetch().unwrap();
let new = "fixture-puuid-new-key";
let account = Account {
puuid: new.into(),
..recorded_account()
};
let history = FakeHistory::new(account, vec![RECAP_MATCH.replace(SELF_PUUID, new)]);
let tracker = Tracker::open(&world.dir.path().join("arena.db"), Box::new(history)).unwrap();
tracker.sync(RIOT_ID, &mut |_| {}).unwrap();
let recap = tracker.match_recap(new, MATCH_ID).unwrap().unwrap();
assert_eq!(
tracker.death_recap(&recap, &catalog(&world.dir)).unwrap(),
first
);
assert_eq!(tracker.match_count(SELF_PUUID).unwrap(), 0);
}
+2
View File
@@ -212,6 +212,8 @@ mod deletion;
mod friends;
#[path = "follow/in_game.rs"]
mod in_game;
#[path = "follow/key_change.rs"]
mod key_change;
#[path = "follow/live_matches.rs"]
mod live_matches;
#[path = "follow/pending_matches.rs"]
+159
View File
@@ -0,0 +1,159 @@
//! Riot's key changes while the app runs: the Account being updated follows its new PUUID.
use super::provisional_matches::{game, published, start_game};
use super::*;
use arena_tracker_core::MatchHistorySource;
use std::sync::atomic::AtomicBool;
const NEW: &str = "fixture-puuid-new-key";
/// Riot under the old key until `new_key` is set, then under the new one.
struct Switch {
old: Arc<FakeHistory>,
new: Arc<FakeHistory>,
new_key: Arc<AtomicBool>,
}
impl Switch {
fn now(&self) -> &FakeHistory {
match self.new_key.load(Ordering::SeqCst) {
true => &self.new,
false => &self.old,
}
}
}
impl MatchHistorySource for Switch {
fn resolve_account(&self, game_name: &str, tag_line: &str) -> Result<Account, SourceError> {
self.now().resolve_account(game_name, tag_line)
}
fn match_ids(
&self,
puuid: &str,
queue_id: u32,
start: usize,
count: usize,
start_time_s: Option<i64>,
) -> Result<Vec<String>, SourceError> {
self.now()
.match_ids(puuid, queue_id, start, count, start_time_s)
}
fn fetch_match(&self, match_id: &str) -> Result<String, SourceError> {
self.now().fetch_match(match_id)
}
}
#[test]
fn the_account_updated_follows_its_new_puuid_when_the_key_changes_during_the_session() {
let dir = tempfile::tempdir().unwrap();
let new_key = Arc::new(AtomicBool::new(false));
let account = Account {
puuid: NEW.into(),
..recorded_account()
};
let all = payloads(&s2_matches());
let under_new = all.iter().map(|p| played_by(p, NEW)).collect();
let source = Switch {
old: Arc::new(FakeHistory::new(recorded_account(), all.clone())),
new: Arc::new(FakeHistory::new(account, under_new)),
new_key: new_key.clone(),
};
let client = FakeClient::recorded();
let tracker = Tracker::open(&dir.path().join("arena.db"), Box::new(source))
.unwrap()
.with_seasons(seasons())
.with_client(Box::new(client.clone()));
round(&tracker);
let updating = |tracker: &Tracker| tracker.status().updating.map(|a| a.puuid);
assert_eq!(updating(&tracker).as_deref(), Some(SELF_PUUID));
// The client closes (a refresh then syncs the Account kept up to date) and the key changes.
client.sign_out();
round(&tracker);
new_key.store(true, Ordering::SeqCst);
tracker.refresh(&mut |_| {}).unwrap();
assert_eq!(updating(&tracker).as_deref(), Some(NEW));
assert_eq!(tracker.replaced_puuid(SELF_PUUID).as_deref(), Some(NEW));
assert_eq!(tracker.accounts().unwrap().len(), 1);
}
/// A game ended under the old key: its Provisional Match is stored and looked for. Then the
/// client closes and the key changes. Returns what Riot's new key tells, and its requests.
fn provisional_then_key_change() -> (World, Tracker, Arc<FakeHistory>, mpsc::Receiver<String>) {
let world = World::new(&s2_matches());
let new_key = Arc::new(AtomicBool::new(false));
let all = payloads(&s2_matches());
let account = Account {
puuid: NEW.into(),
..recorded_account()
};
let (requests, log) = mpsc::channel();
let new = FakeHistory::new(account, all.iter().map(|p| played_by(p, NEW)).collect())
.logging_requests(requests);
let new = Arc::new(new);
let source = Switch {
old: world.history.clone(),
new: new.clone(),
new_key: new_key.clone(),
};
let tracker = Tracker::open(&world.dir.path().join("arena.db"), Box::new(source))
.unwrap()
.with_seasons(seasons())
.with_client(Box::new(world.client.clone()));
start_game(&world, &tracker);
world
.client
.create_end_of_game_block(&end_of_game_block(game().0, 222, 3));
world.client.set_phase("EndOfGame", true);
assert_eq!(reported_round(&tracker).len(), 1);
world.client.sign_out();
round(&tracker);
new_key.store(true, Ordering::SeqCst);
(world, tracker, new, log)
}
#[test]
fn the_look_up_of_a_provisional_match_follows_the_new_puuid_and_ends_with_its_publication() {
let (_world, tracker, new, log) = provisional_then_key_change();
new.add_unlisted(played_by(&published(5), NEW));
// The refresh moves the Account, and publishes the Match under the new PUUID.
tracker.refresh(&mut |_| {}).unwrap();
assert!(tracker.matches(NEW).unwrap().iter().all(|m| !m.provisional));
let _ = log.try_iter().count();
// Its window is over with its publication: no later round asks for it again.
for _ in 0..3 {
round(&tracker);
}
assert_eq!(
log.try_iter().filter(|r| r.starts_with("match ")).count(),
0
);
}
#[test]
fn a_provisional_match_stays_readable_with_its_block_after_the_account_moves() {
let (world, tracker, _new, _log) = provisional_then_key_change();
let blocks = || {
let db = rusqlite::Connection::open(world.dir.path().join("arena.db")).unwrap();
let sql = "SELECT COUNT(*) FROM end_of_game_blocks WHERE raw != ''";
db.query_row(sql, [], |row| row.get::<_, i64>(0)).unwrap()
};
assert_eq!(blocks(), 1_i64);
tracker.refresh(&mut |_| {}).unwrap();
assert_eq!(tracker.match_count(SELF_PUUID).unwrap(), 0);
let recap = tracker.match_recap(NEW, &game().1).unwrap().unwrap();
assert!(recap.provisional);
assert_eq!(
(recap.teams.iter().flat_map(|t| &t.players))
.filter(|p| p.is_account)
.count(),
1
);
assert_eq!(blocks(), 1_i64, "its end-of-game block is kept");
}
+4
View File
@@ -102,5 +102,9 @@ mod accounts;
mod compatibility;
#[path = "import/concurrency.rs"]
mod concurrency;
#[path = "import/quota.rs"]
mod quota;
#[path = "import/rekey.rs"]
mod rekey;
#[path = "import/sync.rs"]
mod sync;
+3 -2
View File
@@ -50,10 +50,11 @@ fn an_account_resolved_to_another_puuid_is_a_second_account() {
let before = first.matches("P1").unwrap();
drop(first);
// Under another key it is P2: nothing proves it is the same Account.
// Under another key it is P2, and none of P1's Matches is among its own: nothing proves it
// is the same Account (`import/rekey.rs` has the proof).
let tracker = open(
&db,
FakeHistory::new(account("P2"), build("P2", &[1, 2, 3])),
FakeHistory::new(account("P2"), build("P2", &[3, 4, 5])),
);
let report = sync(&tracker);
+96
View File
@@ -0,0 +1,96 @@
use super::*;
const WAIT: Duration = Duration::from_millis(5);
fn limited() -> FakeHistory {
FakeHistory::new(recorded_account(), recorded_matches()).retry_after(WAIT)
}
/// What a sync tells, as (fetched, to_fetch, quota_wait).
fn told(tracker: &Tracker) -> Vec<(usize, usize, Option<Duration>)> {
let mut progress = Vec::new();
let report = tracker
.sync(RIOT_ID, &mut |p| {
progress.push((p.fetched, p.to_fetch, p.quota_wait))
})
.unwrap();
assert_eq!((report.added, report.stored), (6, 6));
progress
}
#[test]
fn a_rate_limited_listing_tells_its_wait_then_the_import_line_comes_back() {
let dir = tempfile::tempdir().unwrap();
let history = limited();
history.rate_limit_listing_next(1);
let tracker = open(&dir.path().join("arena.db"), history);
let progress = told(&tracker);
assert_eq!(progress[..2], [(0, 0, Some(WAIT)), (0, 0, None)]);
assert_eq!(progress.last(), Some(&(6, 6, None)));
}
#[test]
fn a_rate_limited_match_fetch_tells_its_wait_then_the_import_line_comes_back() {
let dir = tempfile::tempdir().unwrap();
let history = limited();
history.rate_limit_next(2);
let tracker = open(&dir.path().join("arena.db"), history);
let progress = told(&tracker);
// Listed (0 / 6), then the first fetch waits twice and resumes with the same counts.
assert_eq!(
progress[..5],
[
(0, 6, None),
(0, 6, Some(WAIT)),
(0, 6, Some(WAIT)),
(0, 6, None),
(1, 6, None)
]
);
assert_eq!(progress.len(), 10);
}
#[test]
fn an_import_without_a_wait_never_tells_one() {
let dir = tempfile::tempdir().unwrap();
let tracker = open(&dir.path().join("arena.db"), limited());
assert!(told(&tracker).iter().all(|(_, _, wait)| wait.is_none()));
}
#[test]
fn a_rate_limited_resolution_of_a_friend_tells_its_wait() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
let ami = Account {
puuid: "ami-puuid".into(),
game_name: "Ami".into(),
tag_line: "FIX".into(),
};
let history = FakeHistory::new(ami, Vec::new()).retry_after(WAIT);
let tracker = open(&db, history);
tracker.add_friend("Ami#FIX").unwrap();
drop(tracker);
let history = FakeHistory::new(
Account {
puuid: "ami-puuid".into(),
game_name: "Ami".into(),
tag_line: "FIX".into(),
},
Vec::new(),
)
.retry_after(WAIT);
history.rate_limit_resolution_next(1);
let tracker = open(&db, history);
let mut waits = Vec::new();
tracker
.import_friend("ami-puuid", &mut |p| waits.push(p.quota_wait))
.unwrap();
assert_eq!(waits[..2], [Some(WAIT), None]);
}
+428
View File
@@ -0,0 +1,428 @@
//! A new Riot key gives every Account another PUUID for the same Riot ID (#150): the stored
//! Account follows it on proof that it is the same Account, else nothing changes.
use super::*;
use rusqlite::Connection;
const NEW: &str = "fixture-puuid-new-key";
const FRIEND_OLD: &str = "friend-old-key";
const FRIEND_NEW: &str = "friend-new-key";
const PROVISIONAL_MS: i64 = 1_010_000_000;
/// The Matches of `five_matches`, as Riot lists them for another PUUID.
fn under(puuid: &str, payloads: Vec<String>) -> Vec<String> {
payloads.iter().map(|p| played_by(p, puuid)).collect()
}
/// Riot under another key: the same Riot ID, another PUUID.
fn new_key(puuid: &str, payloads: Vec<String>) -> FakeHistory {
let account = Account {
puuid: puuid.into(),
..recorded_account()
};
FakeHistory::new(account, under(puuid, payloads))
}
fn old_matches() -> Vec<String> {
five_matches(1_000_000)
}
/// What the app stored besides, for the same Account: a Provisional Match, Mastery Points, a
/// platform and the last active Account.
fn store_besides(db: &Path, puuid: &str) {
Connection::open(db)
.unwrap()
.execute_batch(&format!(
"INSERT INTO mastery VALUES ('{puuid}', 1, 100);
INSERT INTO meta VALUES ('mastery:{puuid}', '1'), ('platform:{puuid}', 'EUW1'),
('last_active_puuid', '{puuid}');
INSERT INTO matches VALUES ('{puuid}', 'EUW1_77', 1750, 7, 'G', 3, 0,
{PROVISIONAL_MS}, '{{}}', 1);"
))
.unwrap();
}
/// Every stored row of the tables a PUUID lives in, as text.
fn dump(db: &Path) -> Vec<String> {
let db = Connection::open(db).unwrap();
[
"SELECT 'account '||puuid||' '||game_name||'#'||tag_line||' '||friend FROM accounts",
"SELECT 'match '||puuid||' '||match_id||' '||provisional||' '||raw FROM matches",
"SELECT 'mastery '||puuid||' '||champion_id||' '||points FROM mastery",
"SELECT 'meta '||name||'='||value FROM meta",
]
.iter()
.flat_map(|sql| {
let mut stmt = db.prepare(sql).unwrap();
let mut rows: Vec<String> = (stmt.query_map([], |row| row.get(0)).unwrap())
.map(Result::unwrap)
.collect();
rows.sort();
rows
})
.collect()
}
fn meta(db: &Path, name: &str) -> Option<String> {
let prefix = format!("meta {name}=");
dump(db)
.iter()
.find_map(|row| row.strip_prefix(&prefix).map(String::from))
}
fn puuids(tracker: &Tracker) -> Vec<String> {
(tracker.accounts().unwrap().into_iter())
.map(|a| a.puuid)
.collect()
}
fn flagged_players(tracker: &Tracker, puuid: &str, match_id: &str) -> usize {
let recap = tracker.match_recap(puuid, match_id).unwrap().unwrap();
(recap.teams.iter().flat_map(|t| &t.players))
.filter(|p| p.is_account)
.count()
}
fn ids_requests(requests: &mpsc::Receiver<String>) -> usize {
requests
.try_iter()
.filter(|r| r.starts_with("ids "))
.count()
}
/// Synced under the old key, with the rest stored.
fn old_world(db: &Path) {
sync(&open(
db,
FakeHistory::new(recorded_account(), old_matches()),
));
store_besides(db, SELF_PUUID);
}
/// The new key's Riot knows a Match more, and publishes the Provisional one.
fn new_key_with_news(requests: mpsc::Sender<String>) -> FakeHistory {
let mut all = old_matches();
all.push(payload(
"EUW1_5",
1750,
5,
"Champion",
2,
true,
1_006_000_000,
));
all.push(payload("EUW1_77", 1750, 7, "G", 3, false, PROVISIONAL_MS));
new_key(NEW, all).logging_requests(requests)
}
#[test]
fn an_account_follows_its_new_puuid_with_everything_stored_for_it() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
old_world(&db);
let mark = meta(&db, &format!("synced_until_ms:{SELF_PUUID}")).unwrap();
let (requests, log) = mpsc::channel();
let history = new_key_with_news(requests);
let fetches = history.fetch_counter();
let tracker = open(&db, history);
assert_eq!(flagged_players(&tracker, SELF_PUUID, "EUW1_0"), 1);
let report = sync(&tracker);
assert_eq!(report.account.puuid, NEW);
assert_eq!((report.added, report.stored), (1, 7));
// Only the proof's Match, the Match it did not have and the Provisional one are fetched.
assert_eq!(
fetches.load(Ordering::SeqCst),
3,
"the proof's Match, then two"
);
// The proof comes right after the resolution, before the listing.
let requests: Vec<String> = log.try_iter().collect();
assert_eq!(requests[..2], ["account Joueur#EUW", &format!("ids {NEW}")]);
assert_eq!(puuids(&tracker), [NEW]);
assert_eq!(tracker.match_count(SELF_PUUID).unwrap(), 0);
let stored = tracker.matches(NEW).unwrap();
assert!(stored.iter().all(|m| !m.provisional));
assert_eq!(stored.len(), 7);
assert_eq!(flagged_players(&tracker, NEW, "EUW1_0"), 1);
assert_eq!(tracker.mastery(NEW).unwrap().unwrap()[&1], 100);
assert_eq!(tracker.mastery(SELF_PUUID).unwrap(), None);
assert_eq!(tracker.last_active_account().unwrap().unwrap().puuid, NEW);
assert_eq!(
meta(&db, &format!("synced_until_ms:{NEW}")).unwrap(),
"1010000000"
);
assert!(mark.parse::<i64>().unwrap() < 1_010_000_000);
assert_eq!(
meta(&db, &format!("platform:{NEW}")).as_deref(),
Some("EUW1")
);
assert!(dump(&db).iter().all(|row| !row.contains(SELF_PUUID)));
assert_eq!(tracker.replaced_puuid(SELF_PUUID).as_deref(), Some(NEW));
}
#[test]
fn running_it_again_changes_nothing_and_sends_no_proof_request() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
old_world(&db);
let (requests, log) = mpsc::channel();
let tracker = open(&db, new_key_with_news(requests));
sync(&tracker);
// One listing per queue and the proof request.
assert_eq!(ids_requests(&log), 5);
let before = dump(&db);
sync(&tracker);
assert_eq!(ids_requests(&log), 4);
assert_eq!(dump(&db), before);
}
#[test]
fn an_interrupted_rekey_starts_again_without_loss() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
old_world(&db);
let before = dump(&db);
let history = new_key(NEW, old_matches());
history.fail_listing_with(Some(SourceError::Network("coupure".into())));
let tracker = open(&db, history);
assert!(tracker.sync(RIOT_ID, &mut |_| {}).is_err());
assert_eq!(dump(&db), before);
assert_eq!(tracker.replaced_puuid(SELF_PUUID), None);
drop(tracker);
// The next launch.
let tracker = open(&db, new_key(NEW, old_matches()));
sync(&tracker);
assert_eq!(puuids(&tracker), [NEW]);
assert_eq!(tracker.match_count(NEW).unwrap(), 6);
}
#[test]
fn nothing_changes_without_a_published_match_in_common() {
for provisional_only in [false, true] {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
sync(&open(&db, FakeHistory::new(recorded_account(), Vec::new())));
if provisional_only {
store_besides(&db, SELF_PUUID);
}
let before = dump(&db);
// Riot lists Matches for the new PUUID, among them the Provisional one.
let tracker = open(&db, new_key(NEW, old_matches()));
let report = sync(&tracker);
assert_eq!(report.account.puuid, NEW);
let mut puuids = puuids(&tracker);
puuids.sort();
assert_eq!(puuids, [NEW, SELF_PUUID]);
let after = dump(&db);
assert!(
before.iter().all(|row| after.contains(row)),
"{provisional_only}"
);
assert_eq!(tracker.replaced_puuid(SELF_PUUID), None);
}
}
#[test]
fn a_new_puuid_already_stored_is_merged_and_the_published_match_wins() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
old_world(&db);
// Under the new key, with Matches of its own: nothing proves it is the same Account.
let own = vec![payload(
"EUW1_10",
1750,
10,
"Champion",
1,
true,
1_020_000_000,
)];
let second = open(&db, new_key(NEW, own.clone()));
sync(&second);
assert_eq!(puuids(&second).len(), 2);
drop(second);
let sql = Connection::open(&db).unwrap();
sql.execute_batch(&format!(
"UPDATE accounts SET friend = 1 WHERE puuid = '{SELF_PUUID}';
-- published on the old side, Provisional on the new one
INSERT INTO matches VALUES ('{NEW}', 'EUW1_3', 1750, 1, 'P', 1, 0, 1, 'provisional', 1);
-- Provisional on the old side, published on the new one
INSERT INTO matches VALUES ('{SELF_PUUID}', 'EUW1_90', 1750, 1, 'P', 1, 0, 2, 'old', 1);
INSERT INTO matches VALUES ('{NEW}', 'EUW1_90', 1750, 1, 'P', 1, 0, 2, 'new', 0);
INSERT INTO mastery VALUES ('{NEW}', 1, 999), ('{NEW}', 2, 5);
INSERT INTO meta VALUES ('mastery:{NEW}', '1');"
))
.unwrap();
drop(sql);
let mut all = old_matches();
all.extend(own);
let tracker = open(&db, new_key(NEW, all));
sync(&tracker);
assert_eq!(puuids(&tracker), [NEW]);
assert_eq!(tracker.friends().unwrap().len(), 1);
let rows = dump(&db);
let matches: Vec<_> = rows.iter().filter(|r| r.starts_with("match ")).collect();
// The five of the old key, EUW1_10, EUW1_90 and the Provisional EUW1_77, none twice.
assert_eq!(matches.len(), 8, "{matches:?}");
assert!(rows.contains(&format!("match {NEW} EUW1_90 0 new")));
let provisional: Vec<_> = (tracker.matches(NEW).unwrap().into_iter())
.filter(|m| m.provisional)
.map(|m| m.match_id)
.collect();
assert_eq!(provisional, ["EUW1_77"]);
assert_eq!(flagged_players(&tracker, NEW, "EUW1_3"), 1);
// The new Account's own Mastery Points win.
let mastery = tracker.mastery(NEW).unwrap().unwrap();
assert_eq!((mastery[&1], mastery[&2]), (999, 5));
assert!(rows.iter().all(|r| !r.contains(SELF_PUUID)));
}
#[test]
fn a_friend_follows_its_new_puuid_and_stays_a_friend() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
let ami = |puuid: &str| Account {
puuid: puuid.into(),
game_name: "Ami".into(),
tag_line: "FIX".into(),
};
let matches = || {
(0..3)
.map(|i| {
payload(
&format!("EUW1_f{i}"),
1750,
5,
"Champion",
2,
true,
1_000_000_000 + i * 1_000_000,
)
})
.collect::<Vec<_>>()
};
let old = open(
&db,
FakeHistory::new(ami(FRIEND_OLD), under(FRIEND_OLD, matches())),
);
old.add_friend("Ami#FIX").unwrap();
old.import_friend(FRIEND_OLD, &mut |_| {}).unwrap();
drop(old);
let (requests, log) = mpsc::channel();
let history =
FakeHistory::new(ami(FRIEND_NEW), under(FRIEND_NEW, matches())).logging_requests(requests);
let fetches = history.fetch_counter();
let tracker = open(&db, history);
let report = tracker.import_friend(FRIEND_OLD, &mut |_| {}).unwrap();
assert_eq!(report.account, ami(FRIEND_NEW));
assert_eq!((report.added, report.stored), (0, 3));
// Only the proof's Match. The sync mark moved with the Friend: one listing step after the
// proof's request, not a first import's two.
assert_eq!(fetches.load(Ordering::SeqCst), 1);
assert_eq!(ids_requests(&log), 5);
assert_eq!(tracker.friends().unwrap(), [ami(FRIEND_NEW)]);
assert_eq!(tracker.accounts().unwrap(), [ami(FRIEND_NEW)]);
assert_eq!(
tracker.replaced_puuid(FRIEND_OLD).as_deref(),
Some(FRIEND_NEW)
);
assert_eq!(
meta(&db, &format!("platform:{FRIEND_NEW}")).as_deref(),
Some("EUW1")
);
assert!(dump(&db).iter().all(|row| !row.contains(FRIEND_OLD)));
}
#[test]
fn a_friend_whose_riot_id_changed_is_imported_under_its_stored_puuid() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
let ami = Account {
puuid: FRIEND_OLD.into(),
game_name: "Ami".into(),
tag_line: "FIX".into(),
};
let old = open(&db, FakeHistory::new(ami.clone(), Vec::new()));
old.add_friend("Ami#FIX").unwrap();
drop(old);
// Riot knows no Account with that Riot ID any more.
let tracker = open(&db, FakeHistory::new(recorded_account(), Vec::new()));
let report = tracker.import_friend(FRIEND_OLD, &mut |_| {}).unwrap();
assert_eq!(report.account, ami);
}
#[test]
fn a_friend_whose_riot_id_belongs_to_another_stored_account_is_imported_as_itself() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
let ami = |puuid: &str| Account {
puuid: puuid.into(),
game_name: "Ami".into(),
tag_line: "FIX".into(),
};
let matches = |from: i64| {
(0..2)
.map(|i| {
payload(
&format!("EUW1_{from}{i}"),
1750,
5,
"Champion",
2,
true,
1_000_000_000 + from * 1_000 + i,
)
})
.collect::<Vec<_>>()
};
// Your own Account, and the Friend: each with Matches of its own.
sync(&open(
&db,
FakeHistory::new(recorded_account(), five_matches(1_000_000)),
));
let old = open(
&db,
FakeHistory::new(ami(FRIEND_OLD), under(FRIEND_OLD, matches(1))),
);
old.add_friend("Ami#FIX").unwrap();
old.import_friend(FRIEND_OLD, &mut |_| {}).unwrap();
drop(old);
let before = dump(&db);
// Now "Ami#FIX" resolves to your own Account, sharing no Match with the Friend.
let history = FakeHistory::new(
Account {
game_name: "Ami".into(),
tag_line: "FIX".into(),
..recorded_account()
},
five_matches(1_000_000),
);
let fetches = history.fetch_counter();
let tracker = open(&db, history);
let report = tracker.import_friend(FRIEND_OLD, &mut |_| {}).unwrap();
assert_eq!(report.account, ami(FRIEND_OLD));
assert_eq!(fetches.load(Ordering::SeqCst), 0);
assert_eq!(tracker.replaced_puuid(FRIEND_OLD), None);
assert_eq!(tracker.friends().unwrap(), [ami(FRIEND_OLD)]);
assert_eq!(tracker.match_count(SELF_PUUID).unwrap(), 5);
assert_eq!(tracker.match_count(FRIEND_OLD).unwrap(), 2);
assert!(before.iter().all(|row| dump(&db).contains(row)));
}
#[path = "rekey/identity.rs"]
mod identity;
+138
View File
@@ -0,0 +1,138 @@
//! The proof names the Account, not anyone who shared the Match.
use super::*;
/// Your own Account (five Matches), and a Friend stored as `Ami#FIX` whose newest Match is the
/// last of yours: the same Match, another champion.
fn duo_world(db: &Path) {
sync(&open(
db,
FakeHistory::new(recorded_account(), old_matches()),
));
let alone = payload("EUW1_alone", 1750, 99, "Champion", 8, false, 900_000_000);
let together = payload("EUW1_4", 1750, 77, "Champion", 2, false, 1_004_000_000);
let friend = FakeHistory::new(
Account {
puuid: FRIEND_OLD.into(),
game_name: "Ami".into(),
tag_line: "FIX".into(),
},
under(FRIEND_OLD, vec![alone, together]),
);
let tracker = open(db, friend);
tracker.add_friend("Ami#FIX").unwrap();
tracker.import_friend(FRIEND_OLD, &mut |_| {}).unwrap();
assert_eq!(tracker.match_count(FRIEND_OLD).unwrap(), 2);
}
#[test]
fn an_account_taking_a_friends_old_riot_id_does_not_absorb_the_friend() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
duo_world(&db);
let before = dump(&db);
// You renamed to the Riot ID the Friend had (the stored one is stale, the Friend renamed).
let renamed = Account {
game_name: "Ami".into(),
tag_line: "FIX".into(),
..recorded_account()
};
let tracker = open(&db, FakeHistory::new(renamed, old_matches()));
let report = tracker.sync("Ami#FIX", &mut |_| {}).unwrap();
assert_eq!(
(report.account.puuid.as_str(), report.added),
(SELF_PUUID, 0)
);
assert_eq!(tracker.replaced_puuid(FRIEND_OLD), None);
assert_eq!(tracker.friends().unwrap().len(), 1);
assert_eq!(tracker.match_count(FRIEND_OLD).unwrap(), 2);
assert_eq!(tracker.match_count(SELF_PUUID).unwrap(), 5);
let after = dump(&db);
// Only your own Account's name changed.
let friend_rows = |rows: &[String]| -> Vec<String> {
(rows.iter())
.filter(|r| r.contains(FRIEND_OLD))
.cloned()
.collect()
};
assert_eq!(friend_rows(&after), friend_rows(&before));
}
/// A third participant of the shared Match took "Ami#FIX": Riot lists the Match for them too.
/// The Friend played champion 77 and placed 2nd.
fn stranger_takes_the_riot_id(champion: u32, placement: u8) {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
duo_world(&db);
let before = dump(&db);
let theirs = payload(
"EUW1_4",
1750,
champion,
"Champion",
placement,
true,
1_004_000_000,
);
let stranger = Account {
puuid: "stranger".into(),
game_name: "Ami".into(),
tag_line: "FIX".into(),
};
let tracker = open(
&db,
FakeHistory::new(stranger, under("stranger", vec![theirs])),
);
let report = tracker.import_friend(FRIEND_OLD, &mut |_| {}).unwrap();
assert_eq!(report.account.puuid, FRIEND_OLD);
assert_eq!(tracker.replaced_puuid(FRIEND_OLD), None);
assert_eq!(dump(&db), before);
}
#[test]
fn a_stranger_of_the_same_match_taking_a_friends_riot_id_does_not_take_the_friend() {
stranger_takes_the_riot_id(50, 1);
}
#[test]
fn an_opponent_on_the_friends_champion_does_not_take_the_friend_either() {
stranger_takes_the_riot_id(77, 1);
}
/// Riot answers the sync with this history instead: the proof it allows fails, nothing moves
/// and the sync goes on with a second Account.
fn sync_without_proof(history: FakeHistory) {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("arena.db");
old_world(&db);
let before = dump(&db);
let tracker = open(&db, history);
sync(&tracker);
assert_eq!(tracker.replaced_puuid(SELF_PUUID), None);
let after = dump(&db);
assert!(before.iter().all(|row| after.contains(row)));
let mut puuids = puuids(&tracker);
puuids.sort();
assert_eq!(puuids, [NEW, SELF_PUUID]);
}
#[test]
fn a_proof_match_riot_does_not_have_proves_nothing() {
let history = new_key(NEW, old_matches());
history.fail_match_with(Some(SourceError::NotFound));
sync_without_proof(history);
}
#[test]
fn a_proof_match_that_cannot_be_read_proves_nothing() {
let mut matches = old_matches();
matches.pop();
let history = new_key(NEW, matches);
history.add_unreadable("EUW1_4", 1_004_000_000, "not a Match");
sync_without_proof(history);
}
+5 -2
View File
@@ -212,7 +212,8 @@ fn a_match_that_cannot_be_delivered_or_read_does_not_block_the_others() {
progress.last(),
Some(&SyncProgress {
fetched: 5,
to_fetch: 5
to_fetch: 5,
..Default::default()
})
);
let again = sync(&tracker);
@@ -247,6 +248,7 @@ fn progress_goes_from_nothing_fetched_to_everything_fetched() {
.map(|fetched| SyncProgress {
fetched,
to_fetch: 6,
..Default::default()
})
.collect();
assert_eq!(progress, want);
@@ -257,7 +259,8 @@ fn progress_goes_from_nothing_fetched_to_everything_fetched() {
progress,
[SyncProgress {
fetched: 0,
to_fetch: 0
to_fetch: 0,
..Default::default()
}]
);
}
@@ -19,5 +19,5 @@ The relay (`crates/relay`) is a request in, a request out: `/{routing value}{Rio
- When the relay is down, imports stop; what is stored stays readable.
- The relay sees each player's address and Riot IDs in transit; it logs only the type of call, the status and the duration.
- A PUUID depends on the key's Riot application: switching to the production key changes every stored one (#150).
- A PUUID depends on the key's Riot application: switching to the production key changes every stored one. A sync and a Friend's import first ask Riot for the PUUID of the Riot ID, and move the stored Account to it only on proof: a stored published Match is listed for the new PUUID and the new PUUID has the same champion and Placement in it (the same participant, so not a mere co-participant of that Match). Without proof nothing changes. The follower's look-ups of a Match by id during a session do not check; they recover at the next sync (#150).
- Not built yet: a cache of Matches (if the quota is reached), Riot's per-method limits (its 429 is respected).
+3 -3
View File
@@ -2,7 +2,7 @@
## Défi et Statistiques
L’appli s’ouvre sur **Défi** : la bannière du Défi de la Saison, puis les cartes de vos champions. À côté des onglets, le sélecteur de **Compte** liste les Comptes déjà connectés au client sur ce PC, le Compte actif (celui du client) en premier, et choisit le Compte que montrent **Défi**, **Statistiques** et **Parties** (les Comptes sous « Vos Comptes », vos Amis sous « Amis »). Pour un autre Compte, la bannière commence par « Défi de Pseudo · », et la Progression officielle et l’animation de fin de Partie sont réservées au Compte actif. Le filtre **Tous** revient à chaque changement de Compte ; le tri et le thème restent les mêmes. L’appli revient sur le Compte actif quand une Sélection ou une Partie en cours commence, et à la fin d’une Partie suivie. Pour l’analyse détaillée (courbe des champions validés, Placements, Tentatives, tableau des champions, avec les sélecteurs de Saison et de Format), cliquez l’icône de courbe **Statistiques**, dans le coin inférieur droit de la bannière (une bulle la nomme au survol). La page porte **‹ Défi** en haut à gauche, qui ramène au Défi ; l’onglet **Défi** de la barre du haut y ramène aussi. Au clavier, Tab atteint l’icône et le retour, Entrée ou Espace les active. Survolez l’anneau de la bannière : la graduation visée s’allume et la bannière présente ce champion (« X · validé le 12 nov. · 3 Tentatives », « X · 2 Parties · meilleur Placement 3ᵉ » ou « X · jamais joué ») ; elle revient à son état habituel quand vous quittez l’anneau.
L’appli s’ouvre sur **Défi** : la bannière du Défi de la Saison, puis les cartes de vos champions. À côté des onglets, le sélecteur de **Compte** liste les Comptes déjà connectés au client sur ce PC, le Compte actif (celui du client) en premier, et choisit le Compte que montrent **Défi**, **Statistiques** et **Parties** (les Comptes sous « Vos Comptes », vos Amis sous « Amis »). Pour un autre Compte, la bannière commence par « Défi de Pseudo · », et la Progression officielle et l’animation de fin de Partie sont réservées au Compte actif. Le filtre **Tous** revient à chaque changement de Compte ; le tri et le thème restent les mêmes. L’appli revient sur le Compte actif quand une Sélection ou une Partie en cours commence, et à la fin d’une Partie suivie. Pour l’analyse détaillée (courbe des champions validés, Placements, Tentatives, tableau des champions, avec les sélecteurs de Saison et de Format), cliquez l’icône de courbe **Statistiques**, dans le coin inférieur droit de la bannière (une bulle la nomme au survol). La page porte **‹ Défi** en haut à gauche, qui ramène au Défi ; l’onglet **Défi** de la barre du haut y ramène aussi. Au clavier, Tab atteint l’icône et le retour, Entrée ou Espace les active. La première fois, l’import de l’historique de votre Compte se voit de la même façon : la ligne en haut à droite compte les Parties (« Import en cours : n / N Parties ») et, à partir de 10 Parties, un arc se remplit autour de l’anneau ; si Riot demande d’attendre (quota atteint), l’arc s’arrête et la ligne dit « Quota Riot atteint : reprise dans 12 s », puis l’import reprend tout seul. Survolez l’anneau de la bannière : la graduation visée s’allume et la bannière présente ce champion (« X · validé le 12 nov. · 3 Tentatives », « X · 2 Parties · meilleur Placement 3ᵉ » ou « X · jamais joué ») ; elle revient à son état habituel quand vous quittez l’anneau.
Au début d’une Sélection des champions Arena, l’onglet **Sélection** apparaît à droite de **Défi** et **Parties** et l’appli l’affiche d’elle-même, où que vous soyez. Il montre les Champions de l’Enclume et « Autres champions ». Pendant la sélection, l’onglet **Défi** montre l’accueil habituel (et son icône **Statistiques**) ; revenez sur **Sélection** quand vous voulez, la main y est posée. Les bans et les choix des alliés ne vous ramènent pas sur **Sélection**. À la fin de la sélection, l’onglet disparaît et l’appli affiche le Défi, ou **En partie** si la partie est lancée.
@@ -10,13 +10,13 @@ Au lancement d’une Partie Arena, y compris quand l’appli démarre ou retrouv
## Amis
Pour consulter le Défi d’un autre joueur, ouvrez le sélecteur de Compte, choisissez **Ajouter un ami…** tout en bas, saisissez son Riot ID sous la forme `Pseudo#TAG` et appuyez sur Entrée (Échap ou **Annuler** referme le champ). Il doit jouer dans la même région que vous. Si le Compte est déjà l’un des vôtres ou un Ami, il est simplement sélectionné. Votre ami n’a rien à installer : ses Parties Arena viennent de l’API Riot, par le service d’Arena Tracker. À l’ajout, tout son historique disponible est importé en arrière-plan, la Saison en cours d’abord et après les besoins de votre Compte actif ; son Défi se remplit au fur et à mesure, et la ligne en haut à droite affiche « Import de Pseudo : n / N Parties ». Ensuite, seules ses nouvelles Parties sont récupérées, quand vous le choisissez dans le sélecteur ou que vous appuyez sur **Actualiser** pendant que son Défi est affiché ; l’appli ne le fait jamais d’elle-même. Si l’import est interrompu, il reprend de la même façon sans refaire ce qui est enregistré. Un Ami qui se connecte au client sur votre PC reste un Ami, suivi comme votre Compte actif.
Pour consulter le Défi d’un autre joueur, ouvrez le sélecteur de Compte, choisissez **Ajouter un ami…** tout en bas, saisissez son Riot ID sous la forme `Pseudo#TAG` et appuyez sur Entrée (Échap ou **Annuler** referme le champ). Il doit jouer dans la même région que vous. Si le Compte est déjà l’un des vôtres ou un Ami, il est simplement sélectionné. Votre ami n’a rien à installer : ses Parties Arena viennent de l’API Riot, par le service d’Arena Tracker. À l’ajout, tout son historique disponible est importé en arrière-plan, la Saison en cours d’abord et après les besoins de votre Compte actif ; son Défi se remplit au fur et à mesure, et la ligne en haut à droite affiche « Import de Pseudo : n / N Parties ». Si l’import porte sur 10 Parties ou plus et que le Compte de votre ami est affiché, un arc fin se remplit autour de l’anneau de la bannière, de midi vers la droite, et disparaît à la fin. Si Riot demande d’attendre (quota atteint), l’arc s’arrête et la ligne dit « Quota Riot atteint : reprise dans 12 s », décomptée chaque seconde, puis l’import reprend tout seul. Ensuite, seules ses nouvelles Parties sont récupérées, quand vous le choisissez dans le sélecteur ou que vous appuyez sur **Actualiser** pendant que son Défi est affiché ; l’appli ne le fait jamais d’elle-même. Si l’import est interrompu, il reprend de la même façon sans refaire ce qui est enregistré. Un Ami qui se connecte au client sur votre PC reste un Ami, suivi comme votre Compte actif. Quand Riot change l’identifiant technique (PUUID) d’un Compte ou d’un Ami, par exemple avec une nouvelle clé, Arena Tracker le retrouve par une de ses Parties enregistrées et garde son historique ; sans cette preuve (Riot ID changé, Parties trop anciennes), rien n’est modifié ni supprimé : le Riot ID est alors importé comme un second Compte, et l’ancien peut être supprimé dans **Paramètres** (voir « Supprimer un Compte ou un Ami »).
## Parties
L’onglet **Parties** liste vos Parties enregistrées, de la plus récente à la plus ancienne, pour le Compte choisi dans le sélecteur de la barre du haut (le Compte connecté au client au démarrage). Chaque ligne montre le champion, la date et l’heure, et le Placement, en or pour un top 1, en vert pour une autre Victoire, en rouge sinon. Au-dessus de la liste, des filtres se combinent : la **Saison** (la Saison actuelle par défaut, ou toutes les Saisons s’il n’y en a pas) et le **Format**, les mêmes sélecteurs que sur **Statistiques** : en changer sur une page le change sur l’autre ; le **Placement** (**Tous**, **Top 1** ou **Victoires**, les Parties que le jeu compte comme gagnées) ; et une recherche de champion, comme sur l’accueil (nom, abréviation connue comme « TF », sans tenir compte des accents ni des majuscules). Le Placement et la recherche sont gardés tant que l’appli reste ouverte. Si aucune Partie ne correspond, la liste le dit et le récapitulatif reste vide. À l’ouverture, la Partie la plus récente que les filtres laissent est choisie et son récapitulatif s’affiche à côté : les équipes rangées par Placement, votre ligne encadrée d’or, et pour chaque joueur son Riot ID, son niveau, son K/D/A, ses objets, ses améliorations et ses dégâts aux champions (une barre comparée au meilleur de la Partie, partagée entre physiques, magiques et bruts, le total à côté). Les objets et les améliorations montrent leur icône dans une case, leur nom dans la bulle de survol, toujours en français, quelle que soit la langue du client (les objets viennent de Data Dragon, les améliorations de CommunityDragon) ; sans eux (première ouverture hors ligne, objet très récent), une icône neutre et « Objet n » ou « Amélioration n ». Survoler un objet ou une amélioration, dans le récapitulatif ou dans **Dégâts observés dans les récaps de mort**, affiche une bulle avec son nom et sa description ; un « ? » marque une valeur que le jeu calcule pendant la Partie, et « Description indisponible » une description que le catalogue n’a pas. Ces noms, descriptions et icônes sont gardés sur le disque : ils restent lisibles hors ligne. L’appli regarde si le jeu a changé de patch à son lancement et à chaque ouverture du client, jamais en continu, et ne télécharge de nouveau que dans ce cas ; au premier téléchargement, les icônes apparaissent au fur et à mesure ; si CommunityDragon n’a pas encore le nouveau patch, les noms précédents restent jusqu’à la vérification suivante. Cliquez une autre Partie, ou parcourez la liste avec les flèches haut et bas. Cliquez la ligne d’un joueur (ou atteignez-la avec Tab, puis Entrée ou Espace) pour déplier ses détails, en barres avec leur valeur à côté : dégâts aux champions et reçus (une barre partagée entre physiques, magiques et bruts), puis dégâts atténués, soins et boucliers sur les alliés, or gagné et dépensé, contrôle (une barre par valeur, pleine pour le meilleur joueur de la Partie) ; recliquez pour les replier. Les totaux sont ceux de Riot, tels quels. Une valeur que Riot ne donne pas s’affiche « Indisponible ». Sous ces valeurs, la section **Dégâts observés dans les récaps de mort** détaille, par objet et par amélioration du joueur (puis « Autres effets »), les dégâts que les récaps de mort des champions éliminés lui attribuent : c’est la seule source de dégâts par effet, si bien que les dégâts infligés à un champion qui survit n’y figurent jamais et que le total de la Partie par effet reste indisponible. Les récaps sont récupérés chez Riot une fois par Partie, à la fin d’une Partie suivie ou à la première ouverture d’une Partie plus ancienne ; une Partie provisoire affiche « En attente », une Partie dont Riot refuse les récaps « Indisponible », et en cas d’échec passager le bouton **Réessayer** les redemande. Une bannière, la même que celle du Défi (Saison, compteur, anneau), surmonte la liste et le récapitulatif : son illustration est le champion de la Partie choisie, dont la graduation est allumée sur l’anneau. Dans une fenêtre étroite, la liste et ses filtres s’ouvrent avec le bouton **Parties** au-dessus du récapitulatif. Si la Partie affichée n’est plus laissée par un filtre, la première Partie de la liste prend sa place.
À la fin d’une Partie Arena, dès que le client donne son résultat, l’appli affiche **Parties** sur cette Partie (marquée « Provisoire » jusqu’à sa publication par Riot), où que vous soyez, Paramètres compris. Le Placement repasse à **Tous** et la recherche se vide pour qu’elle apparaisse. Si la Saison ou le Format choisis l’écartent, ils reviennent à la Saison de la Partie (toutes les Saisons si aucune ne la contient) et à tous les Formats (sur **Statistiques** aussi). La fenêtre ne passe pas au premier plan et ne vous prend pas le focus : réduite ou cachée dans la zone de notification, elle le reste. L’animation de fin de Partie (la comète d’un top 1, le compteur qui monte) joue alors sur la bannière de **Parties** ; en revenant sur le Défi, vous le trouvez dans son état final, sans la revoir. Changez ensuite d’onglet librement, rien ne vous ramène sur **Parties**. Si le client ne donne pas de résultat, **En partie** reste jusqu’au retour au salon, puis l’appli affiche le Défi. Pour afficher le Défi plutôt que **Parties** à la fin d’une Partie, désactivez **Ouvrir le récapitulatif en fin de Partie** dans les Paramètres : la Partie reste dans la liste.
À la fin d’une Partie Arena, dès que le client donne son résultat, l’appli affiche **Parties** sur cette Partie (marquée « Provisoire » jusqu’à sa publication par Riot), où que vous soyez, Paramètres compris. Le Placement repasse à **Tous** et la recherche se vide pour qu’elle apparaisse. Si la Saison ou le Format choisis l’écartent, ils reviennent à la Saison de la Partie (toutes les Saisons si aucune ne la contient) et à tous les Formats (sur **Statistiques** aussi). Comme à l’entrée en sélection, la fenêtre passe au premier plan, même réduite ou cachée dans la zone de notification, sans vous prendre le focus ; elle y passe aussi quand l’appli affiche le Défi en fin de Partie. L’animation de fin de Partie (la comète d’un top 1, le compteur qui monte) joue alors sur la bannière de **Parties** ; en revenant sur le Défi, vous le trouvez dans son état final, sans la revoir. Changez ensuite d’onglet librement, rien ne vous ramène sur **Parties**. Si le client ne donne pas de résultat, **En partie** reste jusqu’au retour au salon, puis l’appli affiche le Défi. Pour afficher le Défi plutôt que **Parties** à la fin d’une Partie, désactivez **Ouvrir le récapitulatif en fin de Partie** dans les Paramètres : la Partie reste dans la liste.
## Installer
+19 -17
View File
@@ -4,9 +4,9 @@
Entre deux Parties, le joueur veut repérer les champions avec lesquels il lui manque un top 1. Pendant une sélection Arena, il veut répondre à une question plus précise : « Parmi les champions marqués d’une enclume, lesquels me reste-t-il à valider et lesquels puis-je encore choisir ? » L’écran actuel demande de lire un tableau parmi des compteurs, des filtres et des graphiques.
L’accueil et la sélection doivent donner la réponse avec les mêmes cartes de champion. Une page « Statistiques » accueille l’analyse détaillée. La référence visuelle est la maquette validée, avec ses portraits verticaux allongés, son compteur discret et son trait de progression fin. L’interface reste en français et garde sa propre identité visuelle. [Ouvrir la maquette interactive](prototype-interface.html)
L’accueil et la sélection doivent donner la réponse avec les mêmes cartes de champion. Une page « Statistiques » accueille l’analyse détaillée. Les cartes sont des portraits verticaux allongés, avec un compteur discret et un trait de progression fin. L’interface reste en français et garde sa propre identité visuelle. Ce document est la seule référence : les maquettes interactives qui ont servi à le valider ne sont plus dans le dépôt (#171).
L’identité « L’Anneau » (itération « La Bannière ») habille ensuite cette refonte : les couleurs du logo, une bannière illustrée et des animations déclenchées par les événements du jeu. Sa référence visuelle est une seconde page interactive, à ouvrir avec une connexion pour les illustrations. [Ouvrir la référence de l’identité](prototype-identite.html)
L’identité « L’Anneau » (itération « La Bannière ») habille ensuite cette refonte : les couleurs du logo, une bannière illustrée et des animations déclenchées par les événements du jeu.
## Critères d’acceptation
@@ -15,7 +15,7 @@ L’identité « L’Anneau » (itération « La Bannière ») habille ensuite c
1. À chaque ouverture, « Tous » est sélectionné. La grille présente tous les champions, y compris ceux jamais joués et ceux déjà validés. La recherche par nom et les filtres « Restants » et « Validés » permettent de réduire la grille.
2. La bannière ouvre l’accueil. Elle porte l’anneau, un titre-compteur « N / total champions validés » surmonté de la Saison (précédée de « Défi de Pseudo · » pour un Compte autre que le Compte actif), et deux lignes : « Dernier champion validé : X, le … » et « Dernière Partie : … ». La seconde est permanente : elle se calcule à partir des Parties enregistrées, pas des seules Parties suivies pendant la session. Le titre « Défi de saison » disparaît. Le total reste celui du Défi quand on recherche un champion, filtre la grille ou passe en sélection. La section « Identité » décrit la bannière et l’anneau.
3. Lorsqu’aucune préférence de tri n’a encore été enregistrée, les champions sont classés par points de maîtrise décroissants. Le joueur peut choisir A–Z. Le même choix s’applique aux deux écrans et à toutes leurs sections de cartes, puis à la prochaine ouverture. L’anneau n’est pas une section de cartes : c’est une jauge à l’ordre fixe, qui ne suit pas le tri choisi.
4. **Compte.** Un seul sélecteur de Compte, à côté des onglets dans la barre du haut, choisit le Compte que montrent « Défi » (bannière, anneau, grille, fiches), « Statistiques » et « Parties » : il liste, sous « Vos Comptes », les Comptes déjà connectés au client sur ce PC, le Compte actif (celui du client, ou le dernier connu quand il est fermé) en premier, puis, sous « Amis » (seulement s’il y en a), les Amis ; sa dernière entrée, seule, est « Ajouter un ami… ». L’appli démarre sur le Compte actif et y revient à l’entrée dans une phase (sélection, Partie en cours), où le sélecteur est grisé, et quand une Partie suivie s’ouvre en fin de Partie. Un autre Compte rétablit « Tous » dans le filtre de l’accueil et dans celui de « Statistiques » ; le tri et le thème sont communs à tous les Comptes. Ses statistiques sont calculées une fois, hors du thread d’interface. La Progression officielle et les animations de fin de Partie ne concernent que le Compte actif. **Amis.** Un Ami est un Compte ajouté par son Riot ID pour consulter son Défi ; ses Parties viennent de l’API Riot, par le service d’Arena Tracker, il n’a rien à installer. « Ajouter un ami… » laisse le Compte affiché sélectionné et ouvre sous l’en-tête un champ « Pseudo#TAG » (avec « Annuler » ; Échap le ferme aussi), validé par Entrée : la recherche tourne hors du thread d’interface, à basse priorité, « Recherche du Compte… » l’indique et Entrée est ignorée en attendant. Un refus s’affiche à côté du champ, qui garde son texte : Riot ID mal formé (« Saisissez un Riot ID de la forme Pseudo#TAG. »), « Aucun Compte ne porte ce Riot ID. », « Ce Compte joue dans une autre région. », ou le message d’un échec passager (service indisponible, réseau). Un Compte déjà connu (le vôtre ou un Ami) est simplement sélectionné. Une fois l’Ami ajouté, il est sélectionné et son Défi s’affiche. L’import de son historique Arena disponible tourne en arrière-plan, à basse priorité, après les requêtes du Compte actif, en attendant le `Retry-After` du service quand son quota est plein : la Saison en cours d’abord, puis les autres ; le Défi se remplit au fur et à mesure (rechargé au plus une fois par seconde) et la ligne d’état de l’en-tête dit « Import de Pseudo : n / N Parties » (« Import de Pseudo… » pendant la recherche des Parties) ; ses points de maîtrise sont récupérés à la fin. Une erreur de l’import s’affiche en une ligne d’alerte sans masquer les données enregistrées, et l’import d’un Ami supprimé s’arrête sans rien dire. Ensuite seules les nouvelles Parties sont récupérées, quand on choisit l’Ami dans le sélecteur ou avec « Actualiser » pendant qu’il est affiché (qui n’actualise alors que lui) : jamais à intervalle régulier ni au lancement. Un import interrompu reprend à l’une de ces deux occasions, sans réimporter les Parties déjà enregistrées. Un seul import tourne à la fois ; la demande faite pendant l’un attend sa fin, la dernière gagne. Un Ami qui se connecte au client sur ce PC reste un Ami, sous « Amis » : l’appli le suit alors comme tout Compte actif (le premier de son groupe), ses Parties en direct comprises, et « Actualiser » est celle du suivi.
4. **Compte.** Un seul sélecteur de Compte, à côté des onglets dans la barre du haut, choisit le Compte que montrent « Défi » (bannière, anneau, grille, fiches), « Statistiques » et « Parties » : il liste, sous « Vos Comptes », les Comptes déjà connectés au client sur ce PC, le Compte actif (celui du client, ou le dernier connu quand il est fermé) en premier, puis, sous « Amis » (seulement s’il y en a), les Amis ; sa dernière entrée, seule, est « Ajouter un ami… ». L’appli démarre sur le Compte actif et y revient à l’entrée dans une phase (sélection, Partie en cours), où le sélecteur est grisé, et quand une Partie suivie s’ouvre en fin de Partie. Un autre Compte rétablit « Tous » dans le filtre de l’accueil et dans celui de « Statistiques » ; le tri et le thème sont communs à tous les Comptes. Ses statistiques sont calculées une fois, hors du thread d’interface. La Progression officielle et les animations de fin de Partie ne concernent que le Compte actif. **Amis.** Un Ami est un Compte ajouté par son Riot ID pour consulter son Défi ; ses Parties viennent de l’API Riot, par le service d’Arena Tracker, il n’a rien à installer. « Ajouter un ami… » laisse le Compte affiché sélectionné et ouvre sous l’en-tête un champ « Pseudo#TAG » (avec « Annuler » ; Échap le ferme aussi), validé par Entrée : la recherche tourne hors du thread d’interface, à basse priorité, « Recherche du Compte… » l’indique et Entrée est ignorée en attendant. Un refus s’affiche à côté du champ, qui garde son texte : Riot ID mal formé (« Saisissez un Riot ID de la forme Pseudo#TAG. »), « Aucun Compte ne porte ce Riot ID. », « Ce Compte joue dans une autre région. », ou le message d’un échec passager (service indisponible, réseau). Un Compte déjà connu (le vôtre ou un Ami) est simplement sélectionné. Une fois l’Ami ajouté, il est sélectionné et son Défi s’affiche. L’import de son historique Arena disponible tourne en arrière-plan, à basse priorité, après les requêtes du Compte actif, en attendant le `Retry-After` du service quand son quota est plein : la Saison en cours d’abord, puis les autres ; le Défi se remplit au fur et à mesure (rechargé au plus une fois par seconde) et la ligne d’état de l’en-tête dit « Import de Pseudo : n / N Parties » (« Import de Pseudo… » pendant la recherche des Parties), ou « Quota Riot atteint : reprise dans 12 s » (décomptée chaque seconde) tant que l’import attend le quota Riot, puis l’import reprend ; un arc se remplit autour de l’anneau (section « Identité ») quand il porte sur 10 Parties ou plus ; ses points de maîtrise sont récupérés à la fin. Une erreur de l’import s’affiche en une ligne d’alerte sans masquer les données enregistrées, et l’import d’un Ami supprimé s’arrête sans rien dire. Ensuite seules les nouvelles Parties sont récupérées, quand on choisit l’Ami dans le sélecteur ou avec « Actualiser » pendant qu’il est affiché (qui n’actualise alors que lui) : jamais à intervalle régulier ni au lancement. Un import interrompu reprend à l’une de ces deux occasions, sans réimporter les Parties déjà enregistrées. Un seul import tourne à la fois ; la demande faite pendant l’un attend sa fin, la dernière gagne. Un Ami qui se connecte au client sur ce PC reste un Ami, sous « Amis » : l’appli le suit alors comme tout Compte actif (le premier de son groupe), ses Parties en direct comprises, et « Actualiser » est celle du suivi.
### Carte de champion
@@ -50,9 +50,9 @@ Au survol ou au focus clavier, la fiche du champion apparaît en glissant sur la
### Identité
Cette section décrit l’identité « L’Anneau ». [La page de référence](prototype-identite.html) la montre : l’accueil, une Partie au hasard, un top 1, la sélection, le thème clair et « Statistiques ». C’est une maquette : elle ne montre pas toute la spécification (l’animation différée, par exemple), et en cas d’écart cette section prévaut. Les critères ci-dessus restent valables ; l’identité ne change ni les données, ni les marques, ni le vocabulaire. On dit « validé » et « Premier top 1 », jamais « sacre ».
Cette section décrit l’identité « L’Anneau » ; elle en est la seule référence. Les critères ci-dessus restent valables ; l’identité ne change ni les données, ni les marques, ni le vocabulaire. On dit « validé » et « Premier top 1 », jamais « sacre ».
**Couleurs.** Celles du logo, un anneau doré autour d’un disque bleu nuit, dans toute l’appli. En sombre, les neutres sont des bleus nuit ; en clair, un papier froid. L’accent est doré dans les deux thèmes, avec une encre dorée plus foncée en clair pour rester lisible. Les contours de focus et de survol des cartes utilisent aussi cette encre sur fond clair (#8f5d00), pour conserver un contraste d’au moins 3:1. Le texte posé sur une illustration reste clair dans les deux thèmes. La préférence de thème ne change pas. Les valeurs sont celles de la page de référence.
**Couleurs.** Celles du logo, un anneau doré autour d’un disque bleu nuit, dans toute l’appli. En sombre, les neutres sont des bleus nuit ; en clair, un papier froid. L’accent est doré dans les deux thèmes, avec une encre dorée plus foncée en clair pour rester lisible. Les contours de focus et de survol des cartes utilisent aussi cette encre sur fond clair (#8f5d00), pour conserver un contraste d’au moins 3:1. Le texte posé sur une illustration reste clair dans les deux thèmes. La préférence de thème ne change pas. Les valeurs sont celles du thème de l’appli.
**Police.** Unbounded est embarquée et réservée au nom de l’appli, aux titres et au compteur. Tout le reste reste en Inter.
@@ -60,18 +60,20 @@ Cette section décrit l’identité « L’Anneau ». [La page de référence](p
**Bannière de sélection.** Elle ouvre l’onglet « Sélection » pendant une sélection Arena ; « Défi » garde la bannière d’accueil. Son surtitre porte le compteur, son titre est « Sélection des champions », et sa ligne indique « Champions de l’Enclume · k à valider et disponibles ». Seules les graduations des Champions de l’Enclume y restent vives. L’illustration suit la carte survolée ; au repos, c’est celle du premier Champion de l’Enclume à valider et disponible. La barre du haut n’affiche pas d’autre indicateur de sélection que l’onglet « Sélection ».
**Anneau.** Une graduation par champion du Défi, dans un ordre fixe : d’abord les validés, dans l’ordre de leur Premier top 1 en tournant depuis midi, puis les champions joués, puis ceux jamais joués, ces deux derniers groupes par points de maîtrise décroissants (A–Z tant que les points sont inconnus, comme les cartes). Il ne suit pas le tri choisi. Survoler la couronne vise la graduation la plus proche par l’angle, pas au pixel près (dans une bande qui déborde un peu les graduations, à l’intérieur comme à l’extérieur) : elle s’allume comme au survol d’une carte, l’illustration de la bannière passe en fondu sur ce champion (sans fondu quand les animations Windows sont coupées) et la première ligne de la bannière devient la sienne, son nom en gras : « X · validé le 12 nov. · 3 Tentatives » (« · du premier coup » pour une seule), « X · 2 Parties · meilleur Placement 3ᵉ » (« 1 Partie » au singulier ; sans Placement connu, la fin est omise) ou « X · jamais joué », selon les chiffres de la Saison, tous Formats. Le titre ne change pas ; la seconde ligne (« Dernière Partie : … ») est masquée sans que rien ne bouge. En quittant la couronne, la bannière revient à l’état de repos de l’écran affiché (« Défi », « Sélection », « En partie »), et il en va de même partout où l’anneau est affiché. Pendant l’animation de fin de Partie, le survol de l’anneau est ignoré. Règle n° 1 : rien n’est redessiné tant que la graduation visée ne change pas, hors de la couronne il n’y a aucun travail, et un balayage rapide ne décode jamais plus de deux illustrations à la fois, la dernière graduation visée l’emportant.
**Anneau.** Une graduation par champion du Défi, dans un ordre fixe : d’abord les validés, dans l’ordre de leur Premier top 1 en tournant depuis midi, puis les champions joués, puis ceux jamais joués, ces deux derniers groupes par points de maîtrise décroissants (A–Z tant que les points sont inconnus, comme les cartes). Il ne suit pas le tri choisi. Survoler la couronne vise la graduation la plus proche par l’angle, pas au pixel près (dans une bande qui déborde un peu les graduations, à l’intérieur comme à l’extérieur) : elle s’allume comme au survol d’une carte, l’illustration de la bannière passe en fondu sur ce champion (sans fondu quand les animations Windows sont coupées) et la première ligne de la bannière devient la sienne, son nom en gras : « X · validé le 12 nov. · 3 Tentatives » (« · du premier coup » pour une seule), « X · 2 Parties · meilleur Placement 3ᵉ » (« 1 Partie » au singulier ; sans Placement connu, la fin est omise) ou « X · jamais joué », selon les chiffres de la Saison, tous Formats. Le titre ne change pas ; la seconde ligne (« Dernière Partie : … ») est masquée sans que rien ne bouge. En quittant la couronne, la bannière revient à l’état de repos de l’écran affiché (« Défi », « Sélection », « En partie »), et il en va de même partout où l’anneau est affiché. Pendant l’animation de fin de Partie, le survol de l’anneau est ignoré. Règle n° 1 : rien n’est redessiné tant que la graduation visée ne change pas, hors de la couronne il n’y a aucun travail, et un balayage rapide ne décode jamais plus de deux illustrations à la fois, la dernière graduation visée l’emportant. **Arc d’import (#140).** Pendant l’import des Parties du Compte affiché (le vôtre, au premier lancement par exemple, ou celui d’un Ami), un arc fin entoure les graduations : il part de midi et se remplit dans le sens horaire en proportion de « Parties récupérées / Parties à récupérer », le reste du cercle restant tracé plus discrètement. Il n’apparaît qu’à partir de 10 Parties à récupérer (une synchronisation de 1 ou 2 Parties ne le fait pas clignoter), jamais pour l’import d’un autre Compte que celui affiché, sur toutes les bannières qui portent l’anneau (« Défi », « Parties », « En partie »), et disparaît à la fin de l’import, réussi ou en erreur. L’anneau n’est redessiné que quand l’arc apparaît ou disparaît et, au plus une fois par seconde, quand le compte change ; son glissement vers chaque nouvelle valeur est dessiné par-dessus (#172).
**Illustration.** La bannière montre une fenêtre d’environ 80 % de la largeur du splash du champion, centrée sur lui (voir les décisions d’implémentation pour le cadrage). Elle passe d’une illustration à l’autre par un fondu.
**Animations.** Elles sont toujours déclenchées par un événement et ne dessinent rien au repos. Elles suivent le réglage Windows « Afficher les animations », lu au démarrage et à chacun de ses changements : coupé, chaque animation laisse place à son état final. L’appli n’a pas de réglage « Animations ». L’écran d’une animation est « Défi », ou « Parties » quand la fin de la Partie y a ouvert son récapitulatif (#110). Il est visible quand la fenêtre est affichée et non réduite (Windows ne signale pas une fenêtre seulement recouverte), sans un autre écran ni « Paramètres » devant lui, et hors sélection : une animation demandée pendant une sélection attend sa fin.
**Animations.** Elles ne dessinent rien au repos. Un **événement** est ce que l’appli montre d’elle-même (fin d’une Partie, entrée ou sortie de sélection, début d’une Partie en cours, changement d’écran) : on regarde peu l’appli, donc son animation prend son temps pour accrocher l’œil, deux fois sa durée de base. Un **geste** répond à la main (survol d’une carte, pointeur sur l’anneau) : il monte vite et retombe lentement. Ce **tempo** et la courbe à rebond (dépasser la cible, puis y revenir) sont communs à toutes les animations (#168). Elles suivent le réglage Windows « Afficher les animations », lu au démarrage et à chacun de ses changements : coupé, chaque animation laisse place à son état final. L’appli n’a pas de réglage « Animations ». L’écran d’une animation est « Défi », ou « Parties » quand la fin de la Partie y a ouvert son récapitulatif (#110). Il est visible quand la fenêtre est affichée et non réduite (Windows ne signale pas une fenêtre seulement recouverte), sans un autre écran ni « Paramètres » devant lui, et hors sélection : une animation demandée pendant une sélection attend sa fin.
- Fin d’une Partie suivie en direct. Un top 1 déclenche la comète, la bannière et « Validé ». Une nouvelle Marque fait monter la graduation d’un cran et remplit la coche. Sinon, la graduation clignote et la ligne « Dernière Partie » apparaît en fondu, avec l’illustration qui passe en fondu au champion de la Partie. Elle ne joue jamais pour un Compte autre que le Compte actif. L’animation est différée jusqu’à ce que son écran soit visible : « Défi », ou « Parties » quand la fin de la Partie y a ouvert son récapitulatif (réglage activé), une fois la nouvelle Partie choisie, si bien que l’illustration qui arrive après la comète est celle de son champion. Elle ne joue que la plus forte des Parties terminées entre-temps, elle est abandonnée si une sélection commence, et quitter son écran pendant qu’elle joue l’arrête. Sur « Parties », « Défi » montre ensuite son état final (coches, « Validé ») sans la rejouer ; réglage désactivé, l’animation joue sur « Défi » comme avant. Les Parties importées ou lues dans l’historique n’animent rien.
- Entrée en sélection, dès que la fenêtre montre l’onglet « Sélection » : une bande de lumière dorée traverse la fenêtre (≈ 0,9 s), « Sélection des champions » arrive en fondu en montant de 8 px, puis les Champions de l’Enclume montent du bas de la fenêtre l’un après l’autre (départ à 380 ms, puis toutes les 110 ms), sans rotation. L’onglet « Sélection » s’affiche d’un coup, sans voile, d’où que l’on soit : la bande de lumière tient lieu de transition. Elle ne joue qu’une fois par sélection : quitter « Sélection » pendant la distribution pose la main, et y revenir la montre posée. Une carte encore en mouvement ne réagit au survol ou au focus clavier qu’une fois posée ; si le pointeur bouge avant, le focus clavier en attente est oublié. Les motifs qui arrivent pendant la distribution s’affichent sur leur carte sans la relancer. Réglage Windows coupé : la main apparaît posée, sans balayage.
- Entrée en sélection, dès que la fenêtre montre l’onglet « Sélection » : une bande de lumière dorée traverse la fenêtre (≈ 1,8 s), « Sélection des champions » arrive en fondu en montant de 8 px, puis les Champions de l’Enclume montent du bas de la fenêtre l’un après l’autre (départ à 760 ms, puis toutes les 220 ms, chacune en 1,4 s : une main de cinq est en place vers 3 s), sans rotation. L’onglet « Sélection » s’affiche d’un coup, sans voile, d’où que l’on soit : la bande de lumière tient lieu de transition. Elle ne joue qu’une fois par sélection : quitter « Sélection » pendant la distribution pose la main, et y revenir la montre posée. Une carte encore en mouvement ne réagit au survol ou au focus clavier qu’une fois posée ; si le pointeur bouge avant, le focus clavier en attente est oublié. Les motifs qui arrivent pendant la distribution s’affichent sur leur carte sans la relancer. Réglage Windows coupé : la main apparaît posée, sans balayage.
- Confirmation d’un allié : « Pris par un allié » apparaît sur sa carte de la main, qui s’abaisse de 8 px et se grise, même levée sous le pointeur ou le clavier ; elle reste 8 px plus bas que les autres. Rien d’autre ne bouge.
- Sortie de sélection, si « Sélection » est affichée : les cartes de la main descendent en s’effaçant (≈ 0,3 s, de la dernière à la première), chacune depuis là où elle est : une sortie pendant la distribution reprend les cartes en mouvement où elles en sont, celles pas encore parties restent invisibles ; une carte levée part de sa hauteur, toujours levée, les autres gardent le voile de la main, et une carte qu’une confirmation abaissait part d’où elle en était, sa version d’avant toujours en fondu par-dessus. Puis l’accueil revient comme après un changement d’onglet, dans l’état décrit plus haut (« Tous », recherche vide). Si le voile d’un changement d’onglet couvrait déjà « Sélection », il reste où il en est pendant que la main sort. Depuis « Défi », la sélection disparaît simplement ; depuis « Statistiques », le Défi revient avec le voile des transitions. Quand la sélection a lancé la Partie, c’est « En partie » qui revient à la place du Défi.
- Transitions entre « Défi », « Statistiques », « Parties », « Sélection » et « En partie » (l’icône de la bannière, « ‹ Défi » ou les onglets les déclenchent) : l’écran sortant passe sous un voile de la couleur du fond (≈ 130 ms), puis l’entrant en sort (≈ 280 ms). La barre du haut ne bouge pas. Changer d’écran pendant une transition repart de là où en est le voile. Les sélecteurs de Saison et de Format sont sur la ligne du titre « Statistiques », sous le voile : la barre du haut, commune aux deux écrans, garde sa hauteur. Pas de glissement : déplacer l’écran redessinerait à chaque image la grille, l’anneau et les graphiques, qui sont en cache.
- Survol et focus clavier : le même sur toutes les cartes (grille de l’accueil, main de la sélection, « Autres champions »), en ≈ 350 ms. Une carte jouable monte de 10 px avec une ombre dorée ; une carte grisée monte de 4 px, sans ombre dorée. L’illustration zoome à 107 % dans la carte, qui garde sa taille, pendant que le nom et les coches s’effacent et que la fiche glisse depuis le bas. Quitter une carte en cours d’animation repart de là où elle en est. Une seule carte est levée à la fois : une carte levée au clavier redescend dès que le pointeur bouge. Une molette la repose aussitôt, même en haut ou en bas de la liste. Le voile sur les cartes voisines ne s’applique que dans la main de la sélection. Réglage Windows coupé : la fiche apparaît sans glisser et la carte ne monte pas.
- Sortie de sélection, si « Sélection » est affichée : les cartes de la main descendent en s’effaçant (≈ 0,6 s chacune, de la dernière à la première), chacune depuis là où elle est : une sortie pendant la distribution reprend les cartes en mouvement où elles en sont, celles pas encore parties restent invisibles ; une carte levée part de sa hauteur, toujours levée, les autres gardent le voile de la main, et une carte qu’une confirmation abaissait part d’où elle en était, sa version d’avant toujours en fondu par-dessus. Puis l’accueil revient comme après un changement d’onglet, dans l’état décrit plus haut (« Tous », recherche vide). Si le voile d’un changement d’onglet couvrait déjà « Sélection », il reste où il en est pendant que la main sort. Depuis « Défi », la sélection disparaît simplement ; depuis « Statistiques », le Défi revient avec le voile des transitions. Quand la sélection a lancé la Partie, c’est « En partie » qui revient à la place du Défi.
- Transitions entre « Défi », « Statistiques », « Parties », « Sélection » et « En partie » (l’icône de la bannière, « ‹ Défi », les onglets ou une phase les déclenchent, #169) : l’écran sortant passe sous un voile de la couleur du fond (≈ 200 ms), puis l’entrant en sort (≈ 480 ms). C’est un **voile orienté** : un balayage à bord doux (environ un tiers de la largeur) qui traverse l’écran dans le sens de la barre du haut, « Défi » → « Parties » → « Sélection » → « En partie ». Vers un écran plus à droite il entre par la droite et se retire vers la gauche ; vers un écran plus à gauche, l’inverse. « Statistiques » occupe la place de « Défi » : entre ces deux écrans le voile est un fondu sans direction, vers les autres il suit la barre du haut. La sortie de sélection, qui choisit son écran sous le voile, n’a pas de direction non plus. La barre du haut ne bouge pas ; l’onglet choisi s’allume en fondu (≈ 120 ms) pendant que l’ancien s’éteint. **La bannière reste en place** entre les quatre onglets, qui la partagent : le voile ne couvre que ce qui est dessous, si elle est à sa place, en haut de l’écran, au départ et à l’arrivée (si elle a défilé sur l’un des deux écrans, le voile couvre tout pour cette transition). Son texte et l’icône « Statistiques » s’effacent avec le voile seulement s’ils changent (bannière d’une phase), puis le nouveau texte revient en montant de 10 px, avec rebond ; l’illustration garde son fondu. « Statistiques » n’a pas de bannière : vers elle et depuis elle, le voile couvre tout. Changer d’écran pendant une transition repart de là où en est le voile, du côté qu’il tient. Les sélecteurs de Saison et de Format sont sur la ligne du titre « Statistiques », sous le voile : la barre du haut, commune aux deux écrans, garde sa hauteur. Pas de glissement : déplacer l’écran redessinerait à chaque image la grille, l’anneau et les graphiques, qui sont en cache ; le voile orienté donne le sens sans rien déplacer.
- L’anneau vit sur événement et sous le pointeur, jamais au repos (#170). Survol d’une carte ou de la couronne : la graduation s’allume en « pop » (elle dépasse sa longueur puis revient, ≈ 260 ms) et, quittée, s’éteint en traîne (≈ 640 ms). Pointeur sur la couronne : les graduations voisines de celle visée se soulèvent en vague, qui suit le pointeur avec un léger retard élastique et retombe quand il sort ; la ligne de la bannière arrive en fondu (≈ 140 ms) à l’entrée et à la sortie. Changement d’écran avec la bannière en place : une lumière fait le tour de la couronne dans le sens du voile, horaire vers la droite (≈ 840 ms). Entrée sur « Sélection » : les graduations sans enclume s’éteignent en fondu (≈ 500 ms) ; au retour elles se rallument d’un coup. Changement de Compte ou de Saison : l’anneau se remplit depuis midi dans le sens horaire (≈ 1,7 s), ses graduations sautant à l’arrivée du front ; les premières graduations d’une session sont simplement là. Dans une fenêtre étroite, où l’anneau est posé sur l’illustration, les graduations pas encore atteintes ne sont pas masquées. Pendant la lumière et le remplissage, des graduations prises au hasard jettent un bref éclat : le pétillement.
- Fin de Partie et import, faits pour être remarqués (#172). La comète traîne une queue qui s’amincit et s’efface. À son atterrissage sur un premier top 1, des étincelles et une onde partent de la graduation, une vague parcourt les graduations validées dans les deux sens, des graduations pétillent et la couronne rebondit plus haut ; le compteur roule en dépassant sa place avant de s’y poser. Une nouvelle Marque fait monter la graduation en doré, une Partie sans nouveauté la fait clignoter. L’animation dure deux fois sa durée de base : un vol de 1,3 à 2,4 s selon la place de la graduation, puis 2,4 s pour se poser ; le compteur roule en 1,4 s. Pendant un import, l’arc glisse vers chaque nouvelle valeur (≈ 600 ms) au lieu d’y sauter, et ne bouge pas entre deux valeurs ni pendant l’attente du quota ; quand il disparaît, une lumière fait le tour de l’anneau.
- Survol et focus clavier : le même sur toutes les cartes (grille de l’accueil, main de la sélection, « Autres champions »), un geste : la carte monte en ≈ 260 ms et retombe en ≈ 520 ms (#171). Une carte jouable monte de 17 px avec une ombre dorée, en dépassant un peu sa hauteur (≈ 2 px) avant de s’y poser, et fait le même petit sursaut en repartant avant de retomber : sa hauteur suit une seule courbe à l’aller et au retour, pour qu’une carte quittée en cours de route reparte sans saut ; une carte grisée monte de 7 px, sans ombre dorée. L’illustration zoome à 107 % dans la carte, qui garde sa taille, pendant que le nom et les coches s’effacent et que la fiche glisse depuis le bas. Quitter une carte en cours d’animation repart de là où elle en est. Une seule carte est levée à la fois : une carte levée au clavier redescend dès que le pointeur bouge. Une molette la repose aussitôt, même en haut ou en bas de la liste. Le voile sur les cartes voisines ne s’applique que dans la main de la sélection. Réglage Windows coupé : la fiche apparaît sans glisser et la carte ne monte pas.
- Limites de GPUI, sans le modifier (ADR-0004) : pas de rotation, pas d’espacement des lettres animé, une montée de la carte au lieu d’un grossissement, un voile au lieu d’un filtre ou d’un fondu de l’écran entier.
### Page « Statistiques »
@@ -85,7 +87,7 @@ Pour une Saison, présenter d’abord la courbe cumulée des champions validés,
L’onglet permanent « Parties », à droite de « Défi » dans la barre du haut, liste les Parties enregistrées du Compte choisi dans la barre du haut (le Compte actif au démarrage), de la plus récente à la plus ancienne, filtrées par Saison, Format, Placement et champion (voir « Filtres »). « Défi » n’est allumé que sur « Défi » et « Statistiques », « Parties » sur sa page. On y passe avec le voile des transitions.
- **Sélection.** Ouvrir l’onglet à la main choisit la Partie la plus récente de celles que les filtres laissent : le choix précédent n’est pas gardé d’une ouverture à l’autre. Un clic ou les flèches haut et bas choisissent une autre Partie, Entrée confirme ; son Récapitulatif de partie s’affiche à côté. Pendant une synchronisation, la Partie choisie le reste tant qu’elle est listée et que les filtres la laissent.
- **Ouverture en fin de Partie.** À l’arrivée du bloc de fin d’une Partie Arena suivie (sa Partie provisoire), l’appli affiche « Parties » avec cette Partie choisie et son récapitulatif, d’où que l’on soit (« Défi », « Statistiques », le récapitulatif d’une autre Partie) ; « Paramètres » se ferme, comme à l’entrée en sélection (« la phase décide »). Le Placement revient à « Tous » et la recherche se vide pour qu’elle soit listée ; si la Saison ou le Format choisis (ceux de « Statistiques », les mêmes sélecteurs) l’écartent, ils reviennent à la Saison de la Partie (toutes les Saisons si aucune ne la contient) et à « Tous les Formats », « Statistiques » se recalculant en conséquence en arrière-plan, pour que la nouvelle Partie soit celle qui est choisie ; s’ils la gardent, ils ne bougent pas. Tant que la liste relue ne la contient pas, aucun autre récapitulatif ne s’affiche. La fenêtre n’est jamais mise au premier plan et ne prend pas le focus : réduite ou cachée dans la zone de notification, elle le reste, et la bascule s’y fait sans voile. Le bloc est enregistré en base dès son arrivée, sans attendre une synchronisation en cours, avec le Compte connecté à ce moment : la Partie provisoire est de ce Compte, même si un autre se connecte avant sa conversion. Un bloc dont rien ne dit le mode (ni mode, ni file, ni partie vue en cours) est gardé ; seul un bloc d’un autre mode est écarté. Le texte du bloc, gardé tel que reçu tant que la Partie provisoire peut en avoir besoin (bloc pas encore converti, ou converti et toujours provisoire), est effacé de la base dès qu’il ne sert plus : bloc d’une Partie qui n’est pas Arena, ou Partie publiée par Riot. Un bloc qui ne se convertit pas est relu toutes les 20 s pendant la fenêtre d’attente de la Partie (environ 30 minutes), puis seulement après une synchronisation réussie (adoption d’un Compte, par exemple), et abandonné au bout de 7 jours (son texte reste alors). Ensuite rien ne ramène sur « Parties » : la correction de la Partie publiée, une relecture ou une synchronisation ne déplacent pas le joueur. Quand le client quitte une Partie Arena sans bloc, l’appli affiche le Défi, d’où que l’on soit. La fin de chaque Partie ne décide qu’une fois : la sortie de partie qui suit un bloc ne déplace rien, mais un bloc arrivé après la sortie ouvre encore son récapitulatif. Une Partie trouvée seulement chez Riot ne déplace rien, et pendant une sélection Arena rien ne bascule. « En partie » reste affiché jusqu’au bloc ou au retour au salon : une sortie de partie sans bloc n’affiche le Défi qu’au retour au salon (voir « Pendant une Partie en cours »). Le réglage « Ouvrir le récapitulatif en fin de Partie » des Paramètres, activé par défaut et enregistré, coupe cette ouverture : l’appli affiche le Défi, et la Partie est dans l’historique. Une Partie qu’aucune Saison ne contient s’ouvre aussi, sans rien apporter au Défi. L’animation de fin de Partie garde ses règles, mais joue sur « Parties » : elle attend que l’écran soit visible et que la nouvelle Partie soit choisie ; réglage désactivé, elle joue sur « Défi ».
- **Ouverture en fin de Partie.** À l’arrivée du bloc de fin d’une Partie Arena suivie (sa Partie provisoire), l’appli affiche « Parties » avec cette Partie choisie et son récapitulatif, d’où que l’on soit (« Défi », « Statistiques », le récapitulatif d’une autre Partie) ; « Paramètres » se ferme, comme à l’entrée en sélection (« la phase décide »). Le Placement revient à « Tous » et la recherche se vide pour qu’elle soit listée ; si la Saison ou le Format choisis (ceux de « Statistiques », les mêmes sélecteurs) l’écartent, ils reviennent à la Saison de la Partie (toutes les Saisons si aucune ne la contient) et à « Tous les Formats », « Statistiques » se recalculant en conséquence en arrière-plan, pour que la nouvelle Partie soit celle qui est choisie ; s’ils la gardent, ils ne bougent pas. Tant que la liste relue ne la contient pas, aucun autre récapitulatif ne s’affiche. Comme à l’entrée en sélection, la fenêtre passe au premier plan sans prendre le focus, même réduite ou cachée dans la zone de notification, et la bascule s’y fait sans voile ; il en va de même quand la fin de Partie affiche le Défi (réglage désactivé, ou sortie sans bloc). Le bloc est enregistré en base dès son arrivée, sans attendre une synchronisation en cours, avec le Compte connecté à ce moment : la Partie provisoire est de ce Compte, même si un autre se connecte avant sa conversion. Un bloc dont rien ne dit le mode (ni mode, ni file, ni partie vue en cours) est gardé ; seul un bloc d’un autre mode est écarté. Le texte du bloc, gardé tel que reçu tant que la Partie provisoire peut en avoir besoin (bloc pas encore converti, ou converti et toujours provisoire), est effacé de la base dès qu’il ne sert plus : bloc d’une Partie qui n’est pas Arena, ou Partie publiée par Riot. Un bloc qui ne se convertit pas est relu toutes les 20 s pendant la fenêtre d’attente de la Partie (environ 30 minutes), puis seulement après une synchronisation réussie (adoption d’un Compte, par exemple), et abandonné au bout de 7 jours (son texte reste alors). Ensuite rien ne ramène sur « Parties » : la correction de la Partie publiée, une relecture ou une synchronisation ne déplacent pas le joueur. Quand le client quitte une Partie Arena sans bloc, l’appli affiche le Défi, d’où que l’on soit. La fin de chaque Partie ne décide qu’une fois : la sortie de partie qui suit un bloc ne déplace rien, mais un bloc arrivé après la sortie ouvre encore son récapitulatif. Une Partie trouvée seulement chez Riot ne déplace rien, et pendant une sélection Arena rien ne bascule. « En partie » reste affiché jusqu’au bloc ou au retour au salon : une sortie de partie sans bloc n’affiche le Défi qu’au retour au salon (voir « Pendant une Partie en cours »). Le réglage « Ouvrir le récapitulatif en fin de Partie » des Paramètres, activé par défaut et enregistré, coupe cette ouverture : l’appli affiche le Défi, et la Partie est dans l’historique. Une Partie qu’aucune Saison ne contient s’ouvre aussi, sans rien apporter au Défi. L’animation de fin de Partie garde ses règles, mais joue sur « Parties » : elle attend que l’écran soit visible et que la nouvelle Partie soit choisie ; réglage désactivé, elle joue sur « Défi ».
- **Filtres.** Une rangée au-dessus de la liste (dans la colonne de la liste : derrière le bouton « Parties » dans une fenêtre étroite) : les sélecteurs de Saison et de Format, un contrôle segmenté de Placement « Tous · Top 1 · Victoires » et un champ de recherche de champion. Les filtres se combinent. Saison et Format sont les sélecteurs de « Statistiques », avec le même état : choisir l’un sur une page le change sur l’autre (et, comme sur « Statistiques », la Saison choisie est celle du Défi affiché sur « Défi »). Par défaut la Saison actuelle, ou « Toutes les Saisons » quand il n’y en a pas, comme sur « Statistiques ». Une Partie est de la Saison dont la période contient son début. « Top 1 » garde les Parties de Placement 1 ; « Victoires » celles que le jeu compte comme gagnées (Win : le top 3 en Arena 3x6). La recherche est celle de l’accueil (nom, identifiant Data Dragon, alias connus ; sans casse ni accents), avec son propre champ. Placement et recherche ne sont pas ceux de « Statistiques » et sont gardés tant que l’appli tourne, sans être enregistrés ; ils reviennent à « Tous » et à vide au lancement. Le filtrage se fait sur les Parties déjà chargées, sans nouvelle lecture de la base : seules les lignes gardées sont écrites dans la liste. Si la Partie choisie est écartée, la première Partie gardée est choisie et son récapitulatif s’affiche ; s’il n’en reste aucune, la liste dit « Aucune Partie ne correspond aux filtres » et le récapitulatif est vide. Les filtres restent affichés pour être changés.
- **Compte.** Le sélecteur de Compte de la barre du haut est actif sur cette page (grisé pendant une phase) : choisir un autre Compte remplace la liste aussitôt, sans jamais mélanger les Parties de deux Comptes, choisit la plus récente et replie le joueur déplié. Un changement de Compte dans le client fait de même quand le Compte actif est affiché, c’est-à-dire quand aucun autre Compte n’est choisi.
- **Ligne de la liste.** Portrait et nom du champion, date et heure de début (heure de Windows, « 15 nov. 2026 · 18:29 »), Placement (« 1ᵉʳ », « 2ᵉ »…) coloré selon le résultat : or pour un top 1, vert pour une autre Victoire, rouge sinon, et « Provisoire » pour une Partie provisoire. Pas de Format dans la ligne.
@@ -94,8 +96,8 @@ L’onglet permanent « Parties », à droite de « Défi » dans la barre du ha
- **Détails d’un joueur.** La ligne d’un joueur est un bouton (chevron à droite) : un clic, ou Entrée ou Espace une fois la ligne atteinte avec Tab, déplie ses détails dessous, un autre clic ou la même touche les replie. Un seul joueur est déplié à la fois ; l’état est gardé tant que la même Partie est décodée de nouveau (le joueur est retrouvé à sa nouvelle place quand un Placement corrigé réordonne les équipes ; replié si on ne le retrouve pas avec certitude), et oublié dès qu’on choisit une autre Partie, qu’on quitte l’écran ou qu’on change de Compte. Cinq rangées, dessinées en barres. « Dégâts aux champions » et « Dégâts reçus » sont chacune une seule barre, toujours de même longueur, partagée par type (Physiques, Magiques, Bruts, chacun sa couleur : rouge, bleu, et la couleur du texte pour les Bruts : blanc en thème sombre, encre foncée en thème clair), la part d’un type étant sa part de la somme des types (barre vide quand un type manque, comme dans une Partie provisoire, ou que leur somme est 0) ; le Total s’écrit à côté de la barre et la valeur de chaque type dans une petite légende dessous. « Protection », « Or » et « Contrôle » ont une barre par mesure, pleine pour le meilleur joueur de la Partie sur cette mesure, la valeur écrite en petit à côté de chaque barre ; une valeur absente laisse la barre vide et garde son mot. Les mesures sont : « Protection » (Dégâts atténués (sur soi), Soins aux alliés, Boucliers sur les alliés), « Or » (Or gagné, Or dépensé, suivis de « or ») et « Contrôle » (Contrôle infligé, en secondes ou « 1 min 23 s », puis Score de contrôle, le nombre brut de Riot, sans unité : une bulle sur son titre le précise, « Score Riot, sans unité »). Dégâts, soins et boucliers sont des points ; les milliers sont séparés par une espace fine insécable. Chaque total est celui que Riot publie, jamais la somme des types : ils peuvent différer. Une valeur absente s’affiche « Indisponible » (« En attente » dans une Partie provisoire), jamais 0 ; 0 n’apparaît que si la source le donne. Les valeurs sont écrites avec le récapitulatif, mais les éléments des détails ne sont construits que pour le joueur déplié : replié, le détail ne coûte rien à l’affichage.
- **Dégâts observés dans les récaps de mort.** Sous les cinq rangées des détails d’un joueur, une section titrée « Dégâts observés dans les récaps de mort ». Seule la chronologie Match‑V5 donne des dégâts par effet, et seulement ceux qu’un champion reçoit avant de mourir : chaque entrée de récap de mort est comptée une seule fois, pour le joueur qui l’a infligée et son effet. Les dégâts infligés à un champion qui survit ne sont jamais attribués ; le total de la Partie par effet est indisponible, ce que la section dit une fois, en gris (« Le total de la Partie par effet est indisponible : seuls les dégâts subis avant une élimination sont détaillés. Les dégâts infligés à un champion qui survit ne sont jamais attribués. »). Une ligne par objet ou amélioration du joueur reconnu (icône et nom du catalogue, comme dans le récapitulatif, total des dégâts, puis les types qui ont infligé quelque chose, « Physiques 120 · Magiques 80 »), du plus au moins dommageable, puis « Autres effets » (attaques de base, sorts du champion, effets qui ne sont pas un objet ou une amélioration de sa fin de Partie). La correspondance est automatique quand le nom de l’effet est l’`augmentNameId` d’une amélioration du joueur (sans tenir compte de la casse) ; les objets, et les améliorations dont le nom diffère, passent par une table d’exceptions tenue à la main (`death_recap/exceptions.tsv` du cœur) ; elle est refaite à chaque lecture, si bien qu’un catalogue renouvelé ou une exception ajoutée s’applique aux Parties déjà récupérées. États de la section : « En attente » pour une Partie provisoire (pas de chronologie, rien n’est demandé) ; « Chargement… » pendant la requête ; « Indisponible » quand Riot refuse la chronologie de cette Partie (403, retenu : elle n’est plus redemandée) ; un bouton « Réessayer » avec un message en cas d’échec passager (réseau, service indisponible), qui redemande ; « Aucun dégât observé » quand aucune entrée ne nomme ce joueur. La chronologie est récupérée une fois par Partie : en arrière-plan, à basse priorité, dès qu’une nouvelle Partie suivie est publiée ; à la première ouverture du récapitulatif pour une Partie plus ancienne, sans jamais rattraper l’historique en masse ni pendant une synchronisation. Seules les entrées des récaps de mort sont gardées en base, jamais la chronologie. Les requêtes passent par le service et respectent `Retry-After`. Le récapitulatif ouvert se relit quand la récupération en arrière-plan de sa Partie se termine. Une même chronologie n’est jamais demandée deux fois à la fois : une Partie publiée pendant que son récapitulatif est ouvert (ou ouverte alors qu’elle est en file) attend la récupération en cours. Un récap de mort mis en correspondance avec un ancien catalogue (récupération en cours quand les données du jeu changent) est relu avec le catalogue courant. La page ne lit qu’un récap de mort à la fois : pendant une lecture, seule la dernière demandée attend (une demande à Riot pour la même Partie n’est pas perdue), et quitter l’écran l’oublie ; parcourir la liste quand Riot est lent ne lance pas un thread par Partie.
- **Valeurs absentes.** Une valeur que la source ne donne pas s’affiche « Indisponible », en gris ; 0 seulement si la source donne 0. Dans une Partie provisoire, dont la source est le bloc de fin de partie du client, l’absence s’affiche « En attente ».
- **Disposition.** La bannière du Défi est en haut (#110) : la Saison (« Défi de Pseudo · » pour un autre Compte), le compteur, les lignes « Dernier champion validé » et « Dernière Partie », l’icône « Statistiques » dans le coin inférieur droit et l’anneau, sur l’illustration du champion de la Partie choisie dans la liste, dont la graduation est allumée comme celle du champion joué sur « En partie » ; l’illustration passe en fondu quand le choix change. Sans Partie choisie (liste vide, filtres qui n’en gardent aucune), ni illustration ni graduation allumée. Dans une fenêtre basse, la colonne défile sous la bannière : la liste et le récapitulatif gardent au moins 240 px. Dessous, la liste (≈ 320 px, défilante, sous sa rangée de filtres) et le récapitulatif (défilant) côte à côte. Sous ≈ 900 px de large, la liste passe derrière un bouton « Parties » à chevron qui l’ouvre par-dessus le récapitulatif ; choisir une Partie la referme.
- **Synchronisation.** Le bandeau, la ligne d’état et le bouton « Actualiser » de la barre de titre restent ceux des autres pages. Les Parties déjà connues restent consultables pendant la synchronisation et après un échec, qui s’affiche en une ligne au-dessus.
- **Disposition.** L’écran est limité à 1264 px centrés, comme « Défi » et « Sélection », pour que la bannière soit au même endroit sur chaque onglet (#169). La bannière du Défi est en haut (#110) : la Saison (« Défi de Pseudo · » pour un autre Compte), le compteur, les lignes « Dernier champion validé » et « Dernière Partie », l’icône « Statistiques » dans le coin inférieur droit et l’anneau, sur l’illustration du champion de la Partie choisie dans la liste, dont la graduation est allumée comme celle du champion joué sur « En partie » ; l’illustration passe en fondu quand le choix change. Sans Partie choisie (liste vide, filtres qui n’en gardent aucune), ni illustration ni graduation allumée. Dans une fenêtre basse, la colonne défile sous la bannière : la liste et le récapitulatif gardent au moins 240 px. Dessous, la liste (≈ 320 px, défilante, sous sa rangée de filtres) et le récapitulatif (défilant) côte à côte. Sous ≈ 900 px de large, la liste passe derrière un bouton « Parties » à chevron qui l’ouvre par-dessus le récapitulatif ; choisir une Partie la referme.
- **Synchronisation.** Le bandeau, la ligne d’état et le bouton « Actualiser » de la barre de titre restent ceux des autres pages. Les Parties déjà connues restent consultables pendant la synchronisation et après un échec, qui s’affiche en une ligne au-dessus. Quand le quota de l’API Riot est atteint, l’import attend la fin de l’attente demandée par Riot : l’arc de l’anneau reste figé et la ligne d’état dit « Quota Riot atteint : reprise dans 12 s », décomptée chaque seconde (pour le Compte comme pour un Ami, celle de l’import du Compte passant avant), puis la ligne d’import (« Import en cours : n / N Parties », « Import de Pseudo : n / N Parties ») revient à la reprise. Un seul minuteur, démarré pour l’attente, redessine cette ligne ; il n’y en a aucun hors d’une attente.
- **États vides.** Sans Compte, « Compte indisponible » ; sans Partie, « Aucune Partie enregistrée » ; Parties enregistrées mais aucune gardée par les filtres, « Aucune Partie ne correspond aux filtres » sous les filtres.
- **Règle n° 1.** La liste est la seule partie de l’écran à état propre (sélection, défilement, survol) : une vue en cache, dont seules les lignes visibles sont construites, et que le reste de la page redessiné ne redessine pas. La liste est lue en arrière-plan à l’ouverture de l’écran, puis quand les Parties enregistrées changent pendant qu’il est affiché ; caché, il est seulement marqué à relire, et il ne l’est que si les Parties enregistrées ont changé entre-temps (ou qu’une lecture a été coupée ou a échoué) : rouvrir l’écran sans changement ne relit pas la base, et choisit de nouveau la Partie la plus récente gardée. Un récapitulatif qui n’a pas pu être décodé l’est de nouveau quand la liste est relue ou que l’écran se rouvre. Un seul décodage de récapitulatif à la fois, un résultat périmé est jeté. Rien ne tourne au repos, et les portraits sont rendus en quittant l’écran.
@@ -115,7 +117,7 @@ Le bouton « Ouvrir le dossier des journaux » ouvre dans l’Explorateur Window
- L’application cible reste l’application Windows native en GPUI via gpui-kit. L’accueil et la sélection réutilisent une seule représentation de carte. La logique de progression provient des Parties enregistrées, y compris pour les données antérieures à la refonte. La Progression officielle sert au contrôle du total.
- Le calcul du Défi détermine déjà la première Partie de Placement 1 par ordre chronologique. Exposer sa date à la fiche du champion et employer la même convention de date que la courbe de progression. Les marques saisonnières restent indépendantes du filtre de Format des statistiques.
- Les splashs sont tous téléchargés en arrière-plan, à basse priorité, après les portraits de cartes, et gardés sur disque. Aucune illustration Riot n’entre dans le dépôt : la page de référence les charge depuis Data Dragon. Le cœur calcule le cadrage de chaque champion au téléchargement, en retrouvant l’art de chargement (le portrait vertical des cartes) dans le splash, et en garde le point de focus. Si la correspondance est douteuse, ou si le splash manque, il revient à un cadrage fixe, le même pour tous. Les valeurs de la page de référence viennent de ce calcul et de son repli. Deux splashs au plus sont décodés à la fois : celui qui s’affiche et celui qui le remplace.
- Les splashs sont tous téléchargés en arrière-plan, à basse priorité, après les portraits de cartes, et gardés sur disque. Aucune illustration Riot n’entre dans le dépôt. Le cœur calcule le cadrage de chaque champion au téléchargement, en retrouvant l’art de chargement (le portrait vertical des cartes) dans le splash, et en garde le point de focus. Si la correspondance est douteuse, ou si le splash manque, il revient à un cadrage fixe, le même pour tous. Deux splashs au plus sont décodés à la fois : celui qui s’affiche et celui qui le remplace.
- Conserver le comportement existant de la recherche de champions, des préférences et du suivi de Compte. Le client League reste une source en lecture seule. Les données de sélection sont temporaires : leur disparition laisse l’historique enregistré consultable.
- Réutiliser le suivi de sélection Arena livré avec le ticket #13. Il lit déjà les Champions de l’Enclume, les bans et les choix alliés, puis regroupe les champions exclus pour déterminer lesquels sont disponibles. Transmettre à la carte le motif précis du grisé et actualiser son libellé lorsque ce motif change.
- Respecter les budgets existants : réagir aux événements du client, limiter le travail aux portraits affichés, garder les chargements en arrière-plan à basse priorité. Le survol d’une carte doit pouvoir afficher ses données sans relire l’historique ni recalculer les graphiques. Le benchmark complet relève du contrôle de version majeure. [Budgets et méthode de mesure](performance.md)
@@ -127,7 +129,7 @@ Le bouton « Ouvrir le dossier des journaux » ouvre dans l’Explorateur Window
| Liste des Champions de l’Enclume indisponible | Le suivi actuel accepte une liste absente ou vide. Déterminer si le client permet de distinguer ces deux situations dans les données reçues. | Garder la collection consultable et signaler sobrement l’information indisponible. Une liste inconnue ne suffit pas pour classer tous les champions « sans enclume ». |
| Points de maîtrise | Le tracker ne les récupère pas encore. Vérifier la source par Compte et la disponibilité hors ligne. | Utiliser les dernières valeurs connues. À défaut, proposer A–Z temporairement en conservant la préférence du joueur. Une valeur inconnue reste distincte de zéro. |
Ces replis sont des propositions de développement. La maquette illustre les états connus avec douze champions fictivement suivis.
Ces replis sont des propositions de développement.
État établi pendant la refonte :
@@ -145,4 +147,4 @@ Ces replis sont des propositions de développement. La maquette illustre les ét
## Hors périmètre
Les nouveaux indicateurs statistiques feront l’objet d’un autre ticket. Les itérations « Le Hublot » et « Les Médailles » de l’identité ne sont pas retenues, et aucune illustration Riot n’entre dans le dépôt. La Renommée, les actions de sélection ou de ban dans League et le bouton « Simuler la sélection » de la maquette sont exclus de la version native.
Les nouveaux indicateurs statistiques feront l’objet d’un autre ticket. Les itérations « Le Hublot » et « Les Médailles » de l’identité ne sont pas retenues, et aucune illustration Riot n’entre dans le dépôt. La Renommée, les actions de sélection ou de ban dans League sont exclus de la version native.
+5 -5
View File
@@ -67,13 +67,13 @@ The release benchmark runs these scenarios, in this order, on the reference mach
The identity (ring, banner, animations; `docs/interface.md`) follows the same rule:
- **Animations are triggered by an event** (end of a followed Match, champ select entering or leaving, an ally's confirmation, card hover, tab change) and **draw nothing at rest**. No timer or loop keeps a frame going once an animation is over, and none runs while the window is hidden or minimised. They follow the Windows « Show animations » setting.
- **The foundation** (`crates/app/src/motion.rs`, with the page saying when « Défi » is visible, #86) decides whether the app animates, and when. The Windows setting reaches GPUI's `App::reduce_motion`: gpui-base reads it at start, and the window's own `WM_SETTINGCHANGE` for `SPI_SETCLIENTAREAANIMATION` reads it again, with no polling. When it is off, a tab switch shows its end state at once, and an animation asked for is not played; turning it off ends a transition running and drops the animation waiting, as soon as Windows says so (`AnimationSetting`). An animation asked for while « Défi » is not visible (window minimised or hidden in the notification area, « Statistiques », « Sélection » or « Paramètres » in front, or during a champ select) waits in `Deferred`: only the strongest is kept, it plays once when « Défi » shows again, and a champ select that starts abandons it.
- **Tab transitions lay a veil, never move the screen.** A cached view's cache key holds its bounds and its opacity, so fading or sliding the screen itself would draw the grid, the ring and the charts again at every frame and build the cards again. The veil, of the page's background, covers the screen leaving (130 ms) then lifts off the one arriving (280 ms). Each frame is asked for by the transition itself (`on_next_frame`), and none once the veil is lifted. A window hidden during a transition ends it at once. The champion table is a cached view too, laid out by the space the page gives it, so the veil's frames do not draw it. The screen arriving is prepared (its rows copied and sorted, its cards built) only when it is shown, so a switch undone under the veil prepares nothing. Structural tests check that a transition draws neither the grid, the ring nor the table again, builds no card, recomputes no statistics, and asks for no frame at rest. The charts arriving play gpui-kit's own short entry, as after any switch.
- **The foundation** (`crates/app/src/motion.rs`, with the page saying when « Défi » is visible, #86) decides whether the app animates, and when. The Windows setting reaches GPUI's `App::reduce_motion`: gpui-base reads it at start, and the window's own `WM_SETTINGCHANGE` for `SPI_SETCLIENTAREAANIMATION` reads it again, with no polling. When it is off, a tab switch shows its end state at once, and an animation asked for is not played; turning it off ends a transition running and drops the animation waiting, as soon as Windows says so (`AnimationSetting`). Two tempos are shared (#168), so that no animation sets its own: an **event** (what the app shows of itself) lasts twice its base duration (`motion::event`), and a **gesture** (what answers the hand: a card hovered, the pointer on the ring) rises at its base duration and settles back in twice that (`motion::release`). Both only lengthen animations that already ask for their own frames: neither adds a frame at rest. An animation asked for while « Défi » is not visible (window minimised or hidden in the notification area, « Statistiques », « Sélection » or « Paramètres » in front, or during a champ select) waits in `Deferred`: only the strongest is kept, it plays once when « Défi » shows again, and a champ select that starts abandons it.
- **Tab transitions lay a veil, never move the screen.** A cached view's cache key holds its bounds and its opacity, so fading or sliding the screen itself would draw the grid, the ring and the charts again at every frame and build the cards again. The veil, of the page's background, covers the screen leaving (200 ms) then lifts off the one arriving (480 ms): an event's animation, at twice its base duration (#168). Between two screens of the top bar it has a direction (#169): its soft edge crosses the screen from the side of the screen arriving, painted by the page as three rectangles over the screen (solid, a two-stop gradient, nothing), so the direction costs no cached view either. The four tabs share the banner, limited to the same width on each: the veil starts under it while it is at the top of the screen, and only the banner's text, which is not cached, fades when it changes; the ring and the illustration are left alone. Each frame is asked for by the transition itself (`on_next_frame`), and none once the veil is lifted. A window hidden during a transition ends it at once. The champion table is a cached view too, laid out by the space the page gives it, so the veil's frames do not draw it. The screen arriving is prepared (its rows copied and sorted, its cards built) only when it is shown, so a switch undone under the veil prepares nothing. Structural tests check that a transition draws neither the grid, the ring nor the table again, builds no card, recomputes no statistics, and asks for no frame at rest. The charts arriving play gpui-kit's own short entry, as after any switch.
- **A card hovered is drawn over its grid, which stays cached** (#88). The cards of a grid never change on hover or focus: the page draws the card under the pointer or the keyboard (and those settling back) lifted over the grid, in a deferred layer painted after the page, from where the grid last placed it (`card_lift.rs`). The grid records its visible cards' bounds and indices while it lays out its rows, so drawing them over it reads no layout, searches no card and copies none: the lifted card is the grid's card as it is at each frame. The layer covers each lifted card's place with the page's background, and in the hand lays the veil on the other cards. Each frame is asked for by the page's render while a card moves (`request_animation_frame`), and none once they are still. A wheel drops the grid's lifted cards at once, even at either end of the list, and so does a grid no longer shown (the home under « Sélection », the hand under another tab or after the champ select) or a card filtered out, so no frame is asked for a card no longer drawn; a tab switch or « Paramètres » drops them all, and a hidden window or the setting turned off shows their end state at once. Structural tests check that hovering a card, through its whole animation, draws none of the grid, builds no card and computes no statistics, and that no frame is asked for at rest. A zoomed illustration overflows the card and is cut square by GPUI's rectangular clip: a frame of the page's background rounds its corners again, which nicks the gold glow by a few pixels at each corner.
- **A champ select enters and leaves over its cached hand** (#87). The entry starts once the window shows « Sélection », not behind « Paramètres »: a band of gold light (four two-stop gradients side by side, GPUI's gradients have two stops) crosses the page in 900 ms, the title comes in rising in 700 ms, and the Anvil champions are dealt from the bottom of the window, the first at 380 ms then one every 110 ms, each in 700 ms. The cards dealt, the card an ally just took (it rests 8 px lower in the hand, and goes down there as it greys) and the cards leaving at the end are drawn by the page over the hand's grid, in a deferred layer that covers their places with the page's background, from where the grid last placed them (`crates/app/src/stage/hand.rs`), as the lifted cards are: the grid is never drawn again for them, and a card's reasons changing during the deal show on it without dealing again. The hand's cards come with the statistics, loaded at each new champ select: they are dealt from when they come. A card still dealt is lifted once in its place: until a frame finds it there, the card waited for asks for frames itself. A card out of sight (the hand scrolled out of a low window, a card still under the window's bottom edge) is not built. At the end, the hand leaves (320 ms per card, from the last, 35 ms apart), each card from where it was, read once when the champ select ends (its place in the deal, its lift, the hand's veil, an ally's confirmation not over), then the veil of the tabs covers the champ select from 240 ms and the end is applied under it: the home is prepared only then. Only the screen shown plays this motion (#108): leaving « Sélection » ends it, so that the hand is at rest when it shows again and no frame is asked for it meanwhile; on another tab, a card an ally takes greys in place, and the end of the champ select merely ends it. Each frame is asked for by the motion itself, none once it is over or while the hand waits for its cards; a hidden window, the page covered or the setting turned off shows the end state at once. Structural tests on the Arena capture pilot the sequence step by step and check that it draws the hand's grid again for no frame, builds no card, sorts nothing and computes no statistics, and asks for no frame at rest.
- **The end of a followed Match is drawn over the cached ring, the cached grid and the banner** (#89). The comet, the flaring tick and the bouncing crown are a function of the page's render in a layer over the ring (`Ring::match_layer`): the ring is not drawn again, and the comet and the tick are built at each frame only while the animation runs, unlike the ring's own shapes, built once per set of ticks; the crown is the ring's own, moved. The card that changes is drawn over its grid like a lifted card at rest (`card_lift.rs`), and stays in the grid until the animation ends even if the filter leaves it out. With the pointer on the grid, nothing moves under it: the grid of the new statistics (order, cards, filter) is prepared when they arrive, and the pointer leaving only puts it in place. The banner's counter rolls in painted over its place in the title, and the splash of the champion validé settles in with the banner's own decode. The animation is fixed when it starts (tick, duration) and reads no statistics at each frame; each frame is asked for by the page's render while it runs, and none after. Structural tests check that it draws neither the grid nor the ring again, tessellates no crown, builds no card, recomputes no statistics and asks for no frame at rest, and that leaving a grid it held still sorts nothing and builds no card.
- **A champ select enters and leaves over its cached hand** (#87). The entry starts once the window shows « Sélection », not behind « Paramètres »: a band of gold light (four two-stop gradients side by side, GPUI's gradients have two stops) crosses the page in 1.8 s, the title comes in rising in 1.4 s, and the Anvil champions are dealt from the bottom of the window, the first at 760 ms then one every 220 ms, each in 1.4 s: an event's animation, at twice its base duration (#171). The cards dealt, the card an ally just took (it rests 8 px lower in the hand, and goes down there as it greys) and the cards leaving at the end are drawn by the page over the hand's grid, in a deferred layer that covers their places with the page's background, from where the grid last placed them (`crates/app/src/stage/hand.rs`), as the lifted cards are: the grid is never drawn again for them, and a card's reasons changing during the deal show on it without dealing again. The hand's cards come with the statistics, loaded at each new champ select: they are dealt from when they come. A card still dealt is lifted once in its place: until a frame finds it there, the card waited for asks for frames itself. A card out of sight (the hand scrolled out of a low window, a card still under the window's bottom edge) is not built. At the end, the hand leaves (640 ms per card, from the last, 70 ms apart), each card from where it was, read once when the champ select ends (its place in the deal, its lift, the hand's veil, an ally's confirmation not over), then the veil of the tabs covers the champ select from 480 ms and the end is applied under it: the home is prepared only then. Only the screen shown plays this motion (#108): leaving « Sélection » ends it, so that the hand is at rest when it shows again and no frame is asked for it meanwhile; on another tab, a card an ally takes greys in place, and the end of the champ select merely ends it. Each frame is asked for by the motion itself, none once it is over or while the hand waits for its cards; a hidden window, the page covered or the setting turned off shows the end state at once. Structural tests on the Arena capture pilot the sequence step by step and check that it draws the hand's grid again for no frame, builds no card, sorts nothing and computes no statistics, and asks for no frame at rest.
- **The end of a followed Match is drawn over the cached ring, the cached grid and the banner** (#89). The comet, the flaring tick and the bouncing crown are a function of the page's render in a layer over the ring (`Ring::match_layer`): the ring is not drawn again, and the comet and the tick are built at each frame only while the animation runs, unlike the ring's own shapes, built once per set of ticks; the crown is the ring's own, moved. The card that changes is drawn over its grid like a lifted card at rest (`card_lift.rs`), and stays in the grid until the animation ends even if the filter leaves it out. With the pointer on the grid, nothing moves under it: the grid of the new statistics (order, cards, filter) is prepared when they arrive, and the pointer leaving only puts it in place. The banner's counter rolls in painted over its place in the title, and the splash of the champion validé settles in with the banner's own decode. The animation is fixed when it starts (tick, duration) and reads no statistics at each frame; each frame is asked for by the page's render while it runs, and none after. Structural tests check that it draws neither the grid nor the ring again, tessellates no crown, builds no card, recomputes no statistics and asks for no frame at rest, and that leaving a grid it held still sorts nothing and builds no card. Its sparks, its shock, the wave through the ticks Completed and the twinkles (#172) are built at each frame in that same layer, as the comet is, and it lasts twice its base duration, as an event's animation does. The import's arc glides in the ring's live layer: the part it has not reached yet is painted over it in the colour of the rest, so the ring is still told of the progress, and drawn, at most once a second.
- **Two splashes decoded at most**: the one shown and the one replacing it. All splashes are downloaded in the background, at low priority, after the card portraits, and kept on disk.
- During champ select, the Anvil grid is cached at the height of its card rows. The capture replay checks that a splash fade builds no cards and that traversing the hand and « Autres champions » keeps at most two decoded splashes. The latest hovered card takes over when the current fade finishes.
- **The ring is a cached view**, laid out from its style alone. A structural test guards it: hovering a card, scrolling the grid or an animation on another part does not render the ring; only a change of what it shows (the champions' state, their order, the selection) or its own animation does. Its gain is checked at the next release benchmark.
- **The ring is a cached view**, laid out from its style alone. A structural test guards it: hovering a card, scrolling the grid or an animation on another part does not render the ring; only a change of what it shows (the champions' state, their order, the selection, the import's arc: when it appears or disappears, and its count at most once a second) or its own animation does. The arc's circle is built once per size and its done part once per progress, and a hover tessellates only the lit tick, during an import too. The Riot quota countdown draws the status line, never the ring. Its gain is checked at the next release benchmark. What makes it live (#170: the lit tick's pop and its trail, the wave under the pointer, the light of a switch of screens, the fill for another Account or Season, the ticks going dim, the twinkles) is a layer the page draws over it (`Ring::live_layer`) from what moves and since when (`crates/app/src/page/ring_live.rs`): the ring is drawn again for none of it, the layer's shapes are built at each frame only while something moves, and the page asks for a frame only then. A pointer resting on the crown asks for none once the wave has caught up; a move along the crown tells the page only when it sets the wave moving, not while it moves and asks for its own frames. Nothing moves over the ring out of sight: with the window hidden, « Paramètres » in front or on « Statistiques », which has no ring, what was asked for shows its end state at once and no frame is asked for. Structural tests check that the wave and the trail draw the ring again for a new tick only, that the fill for another Account and the ticks going dim do not draw it again at each frame, that a move within a tick's sector tells the page nothing more, and that no frame is asked for at rest or out of sight.
- **The « Parties » list is a cached view** (`MatchList`, `crates/app/src/page/matches/list.rs`), which owns its selection, scroll and hover. The page drawn again (the recap arriving, the veil) does not draw it: a structural test in `crates/app/src/page/tests/matches.rs` checks that its render count does not move. Its gain is checked at the next release benchmark.
- The « Parties » recap owns its scroll area and image cache. The match-end animation test checks that advancing the banner by one frame reuses the ready recap. Check the frame-time gain with a full recap at the next release benchmark.
-690
View File
@@ -1,690 +0,0 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Arena Tracker · Identité « L'Anneau »</title>
<!-- Référence visuelle de l'identité « L'Anneau » (itération B3, « La Bannière ») : couleurs du logo,
anneau de progression, bannière illustrée, animations de fin de Partie, entrée en sélection et survol.
Les animations reproduisent ce que GPUI sait faire : ni rotation, ni mise à l'échelle d'un élément,
ni espacement des lettres animé ; un voile plutôt qu'un filtre sur les cartes voisines.
Saison fictive (graine fixe). Illustrations chargées depuis Data Dragon : il faut une connexion. -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Unbounded:wght@600;800&display=swap">
<style>
/* Les couleurs du logo : anneau doré autour d'un disque bleu nuit. Sombre d'abord, clair en papier froid.
Le texte posé sur une illustration reste clair dans les deux thèmes. */
:root {
--bg: #11152a; --band: #151a33; --surface: #181e38; --raised: #20274a; --line: #283053;
--fg: #edeaf7; --muted: #8b91b1; --faint: #3a4166;
--gold: #f5b83d; --gold-ink: #f5b83d; --gold-soft: rgba(245, 184, 61, .34); --gold-glow: rgba(245, 184, 61, .55);
--on-gold: #161b2e; --ban: #ff7a7a;
--art-ink: #ffffff; --art-soft: rgba(255, 255, 255, .74); --art-shade: rgba(9, 11, 24, .94); --art-chip: rgba(17, 21, 42, .88);
--display: Unbounded, "Segoe UI", system-ui, sans-serif;
--body: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
--bar-bg: #fdfd96; --bar-fg: #141414;
color-scheme: dark;
}
:root[data-mode="light"] {
--bg: #eef0f7; --band: #e5e8f3; --surface: #ffffff; --raised: #e4e8f4; --line: #d2d7e9;
--fg: #161b2e; --muted: #596082; --faint: #c5cbe0;
--gold: #e3a21a; --gold-ink: #8f5d00; --gold-soft: rgba(212, 146, 14, .4); --gold-glow: rgba(227, 162, 26, .45);
--on-gold: #161b2e; --ban: #c62f2f;
color-scheme: light;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--body); transition: background-color .3s; }
button, input, select { font: inherit; color: inherit; }
/* Sur les fonds clairs, le doré foncé garde les contours de focus et de survol lisibles. */
:focus-visible { outline: 2px solid var(--gold-ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.frame { max-width: 1264px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 150px; }
.top { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; min-height: 64px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font: 600 16px/1 var(--display); letter-spacing: -.02em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; }
.nav button { font-size: 13px; font-weight: 600; color: var(--muted); padding: 7px 13px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; transition: background-color .2s, color .2s; }
.nav button:hover:not(:disabled) { color: var(--fg); background: var(--raised); }
.nav button[aria-current="page"] { color: var(--on-gold); background: var(--gold); }
.nav button:disabled { opacity: .4; cursor: default; }
.screen { padding-top: 22px; }
.crown-ic { width: 1em; height: 1em; fill: currentColor; flex: none; }
@keyframes fade-in { from { opacity: 0; } }
/* ---- Bannière : l'anneau, le texte, le splash recadré sur le champion. ---- */
.banner { position: relative; isolation: isolate; overflow: hidden; border-radius: 16px; min-height: clamp(220px, 26vw, 310px); display: flex; align-items: center; gap: clamp(16px, 3vw, 40px); padding: 24px clamp(16px, 3vw, 36px); background: var(--band); }
.art-box { position: absolute; top: 0; right: 0; width: 72%; height: 100%; z-index: -2; overflow: hidden; }
.art { position: absolute; max-width: none; opacity: 0; transition: opacity .5s ease; }
.art.on { opacity: 1; }
.art.settle { animation: settle 1.8s cubic-bezier(.2,.7,.2,1); }
/* Dans l'appli : l'image est agrandie dans la bannière qui la découpe, puis revient à sa taille. */
@keyframes settle { from { transform: scale(1.07); } }
.grade { position: absolute; inset: 0; z-index: -1; pointer-events: none;
background: linear-gradient(90deg, var(--band) 30%, color-mix(in srgb, var(--band) 72%, transparent) 46%, transparent 74%),
linear-gradient(to top, color-mix(in srgb, var(--band) 55%, transparent), transparent 45%); }
.ring { position: relative; width: clamp(120px, 16vw, 200px); flex: none; aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tick { stroke-linecap: round; transition: opacity .4s, stroke .2s; }
.tick.done { stroke: var(--gold); stroke-width: 4; }
.tick.played { stroke: var(--gold-soft); stroke-width: 3; }
.tick.never { stroke: var(--faint); stroke-width: 3; }
.tick.anvil { stroke-width: 7; }
.tick.lit { stroke: var(--fg); stroke-width: 7; }
.tick.ignite { animation: ignite 1.3s ease-out; }
@keyframes ignite { 0% { stroke: var(--fg); stroke-width: 11; } 100% { } }
.tick.step { animation: step 1.4s ease-out; }
@keyframes step { 0% { stroke: var(--gold); stroke-width: 9; } 100% { } }
.tick.blink { animation: blink .9s ease-in-out; }
@keyframes blink { 0%, 100% { } 40% { stroke: var(--fg); stroke-width: 6; } }
.ring.dim .tick:not(.anvil) { opacity: .16; }
.disc { fill: var(--bg); }
.crown { fill: var(--gold); transform-box: fill-box; transform-origin: 50% 100%; }
.crown.bounce { animation: bounce .8s cubic-bezier(.3,1.8,.4,1); }
@keyframes bounce { 0% { transform: scale(.6) translateY(8px); } 100% { transform: none; } }
.comet { fill: var(--fg); }
.trail { fill: none; stroke: var(--gold); stroke-width: 5; stroke-linecap: round; }
.copy { min-width: 0; max-width: 46%; }
.kicker { font: 600 12px/1.3 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); }
.title { margin: 8px 0 10px; font: 600 clamp(22px, 2.8vw, 34px)/1.12 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.count { display: inline-block; font-weight: 800; color: var(--gold-ink); }
.count.roll { animation: roll .7s cubic-bezier(.2,1.4,.4,1); }
@keyframes roll { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.lines { display: grid; gap: 3px; }
.line { margin: 0; color: var(--muted); font-size: 14px; }
.line b { color: var(--fg); font-weight: 600; }
.line.fresh { animation: fade-in .7s ease both; }
.stage-title.in { animation: title-in .7s cubic-bezier(.2,.8,.2,1) both; }
/* Dans l'appli : fondu et montée, GPUI n'anime pas l'espacement des lettres. */
@keyframes title-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 680px) {
.banner { flex-direction: column; align-items: flex-start; }
.art-box { width: 100%; }
.grade { background: linear-gradient(to top, var(--band) 40%, color-mix(in srgb, var(--band) 40%, transparent) 75%, transparent); }
.copy { max-width: none; }
}
/* ---- Outils et grille de l'accueil, comme dans #78. ---- */
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 28px 0 16px; }
.tools h2 { margin: 0 auto 0 0; font: 600 20px/1.2 var(--display); letter-spacing: -.03em; display: flex; align-items: center; gap: 8px; }
.n { font: 550 12px var(--body); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; letter-spacing: 0; }
.tabs { display: flex; padding: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.tabs button { border: 0; background: transparent; border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--raised); color: var(--fg); }
.sort { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 4px 0 10px; }
.sort select { border: 0; background: transparent; color: var(--fg); font-size: 12px; padding: 7px 4px; }
.sort select option { background: var(--surface); }
.search { width: min(100%, 240px); background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.search:focus { border-color: var(--gold-ink); outline: none; }
.empty { grid-column: 1 / -1; color: var(--muted); padding: 30px 0; }
/* ---- La carte : la même partout, avec le même survol. ---- */
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { position: relative; isolation: isolate; display: block; width: 100%; aspect-ratio: .68; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); text-align: left; color: var(--art-ink); cursor: default;
transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .2s; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 24%; z-index: -2; transition: transform .7s cubic-bezier(.2,.8,.2,1), filter .5s; }
.card.dim img { filter: grayscale(1) brightness(.7); }
.shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(to bottom, rgba(9,11,24,0) 40%, rgba(9,11,24,.35) 58%, var(--art-shade) 92%); }
.reasons { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 3px; }
.reason { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 650; padding: 3px 6px; border-radius: 4px; background: var(--art-chip); color: var(--art-ink); }
.reason.gold { background: #f5b83d; color: #161b2e; }
.reason.ban { color: #ffa0a0; }
.reason.appear { animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
.cap { position: absolute; left: 11px; right: 8px; bottom: 10px; transition: opacity .2s, transform .3s; }
.name { display: block; font-weight: 650; font-size: clamp(14px, 1.35vw, 18px); line-height: 1.15; letter-spacing: -.02em; }
.marks { display: flex; gap: 4px 9px; margin-top: 6px; flex-wrap: wrap; }
.mark { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; color: var(--art-soft); }
.mark::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--art-soft); transition: background-color .4s, border-color .4s; }
.mark.on { color: var(--art-ink); }
.mark.on::before { background: #f5b83d; border-color: #f5b83d; }
.mark.fresh::before { animation: fill 1.2s ease-out; }
@keyframes fill { 0% { background: transparent; box-shadow: 0 0 0 0 rgba(245,184,61,.9); } 40% { background: #f5b83d; box-shadow: 0 0 0 5px rgba(245,184,61,0); } }
.sheet { position: absolute; inset: auto 0 0 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 44px 12px 12px; font-size: 12px;
background: linear-gradient(to bottom, rgba(13,16,33,0), rgba(13,16,33,.93) 34%); opacity: 0; visibility: hidden; transform: translateY(14px);
transition: opacity .22s, transform .3s cubic-bezier(.2,.8,.2,1), visibility .22s; }
.sheet strong { font: 600 15px/1.2 var(--display); letter-spacing: -.02em; margin-bottom: 6px; }
.sheet span { display: flex; justify-content: space-between; gap: 6px; color: var(--art-soft); }
.sheet b { color: var(--art-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
/* Survol ou focus : la carte monte (sans grossir), l'illustration zoome à l'intérieur, la fiche glisse du bas. */
.card:hover, .card:focus-visible { z-index: 2; transform: translateY(-10px); border-color: var(--gold-ink); box-shadow: 0 18px 34px -14px rgba(0,0,0,.65), 0 0 28px -8px var(--gold-glow); outline: none; }
.card:hover img, .card:focus-visible img { transform: scale(1.07); }
.card:hover .sheet, .card:focus-visible .sheet { opacity: 1; visibility: visible; transform: none; }
.card:hover .cap, .card:focus-visible .cap { opacity: 0; transform: translateY(6px); }
.card.dim:hover, .card.dim:focus-visible { transform: translateY(-4px); box-shadow: 0 12px 24px -14px rgba(0,0,0,.6); }
/* Dans la main seulement, un voile sur les voisines (GPUI n'a pas de filtre de luminosité). */
.card::after { content: ""; position: absolute; inset: 0; background: rgba(9, 11, 24, .42); opacity: 0; transition: opacity .3s; pointer-events: none; }
.hand:has(.card:hover) .card:not(:hover)::after { opacity: 1; }
/* ---- Sélection : balayage, titre, main distribuée, « Autres champions ». ---- */
.stage { display: grid; gap: 16px; }
.stage-sub { margin: 0; color: var(--muted); font-size: 14px; }
.stage-sub b { color: var(--gold-ink); }
.sweep { position: fixed; inset: 0; z-index: 40; pointer-events: none; background: linear-gradient(100deg, transparent 36%, var(--gold-soft) 48.5%, rgba(255,255,255,.16) 50%, var(--gold-soft) 51.5%, transparent 64%); background-size: 300% 100%; animation: sweep .9s ease-out both; }
@keyframes sweep { 0% { background-position: 100% 0; opacity: 1; } 100% { background-position: 0 0; opacity: 0; } }
.hand { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; max-width: 1000px; }
@media (max-width: 720px) { .hand { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Distribuées depuis le bas, l'une après l'autre ; sans rotation dans l'appli. */
.hand .card.deal { animation: deal .7s cubic-bezier(.2,1.25,.35,1) both; }
@keyframes deal { 0% { transform: translateY(60vh); opacity: 0; } 100% { transform: none; opacity: 1; } }
.hand .card.taken { transform: translateY(8px); }
.hand .card.taken:hover { transform: translateY(5px); }
.hand .card.leave { transition: transform .32s ease-in, opacity .32s; transform: translateY(48px); opacity: 0; }
.others { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 8px; }
.others summary { display: flex; align-items: center; gap: 10px; min-height: 50px; cursor: pointer; font-weight: 600; list-style: none; }
.others summary::-webkit-details-marker { display: none; }
.others summary::before { content: "›"; font-size: 18px; color: var(--muted); transition: transform .2s; }
.others[open] summary::before { transform: rotate(90deg); }
.others .count-n { color: var(--muted); font-weight: 500; }
.others-body { display: grid; gap: 14px; padding-bottom: 18px; }
/* ---- Statistiques. ---- */
.stats { display: grid; gap: 14px; }
.stats-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.stats-head h1 { margin: 0; font: 600 clamp(24px, 3vw, 34px)/1.1 var(--display); letter-spacing: -.03em; }
.stats-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) { .stats-grid { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel h2 { margin: 0; font: 600 15px/1.2 var(--display); letter-spacing: -.01em; }
.panel p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel svg { display: block; width: 100%; height: auto; margin-top: 14px; overflow: visible; }
.panel svg text { font: 500 10px var(--body); fill: var(--muted); font-variant-numeric: tabular-nums; }
.panel svg .value { fill: var(--fg); font-weight: 650; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.curve { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.curve-area { fill: var(--gold); opacity: .12; }
.bar { fill: var(--faint); }
.bar.lead { fill: var(--gold); }
.hit { fill: transparent; }
.hit:hover { fill: var(--gold-soft); opacity: .25; }
/* ---- Barre de démonstration, hors identité. ---- */
.demo { position: fixed; z-index: 1000; left: 50%; bottom: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px);
display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding: 5px; border-radius: 14px;
border: 2px solid var(--bar-fg); background: var(--bar-bg); color: var(--bar-fg); box-shadow: 4px 4px 0 var(--bar-fg); font: 600 12px/1.2 Inter, system-ui, sans-serif; }
.demo b { padding: 0 8px; }
.demo button { color: var(--bar-fg); background: transparent; border: 1.5px solid transparent; border-radius: 9px; padding: 7px 10px; cursor: pointer; }
.demo button:hover { border-color: var(--bar-fg); }
.demo button[aria-pressed="true"] { background: var(--bar-fg); color: var(--bar-bg); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
</style>
</head>
<body>
<div class="frame">
<header class="top" id="top"></header>
<main class="screen" id="screen"></main>
</div>
<nav class="demo" aria-label="Démonstration">
<b>Démo</b>
<button id="demo-match" type="button" title="Une Partie suivie en direct se termine, avec un champion et un Placement au hasard">Partie au hasard</button>
<button id="demo-top1" type="button" title="Une Partie suivie en direct se termine sur un top 1">Top 1 au hasard</button>
<button id="demo-select" type="button" aria-pressed="false">Sélection</button>
<button id="demo-theme" type="button">Thème clair</button>
<button id="demo-reset" type="button">Réinitialiser</button>
</nav>
<script>
(() => {
// [clé Data Dragon, nom, focus x %, focus y %]. Le focus situe l'art de chargement dans le splash ;
// l'appli le calcule au téléchargement, ces valeurs viennent de ce calcul (et de son repli).
const CHAMPS = [["Aatrox","Aatrox",65,30],["Ahri","Ahri",61,28],["Akali","Akali",50,30],["Akshan","Akshan",48,30],["Alistar","Alistar",61,30],["Ambessa","Ambessa",49,21],["Amumu","Amumu",68,30],["Anivia","Anivia",55,33],["Annie","Annie",78,33],["Aphelios","Aphelios",56,29],["Ashe","Ashe",68,30],["AurelionSol","Aurelion Sol",51,29],["Aurora","Aurora",56,24],["Azir","Azir",71,31],["Bard","Bard",62,30],["Belveth","Bel'Veth",49,26],["Blitzcrank","Blitzcrank",63,30],["Brand","Brand",76,31],["Braum","Braum",76,30],["Briar","Briar",55,33],["Caitlyn","Caitlyn",75,30],["Camille","Camille",72,20],["Cassiopeia","Cassiopeia",64,33],["Chogath","Cho'Gath",59,30],["Corki","Corki",69,34],["Darius","Darius",55,29],["Diana","Diana",67,39],["DrMundo","Dr. Mundo",52,29],["Draven","Draven",72,34],["Ekko","Ekko",72,24],["Elise","Elise",71,25],["Evelynn","Evelynn",52,28],["Ezreal","Ezreal",62,33],["Fiddlesticks","Fiddlesticks",57,40],["Fiora","Fiora",67,30],["Fizz","Fizz",82,28],["Galio","Galio",47,29],["Gangplank","Gangplank",71,33],["Garen","Garen",76,28],["Gnar","Gnar",72,37],["Gragas","Gragas",56,30],["Graves","Graves",71,30],["Gwen","Gwen",51,27],["Hecarim","Hecarim",66,25],["Heimerdinger","Heimerdinger",72,30],["Hwei","Hwei",57,30],["Illaoi","Illaoi",65,29],["Irelia","Irelia",50,30],["Ivern","Ivern",48,30],["Janna","Janna",79,33],["JarvanIV","Jarvan IV",73,30],["Jax","Jax",67,35],["Jayce","Jayce",72,37],["Jhin","Jhin",65,32],["Jinx","Jinx",69,28],["KSante","K'Santé",38,26],["Kaisa","Kai'Sa",49,26],["Kalista","Kalista",60,30],["Karma","Karma",72,25],["Karthus","Karthus",67,25],["Kassadin","Kassadin",63,24],["Katarina","Katarina",65,33],["Kayle","Kayle",76,35],["Kayn","Kayn",50,51],["Kennen","Kennen",75,33],["Khazix","Kha'Zix",80,35],["Kindred","Kindred",63,30],["Kled","Kled",75,30],["KogMaw","Kog'Maw",65,37],["Leblanc","LeBlanc",51,27],["LeeSin","Lee Sin",64,29],["Leona","Leona",75,25],["Lillia","Lillia",43,26],["Lissandra","Lissandra",68,24],["Locke","Locke",62,24],["Lucian","Lucian",71,47],["Lulu","Lulu",69,31],["Lux","Lux",62,28],["Malphite","Malphite",65,37],["Malzahar","Malzahar",63,30],["Maokai","Maokai",59,30],["MasterYi","Maître Yi",78,30],["Mel","Mel",44,30],["Milio","Milio",51,30],["MissFortune","Miss Fortune",69,39],["MonkeyKing","Wukong",62,30],["Mordekaiser","Mordekaiser",47,30],["Morgana","Morgana",73,32],["Naafiri","Naafiri",23,24],["Nami","Nami",75,33],["Nasus","Nasus",67,25],["Nautilus","Nautilus",75,27],["Neeko","Neeko",49,30],["Nidalee","Nidalee",74,24],["Nilah","Nilah",64,33],["Nocturne","Nocturne",65,30],["Nunu","Nunu et Willump",51,51],["Olaf","Olaf",62,33],["Orianna","Orianna",74,29],["Ornn","Ornn",50,33],["Pantheon","Pantheon",51,28],["Poppy","Poppy",67,30],["Pyke","Pyke",49,31],["Qiyana","Qiyana",52,30],["Quinn","Quinn",59,30],["Rakan","Rakan",57,30],["Rammus","Rammus",61,30],["RekSai","Rek'Sai",56,30],["Rell","Rell",47,21],["Renata","Renata Glasc",56,30],["Renekton","Renekton",58,30],["Rengar","Rengar",65,30],["Riven","Riven",75,30],["Rumble","Rumble",70,30],["Ryze","Ryze",62,35],["Samira","Samira",58,32],["Sejuani","Sejuani",54,29],["Senna","Senna",53,30],["Seraphine","Séraphine",50,26],["Sett","Sett",49,21],["Shaco","Shaco",71,28],["Shen","Shen",70,25],["Shyvana","Shyvana",51,30],["Singed","Singed",71,30],["Sion","Sion",68,30],["Sivir","Sivir",56,21],["Skarner","Skarner",52,35],["Smolder","Smolder",50,30],["Sona","Sona",80,30],["Soraka","Soraka",56,26],["Swain","Swain",67,30],["Sylas","Sylas",50,40],["Syndra","Syndra",51,24],["TahmKench","Tahm Kench",18,25],["Taliyah","Taliyah",72,30],["Talon","Talon",63,30],["Taric","Taric",71,25],["Teemo","Teemo",59,30],["Thresh","Thresh",64,30],["Tristana","Tristana",63,27],["Trundle","Trundle",59,30],["Tryndamere","Tryndamere",71,30],["TwistedFate","Twisted Fate",71,30],["Twitch","Twitch",57,32],["Udyr","Udyr",54,29],["Urgot","Urgot",58,23],["Varus","Varus",52,30],["Vayne","Vayne",77,24],["Veigar","Veigar",67,30],["Velkoz","Vel'Koz",56,32],["Vex","Vex",62,30],["Vi","Vi",71,30],["Viego","Viego",71,21],["Viktor","Viktor",49,30],["Vladimir","Vladimir",70,32],["Volibear","Volibear",56,26],["Warwick","Warwick",76,35],["Xayah","Xayah",89,33],["Xerath","Xerath",57,29],["XinZhao","Xin Zhao",52,29],["Yasuo","Yasuo",76,32],["Yone","Yone",58,21],["Yorick","Yorick",62,30],["Yunara","Yunara",65,28],["Yuumi","Yuumi",46,30],["Zaahen","Zaahen",56,23],["Zac","Zac",64,30],["Zed","Zed",66,26],["Zeri","Zeri",55,28],["Ziggs","Ziggs",73,30],["Zilean","Zilean",57,30],["Zoe","Zoé",52,27],["Zyra","Zyra",75,25]];
const DDRAGON = "https://ddragon.leagueoflegends.com/cdn/img/champion";
const SPLASH = { w: 1215, h: 717 };
const SEASON = { name: "Saison 2 · 2026", start: Date.UTC(2026, 8, 10), days: 72 };
const TODAY = SEASON.days - 1;
const CROWN = "M68 186 L52 86 L98 126 L128 66 L158 126 L204 86 L188 186 Z";
const CROWN_ICON = `<svg class="crown-ic" viewBox="40 56 176 140" aria-hidden="true"><path d="${CROWN}"/></svg>`;
const LOGO = `<svg viewBox="0 0 256 256" aria-hidden="true"><circle cx="128" cy="128" r="124" fill="#f5b83d"/><circle cx="128" cy="128" r="100" fill="#161b2e"/><path fill="#f5b83d" d="${CROWN}"/></svg>`;
const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
const $ = id => document.getElementById(id);
const wait = ms => new Promise(done => setTimeout(done, ms));
const esc = s => String(s).replace(/[&<>"]/g, ch => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" }[ch]));
const norm = s => s.toLocaleLowerCase("fr").normalize("NFD").replace(/\p{M}|[^a-z0-9]/gu, "");
const collator = new Intl.Collator("fr", { sensitivity: "base" });
const dayFmt = new Intl.DateTimeFormat("fr-FR", { day: "numeric", month: "short", timeZone: "UTC" });
const longFmt = new Intl.DateTimeFormat("fr-FR", { day: "2-digit", month: "2-digit", year: "numeric", timeZone: "UTC" });
const day = d => dayFmt.format(new Date(SEASON.start + d * 86400000));
const date = d => longFmt.format(new Date(SEASON.start + d * 86400000));
const points = n => new Intl.NumberFormat("fr-FR").format(n);
const place = p => p == null ? "—" : p === 1 ? "1ᵉʳ" : p + "ᵉ";
const plural = (n, w) => `${n} ${w}${n > 1 ? "s" : ""}`;
// ---- Saison fictive. ----
function rng(seed) {
return () => {
seed = (seed + 0x6D2B79F5) | 0;
let t = Math.imul(seed ^ (seed >>> 15), 1 | seed);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
const placementOf = x => x < .17 ? 1 : x < .34 ? 2 : x < .52 ? 3 : x < .68 ? 4 : x < .84 ? 5 : 6;
const isPlayed = c => c.matches.length > 0;
const isCompleted = c => c.matches.some(m => m.p === 1);
const hasWin = c => c.matches.some(m => m.p <= 3);
const firstTop1 = c => c.matches.find(m => m.p === 1)?.day ?? null;
const attempts = c => { const i = c.matches.findIndex(m => m.p === 1); return i < 0 ? c.matches.length : i + 1; };
const best = c => c.matches.length ? Math.min(...c.matches.map(m => m.p)) : null;
function generate() {
const r = rng(20261121);
const champions = CHAMPS.map(([key, name, fx, fy], i) => {
const mastery = Math.round(Math.pow(r(), 2.6) * 420000);
const played = r() < .3 + .55 * (mastery / 420000) + .12;
const matches = [];
if (played) {
const count = 1 + Math.floor(Math.pow(r(), 1.25) * 6);
const days = Array.from({ length: count }, () => Math.floor(r() * (SEASON.days - 2))).sort((a, b) => a - b);
for (const d of days) matches.push({ p: placementOf(r()), day: d, seq: 0 });
}
return { id: i + 1, key, name, fx, fy, mastery, matches };
}).sort((a, b) => collator.compare(a.name, b.name));
const byM = list => list.sort((a, b) => b.mastery - a.mastery);
const completed = byM(champions.filter(isCompleted));
const remaining = byM(champions.filter(c => isPlayed(c) && !isCompleted(c)));
const never = byM(champions.filter(c => !isPlayed(c)));
const anvil = [completed[2], remaining[0], remaining[3], remaining[5], never[1]];
anvil.forEach(c => c.anvil = true);
anvil[2].ban = "Banni";
anvil[3].ban = "Pris par un allié";
anvil[3].later = true;
return champions;
}
const state = { champions: generate(), seq: 0, selection: false, allyTaken: false, screen: "defi", query: "", filter: "all", sort: "mastery", pending: null };
const find = id => state.champions.find(c => c.id === id);
const byMastery = list => [...list].sort((a, b) => b.mastery - a.mastery || collator.compare(a.name, b.name));
const byName = list => [...list].sort((a, b) => collator.compare(a.name, b.name));
const completedCount = () => state.champions.filter(isCompleted).length;
const total = () => state.champions.length;
const anvil = () => byMastery(state.champions.filter(c => c.anvil));
const others = () => byMastery(state.champions.filter(c => !c.anvil));
// Validations dans l'ordre, la plus ancienne d'abord ; deux du même jour gardent leur ordre d'arrivée.
function validations() {
const seqOf = c => c.matches.find(m => m.p === 1).seq;
return state.champions.filter(isCompleted).map(c => ({ c, day: firstTop1(c) }))
.sort((a, b) => a.day - b.day || seqOf(a.c) - seqOf(b.c) || a.c.id - b.c.id);
}
function reasons(c) {
const out = [];
if (isCompleted(c)) out.push("Validé");
if (state.selection && c.ban && (!c.later || state.allyTaken)) out.push(c.ban);
return out;
}
const pickable = c => !reasons(c).length;
// ---- La ligne « Dernière Partie », tirée des Parties enregistrées. ----
function lastMatch() {
let found = null;
for (const c of state.champions) c.matches.forEach((m, i) => {
if (!found || m.day > found.m.day || (m.day === found.m.day && m.seq > found.m.seq)) found = { c, m, i };
});
return found;
}
function lastMatchLine() {
const last = lastMatch();
if (!last) return "";
const { c, m, i } = last;
const first = c.matches.findIndex(x => x.p === 1);
let detail = "";
if (first === i) detail = i === 0 ? " · validé du premier coup" : ` · validé en ${i + 1} Tentatives`;
else if (first < 0 || i < first) detail = ` · ${i === 0 ? "1ʳᵉ" : `${i + 1}ᵉ`} Tentative`;
return `Dernière Partie : <b>${esc(c.name)}</b>, ${place(m.p)}${detail}`;
}
// ---- L'anneau : une jauge à l'ordre fixe, qui ne suit pas le tri choisi. ----
const SIZE = 520, C = SIZE / 2, R1 = 214, R2 = 246, PAD = 20, BOX = SIZE + 2 * PAD;
function ringOrder() {
const played = byMastery(state.champions.filter(c => isPlayed(c) && !isCompleted(c)));
const never = byMastery(state.champions.filter(c => !isPlayed(c)));
return [...validations().map(v => v.c), ...played, ...never];
}
const angleOf = (i, n) => -Math.PI / 2 + (i + .5) * 2 * Math.PI / n;
const at = (a, r) => [C + r * Math.cos(a), C + r * Math.sin(a)];
function ring() {
const list = ringOrder(), n = list.length;
const ticks = list.map((c, i) => {
const a = angleOf(i, n), done = isCompleted(c) && state.pending !== c.id;
const k = done ? "done" : isPlayed(c) ? "played" : "never";
const [x1, y1] = at(a, done ? R1 : k === "played" ? R1 + 10 : R1 + 18);
const [x2, y2] = at(a, done ? R2 : k === "played" ? R2 - 6 : R1 + 21);
return `<line class="tick ${k} ${state.selection && c.anvil ? "anvil" : ""}" data-tick="${c.id}" x1="${x1.toFixed(1)}" y1="${y1.toFixed(1)}" x2="${x2.toFixed(1)}" y2="${y2.toFixed(1)}"/>`;
}).join("");
return `<div class="ring ${state.selection ? "dim" : ""}"><svg viewBox="${-PAD} ${-PAD} ${BOX} ${BOX}" role="img" aria-label="${completedCount()} champions validés sur ${n}">
<circle class="disc" cx="${C}" cy="${C}" r="${R1 - 18}"/><g>${ticks}</g>
<g transform="translate(${C - 82} ${C - 92}) scale(.64)"><path class="crown" d="${CROWN}"/></g>
<path class="trail" opacity="0"/><circle class="comet" r="9" opacity="0" style="filter: drop-shadow(0 0 10px #f5b83d)"/></svg></div>`;
}
// ---- Les cartes. ----
function card(c, { lazy = true, deal = -1, appear = "" } = {}) {
const rs = reasons(c);
const badges = rs.map(r => `<span class="reason ${r === "Validé" ? "gold" : "ban"} ${appear === r ? "appear" : ""}">${r === "Validé" ? CROWN_ICON : ""}${esc(r)}</span>`).join("");
const lines = [["Parties", c.matches.length], ["Victoires", c.matches.filter(m => m.p <= 3).length], ["Meilleur Placement", place(best(c))], ["Tentatives", attempts(c)], ["Points de maîtrise", points(c.mastery)]];
if (isCompleted(c)) lines.push(["Premier top 1", date(firstTop1(c))]);
const style = deal >= 0 ? ` style="animation-delay:${reduced ? 0 : 380 + deal * 110}ms"` : "";
return `<button type="button" class="card ${rs.length ? "dim" : ""} ${deal >= 0 && !reduced ? "deal" : ""}" data-id="${c.id}" aria-label="${esc(c.name + (rs.length ? ", " + rs.join(", ") : ""))}"${style}>
<img alt="" draggable="false" ${lazy ? 'loading="lazy"' : ""} src="${DDRAGON}/loading/${c.key}_0.jpg"><span class="shade"></span>
<span class="reasons">${badges}</span>
<span class="cap"><span class="name">${esc(c.name)}</span><span class="marks"><span class="mark ${isPlayed(c) ? "on" : ""}" data-mark="played">Joué</span><span class="mark ${hasWin(c) ? "on" : ""}" data-mark="win">Victoire</span></span></span>
<span class="sheet" aria-hidden="true"><strong>${esc(c.name)}</strong>${lines.map(([k, v]) => `<span>${k}<b>${esc(v)}</b></span>`).join("")}</span>
</button>`;
}
// ---- La bannière, à l'accueil et en sélection. ----
const ART = `<div class="art-box"><img class="art" alt=""><img class="art" alt=""></div><div class="grade"></div>`;
const restChampion = () => state.selection
? anvil().find(c => pickable(c) && !isCompleted(c)) || anvil()[0]
: validations().map(v => v.c).filter(c => c.id !== state.pending).at(-1);
function homeCopy() {
const last = restChampion();
const count = completedCount() - (state.pending ? 1 : 0);
return `<div class="copy"><span class="kicker">${SEASON.name}</span>
<h1 class="title"><span class="count">${count}</span> / ${total()} champions validés</h1>
<div class="lines"><p class="line" data-line="validated">${last ? `Dernier champion validé : <b>${esc(last.name)}</b>, le ${day(firstTop1(last))}` : "Aucun champion validé pour l'instant."}</p>
<p class="line" data-line="match">${lastMatchLine()}</p></div></div>`;
}
function stageCopy() {
const open = anvil().filter(c => pickable(c) && !isCompleted(c)).length;
return `<div class="copy"><span class="kicker">${SEASON.name} · ${completedCount()} / ${total()} validés</span>
<h1 class="title stage-title ${reduced ? "" : "in"}">Sélection des champions</h1>
<p class="stage-sub">Champions de l'Enclume · <b data-open>${open}</b> à valider et disponibles</p></div>`;
}
// Une fenêtre d'environ 80 % de la largeur du splash, centrée sur le champion et bornée à ses bords.
function frameArt(img, c) {
const box = img.parentElement.getBoundingClientRect();
if (!box.width) return;
const scale = Math.max(box.width / (SPLASH.w * .8), box.height / SPLASH.h);
const w = SPLASH.w * scale, h = SPLASH.h * scale;
const clamp = (v, lo) => Math.min(0, Math.max(lo, v));
Object.assign(img.style, {
width: `${w}px`, height: `${h}px`,
left: `${clamp(box.width / 2 - c.fx / 100 * w, box.width - w)}px`,
top: `${clamp(box.height / 2 - c.fy / 100 * h, box.height - h)}px`,
});
}
let token = 0;
function paint(c, { instant = false, settle = false } = {}) {
const imgs = [...document.querySelectorAll(".banner .art")];
if (!imgs.length || !c) return;
const front = imgs.find(i => i.classList.contains("on"));
if (front && front.dataset.id === String(c.id)) return;
const back = imgs.find(i => i !== front);
const mine = ++token;
back.dataset.id = c.id;
back.classList.remove("settle");
frameArt(back, c);
back.onload = () => {
if (mine !== token) return;
if (instant) back.style.transition = "none";
if (settle && !reduced) back.classList.add("settle");
back.classList.add("on");
front?.classList.remove("on");
if (instant) requestAnimationFrame(() => { back.style.transition = ""; });
};
back.src = `${DDRAGON}/splash/${c.key}_0.jpg`;
}
addEventListener("resize", () => document.querySelectorAll(".banner .art").forEach(img => img.dataset.id && frameArt(img, find(Number(img.dataset.id)))));
// ---- Écrans. ----
const host = $("screen");
function visible() {
const q = norm(state.query);
const keep = c => (state.filter === "all" || (state.filter === "done") === isCompleted(c)) && norm(c.name).includes(q);
const list = state.champions.filter(keep);
return state.sort === "name" ? byName(list) : byMastery(list);
}
function grid() {
const list = visible();
host.querySelector(".n").textContent = list.length;
host.querySelector("#grid").innerHTML = list.map(c => card(c)).join("") || `<p class="empty">Aucun champion trouvé.</p>`;
}
function home() {
host.innerHTML = `<section class="banner">${ART}${ring()}${homeCopy()}</section>
<div class="tools"><h2>Champions <span class="n"></span></h2>
<div class="tabs" role="group" aria-label="Filtrer les champions">${[["all", "Tous"], ["todo", "Restants"], ["done", "Validés"]].map(([k, l]) => `<button type="button" data-filter="${k}" aria-pressed="${state.filter === k}">${l}</button>`).join("")}</div>
<label class="sort">Trier <select id="sort"><option value="mastery" ${state.sort === "mastery" ? "selected" : ""}>Points de maîtrise</option><option value="name" ${state.sort === "name" ? "selected" : ""}>A–Z</option></select></label>
<input class="search" id="search" type="search" placeholder="Rechercher…" aria-label="Rechercher un champion" value="${esc(state.query)}"></div>
<div class="cards" id="grid"></div>`;
host.querySelectorAll("[data-filter]").forEach(b => b.onclick = () => {
state.filter = b.dataset.filter;
host.querySelectorAll("[data-filter]").forEach(x => x.setAttribute("aria-pressed", String(x === b)));
grid();
});
host.querySelector("#sort").onchange = e => { state.sort = e.target.value; grid(); };
host.querySelector("#search").oninput = e => { state.query = e.target.value; grid(); };
grid();
}
function stage() {
host.innerHTML = `<section class="stage" aria-label="Sélection des champions">
${reduced ? "" : `<div class="sweep" aria-hidden="true"></div>`}
<div class="banner">${ART}${ring()}${stageCopy()}</div>
<div class="hand">${anvil().map((c, i) => card(c, { lazy: false, deal: i })).join("")}</div>
<details class="others"><summary>Autres champions <span class="count-n">${others().length}</span></summary><div class="others-body"></div></details></section>`;
host.querySelector(".sweep")?.addEventListener("animationend", e => e.target.remove());
// Une fois distribuée, la carte perd son animation d'entrée, sinon son état final bloquerait la montée au survol.
host.querySelector(".hand").addEventListener("animationend", e => {
if (e.animationName === "deal") { e.target.classList.remove("deal"); e.target.style.animationDelay = ""; }
});
const fold = host.querySelector(".others");
fold.addEventListener("toggle", () => {
const body = fold.querySelector(".others-body");
if (!fold.open) { body.replaceChildren(); return; }
body.innerHTML = `<input class="search" type="search" placeholder="Rechercher…" aria-label="Rechercher parmi les autres champions"><div class="cards"></div>`;
const fill = q => { body.querySelector(".cards").innerHTML = others().filter(c => norm(c.name).includes(norm(q))).map(c => card(c)).join("") || `<p class="empty">Aucun champion trouvé.</p>`; };
body.querySelector("input").oninput = e => fill(e.target.value);
fill("");
});
}
function stats() {
const v = validations();
const perDay = Array.from({ length: SEASON.days }, (_, d) => v.filter(x => x.day <= d).length);
const W = 640, H = 170, L = 34, B = 24, T = 10, R = 12;
const max = Math.max(10, Math.ceil(completedCount() / 10) * 10);
const x = d => L + d / (SEASON.days - 1) * (W - L - R), y = n => T + (1 - n / max) * (H - T - B);
const line = perDay.map((n, d) => `${d ? "L" : "M"}${x(d).toFixed(1)} ${y(n).toFixed(1)}`).join(" ");
const end = perDay.at(-1);
const curve = `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="Champions validés au fil de la Saison : ${end} aujourd'hui">
${[0, max / 2, max].map(n => `<line class="grid-line" x1="${L}" x2="${W - R}" y1="${y(n)}" y2="${y(n)}"/><text x="${L - 8}" y="${y(n) + 4}" text-anchor="end">${n}</text>`).join("")}
${[0, Math.round((SEASON.days - 1) / 2), SEASON.days - 1].map((d, i) => `<text x="${x(d)}" y="${H - 6}" text-anchor="${["start", "middle", "end"][i]}">${day(d)}</text>`).join("")}
<path class="curve-area" d="${line} L${x(SEASON.days - 1)} ${y(0)} L${x(0)} ${y(0)} Z"/><path class="curve" d="${line}"/>
<circle cx="${x(SEASON.days - 1)}" cy="${y(end)}" r="4.5" fill="var(--gold)" stroke="var(--surface)" stroke-width="2"/>
<text class="value" x="${x(SEASON.days - 1) - 10}" y="${y(end) - 10}" text-anchor="end">${end}</text>
${perDay.map((n, d) => `<rect class="hit" x="${(x(d) - 4).toFixed(1)}" y="${T}" width="8" height="${H - T - B}"><title>${day(d)} · ${n} validés</title></rect>`).join("")}</svg>`;
const bars = (counts, labels, caption) => {
const BW = 300, BH = 140, top = Math.max(...counts, 1), slot = BW / counts.length;
return `<svg viewBox="0 0 ${BW} ${BH + 20}" role="img" aria-label="${caption}"><line class="grid-line" x1="0" x2="${BW}" y1="${BH}" y2="${BH}"/>${counts.map((n, i) => {
const h = Math.max(n ? 3 : 0, n / top * (BH - 22)), bx = i * slot + slot * .2, bw = slot * .6;
return `<path class="bar ${i === 0 ? "lead" : ""}" d="M${bx} ${BH} V${BH - h + 4} q0 -4 4 -4 h${bw - 8} q4 0 4 4 V${BH} Z"><title>${labels[i]} · ${n}</title></path>
<text x="${bx + bw / 2}" y="${BH + 15}" text-anchor="middle">${labels[i]}</text>${i === 0 ? `<text class="value" x="${bx + bw / 2}" y="${BH - h - 6}" text-anchor="middle">${n}</text>` : ""}`;
}).join("")}</svg>`;
};
const placements = [1, 2, 3, 4, 5, 6].map(p => state.champions.reduce((s, c) => s + c.matches.filter(m => m.p === p).length, 0));
const tries = [1, 2, 3, 4, 5].map(k => v.filter(e => k < 5 ? attempts(e.c) === k : attempts(e.c) >= 5).length);
host.innerHTML = `<section class="stats"><div class="stats-head"><div><h1>Statistiques</h1><p>${SEASON.name} · tous les Formats</p></div><p>${completedCount()} / ${total()} champions validés</p></div>
<div class="stats-grid"><article class="panel wide"><h2>Courbe des validations</h2><p>Champions validés, cumulés jour après jour.</p>${curve}</article>
<article class="panel"><h2>Placements</h2><p>Toutes les Parties de la Saison.</p>${bars(placements, ["1ᵉʳ", "2ᵉ", "3ᵉ", "4ᵉ", "5ᵉ", "6ᵉ"], "Parties par Placement")}</article>
<article class="panel"><h2>Tentatives</h2><p>Parties jouées jusqu'au premier top 1.</p>${bars(tries, ["1", "2", "3", "4", "5+"], "Champions validés par nombre de Tentatives")}</article></div></section>`;
}
function fill() {
cancelAnimationFrame(raf);
state.pending = null;
if (state.screen === "stats") return stats();
state.selection ? stage() : home();
paint(restChampion(), { instant: true });
}
function renderTop() {
const sel = state.selection;
$("top").innerHTML = `<span class="brand">${LOGO}Arena Tracker</span>
<nav class="nav" aria-label="Navigation"><button type="button" data-screen="defi" ${state.screen === "defi" ? 'aria-current="page"' : ""}>Défi</button>
<button type="button" data-screen="stats" ${state.screen === "stats" ? 'aria-current="page"' : ""} ${sel ? "disabled" : ""}>Statistiques</button></nav>`;
$("top").querySelectorAll("[data-screen]").forEach(b => b.onclick = () => go(b.dataset.screen));
}
// Changement d'écran : court, dans le sens du trajet ; la barre du haut ne bouge pas.
let swapSeq = 0;
async function swap(fn, kind) {
const seq = ++swapSeq;
host.getAnimations?.().forEach(a => a.cancel());
if (reduced || !host.animate) return fn();
if (kind === "stage-out") {
host.querySelectorAll(".hand .card").forEach((c, i, all) => { c.classList.remove("deal"); c.style.transitionDelay = `${(all.length - 1 - i) * 35}ms`; c.classList.add("leave"); });
await wait(240);
if (seq !== swapSeq) return;
}
const out = { forward: "translateX(-14px)", back: "translateX(14px)", "stage-in": "translateY(-6px)", "stage-out": "translateY(16px)" }[kind];
await host.animate([{ opacity: 1, transform: "none" }, { opacity: 0, transform: out }], { duration: 130, easing: "ease-in", fill: "forwards" }).finished.catch(() => {});
if (seq !== swapSeq) return;
fn();
host.getAnimations().forEach(a => a.cancel());
const from = { forward: "translateX(18px)", back: "translateX(-18px)", "stage-out": "translateY(10px)" }[kind];
if (from) host.animate([{ opacity: 0, transform: from }, { opacity: 1, transform: "none" }], { duration: 280, easing: "cubic-bezier(.2,.8,.2,1)" });
}
function go(name) {
if (name === state.screen || (name === "stats" && state.selection)) return;
state.screen = name;
renderTop();
swap(fill, name === "stats" ? "forward" : "back");
}
// ---- Survol : la graduation du champion s'allume ; en sélection la bannière le montre. ----
let hovered = null;
function hover(id) {
if (id === hovered) return;
hovered = id;
host.querySelectorAll(".tick.lit").forEach(t => t.classList.remove("lit"));
if (id) host.querySelector(`.tick[data-tick="${id}"]`)?.classList.add("lit");
if (state.selection && state.screen === "defi") paint(id ? find(id) : restChampion());
}
const idOf = t => { const el = t?.closest?.("[data-id]"); return el && host.contains(el) ? Number(el.dataset.id) : null; };
host.addEventListener("pointerover", e => hover(idOf(e.target)));
host.addEventListener("pointerleave", () => hover(null));
host.addEventListener("focusin", e => hover(idOf(e.target)));
host.addEventListener("focusout", e => hover(host.contains(e.relatedTarget) ? idOf(e.relatedTarget) : null));
// ---- Fin d'une Partie suivie en direct : une animation à la mesure de ce qu'elle apporte. ----
let raf = 0;
function redrawRing() {
const old = host.querySelector(".ring");
old.insertAdjacentHTML("afterend", ring());
old.remove();
return host.querySelector(".ring svg");
}
function refreshCard(c, appear) {
const el = host.querySelector(`#grid .card[data-id="${c.id}"]`);
if (el) el.outerHTML = card(c, { appear });
return host.querySelector(`#grid .card[data-id="${c.id}"]`);
}
function matchEnded(c, kind, gained) {
if (state.screen !== "defi" || state.selection) { if (state.screen === "stats") stats(); return; }
hover(null);
if (kind === "top1") return comet(c);
const svg = redrawRing();
const tick = svg.querySelector(`.tick[data-tick="${c.id}"]`);
tick.classList.add(kind === "mark" ? "step" : "blink");
const lineEl = host.querySelector('[data-line="match"]');
lineEl.innerHTML = lastMatchLine();
lineEl.classList.remove("fresh"); void lineEl.offsetWidth; lineEl.classList.add("fresh");
const el = refreshCard(c);
for (const m of gained) el?.querySelector(`[data-mark="${m}"]`)?.classList.add("fresh");
}
// Top 1 : la comète part de midi jusqu'à la graduation, puis la bannière change de champion.
function comet(c) {
cancelAnimationFrame(raf);
state.pending = c.id;
const svg = redrawRing();
const list = ringOrder(), n = list.length, index = list.findIndex(x => x.id === c.id);
const finish = () => {
if (state.pending !== c.id) return;
state.pending = null;
const a = angleOf(index, n), [x1, y1] = at(a, R1), [x2, y2] = at(a, R2);
const tick = svg.querySelector(`.tick[data-tick="${c.id}"]`);
tick.setAttribute("class", "tick done ignite");
tick.setAttribute("x1", x1); tick.setAttribute("y1", y1); tick.setAttribute("x2", x2); tick.setAttribute("y2", y2);
if (!reduced) svg.querySelector(".crown").classList.add("bounce");
host.querySelector(".copy").outerHTML = homeCopy();
if (!reduced) host.querySelector(".count").classList.add("roll");
host.querySelectorAll(".line").forEach(l => l.classList.add("fresh"));
paint(c, { settle: true });
refreshCard(c, "Validé");
};
if (reduced) return finish();
const dot = svg.querySelector(".comet"), trail = svg.querySelector(".trail");
const start = angleOf(0, n) - Math.PI / n, end = angleOf(index, n), r = (R1 + R2) / 2;
const t0 = performance.now(), duration = 650 + 550 * (index / n);
const ease = t => 1 - Math.pow(1 - t, 3);
function fly(now) {
const t = Math.min(1, (now - t0) / duration), a = start + (end - start) * ease(t);
const [x, y] = at(a, r);
dot.setAttribute("cx", x); dot.setAttribute("cy", y); dot.setAttribute("opacity", "1");
const [sx, sy] = at(Math.max(start, a - .9), r);
trail.setAttribute("d", `M ${sx} ${sy} A ${r} ${r} 0 0 1 ${x} ${y}`);
trail.setAttribute("opacity", String(.85 * (1 - t * .6)));
if (t < 1) raf = requestAnimationFrame(fly);
else { dot.setAttribute("opacity", "0"); trail.setAttribute("opacity", "0"); raf = 0; finish(); }
}
raf = requestAnimationFrame(fly);
}
function playMatch(forceTop1) {
const pool = state.champions.filter(c => forceTop1 ? isPlayed(c) && !isCompleted(c) : true);
const c = pool[Math.floor(Math.random() * pool.length)];
if (!c) return;
const p = forceTop1 ? 1 : placementOf(Math.random());
const was = { played: isPlayed(c), win: hasWin(c), completed: isCompleted(c) };
c.matches.push({ p, day: TODAY, seq: ++state.seq });
const gained = [!was.played && "played", !was.win && p <= 3 && "win"].filter(Boolean);
const kind = !was.completed && p === 1 ? "top1" : gained.length ? "mark" : "match";
matchEnded(c, kind, gained);
}
// ---- Démo. ----
let allyTimer = 0;
function toggleSelection() {
clearTimeout(allyTimer);
const from = state.screen;
state.selection = !state.selection;
state.allyTaken = false;
state.screen = "defi";
$("demo-select").setAttribute("aria-pressed", String(state.selection));
renderTop();
// Une sélection ouvre toujours « Défi », même depuis « Statistiques ».
swap(fill, state.selection ? "stage-in" : from === "stats" ? "back" : "stage-out");
if (state.selection) allyTimer = setTimeout(() => {
state.allyTaken = true;
const c = anvil().find(x => x.later);
const el = host.querySelector(`.hand .card[data-id="${c.id}"]`);
if (!el) return;
el.querySelector(".reasons").insertAdjacentHTML("beforeend", `<span class="reason ban appear">${esc(c.ban)}</span>`);
el.classList.add("dim", "taken");
const open = host.querySelector("[data-open]");
if (open) open.textContent = anvil().filter(x => pickable(x) && !isCompleted(x)).length;
if (!hovered) paint(restChampion());
}, 2600);
}
const root = document.documentElement;
const themeLabel = () => { $("demo-theme").textContent = root.dataset.mode === "light" ? "Thème sombre" : "Thème clair"; };
$("demo-theme").onclick = () => { root.dataset.mode = root.dataset.mode === "light" ? "dark" : "light"; themeLabel(); };
if (matchMedia("(prefers-color-scheme: light)").matches) root.dataset.mode = "light";
themeLabel();
$("demo-match").onclick = () => playMatch(false);
$("demo-top1").onclick = () => playMatch(true);
$("demo-select").onclick = toggleSelection;
$("demo-reset").onclick = () => {
clearTimeout(allyTimer);
Object.assign(state, { champions: generate(), seq: 0, selection: false, allyTaken: false, screen: "defi", query: "", filter: "all", pending: null });
$("demo-select").setAttribute("aria-pressed", "false");
renderTop();
fill();
};
window.AT = { state, playMatch, toggleSelection, go, lastMatchLine };
renderTop();
fill();
})();
</script>
</body>
</html>
-339
View File
@@ -1,339 +0,0 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Arena Tracker · Maquette interactive</title>
<!-- Maquette autonome : comparer la lisibilité de la même carte sur les deux écrans. -->
<style>
:root {
color-scheme: dark;
font: 15px/1.45 Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
--bg: #121318; --surface: #1a1b22; --line: #32343f; --text: #f3f2f8;
--soft: #b4b4c3; --accent: #c1afff; --ink: #201732;
}
* { box-sizing: border-box }
body { margin: 0; background: var(--bg); color: var(--text) }
button, input, select { font: inherit }
button, select, summary { cursor: pointer }
button, input, select { color: inherit }
button { background: none; border: 0 }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px }
[hidden] { display: none !important }
.wrap { width: min(1264px, 100%); margin-inline: auto; padding-inline: clamp(16px,4.6vw,66px) }
header { background: #17181e; border-bottom: 1px solid var(--line) }
.topbar, .brand, nav, .mode, .progress-meta, .collection-head, .tools, .search,
.sort, .marks, .mark, .reason, .detail-line, footer .wrap { display: flex; align-items: center }
.topbar { gap: 40px; min-height: 64px }
.brand { gap: 10px; white-space: nowrap; font-weight: 740; font-size: 18px; letter-spacing: -.7px }
.brand img { width: 27px; height: 27px }
nav { gap: 4px }
nav button { border-radius: 7px; padding: 8px 14px; color: var(--soft); font-size: 13px; font-weight: 600 }
nav button[aria-current=page] { color: #eee9ff; background: #34303f }
nav button:hover, .mode:hover { color: white; background: #30313a }
.mode { margin-left: auto; gap: 8px; justify-content: center; padding: 8px 12px; border: 1px solid #454551; border-radius: 7px; font-size: 12px; font-weight: 600 }
.mode[aria-pressed=true] { color: var(--accent); border-color: #76678f }
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none }
main { min-height: calc(100vh - 130px); padding-block: 35px 22px }
.season { color: var(--soft); font-size: 12px }
.progress-meta { justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 3px }
h1,h2,h3,p { margin: 0 }
h1 { font-size: clamp(25px,2.5vw,32px); font-weight: 650; line-height: 1.15; letter-spacing: -.045em }
h2 { font-size: 23px; font-weight: 650; line-height: 1.25; letter-spacing: -.045em }
.total { color: var(--soft); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums }
.total strong { color: var(--text); font-weight: 600 }
progress { display: block; appearance: none; width: 100%; height: 2px; margin-top: 5px; border: none; border-radius: 2px; background: #3b3a46; overflow: hidden }
progress::-webkit-progress-bar { background: #3b3a46 }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px }
progress::-moz-progress-bar { background: var(--accent); border-radius: 10px }
.collection-head { margin-block: 28px 16px; justify-content: space-between; flex-wrap: wrap; gap: 12px }
h2 .count { vertical-align: middle; display: inline-block; margin-left: 5px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--soft); font-size: 12px; font-weight: 550; letter-spacing: normal }
.tools { gap: 8px; flex-wrap: wrap }
.search, .sort, .tabs { min-height: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px }
.search,.sort { gap: 7px; padding-inline: 10px; color: var(--soft) }
.search:focus-within,.sort:focus-within { border-color: var(--accent) }
input, select { background: transparent; outline: none; border: 0; font-size: 12px }
input { width: 140px; padding: 7px 0; color: var(--text) }
input::placeholder { color: var(--soft) }
select { cursor: pointer; color: var(--text); padding-block: 6px }
option { background: var(--surface) }
.tabs { display: flex; align-items: stretch; padding: 2px }
.tabs button { font-size: 12px; border-radius: 4px; padding: 3px 9px; color: var(--soft) }
.tabs button[aria-pressed=true] { background: #373640; color: white }
.grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 14px }
.card { position: relative; isolation: isolate; display: block; text-align: left; padding: 0; width: 100%; aspect-ratio: .68; background: #252631; border: 1px solid #393a43; border-radius: 10px; overflow: hidden }
.card:hover,.card:focus-visible,.card.pinned { border-color: var(--accent) }
.card img,.shade,.card-info { position: absolute; inset: 0; width: 100%; height: 100% }
.card img { object-fit: cover; object-position: 50% 24%; z-index: -2 }
.card.dim img { filter: grayscale(1) brightness(.72) }
.shade { z-index: -1; background: linear-gradient(to bottom,rgba(12,13,21,.04) 35%,rgba(10,11,18,.3) 55%,rgba(10,11,18,.95) 90%) }
.reason-stack { position: absolute; top: 9px; left: 8px; right: 8px; display: flex; align-items: flex-start; flex-wrap: wrap; gap: 3px }
.reason { width: fit-content; max-width: 100%; gap: 4px; padding: 3px 6px; border-radius: 4px; background: #202027ee; color: #f0eff3; font-size: 10px; font-weight: 650 }
.reason .icon { width: 12px; height: 12px }
.caption { position: absolute; left: 12px; right: 8px; bottom: 12px }
.name { display: block; color: #fff; font-size: clamp(16px,1.5vw,21px); font-weight: 670; letter-spacing: -.035em; line-height: 1.18 }
.marks { margin-top: 7px; flex-wrap: wrap; gap: 4px 10px }
.mark { gap: 4px; font-size: 10px; font-weight: 600; color: #cdccd4 }
.mark.on { color: #dfd4ff }
.mark .dot { display: inline-grid; place-items: center; width: 11px; height: 11px; border-radius: 50%; border: 1px solid #acaab7 }
.mark.on .dot { background: #c4b3fc; border-color: #c4b3fc; color: var(--ink) }
.dot .icon { width: 8px; height: 8px; stroke-width: 3 }
.card-info { display: none; padding: 12px; flex-direction: column; justify-content: center; background: #16161ef5; font-size: 12px; pointer-events: none }
.card-info strong { font-size: 17px; margin-bottom: 10px; letter-spacing: -.035em }
.detail-line { justify-content: space-between; gap: 4px; padding-block: 2px; color: var(--soft) }
.detail-line b { color: white; font-weight: 600 }
.card.pinned .card-info,.card:focus-visible:not(.dismissed) .card-info { display: flex }
@media (hover:hover) { .card:hover:not(.dismissed) .card-info { display: flex } }
details { margin-top: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line) }
summary { display: flex; align-items: center; gap: 9px; min-height: 51px; font-weight: 600; list-style: none }
summary::-webkit-details-marker { display: none }
summary .icon { color: var(--soft) }
details[open] summary .icon { transform: rotate(90deg) }
details .search { width: fit-content; margin-block: 2px 14px }
details .grid { margin-bottom: 18px }
.empty { color: var(--soft); grid-column: 1/-1; padding: 30px 0 }
#stats { padding-top: 27px }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px }
.chart { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 20px }
.chart h2 { font-size: 18px }
.chart svg { display: block; width: 100%; height: 120px; margin-top: 18px }
.chart svg text { font: 12px system-ui; fill: var(--soft) }
.bars { display: flex; align-items: end; gap: 12px; margin-top: 18px }
.bar-col { flex: 1; display: grid; justify-items: center; gap: 4px; font-size: 12px; color: var(--soft) }
.bar { width: min(36px,75%); height: var(--height); background: #ae9acb; border-radius: 3px 3px 0 0 }
footer .wrap { justify-content: space-between; padding-block: 14px 22px; color: #a5a5b5; font-size: 11px; gap: 12px }
@media(max-width:1000px) { .grid { grid-template-columns: repeat(4,minmax(0,1fr)) } .topbar { gap: 22px } }
@media(max-width:720px) { .grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px } .chart-grid { grid-template-columns: 1fr } .topbar { flex-wrap:wrap; gap: 4px 12px; padding-block: 10px } nav { order: 2; width: 100% } main { padding-top: 18px } .progress-meta { align-items:flex-start; flex-direction:column; gap:6px } }
@media(max-width:480px) { .grid { grid-template-columns: repeat(2,minmax(0,1fr)) } .tools { width:100% } .caption { left:9px } .topbar .mode { font-size:11px; padding:7px 9px } }
</style>
</head>
<body>
<header><div class="wrap topbar">
<span class="brand"><img alt="" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiI+CiAgPCEtLSBUaGUgQXJlbmEgc2VlbiBmcm9tIGFib3ZlOiBhIHJpbmcuIFRoZSBnb2xkIHJpbSBrZWVwcyB0aGUgZGlzYyB2aXNpYmxlIG9uIGRhcmsgYmFja2dyb3VuZHMuIC0tPgogIDxjaXJjbGUgY3g9IjEyOCIgY3k9IjEyOCIgcj0iMTI0IiBmaWxsPSIjZjViODNkIi8+CiAgPGNpcmNsZSBjeD0iMTI4IiBjeT0iMTI4IiByPSIxMDAiIGZpbGw9IiMxNjFiMmUiLz4KICA8IS0tIEEgdG9wIDE6IGEgY3Jvd24sIGluIG9uZSBzb2xpZCBzaGFwZSBzbyB0aGF0IGl0IHN1cnZpdmVzIGF0IDE2IHBpeGVscy4gLS0+CiAgPHBhdGggZmlsbD0iI2Y1YjgzZCIgZD0iTTY4IDE4NiBMNTIgODYgTDk4IDEyNiBMMTI4IDY2IEwxNTggMTI2IEwyMDQgODYgTDE4OCAxODYgWiIvPgo8L3N2Zz4K">Arena Tracker</span>
<nav aria-label="Navigation principale"><button id="homeTab" aria-current="page">Défi</button><button id="statsTab">Statistiques</button></nav>
<button class="mode" id="simulate" aria-pressed="false"><span aria-hidden="true">⇄</span> <span id="modeLabel">Simuler la sélection</span></button>
</div></header>
<main class="wrap">
<section aria-labelledby="title">
<div class="season">Saison 2 · 2026</div>
<div class="progress-meta"><h1 id="title">Défi de saison</h1>
<div class="total"><strong id="fraction"></strong> champions validés
<progress id="progress" aria-label="Champions validés cette saison"></progress>
</div>
</div>
</section>
<section id="collection" aria-labelledby="collectionTitle">
<div class="collection-head">
<h2 id="collectionTitle"><span id="heading">Mes champions</span> <span class="count" id="visibleCount"></span></h2>
<div class="tools">
<label class="search" id="homeSearchBox"><span data-icon="search"></span><input id="homeSearch" type="search" aria-label="Rechercher dans mes champions" placeholder="Rechercher…"></label>
<div class="tabs" id="filters" role="group" aria-label="État du Défi"><button data-filter="Tous" aria-pressed="true">Tous</button><button data-filter="Restants" aria-pressed="false">Restants</button><button data-filter="Validés" aria-pressed="false">Validés</button></div>
<label class="sort"><span data-icon="sort"></span><select id="sort" aria-label="Trier les champions"><option value="mastery">Maîtrise</option><option value="name">A–Z</option></select></label>
</div>
</div>
<div class="grid" id="primary"></div>
<details id="others" hidden>
<summary><span data-icon="chevron"></span>Autres champions</summary>
<label class="search"><span data-icon="search"></span><input id="otherSearch" type="search" aria-label="Rechercher dans les autres champions" placeholder="Rechercher…"></label>
<div class="grid" id="secondary"></div>
</details>
</section>
<section id="stats" hidden aria-label="Statistiques de la saison">
<article class="chart"><h2>Champions validés au fil de la saison</h2><div id="trend"></div></article>
<div class="chart-grid"><article class="chart"><h2>Répartition des placements</h2><div class="bars" id="placements"></div></article><article class="chart"><h2>Tentatives pour valider</h2><div class="bars" id="attempts"></div></article></div>
</section>
</main>
<footer><div class="wrap"><span>Maquette interactive · Données fictives</span><span>Illustrations Riot Games</span></div></footer>
<script>
// Ressources embarquées pour ouvrir la maquette hors ligne.
const portraits = {
"Ahri": "data:image/webp;base64,UklGRsxWAABXRUJQVlA4IMBWAADQSAGdASoiAXwBPl0mj0WjoiEiqXP9mHALiWIG+OUGwAQ6Nn85fIfwbNr6y9Avvv7z5zu073b/meac99/yPWZ+tPYS/pv978+b18fvT6nf2+/dL3h/TF/ivUN/tX/M62395vZJ/cD08P3i+G7+2f9791/ax///sAf//24Oc/iBsg/Kfr/9v/hv3h9nvL3aT/Ovzb/P/yfp/4d/OXUU/K/6l/teIZ4T8kPYg8Bf+HxXde/IH/N3y3vH3oG+S3/q+Xj9K/4HsI/0L+/78wgffP6i7dTXWMG5Pn+hpvxUQppocRIMIHbu2qqvJzoFiE6kRGMOhX3526lCmpbjzNJqztvCRE5XItw+UZU1Bsb1kPhBJXoULHZzHvrs8Vje3pNAZGFQXZjOlDOCud/Y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6QsGanXienHrIiQzIT+k1fpF/YqhmHwtvLibbfPdLine truncated
};
const paths = {
search: '<circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/>',
sort: '<path d="M4 6h16M4 12h11M4 18h6"/>',
chevron: '<path d="m9 5 7 7-7 7"/>',
check: '<path d="m4 12 5 5L20 6"/>',
ban: '<circle cx="12" cy="12" r="9"/><path d="m6 6 12 12"/>',
ally: '<circle cx="12" cy="8" r="3"/><path d="M5 20v-2c0-6 14-6 14 0v2"/>'
};
function icon(key) { return '<svg class="icon" aria-hidden="true" viewBox="0 0 24 24">' + paths[key] + '</svg>'; }
document.querySelectorAll('[data-icon]').forEach(el => el.replaceWith(document.createRange().createContextualFragment(icon(el.dataset.icon))));
// Parties fictives en Arena 3×6. Les nombres sont les placements, du plus ancien au plus récent.
const matchDates = ['14 nov. 2026', '15 nov. 2026', '16 nov. 2026', '17 nov. 2026'];
const champions = [
{name:'Ahri', mastery:280400, matches:[5,3,2], anvil:true},
{name:'Ekko', mastery:248100, matches:[2,1,5], anvil:true},
{name:'Leona', mastery:205000, matches:[4,6], anvil:true, unavailable:'Banni'},
{name:"Kog’Maw", key:'KogMaw', mastery:180300, matches:[3,2,4], anvil:true},
{name:'Akali', mastery:144600, matches:[], anvil:true, unavailable:'Pris par un allié'},
{name:'Jhin', mastery:121800, matches:[5], anvil:true},
{name:'Ashe', mastery:115200, matches:[1,3]},
{name:'Diana', mastery:108900, matches:[5,2]},
{name:'Miss Fortune', key:'MissFortune', mastery:84000, matches:[4,3,1]},
{name:'Senna', mastery:71200, matches:[], unavailable:'Banni'},
{name:'Yasuo', mastery:60000, matches:[6,4,2,1], unavailable:'Pris par un allié'},
{name:'Zyra', mastery:55800, matches:[4,5]}
];
const $ = id => document.getElementById(id);
const complete = c => c.matches.includes(1);
const completed = champions.filter(complete);
$('fraction').textContent = completed.length + ' / ' + champions.length;
$('progress').max = champions.length;
$('progress').value = completed.length;
let selection = false;
let statistics = false;
let filter = 'Tous';
try { if (localStorage.getItem('arena-prototype-sort') === 'name') $('sort').value = 'name'; } catch { /* Stockage facultatif pour les fichiers locaux. */ }
function mark(label, on) {
return '<span class="mark' + (on ? ' on' : '') + '"><span class="dot" aria-hidden="true">' + (on ? icon('check') : '') + '</span>' + label + '</span>';
}
function card(c) {
const wins = c.matches.filter(p => p <= 3).length;
const firstTop1 = c.matches.indexOf(1);
const reasons = [];
if (complete(c)) reasons.push(['Validé','check']);
if (selection && c.unavailable) reasons.push([c.unavailable, c.unavailable === 'Banni' ? 'ban' : 'ally']);
const labels = reasons.map(([label, symbol]) => '<span class="reason">' + icon(symbol) + label + '</span>').join('');
const best = c.matches.length ? Math.min(...c.matches) : 0;
const details = [
['Parties', c.matches.length], ['Victoires', wins],
['Meilleur placement', best ? (best === 1 ? '1ᵉʳ' : best + 'ᵉ') : '—'],
['Tentatives', firstTop1 >= 0 ? firstTop1 + 1 : c.matches.length],
['Maîtrise', c.mastery.toLocaleString('fr-FR')]
];
if (firstTop1 >= 0) details.push(['Premier top 1', matchDates[firstTop1]]);
const summary = [c.name, ...reasons.map(r => r[0]), ...details.map(([k,v]) => k + ' ' + v)].join(', ');
return '<button type="button" class="card' + (reasons.length ? ' dim' : '') + '" aria-label="' + summary + '">' +
'<img alt="" draggable="false" src="' + portraits[c.key || c.name] + '"><span class="shade"></span><span class="reason-stack">' + labels + '</span>' +
'<span class="caption"><span class="name">' + c.name + '</span><span class="marks">' + mark('Joué', c.matches.length > 0) + mark('Victoire', wins > 0) + '</span></span>' +
'<span class="card-info" aria-hidden="true"><strong>' + c.name + '</strong>' + details.map(([k,v]) => '<span class="detail-line">' + k + '<b>' + v + '</b></span>').join('') + '</span></button>';
}
function normalise(name) { return name.toLocaleLowerCase('fr').normalize('NFD').replace(/\p{M}|[^a-z0-9]/gu, ''); }
function ordered(list) {
const byName = (a,b) => a.name.localeCompare(b.name, 'fr');
return list.sort($('sort').value === 'name' ? byName : (a,b) => b.mastery - a.mastery || byName(a,b));
}
function showCards(container, list) {
$(container).innerHTML = list.map(card).join('') || '<p class="empty">Aucun champion trouvé.</p>';
}
function renderPrimary() {
const query = normalise($('homeSearch').value);
const list = champions.filter(c => {
if (selection) return c.anvil;
const matchesFilter = filter === 'Tous' || (filter === 'Validés' ? complete(c) : !complete(c));
return matchesFilter && normalise(c.name).includes(query);
});
showCards('primary', ordered(list));
$('visibleCount').textContent = list.length;
}
function renderOthers() {
if (!selection || !$('others').open) return;
const query = normalise($('otherSearch').value);
showCards('secondary', ordered(champions.filter(c => !c.anvil && normalise(c.name).includes(query))));
}
function showScreen() {
$('stats').hidden = !statistics;
$('collection').hidden = statistics;
$('homeTab').setAttribute('aria-current', statistics ? 'false' : 'page');
$('statsTab').setAttribute('aria-current', statistics ? 'page' : 'false');
$('simulate').setAttribute('aria-pressed', selection);
$('modeLabel').textContent = selection ? 'Terminer la sélection' : 'Simuler la sélection';
$('title').textContent = statistics ? 'Statistiques' : selection ? 'Sélection des champions' : 'Défi de saison';
$('heading').textContent = selection ? 'Champions de l’Enclume' : 'Mes champions';
$('homeSearchBox').hidden = $('filters').hidden = selection;
$('others').hidden = !selection;
if (!statistics) { renderPrimary(); renderOthers(); }
}
$('simulate').onclick = () => {
selection = !selection;
statistics = false;
$('others').open = false;
$('otherSearch').value = '';
showScreen();
};
$('homeTab').onclick = () => { statistics = false; showScreen(); };
$('statsTab').onclick = () => { statistics = true; showScreen(); };
$('sort').onchange = () => {
try { localStorage.setItem('arena-prototype-sort', $('sort').value); } catch { /* Stockage indisponible. */ }
renderPrimary(); renderOthers();
};
$('filters').onclick = event => {
const button = event.target.closest('[data-filter]');
if (!button) return;
filter = button.dataset.filter;
for (const item of $('filters').children) item.setAttribute('aria-pressed', item === button);
renderPrimary();
};
$('homeSearch').oninput = renderPrimary;
$('otherSearch').oninput = renderOthers;
$('others').ontoggle = renderOthers;
function dismissDetails(button) {
button.classList.remove('pinned');
button.classList.add('dismissed');
}
document.addEventListener('click', event => {
const card = event.target.closest('.card');
const old = document.querySelector('.card.pinned');
if (old) dismissDetails(old);
if (card && card !== old) { card.classList.remove('dismissed'); card.classList.add('pinned'); }
});
document.addEventListener('keydown', event => {
if (event.key === 'Escape') {
document.querySelectorAll('.card:hover,.card:focus,.card.pinned').forEach(dismissDetails);
}
});
for (const eventName of ['pointerover','focusin']) {
$('collection').addEventListener(eventName, event => {
const card = event.target.closest('.card.dismissed');
if (card && !card.contains(event.relatedTarget)) card.classList.remove('dismissed');
});
}
// Le même petit historique alimente les trois graphiques de démonstration.
function renderCharts() {
const placements = [0,0,0,0,0,0];
const attempts = [0,0,0,0,0];
const days = [0];
let count = 0;
const rounds = Math.max(...champions.map(c => c.matches.length));
for (let round = 0; round < rounds; round++) {
for (const c of champions) {
if (c.matches[round]) placements[c.matches[round] - 1]++;
if (c.matches.indexOf(1) === round) { count++; attempts[Math.min(round,4)]++; }
}
days.push(count);
}
const x = i => 35 + 610 * i / rounds;
const y = v => 90 - 70 * v / Math.max(count,1);
const path = days.map((v,i) => (i ? 'L' : 'M') + x(i) + ' ' + y(v)).join(' ');
const ticks = days.map((v,i) => '<text x="' + x(i) + '" y="110" text-anchor="middle">J' + (i+1) + '</text>').join('');
$('trend').innerHTML = '<svg viewBox="0 0 680 118" role="img" aria-label="Champions validés par jour : ' + days.join(', ') + '">' +
'<path d="M35 20H645 M35 55H645 M35 90H645" stroke="#3b3945"/><text x="15" y="24">' + count + '</text><text x="15" y="94">0</text>' +
'<path d="' + path + ' L645 90 H35 Z" fill="#b39aee" opacity=".13"/><path d="' + path + '" fill="none" stroke="#c1afff" stroke-width="3"/>' + ticks + '</svg>';
function bars(id, values, labels) {
$(id).innerHTML = values.map((v,i) => '<div class="bar-col" aria-label="' + labels[i] + ' : ' + v + '"><b>' + v + '</b><span class="bar" style="--height:' + 65 * v / Math.max(...values,1) + 'px"></span><span>' + labels[i] + '</span></div>').join('');
}
bars('placements', placements, ['1ᵉʳ','2ᵉ','3ᵉ','4ᵉ','5ᵉ','6ᵉ']);
bars('attempts', attempts, ['1','2','3','4','5+']);
}
renderCharts();
showScreen();
</script>
</body>
</html>