CI / core (pull_request) Successful in 1m50s
- The core reads the champion played in the client's gameflow session (champion selections, else the teams, by the summoner's client PUUID) and follows the Live Match from one read to the next: it starts with an Arena game in progress and lasts through that game's end-of-game screen. - The follower tells the page the Live Match on each change, before the champ select's end, so the end of a champ select that launched a game shows « En partie » instead of « Défi », without computing the statistics again. - « En partie »: the banner with the champion's splash, the Season and the count, its tick of the ring lit and the stake (« Un top 1 validerait X : 88 / 172 », or the day it was validated); « Champion en cours d’identification » until the client says it. Under it, the card's sheet and the champion's 5 latest Matches of the Season, read at low priority. - A Live Match is a phase like the champ select: the signed-in Account and the current Season, the Account selector greyed, « Paramètres » closed, and a minimised or hidden window shown again without the focus, never raised. - Its end-of-game block ends it and #129 decides the screen; without a block, the lobby shows « Défi ». A screen gone with its tab falls back to « Défi ». - Tests with the simulated client: launch from the champ select, a client met in a game, the champion identified late, the end with and without a block, a game outside Arena. docs/interface.md and the guide are updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0192He3BEKJ9v922udzup4Qn
145 lines
5.1 KiB
Rust
145 lines
5.1 KiB
Rust
use super::{InGame, Recent, RecentMatch};
|
|
use crate::page::home::notice_line;
|
|
use crate::page::{Page, shown};
|
|
use crate::theme::{gold_ink, heading, surface};
|
|
use gpui_kit::component::{ActiveTheme as _, StyledExt as _, Theme};
|
|
use gpui_kit::*;
|
|
|
|
/// What stands for the latest Matches while they are read.
|
|
const LOADING: &str = "Chargement des Parties…";
|
|
|
|
impl Page {
|
|
/// « En partie »: the banner of the Live Match, then the champion's sheet and its latest
|
|
/// Matches of the Season side by side (one above the other in a narrow window). The column
|
|
/// scrolls in a low window, as the home's does.
|
|
pub(in crate::page) fn in_game_content(
|
|
&self,
|
|
window: &mut Window,
|
|
cx: &mut Context<Page>,
|
|
) -> Vec<AnyElement> {
|
|
let mut column = self.banner_column(window, cx);
|
|
let theme = cx.theme();
|
|
match self.stats_notice() {
|
|
// The header already says there is no Season, and a banner the statistics' error.
|
|
Some(notice) if notice.said_elsewhere() => {}
|
|
Some(notice) => {
|
|
column = column.child(notice_line(
|
|
"in-game-notice",
|
|
notice.label(self.error().map(String::as_str)),
|
|
theme.muted_foreground,
|
|
));
|
|
}
|
|
None if shown("in-game-details") && !self.in_game.sheet.is_empty() => {
|
|
column = column.child(details(&self.in_game, cx));
|
|
}
|
|
None => {}
|
|
}
|
|
vec![column.id("in-game").overflow_y_scroll().into_any_element()]
|
|
}
|
|
}
|
|
|
|
/// The champion's sheet, then its latest Matches.
|
|
fn details(in_game: &InGame, cx: &App) -> impl IntoElement {
|
|
let theme = cx.theme();
|
|
div()
|
|
.h_flex()
|
|
.flex_wrap()
|
|
.items_start()
|
|
.gap_3()
|
|
.child(
|
|
panel("Fiche du champion", "in-game-sheet", cx).children(in_game.sheet.iter().map(
|
|
|(label, value)| {
|
|
line(theme)
|
|
.debug_selector(move || format!("in-game-sheet-{label}"))
|
|
.child(div().text_color(theme.muted_foreground).child(*label))
|
|
.child(div().font_weight(FontWeight::SEMIBOLD).child(value.clone()))
|
|
},
|
|
)),
|
|
)
|
|
.child(
|
|
panel("Dernières Parties de la Saison", "in-game-recent", cx)
|
|
.children(recent(in_game, theme)),
|
|
)
|
|
}
|
|
|
|
/// A titled panel of the screen: the two share the width, or wrap one above the other.
|
|
fn panel(title: &'static str, selector: &'static str, cx: &App) -> Div {
|
|
let theme = cx.theme();
|
|
div()
|
|
.v_flex()
|
|
.flex_1()
|
|
.min_w(px(280.))
|
|
.gap_2()
|
|
.p_4()
|
|
.bg(surface(theme))
|
|
.border_1()
|
|
.border_color(theme.border)
|
|
.rounded(px(12.))
|
|
.debug_selector(move || selector.into())
|
|
.child(heading(cx).mb_1().text_lg().child(title))
|
|
}
|
|
|
|
/// One line of a panel: its label left, its value right.
|
|
fn line(theme: &Theme) -> Div {
|
|
div()
|
|
.h_flex()
|
|
.justify_between()
|
|
.items_center()
|
|
.gap_3()
|
|
.py_1()
|
|
.border_b_1()
|
|
.border_color(theme.border)
|
|
.text_sm()
|
|
}
|
|
|
|
/// The lines of the latest Matches, or what stands for them.
|
|
fn recent(in_game: &InGame, theme: &Theme) -> Vec<AnyElement> {
|
|
let muted = theme.muted_foreground;
|
|
match &in_game.recent {
|
|
Recent::Loading => vec![notice_line("in-game-recent-loading", LOADING.into(), muted)],
|
|
Recent::Failed(error) => vec![notice_line("in-game-recent-error", error.clone(), muted)],
|
|
Recent::Ready(matches) if matches.is_empty() => vec![notice_line(
|
|
"in-game-first-match",
|
|
in_game.first_match.clone(),
|
|
muted,
|
|
)],
|
|
Recent::Ready(matches) => (matches.iter().enumerate())
|
|
.map(|(ix, played)| recent_line(ix, played, theme).into_any_element())
|
|
.collect(),
|
|
}
|
|
}
|
|
|
|
/// A Match: when it started and its Format, then its Placement in the colour of its result, as
|
|
/// in « Parties ».
|
|
fn recent_line(ix: usize, played: &RecentMatch, theme: &Theme) -> Div {
|
|
let ink = played.outcome.ink(theme);
|
|
line(theme)
|
|
.debug_selector(move || format!("in-game-recent-{ix}"))
|
|
.child(
|
|
div().v_flex().min_w_0().child(played.when.clone()).child(
|
|
div()
|
|
.text_xs()
|
|
.text_color(theme.muted_foreground)
|
|
.child(played.format.clone()),
|
|
),
|
|
)
|
|
.child(
|
|
div()
|
|
.v_flex()
|
|
.items_end()
|
|
.flex_shrink_0()
|
|
.child(
|
|
div()
|
|
.font_weight(FontWeight::SEMIBOLD)
|
|
.text_color(ink)
|
|
.child(played.placement.clone()),
|
|
)
|
|
.children(played.provisional.then(|| {
|
|
div()
|
|
.text_xs()
|
|
.text_color(gold_ink(theme))
|
|
.child("Provisoire")
|
|
})),
|
|
)
|
|
}
|