Rename the statistics page module to page (#71)
Rename only, no behaviour change: the page is about to hold two tabs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ce8c777c4
commit
0350f66cfd
2 files changed
+16
-16
No files matched your search
@@ -1,12 +1,12 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
mod champion_table;
|
||||
mod page;
|
||||
#[cfg(feature = "profile")]
|
||||
mod profile;
|
||||
mod release;
|
||||
mod settings;
|
||||
mod single_instance;
|
||||
mod stats_page;
|
||||
mod text;
|
||||
mod title_bar;
|
||||
mod tray;
|
||||
@@ -22,8 +22,8 @@ use gpui_kit::base::async_util::{Sender, unbounded};
|
||||
use gpui_kit::component::*;
|
||||
use gpui_kit::*;
|
||||
|
||||
use page::Page;
|
||||
use settings::{KeyEvent, KeyForm, KeyStore, apply_theme};
|
||||
use stats_page::StatsPage;
|
||||
use title_bar::{MIN_WINDOW_SIZE, refresh_button, settings_button, title_bar, update_button};
|
||||
use worker::{Msg, spawn_follower};
|
||||
|
||||
@@ -36,7 +36,7 @@ enum Screen {
|
||||
}
|
||||
|
||||
struct RootView {
|
||||
page: Entity<StatsPage>,
|
||||
page: Entity<Page>,
|
||||
form: Entity<KeyForm>,
|
||||
focus: FocusHandle,
|
||||
screen: Screen,
|
||||
@@ -61,7 +61,7 @@ impl RootView {
|
||||
let first_launch = !store.has_key() && tracker.accounts().unwrap_or_default().is_empty();
|
||||
let (tx, rx) = unbounded();
|
||||
let page = cx.new(|cx| {
|
||||
StatsPage::new(
|
||||
Page::new(
|
||||
tracker.clone(),
|
||||
notice,
|
||||
!first_launch,
|
||||
@@ -92,7 +92,7 @@ impl RootView {
|
||||
let champ_select = cx.subscribe_in(
|
||||
&page,
|
||||
window,
|
||||
|this, _, transition: &stats_page::ChampSelectTransition, window, cx| {
|
||||
|this, _, transition: &page::ChampSelectTransition, window, cx| {
|
||||
// Only on entry: the window stays open after the champ select.
|
||||
if transition.entered
|
||||
&& let Some(hwnd) = tray::window_hwnd(window)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! The statistics page: banners, Challenge header, charts and champion table for one Account.
|
||||
//! The page: banners, Challenge header, charts and champion table for one Account.
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
||||
@@ -87,9 +87,9 @@ impl SelectItem for AccountItem {
|
||||
pub struct ChampSelectTransition {
|
||||
pub entered: bool,
|
||||
}
|
||||
impl EventEmitter<ChampSelectTransition> for StatsPage {}
|
||||
impl EventEmitter<ChampSelectTransition> for Page {}
|
||||
|
||||
pub struct StatsPage {
|
||||
pub struct Page {
|
||||
tracker: Arc<Tracker>,
|
||||
tx: Sender<Msg>,
|
||||
notice: Option<String>,
|
||||
@@ -157,7 +157,7 @@ fn filters(in_season: bool) -> &'static [(&'static str, StateFilter)] {
|
||||
}
|
||||
}
|
||||
|
||||
impl StatsPage {
|
||||
impl Page {
|
||||
/// `following`: a follower thread is already running, its first round is pending.
|
||||
pub fn new(
|
||||
tracker: Arc<Tracker>,
|
||||
@@ -259,7 +259,7 @@ impl StatsPage {
|
||||
}
|
||||
});
|
||||
|
||||
let mut page = StatsPage {
|
||||
let mut page = Page {
|
||||
status: tracker.status(),
|
||||
tracker,
|
||||
tx,
|
||||
@@ -1104,7 +1104,7 @@ fn attempts_chart(charts: &Charts) -> Option<AnyElement> {
|
||||
})
|
||||
}
|
||||
|
||||
impl Render for StatsPage {
|
||||
impl Render for Page {
|
||||
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let (border, muted) = {
|
||||
let theme = cx.theme();
|
||||
@@ -1241,10 +1241,10 @@ mod tests {
|
||||
WindowBounds, WindowOptions, point, px, size,
|
||||
};
|
||||
|
||||
use super::StatsPage;
|
||||
use super::Page;
|
||||
use crate::champion_table::tests::row;
|
||||
|
||||
fn open_page(cx: &mut TestAppContext) -> (Entity<StatsPage>, VisualTestContext) {
|
||||
fn open_page(cx: &mut TestAppContext) -> (Entity<Page>, VisualTestContext) {
|
||||
open_page_with_tracker(
|
||||
cx,
|
||||
Tracker::open(
|
||||
@@ -1259,7 +1259,7 @@ mod tests {
|
||||
fn open_page_with_tracker(
|
||||
cx: &mut TestAppContext,
|
||||
tracker: Tracker,
|
||||
) -> (Entity<StatsPage>, VisualTestContext) {
|
||||
) -> (Entity<Page>, VisualTestContext) {
|
||||
cx.update(gpui_kit::init);
|
||||
let tracker = Arc::new(tracker);
|
||||
let (window, page) = cx.update(|cx| {
|
||||
@@ -1273,7 +1273,7 @@ mod tests {
|
||||
..Default::default()
|
||||
};
|
||||
gpui_kit::open_window(options, cx, |window, cx| {
|
||||
cx.new(|cx| StatsPage::new(tracker, None, false, rx, tx, window, cx))
|
||||
cx.new(|cx| Page::new(tracker, None, false, rx, tx, window, cx))
|
||||
})
|
||||
.unwrap()
|
||||
});
|
||||
@@ -1316,7 +1316,7 @@ mod tests {
|
||||
|
||||
/// A page on Alice's 3x6 statistics with the Format filter set, whose refresh worker meets Bob
|
||||
/// (the client adopted another Account) before the UI does.
|
||||
async fn refresh_towards_bob(cx: &mut TestAppContext, pin_alice: bool) -> Entity<StatsPage> {
|
||||
async fn refresh_towards_bob(cx: &mut TestAppContext, pin_alice: bool) -> Entity<Page> {
|
||||
cx.executor().allow_parking();
|
||||
let tracker = Tracker::open(Path::new(":memory:"), Box::new(RefreshHistory))
|
||||
.unwrap()
|
||||
Reference in new issue
Block a user