feat(download): M94 下载页换成真组件 + 真快照 + 真指令(PAGEDL)
页面(crates/app-iced/src/pages/download*):
- Tabs(分类)/ ListItem(版本行)/ filled 安装按钮 / progress / EmptyState / divider
全部取自 components/ 的真组件;页头动作换成 buttons::text
- 数据只吃 pages::download::Download(app/view.rs 由 AppState 快照转,installed_only 与
download_query 照用);页面自己不留业务状态,交互只发意图
- 状态:加载(不确定进度 + 文案)/ 空(EmptyState + 刷新 CTA)/ 有数据 / 安装中 / 安装失败
(失败给可读文案 + 「打开日志」出口)
接线(追加式):
- pages::Message 加 SelectVersion / InstallVersion / CancelInstall / SetCategory
- app/update.rs 翻成 AppCommand::{InstallVersion, CancelInstall, ListVersions}
(SelectVersion 只改视图模型;「刷新」= 当前分类重新拉,全部走 RefreshAll)
- pages::Model 加 download 字段
文案:28 个 Download* key 进中英两套 catalog(一行一个 key 的全语言);页面零中文字面量,
core 的中文阶段串(InstallStage::label / message)一律不进界面
i18n 结构:catalog.rs 的既有测试模块原样外置到 catalog/tests.rs(392 行 → 282 行,
逐字未改),新 key 才装得下 400 行硬上限
测试:app-iced 276 + i18n 23 全绿;clippy -D warnings 与 fmt --check 干净
This commit is contained in:
1 parent
b3f99652bb
commit
57e8380b24
14 files changed
+1633
-247
No files matched your search
@@ -4,103 +4,124 @@
|
||||
//! 内容是一串线性进度项,分栏没有第二个阅读对象。窗口变宽时**正文列不变宽**(撞行宽上限),
|
||||
//! 多出来的宽度留白——这就是 M68「全宽单卡」的反面。
|
||||
//!
|
||||
//! 页头 1 个操作 + 空态 3 个快捷入口(12b §15.5:≤3)。
|
||||
//! ## M94:占位控件 → 真组件 + 真数据 + 真指令(逐项对照)
|
||||
//!
|
||||
//! | 位置 | M84(占位) | M94(真组件) |
|
||||
//! |---|---|---|
|
||||
//! | 页头动作 | `frame::text_action`(`text` + 手搓 hover) | `buttons::text`(五式 + 状态层) |
|
||||
//! | 分类 | 无 | `navigation::tabs`(Primary,48 高 / 3px `Primary` 指示条) |
|
||||
//! | 列表行 | 无 | `navigation::list_item`(两行档 **60**:`row_height` 44 + 每多一行 16) |
|
||||
//! | 分隔线 | `frame::divider` | `components::divider::full` / `list` |
|
||||
//! | 安装按钮 | 无 | `buttons::filled`(**本页唯一实心 accent**,rubric K2) |
|
||||
//! | 进度 | 无 | `feedback::progress::linear`(已知 = determinate,未知 = indeterminate) |
|
||||
//! | 空态 | `frame::empty_state` | `feedback::empty_state`(`EmptyState` 真组件) |
|
||||
//! | 数据 | `"3 sources healthy · …"` 硬编码假状态行 | [`Download`](`app/view.rs` 从 presenter 快照转) |
|
||||
//! | 文案 | 英文字面量 | `unlucky_i18n` 的 `Key`(拼错编译失败;中英两套目录) |
|
||||
//!
|
||||
//! ## 状态矩阵(四个状态都能从快照推出来,都出图)
|
||||
//!
|
||||
//! | 状态 | 条件 | 组件 |
|
||||
//! |---|---|---|
|
||||
//! | 加载 | 快照里没有版本列表([`Download::is_loading`]) | 不确定态进度条 + 文案([`states::loading`]) |
|
||||
//! | 空 | 列表拉到了、过滤后为空([`Download::is_empty`]) | `EmptyState` + 刷新 CTA([`states::empty`]) |
|
||||
//! | 有数据 | 有版本行 | Tabs + 计数头 + `ListItem` 列表([`rows`]) |
|
||||
//! | 安装中 / 失败 | `AppState::install` 不为空 | 进度条 + 阶段 + 「取消」/「打开日志」([`install`]) |
|
||||
//!
|
||||
//! ## 意图 → 消息 → 指令(页面只发意图,不做乐观回显)
|
||||
//!
|
||||
//! | 用户动作 | 页面消息 | app 层落点 |
|
||||
//! |---|---|---|
|
||||
//! | 点分类 tab | [`Message::SetCategory`] | `AppCommand::ListVersions(category)`(`All` 不派:画现有快照) |
|
||||
//! | 点一行 | [`Message::SelectVersion`] | **只改视图模型**(选中不是业务命令) |
|
||||
//! | 点「安装」 | [`Message::InstallVersion`] | `AppCommand::InstallVersion(id)` |
|
||||
//! | 点「取消安装」 | [`Message::CancelInstall`] | `AppCommand::CancelInstall` |
|
||||
//! | 点「刷新」/「打开日志」 | `Message::Action(RefreshSources)` / `Message::Navigate(Logs)` | `ListVersions` / `AppState::navigate` |
|
||||
//!
|
||||
//! 进度条只读 `model.install`:它由 presenter 的 `InstallProgress` 事件经 `apply` 灌进来。
|
||||
//! 于是「点了没变」只有一种解释——后端还没回事件,这正是要的(P3-2 的纪律)。
|
||||
//!
|
||||
//! ## 版面判据(一条没动)
|
||||
//!
|
||||
//! 正文列 424 硬上限、断点 600 / 840、rail 88 都由 [`super::layout`] 与 `shell` 无条件施加,
|
||||
//! 本页拿不到「更宽」的选项;页头仍按 M3 口径铺满页宽(偏离 #1,未变)。
|
||||
|
||||
use iced::widget::{column, container, row};
|
||||
use iced::{Alignment, Element, Length};
|
||||
mod demo;
|
||||
mod install;
|
||||
mod model;
|
||||
mod rows;
|
||||
mod states;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub use demo::demo;
|
||||
pub use model::{Category, Download};
|
||||
|
||||
use iced::widget::column;
|
||||
use iced::{Element, Length};
|
||||
|
||||
use unlucky_design::color::Role;
|
||||
use unlucky_design::icons::IconKind;
|
||||
use unlucky_design::spacing::Space;
|
||||
use unlucky_design::typography::TypeRole;
|
||||
|
||||
use unlucky_i18n::{Catalog, Key, Lang};
|
||||
|
||||
use crate::app::components::buttons::{self, Button};
|
||||
use crate::app::components::divider;
|
||||
use crate::theme::Ui;
|
||||
|
||||
use super::frame::{self, Header};
|
||||
use super::layout::FrameMetrics;
|
||||
use super::{Action, Message};
|
||||
|
||||
/// 整页。
|
||||
pub fn view<'a>(ui: &'a Ui, metrics: FrameMetrics) -> Element<'a, Message> {
|
||||
let header = Header::new("Download")
|
||||
.subtitle("Versions, mod loaders and modpacks")
|
||||
.action(frame::text_action(
|
||||
/// 整页(**唯一**的真数据入口:`model` 由 `app/view.rs` 从 presenter 快照建)。
|
||||
///
|
||||
/// `lang` 是 i18n 的入参:`theme::Ui` 还没有 language 字段(那条在 M93 手里),产品路径现传
|
||||
/// [`Lang::En`](D28 的英文基线零中文负担);接上探测结果时只改调用点,页面不用动。
|
||||
pub fn view<'a>(
|
||||
ui: &'a Ui,
|
||||
metrics: FrameMetrics,
|
||||
model: &'a Download,
|
||||
lang: Lang,
|
||||
) -> Element<'a, Message> {
|
||||
let catalog = lang.catalog();
|
||||
|
||||
let header = Header::new(catalog.text(Key::DownloadTitle))
|
||||
.subtitle(catalog.text(Key::DownloadSubtitle))
|
||||
.action(buttons::text(
|
||||
ui,
|
||||
"Refresh sources",
|
||||
Action::RefreshSources,
|
||||
Button::new(
|
||||
catalog.text(Key::DownloadRefresh),
|
||||
Message::Action(Action::RefreshSources),
|
||||
),
|
||||
));
|
||||
|
||||
let empty = frame::empty_state(
|
||||
ui,
|
||||
IconKind::Download,
|
||||
"No downloads in progress",
|
||||
"Pick a version or drop a modpack file here. Sources are probed per region and can be pinned \
|
||||
in Settings → Downloads.",
|
||||
vec![
|
||||
frame::text_action(ui, "Browse versions", Action::BrowseVersions),
|
||||
frame::text_action(ui, "Import modpack", Action::ImportModpack),
|
||||
frame::text_action(ui, "Check sources", Action::CheckSources),
|
||||
],
|
||||
);
|
||||
|
||||
let body = frame::single_column(
|
||||
metrics,
|
||||
column![source_status(ui), empty]
|
||||
.spacing(ui.space(Space::X4))
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill),
|
||||
);
|
||||
|
||||
frame::page(ui, metrics, header, body)
|
||||
frame::page(ui, metrics, header, body(ui, metrics, catalog, model))
|
||||
}
|
||||
|
||||
/// 来源状态行(12pt,`OnSurfaceVariant`):说明这一页的数据从哪来,不是业务数据。
|
||||
fn source_status<'a>(ui: &'a Ui) -> Element<'a, Message> {
|
||||
container(
|
||||
row![
|
||||
frame::glyph(
|
||||
IconKind::Check,
|
||||
ui.color(Role::Secondary),
|
||||
frame::ICON_SMALL_PX
|
||||
),
|
||||
frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodySmall,
|
||||
false,
|
||||
"3 sources healthy · BMCLAPI pinned by region · 2 min ago",
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
),
|
||||
/// 正文:加载 / 空 / 列表 + 底部安装面板(列宽由 [`super::layout`] 决议,页面只吃结果)。
|
||||
fn body<'a>(
|
||||
ui: &'a Ui,
|
||||
metrics: FrameMetrics,
|
||||
catalog: Catalog,
|
||||
model: &'a Download,
|
||||
) -> Element<'a, Message> {
|
||||
let content = if model.is_loading() {
|
||||
states::loading(ui, catalog)
|
||||
} else if model.is_empty() {
|
||||
states::empty(ui, catalog)
|
||||
} else {
|
||||
column![
|
||||
rows::categories(ui, catalog, model.category),
|
||||
rows::head(ui, catalog, model),
|
||||
divider::full(ui),
|
||||
rows::list(ui, catalog, model),
|
||||
divider::full(ui),
|
||||
install::panel(ui, catalog, model),
|
||||
]
|
||||
.spacing(ui.space(Space::X2))
|
||||
.align_y(Alignment::Center),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
}
|
||||
.spacing(ui.space(Space::X3))
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.into()
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::layout::{content_column_width, frame_metrics, measure_cap_px, PaneKit};
|
||||
|
||||
/// 单列页:任何窗口宽度都不许出现第二列,正文列不许超过行宽上限。
|
||||
#[test]
|
||||
fn download_is_single_column_at_every_width() {
|
||||
for width in [600.0, 840.0, 900.0, 1180.0, 2400.0] {
|
||||
let metrics = frame_metrics(PaneKit::Single, width);
|
||||
assert!(metrics.secondary.is_none(), "{width} 宽下载页出现了第二列");
|
||||
assert!(metrics.column <= measure_cap_px() + f32::EPSILON);
|
||||
assert_eq!(metrics.column, content_column_width(width));
|
||||
}
|
||||
}
|
||||
|
||||
/// 宽窗下多出来的宽度必须留白(不是把卡片拉宽)——1180 的正文列 < 可用宽度。
|
||||
#[test]
|
||||
fn extra_width_goes_to_margin_not_to_the_column() {
|
||||
let metrics = frame_metrics(PaneKit::Single, 1180.0);
|
||||
assert_eq!(metrics.column, measure_cap_px());
|
||||
assert!(
|
||||
metrics.available - metrics.column >= 400.0,
|
||||
"1180 宽下应留出大片留白(M68 的全宽卡就是没有这段留白)"
|
||||
);
|
||||
}
|
||||
frame::single_column(metrics, content)
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
//! 下载页的**演示数据**(截图 harness 与单测的输入,产品路径不读)。
|
||||
//!
|
||||
//! 与 `pages/instances/data.rs` 同一条纪律:演示条目是**页面侧常量**,不是业务 DTO——
|
||||
//! 于是核心 DTO 每改一次字段,基线图不会跟着漂。真页面的数据只走
|
||||
//! [`Download::from_snapshot`](super::model::Download::from_snapshot)。
|
||||
//!
|
||||
//! 演示条目本身也是一步「DTO → 视图模型」的真转换([`VersionRow::of`](super::model::VersionRow)、
|
||||
//! [`InstallView::of`](super::model::InstallView)):图上看到的副文案 / 进度行就是产品路径
|
||||
//! 那条转换的产物,不是另写一套拼串。
|
||||
//!
|
||||
//! ## 为什么要一个环境变量
|
||||
//!
|
||||
//! 状态矩阵(加载 / 空 / 有数据 / 安装中 / 安装失败)都要出图,而 harness 的
|
||||
//! `--screen` 只选页面、选不了页面状态:
|
||||
//!
|
||||
//! ```text
|
||||
//! ULL_DL_DEMO=empty cargo run -p unlucky-app-iced --example pages_demo -- \
|
||||
//! --screen=download --screenshot=out.png --screenshot-theme=light --software-renderer
|
||||
//! ```
|
||||
//!
|
||||
//! 取值:`ready`(缺省)/ `loading` / `empty` / `selected` / `installing` / `failed`。
|
||||
//! **只有 harness 与演示走这里**:产品路径由 `app/view.rs` 从 presenter 快照建模型。
|
||||
|
||||
use unlucky_presenter::dto::{
|
||||
AncientKind, InstallProgressView, InstallStage, VersionKind, VersionSummary,
|
||||
};
|
||||
|
||||
use unlucky_i18n::Catalog;
|
||||
|
||||
use super::model::{Category, Download, InstallView, VersionRow};
|
||||
|
||||
/// 取证开关的名字([`demo`] 读它)。
|
||||
pub const DEMO_STATE_ENV: &str = "ULL_DL_DEMO";
|
||||
|
||||
/// 演示模型:按 [`DEMO_STATE_ENV`] 选状态,缺省是「有数据」。
|
||||
pub fn demo(catalog: Catalog) -> Download {
|
||||
match std::env::var(DEMO_STATE_ENV).ok().as_deref() {
|
||||
Some("loading") => Download::loading(),
|
||||
Some("empty") => Download {
|
||||
loaded: true,
|
||||
..Download::loading()
|
||||
},
|
||||
Some("installing") => Download {
|
||||
install: Some(install(InstallStage::Downloading, 0.42, catalog)),
|
||||
selected: Some("1.21.9".to_string()),
|
||||
..ready(catalog)
|
||||
},
|
||||
Some("selected") => Download {
|
||||
selected: Some("1.21.9".to_string()),
|
||||
..ready(catalog)
|
||||
},
|
||||
Some("failed") => Download {
|
||||
install: Some(install(InstallStage::Failed, 0.0, catalog)),
|
||||
selected: Some("1.21.9".to_string()),
|
||||
..ready(catalog)
|
||||
},
|
||||
_ => ready(catalog),
|
||||
}
|
||||
}
|
||||
|
||||
/// 有数据:六行(三条正式、一条预览、两条远古),与 presenter 的 `mock_versions` 同形。
|
||||
///
|
||||
/// 不复用 `mock_data::mock_versions()`:演示数据是**出图的基线**,得比 mock 稳定
|
||||
/// (mock 随 P3 的假数据一起漂)。
|
||||
fn ready(catalog: Catalog) -> Download {
|
||||
fn summary(id: &str, kind: VersionKind, released: &str, installed: bool) -> VersionSummary {
|
||||
VersionSummary {
|
||||
id: id.to_string(),
|
||||
kind,
|
||||
released: released.to_string(),
|
||||
installed,
|
||||
}
|
||||
}
|
||||
|
||||
let versions = vec![
|
||||
summary("1.21.9", VersionKind::Release, "2026-09-20", false),
|
||||
summary("1.21.8", VersionKind::Release, "2026-07-11", true),
|
||||
summary("1.20.4", VersionKind::Release, "2023-12-07", true),
|
||||
summary("1.21.9-pre3", VersionKind::Snapshot, "2026-09-01", false),
|
||||
summary(
|
||||
"rd-132211",
|
||||
VersionKind::Ancient(AncientKind::Classic),
|
||||
"2009-05-13",
|
||||
false,
|
||||
),
|
||||
summary(
|
||||
"a1.2.6",
|
||||
VersionKind::Ancient(AncientKind::OldAlpha),
|
||||
"2010-08-11",
|
||||
false,
|
||||
),
|
||||
];
|
||||
|
||||
let rows: Vec<VersionRow> = versions
|
||||
.iter()
|
||||
.map(|version| VersionRow::of(version, catalog))
|
||||
.collect();
|
||||
|
||||
Download {
|
||||
// 混合分类 → 没有单个 chip 该亮(这正是 `Category::of` 的反推结果)
|
||||
category: Category::of(&versions),
|
||||
rows,
|
||||
selected: None,
|
||||
install: None,
|
||||
loaded: true,
|
||||
}
|
||||
}
|
||||
|
||||
/// 一次安装的演示快照(文件计数 / 字节 / 速度 / 剩余时间都给真值,进度条画得出来)。
|
||||
fn install(stage: InstallStage, ratio: f32, catalog: Catalog) -> InstallView {
|
||||
let total = 512;
|
||||
let done = (f64::from(ratio) * total as f64) as u64;
|
||||
let failed = matches!(stage, InstallStage::Failed);
|
||||
|
||||
InstallView::of(
|
||||
&InstallProgressView {
|
||||
version: "1.21.9".to_string(),
|
||||
instance: "1.21.9".to_string(),
|
||||
// 演示也**不**搬 core 的中文串:`loader` 字段这里给的是结构化徽标的英文名
|
||||
loader: "Vanilla".to_string(),
|
||||
stage,
|
||||
files_done: if failed { 137 } else { done },
|
||||
files_total: total,
|
||||
bytes_done: 0,
|
||||
bytes_total: 0,
|
||||
speed_bps: if failed { 0 } else { 1_258_291 },
|
||||
eta_secs: if failed { 0 } else { 75 },
|
||||
message: String::new(),
|
||||
},
|
||||
catalog,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
//! 安装面板(页面底部):选中版本 → 「安装」/ 进度 → 「取消」/ 失败 → 「打开日志」。
|
||||
//!
|
||||
//! ## 这一块为什么钉在底部而不是跟着列表滚
|
||||
//!
|
||||
//! 列表是**线性进度项 + 版本集**,装的是「几十行」;底部按钮如果跟着滚,用户在列表中间永远
|
||||
//! 看不到「安装」在哪。所以列表独立滚动(`rows::list`),面板固定占尾部一行高度。
|
||||
//!
|
||||
//! ## 只有 intent,没有乐观回显
|
||||
//!
|
||||
//! | 控件 | 消息 | app 层落点 |
|
||||
//! |---|---|---|
|
||||
//! | 「安装」 | [`Message::InstallVersion`] | `AppCommand::InstallVersion(id)` |
|
||||
//! | 「取消安装」 | [`Message::CancelInstall`] | `AppCommand::CancelInstall` |
|
||||
//! | 「打开日志」 | [`Message::Navigate(Route::Logs)]` | `AppState::navigate`(不派指令) |
|
||||
//!
|
||||
//! 按钮按下**不改任何本地状态**:进度条读的是 `model.install`,它只由 presenter 的
|
||||
//! `InstallProgress` 事件灌进来(`apply` → 视图模型重建)。于是「点了没变」= 后端还没回事件,
|
||||
//! 正是要的行为。
|
||||
|
||||
use iced::widget::{column, container, row};
|
||||
use iced::{Alignment, Element, Length, Padding};
|
||||
|
||||
use unlucky_design::color::Role;
|
||||
use unlucky_design::icons::IconKind;
|
||||
use unlucky_design::spacing::Space;
|
||||
use unlucky_design::typography::TypeRole;
|
||||
|
||||
use unlucky_presenter::router::Route;
|
||||
|
||||
use unlucky_i18n::{Catalog, Key};
|
||||
|
||||
use crate::app::components::buttons::{self, Button};
|
||||
use crate::app::components::feedback::{linear, Progress};
|
||||
use crate::theme::Ui;
|
||||
|
||||
use super::super::frame;
|
||||
use super::super::Message;
|
||||
use super::model::{Download, InstallView, VersionRow};
|
||||
|
||||
/// 不确定态进度条的相位(页面没有帧订阅 ⇒ 不做动画,取一帧好看的静态相位)。
|
||||
const INDETERMINATE_PHASE: f32 = 0.35;
|
||||
|
||||
/// 底部的安装面板。
|
||||
pub(super) fn panel<'a>(ui: &'a Ui, catalog: Catalog, model: &'a Download) -> Element<'a, Message> {
|
||||
let content = match &model.install {
|
||||
Some(install) => installing(ui, catalog, install),
|
||||
None => match model.selected_row() {
|
||||
Some(entry) => ready(ui, catalog, entry),
|
||||
None => hint(ui, catalog),
|
||||
},
|
||||
};
|
||||
|
||||
container(content)
|
||||
.width(Length::Fill)
|
||||
.padding(Padding::from([ui.space(Space::X3), 0.0]))
|
||||
.into()
|
||||
}
|
||||
|
||||
/// 没选中任何版本:给一句「选一个版本再安装」(不静默禁用,也不画一个点不动的按钮)。
|
||||
fn hint<'a>(ui: &'a Ui, catalog: Catalog) -> Element<'a, Message> {
|
||||
frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodySmall,
|
||||
false,
|
||||
catalog.text(Key::DownloadSelectHint),
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
)
|
||||
}
|
||||
|
||||
/// 选好了:版本 id + 「安装」(全屏唯一实心 accent,rubric K2)。
|
||||
///
|
||||
/// 已装的版本给**禁用**的 Outlined 按钮(`Button::disabled` 只清消息、保留几何):
|
||||
/// 「已装」是列表行上的事实(overline + 勾),按钮再点一次不会更清楚。
|
||||
fn ready<'a>(ui: &'a Ui, catalog: Catalog, entry: &'a VersionRow) -> Element<'a, Message> {
|
||||
let label = container(frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodyMedium,
|
||||
false,
|
||||
entry.id.as_str(),
|
||||
ui.color(Role::OnSurface),
|
||||
))
|
||||
.width(Length::Fill);
|
||||
|
||||
let action = if entry.installed {
|
||||
buttons::outlined(ui, Button::disabled(catalog.text(Key::DownloadInstall)))
|
||||
} else {
|
||||
buttons::filled(
|
||||
ui,
|
||||
Button::new(
|
||||
catalog.text(Key::DownloadInstall),
|
||||
Message::InstallVersion(entry.id.clone()),
|
||||
)
|
||||
.leading(IconKind::Download),
|
||||
)
|
||||
};
|
||||
|
||||
row![label.width(Length::Fill), action]
|
||||
.width(Length::Fill)
|
||||
.align_y(Alignment::Center)
|
||||
.into()
|
||||
}
|
||||
|
||||
/// 安装中 / 已收尾:阶段 + 进度条 + 计数 + 速率,失败时给可读文案与出口。
|
||||
fn installing<'a>(ui: &'a Ui, catalog: Catalog, install: &'a InstallView) -> Element<'a, Message> {
|
||||
let bar = if install.known {
|
||||
linear(ui, Progress::determinate(install.ratio))
|
||||
} else {
|
||||
linear(ui, Progress::indeterminate(INDETERMINATE_PHASE))
|
||||
};
|
||||
|
||||
let mut body = column![
|
||||
row![
|
||||
container(frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodyMedium,
|
||||
false,
|
||||
install.version.as_str(),
|
||||
ui.color(Role::OnSurface),
|
||||
))
|
||||
.width(Length::Fill),
|
||||
frame::text_role(
|
||||
ui,
|
||||
TypeRole::LabelMedium,
|
||||
false,
|
||||
install.stage_label.as_str(),
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
),
|
||||
]
|
||||
.width(Length::Fill)
|
||||
.align_y(Alignment::Center),
|
||||
bar,
|
||||
frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodySmall,
|
||||
false,
|
||||
install.detail.as_str(),
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
),
|
||||
]
|
||||
.spacing(ui.space(Space::X2))
|
||||
.width(Length::Fill);
|
||||
|
||||
if let Some(rate) = &install.rate {
|
||||
body = body.push(frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodySmall,
|
||||
false,
|
||||
rate.as_str(),
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
));
|
||||
}
|
||||
|
||||
// 失败态:**可读的原因出口**(结构化文案 + 去日志页),不静默、不搬 core 的中文串。
|
||||
if install.failed() {
|
||||
body = body.push(frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodySmall,
|
||||
false,
|
||||
catalog.text(Key::DownloadFailedHint),
|
||||
ui.color(Role::Error),
|
||||
));
|
||||
}
|
||||
|
||||
let action = if install.running() {
|
||||
buttons::text(
|
||||
ui,
|
||||
Button::new(catalog.text(Key::DownloadCancel), Message::CancelInstall),
|
||||
)
|
||||
} else if install.failed() {
|
||||
buttons::outlined(
|
||||
ui,
|
||||
Button::new(
|
||||
catalog.text(Key::DownloadOpenLogs),
|
||||
Message::Navigate(Route::Logs),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
frame::gap(0.0)
|
||||
};
|
||||
|
||||
column![body, action]
|
||||
.spacing(ui.space(Space::X2))
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
//! 下载页视图模型:**presenter 快照 → 页面要画的东西**(与 [`super::super::model`] 同一套分层)。
|
||||
//!
|
||||
//! ## 为什么这一页也要中间层
|
||||
//!
|
||||
//! 页面层不认识 presenter 的 DTO(同实例页的理由):真页面吃 `AppState` 的快照,
|
||||
//! 演示数据与单测吃 [`super::demo`],两边都转成这里的纯展示字段。
|
||||
//!
|
||||
//! 文案在这一层就按 [`Catalog`] 求好值(`supporting` / `detail` / `rate` 都是 `String`):
|
||||
//! iced 的文字控件**借用**内容,行内文案又是 `format!` 出来的,不先落成字段就没法进控件树
|
||||
//! (`pages/frame` 的 `text_role_owned` 是同一个理由的单行版)。
|
||||
//!
|
||||
//! ## 快照里**没有**的东西(都登记在 `pages/mod.rs` 的偏离表里)
|
||||
//!
|
||||
//! | 缺什么 | 后果 | 兜法 |
|
||||
//! |---|---|---|
|
||||
//! | 「版本列表已加载完成」标志 | 空列表既可能是「还没拉到」也可能是「真的没有」 | [`Download::loaded`] 按「快照里有没有版本」判:没有 = 加载中 |
|
||||
//! | 版本列表**失败**事件 | 拉取失败会停在加载态(不静默:页面上有说明与刷新入口) | 错误态借安装阶段的 `Failed`(结构化、可翻译) |
|
||||
//! | 「当前选中」字段 | 选中态存在模型里,任何快照重建都会回到「正在安装的那个版本」 | 见 `pages/mod.rs` 偏离登记;长期要靠 presenter 加字段 |
|
||||
//!
|
||||
//! ## 中文串一个都不许画
|
||||
//!
|
||||
//! `InstallProgressView::message` / `InstallStage::label()` 都是**中文业务串**(`i18n::bridge`
|
||||
//! 的规矩 2:core 的中文串只给日志和 CLI)。所以这里只搬**结构化字段**(阶段枚举、计数、字节),
|
||||
//! 文案按 `Key` 现求——中文环境自然出中文,英文环境不需要任何中文字体。
|
||||
|
||||
use unlucky_presenter::dto::{
|
||||
human_bytes, AncientKind, InstallProgressView, InstallStage, VersionCategory, VersionKind,
|
||||
VersionSummary,
|
||||
};
|
||||
use unlucky_presenter::state::AppState;
|
||||
|
||||
use unlucky_i18n::{Catalog, Key};
|
||||
|
||||
/// 分类筛选(页面上的四个 filter chip)。
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
pub enum Category {
|
||||
/// 不过滤:画快照里有什么就是什么(首帧与 `RefreshAll` 的落点)
|
||||
#[default]
|
||||
All,
|
||||
/// 正式版
|
||||
Release,
|
||||
/// 预览版
|
||||
Snapshot,
|
||||
/// 远古版(快照里按 `AncientKind` 分四类,页面先只认一个 chip)
|
||||
Ancient,
|
||||
}
|
||||
|
||||
impl Category {
|
||||
/// 四个 chip 的声明顺序(= 画出来的顺序)。
|
||||
pub const ALL: [Category; 4] = [
|
||||
Category::All,
|
||||
Category::Release,
|
||||
Category::Snapshot,
|
||||
Category::Ancient,
|
||||
];
|
||||
|
||||
/// chip 文案的 key。
|
||||
pub const fn label_key(self) -> Key {
|
||||
match self {
|
||||
Category::All => Key::DownloadCategoryAll,
|
||||
Category::Release => Key::DownloadCategoryRelease,
|
||||
Category::Snapshot => Key::DownloadCategorySnapshot,
|
||||
Category::Ancient => Key::DownloadCategoryAncient,
|
||||
}
|
||||
}
|
||||
|
||||
/// 点这个 chip 要派的指令(`None` = 不派:`All` 就是「把当前快照全画出来」)。
|
||||
///
|
||||
/// 远古版在 `VersionCategory` 里是**带子类的**(`Ancient(AncientKind)`),一个 chip 拉不全四类;
|
||||
/// 这里先拉 `Classic`,四子类同屏要靠 presenter 侧支持(已登记 finding)。
|
||||
pub const fn command(self) -> Option<VersionCategory> {
|
||||
match self {
|
||||
Category::All => None,
|
||||
Category::Release => Some(VersionCategory::Release),
|
||||
Category::Snapshot => Some(VersionCategory::Snapshot),
|
||||
Category::Ancient => Some(VersionCategory::Ancient(AncientKind::Classic)),
|
||||
}
|
||||
}
|
||||
|
||||
/// 这个版本属于这个分类吗。
|
||||
pub fn matches(self, kind: VersionKind) -> bool {
|
||||
match self {
|
||||
Category::All => true,
|
||||
Category::Release => kind == VersionKind::Release,
|
||||
Category::Snapshot => kind == VersionKind::Snapshot,
|
||||
Category::Ancient => kind.is_ancient(),
|
||||
}
|
||||
}
|
||||
|
||||
/// 从快照里**反推**当前分类:整份列表只有一类 → 那一类;混合或为空 → [`Category::All`]。
|
||||
///
|
||||
/// 快照没有「我上次按哪个分类拉的」这种字段,所以分类靠列表内容反推
|
||||
/// (`ListVersions` 的结果是单一分类,`RefreshAll` 的结果是混合)。
|
||||
pub fn of(versions: &[VersionSummary]) -> Self {
|
||||
let mut kinds = versions.iter().map(|version| version.kind);
|
||||
let Some(first) = kinds.next() else {
|
||||
return Category::All;
|
||||
};
|
||||
if kinds.all(|kind| kind == first) {
|
||||
match first {
|
||||
VersionKind::Release => Category::Release,
|
||||
VersionKind::Snapshot => Category::Snapshot,
|
||||
VersionKind::Ancient(_) => Category::Ancient,
|
||||
}
|
||||
} else {
|
||||
Category::All
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 版本列表的一行(`ListItem` 的两行档:headline = 版本 id,supporting = `正式版 · 发布于 …`)。
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct VersionRow {
|
||||
/// 版本 id(`1.21.9` / `rd-132211`)——也是「安装」指令的载荷
|
||||
pub id: String,
|
||||
/// 发布日期(ISO-8601 日期部分,快照原样)
|
||||
pub released: String,
|
||||
/// 版本类型
|
||||
pub kind: VersionKind,
|
||||
/// 本地是否已安装(行上给勾 / overline `Installed`)
|
||||
pub installed: bool,
|
||||
/// 副文案(`正式版 · 发布于 2026-09-20`;一行 = 一个 key,不拼片段)
|
||||
pub supporting: String,
|
||||
}
|
||||
|
||||
impl VersionRow {
|
||||
pub(super) fn of(version: &VersionSummary, catalog: Catalog) -> Self {
|
||||
Self {
|
||||
id: version.id.clone(),
|
||||
released: version.released.clone(),
|
||||
kind: version.kind,
|
||||
installed: version.installed,
|
||||
supporting: catalog.render(
|
||||
Key::DownloadRowSupporting,
|
||||
&[
|
||||
("kind", catalog.text(kind_key(version.kind))),
|
||||
("date", version.released.as_str()),
|
||||
],
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 版本类型 → 文案 key(远古版不分子类:chip 只有一档,行上再分子类等于两套语言)。
|
||||
const fn kind_key(kind: VersionKind) -> Key {
|
||||
match kind {
|
||||
VersionKind::Release => Key::DownloadCategoryRelease,
|
||||
VersionKind::Snapshot => Key::DownloadCategorySnapshot,
|
||||
VersionKind::Ancient(_) => Key::DownloadCategoryAncient,
|
||||
}
|
||||
}
|
||||
|
||||
/// 一次安装的展示态(结构化字段 + 已求好的文案)。
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct InstallView {
|
||||
/// 目标版本(= 选中的那一行)
|
||||
pub version: String,
|
||||
/// 阶段
|
||||
pub stage: InstallStage,
|
||||
/// 阶段词(`下载文件`)
|
||||
pub stage_label: String,
|
||||
/// 计数行(`128/512 文件`;未知时是「等第一个文件…」)
|
||||
pub detail: String,
|
||||
/// 速率 + 剩余时间(`1.2 MB/s · 剩 1m15s`;未知时 `None`)
|
||||
pub rate: Option<String>,
|
||||
/// 整体进度 0.0~1.0
|
||||
pub ratio: f32,
|
||||
/// 进度是否已知(`false` = 进度条画不确定态)
|
||||
pub known: bool,
|
||||
}
|
||||
|
||||
impl InstallView {
|
||||
/// 快照 → 展示态。
|
||||
pub(super) fn of(progress: &InstallProgressView, catalog: Catalog) -> Self {
|
||||
let known = progress.is_known();
|
||||
let detail = if known {
|
||||
catalog.render(
|
||||
Key::DownloadProgress,
|
||||
&[
|
||||
("done", &progress.files_done.to_string()),
|
||||
("total", &progress.files_total.to_string()),
|
||||
],
|
||||
)
|
||||
} else {
|
||||
catalog.text(Key::DownloadProgressUnknown).to_owned()
|
||||
};
|
||||
let rate = if progress.speed_bps == 0 || progress.eta_secs == 0 {
|
||||
None
|
||||
} else {
|
||||
let eta = if progress.eta_secs >= 60 {
|
||||
catalog.render(
|
||||
Key::DownloadEtaMins,
|
||||
&[
|
||||
("mins", &(progress.eta_secs / 60).to_string()),
|
||||
("secs", &format!("{:02}", progress.eta_secs % 60)),
|
||||
],
|
||||
)
|
||||
} else {
|
||||
catalog.render(
|
||||
Key::DownloadEtaSecs,
|
||||
&[("secs", &progress.eta_secs.to_string())],
|
||||
)
|
||||
};
|
||||
Some(catalog.render(
|
||||
Key::DownloadRate,
|
||||
&[
|
||||
("speed", &format!("{}/s", human_bytes(progress.speed_bps))),
|
||||
("eta", eta.as_str()),
|
||||
],
|
||||
))
|
||||
};
|
||||
|
||||
Self {
|
||||
version: progress.version.clone(),
|
||||
stage: progress.stage,
|
||||
stage_label: catalog.text(stage_key(progress.stage)).to_owned(),
|
||||
detail,
|
||||
rate,
|
||||
ratio: progress.ratio(),
|
||||
known,
|
||||
}
|
||||
}
|
||||
|
||||
/// 失败了(错误态要出可读文案 + 出口,不许静默)。
|
||||
pub const fn failed(&self) -> bool {
|
||||
matches!(self.stage, InstallStage::Failed)
|
||||
}
|
||||
|
||||
/// 收尾了(`Done` / `Failed` / `Cancelled`)。
|
||||
pub fn terminal(&self) -> bool {
|
||||
self.stage.is_terminal()
|
||||
}
|
||||
|
||||
/// 还在跑(「取消安装」只在这时给)。
|
||||
pub fn running(&self) -> bool {
|
||||
!self.stage.is_terminal()
|
||||
}
|
||||
}
|
||||
|
||||
/// 阶段 → 文案 key(**不**用 `InstallStage::label()`:那是中文业务串)。
|
||||
const fn stage_key(stage: InstallStage) -> Key {
|
||||
match stage {
|
||||
InstallStage::Planning => Key::DownloadStagePlanning,
|
||||
InstallStage::Downloading => Key::DownloadStageDownloading,
|
||||
InstallStage::Installing => Key::DownloadStageInstalling,
|
||||
InstallStage::Registering => Key::DownloadStageRegistering,
|
||||
InstallStage::Done => Key::DownloadStageDone,
|
||||
InstallStage::Failed => Key::DownloadStageFailed,
|
||||
InstallStage::Cancelled => Key::DownloadStageCancelled,
|
||||
}
|
||||
}
|
||||
|
||||
/// 下载页要画的东西(**全部字段都能从快照推出来**,页面自己不留状态)。
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct Download {
|
||||
/// 版本列表(顺序 = 快照顺序)
|
||||
pub rows: Vec<VersionRow>,
|
||||
/// 当前分类(从快照反推)
|
||||
pub category: Category,
|
||||
/// 选中的版本 id(`None` = 没选中 → 安装按钮禁用)
|
||||
pub selected: Option<String>,
|
||||
/// 正在跑(或刚跑完)的安装
|
||||
pub install: Option<InstallView>,
|
||||
/// 快照里有没有版本列表(`false` = 还没拉到 → 加载态)
|
||||
pub loaded: bool,
|
||||
}
|
||||
|
||||
impl Download {
|
||||
/// 空模型 = 加载态(首帧,以及 `pages::Model::new` 的默认值)。
|
||||
pub fn loading() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// presenter 快照 → 下载页模型(**唯一的真数据入口**)。
|
||||
///
|
||||
/// 快照里的两个过滤条件(`installed_only` / `download_query`)原样照用:它们是 presenter 的
|
||||
/// 状态,页面不该另存一份;过滤后为空就是「空态」(`loaded` 仍为 `true`)。
|
||||
pub fn from_snapshot(state: &AppState, catalog: Catalog) -> Self {
|
||||
let query = state.download_query.trim().to_ascii_lowercase();
|
||||
let rows = state
|
||||
.versions
|
||||
.iter()
|
||||
.filter(|version| !state.installed_only || version.installed)
|
||||
.filter(|version| query.is_empty() || version.id.to_ascii_lowercase().contains(&query))
|
||||
.map(|version| VersionRow::of(version, catalog))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let install = state
|
||||
.install
|
||||
.as_ref()
|
||||
.map(|view| InstallView::of(view, catalog));
|
||||
// 快照没有「选中」字段:正在安装的那个版本就是「选中」(见模块文档的缺口表)。
|
||||
let selected = install.as_ref().map(|view| view.version.clone());
|
||||
|
||||
Self {
|
||||
rows,
|
||||
category: Category::of(&state.versions),
|
||||
selected,
|
||||
install,
|
||||
loaded: !state.versions.is_empty(),
|
||||
}
|
||||
}
|
||||
|
||||
/// 选中的那一行(安装面板上的版本名)。
|
||||
pub fn selected_row(&self) -> Option<&VersionRow> {
|
||||
let id = self.selected.as_deref()?;
|
||||
self.rows.iter().find(|row| row.id == id)
|
||||
}
|
||||
|
||||
/// 加载态:快照里还没有版本列表。
|
||||
pub const fn is_loading(&self) -> bool {
|
||||
!self.loaded
|
||||
}
|
||||
|
||||
/// 空态:列表拉到了,但过滤之后一行都不剩。
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.loaded && self.rows.is_empty()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
//! 版本列表:分类 Tabs + 计数头 + `ListItem` 行(全是 `components/` 的真组件)。
|
||||
//!
|
||||
//! | 位置 | M84(占位) | M94(真组件) |
|
||||
//! |---|---|---|
|
||||
//! | 分类 | 无(整页只有一行假状态) | [`navigation::tabs`] 的 Primary 档(48 高、3px `Primary` 指示条) |
|
||||
//! | 列表行 | 无 | [`navigation::list_item`] 的两行档(**60** = `row_height` 44 + 每多一行 16) |
|
||||
//! | 计数头 | 无 | `LabelMedium` + `OnSurfaceVariant`(与实例页列表头同一个语言) |
|
||||
//! | 已装标记 | 无 | overline `Installed` + trailing `Check`(`Primary`) |
|
||||
//!
|
||||
//! 行高从「手搓 56」变成 60 的理由与实例页完全一样:真 `ListItem` 自己的几何真源,页面不覆盖。
|
||||
|
||||
use iced::widget::{column, scrollable};
|
||||
use iced::{Element, Length, Padding};
|
||||
|
||||
use unlucky_design::color::Role;
|
||||
use unlucky_design::icons::IconKind;
|
||||
use unlucky_design::spacing::Space;
|
||||
use unlucky_design::typography::TypeRole;
|
||||
|
||||
use unlucky_i18n::{Catalog, Key};
|
||||
|
||||
use crate::app::components::navigation::list_item::{list_item, ListItem};
|
||||
use crate::app::components::navigation::tabs::{tabs, Tab, Tabs};
|
||||
use crate::theme::Ui;
|
||||
|
||||
use super::super::frame;
|
||||
use super::super::Message;
|
||||
use super::model::{Category, Download, VersionRow};
|
||||
|
||||
/// 行与行的间距(`Space::X1`;与实例页同值,行高差异全部来自 `ListItem` 自己的几何)。
|
||||
const ROW_GAP: Space = Space::X1;
|
||||
|
||||
/// 分类筛选(Primary Tabs:选中项下方 3px `Primary` 指示条)。
|
||||
///
|
||||
/// 点一个分类 = `Message::SetCategory`,由 app 层翻成 `AppCommand::ListVersions`——
|
||||
/// 页面**不**自己过滤列表(列表内容 = 快照里有什么),所以「点了但没反应」只会发生在
|
||||
/// presenter 没回列表的时候,不会出现「页面过滤过、后端还是旧分类」的两份真相。
|
||||
pub(super) fn categories<'a>(
|
||||
ui: &'a Ui,
|
||||
catalog: Catalog,
|
||||
current: Category,
|
||||
) -> Element<'a, Message> {
|
||||
let mut row = Tabs::primary();
|
||||
for category in Category::ALL {
|
||||
let mut tab = Tab::new(
|
||||
catalog.text(category.label_key()),
|
||||
Message::SetCategory(category),
|
||||
);
|
||||
if category == current {
|
||||
tab = tab.selected();
|
||||
}
|
||||
row = row.tab(tab);
|
||||
}
|
||||
tabs(ui, row)
|
||||
}
|
||||
|
||||
/// 计数头(`LabelMedium`):一行 = 一个 key,数字走占位符,不拼片段。
|
||||
pub(super) fn head<'a>(ui: &'a Ui, catalog: Catalog, model: &Download) -> Element<'a, Message> {
|
||||
frame::text_role_owned(
|
||||
ui,
|
||||
TypeRole::LabelMedium,
|
||||
false,
|
||||
catalog.render(
|
||||
Key::DownloadCount,
|
||||
&[("count", &model.rows.len().to_string())],
|
||||
),
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
)
|
||||
}
|
||||
|
||||
/// 版本行列表(**独立滚动**:只有列表滚,安装面板钉在底部不跟着滚)。
|
||||
pub(super) fn list<'a>(ui: &'a Ui, catalog: Catalog, model: &'a Download) -> Element<'a, Message> {
|
||||
let rows = column(
|
||||
model
|
||||
.rows
|
||||
.iter()
|
||||
.map(|entry| version_row(ui, catalog, model, entry))
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
.spacing(ui.space(ROW_GAP))
|
||||
.padding(Padding::from([0.0, ui.space(Space::X2)]))
|
||||
.width(Length::Fill);
|
||||
|
||||
scrollable(rows)
|
||||
.direction(scrollable::Direction::Vertical(
|
||||
scrollable::Scrollbar::new()
|
||||
.width(frame::SCROLLBAR_WIDTH)
|
||||
.scroller_width(frame::SCROLLBAR_WIDTH)
|
||||
.margin(frame::SCROLLBAR_MARGIN),
|
||||
))
|
||||
.height(Length::Fill)
|
||||
.style(frame::scroll_style(ui))
|
||||
.into()
|
||||
}
|
||||
|
||||
/// 一行:headline = 版本 id,supporting = `正式版 · 发布于 2026-09-20`,已装给勾。
|
||||
///
|
||||
/// 点一行 = `Message::SelectVersion(id)`(**页面内选中**,不 dispatch);「安装」是旁边那个
|
||||
/// 独立按钮,点它才派 `AppCommand::InstallVersion`。选中不做乐观回显:行的高亮来自模型,
|
||||
/// 模型在 app 层被改写之后才变。
|
||||
fn version_row<'a>(
|
||||
ui: &'a Ui,
|
||||
catalog: Catalog,
|
||||
model: &Download,
|
||||
entry: &'a VersionRow,
|
||||
) -> Element<'a, Message> {
|
||||
let mut item = ListItem::new(entry.id.as_str(), Message::SelectVersion(entry.id.clone()))
|
||||
.supporting(entry.supporting.as_str())
|
||||
.leading(IconKind::Download);
|
||||
|
||||
if entry.installed {
|
||||
item = item
|
||||
.overline(catalog.text(Key::DownloadInstalled))
|
||||
.trailing(IconKind::Check);
|
||||
}
|
||||
if model.selected.as_deref() == Some(entry.id.as_str()) {
|
||||
item = item.selected();
|
||||
}
|
||||
|
||||
list_item(ui, item)
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
//! 加载态与空态(**没有可用版本数据时页面不能是白屏**)。
|
||||
//!
|
||||
//! | 状态 | 触发条件(都能从快照推出来) | 画什么 |
|
||||
//! |---|---|---|
|
||||
//! | 加载 | `model.is_loading()`:快照里还没有版本列表 | 不确定态进度条 + 「正在加载版本列表…」+ 一句说明 |
|
||||
//! | 空 | `model.is_empty()`:列表拉到了,但过滤后一行不剩 | 真 [`empty_state`](图标块 96 + 24 标题 + 说明 + 一个刷新 CTA) |
|
||||
//!
|
||||
//! 两者都**不留白**:加载态给得出「还在等」的视觉证据(进度条不是装饰,是唯一的非文字信号),
|
||||
//! 空态给得出「下一步做什么」(刷新)。
|
||||
//!
|
||||
//! 拉取**失败**在这条通道上没有结构化事件(presenter 只有 `VersionListChanged`),所以列表拉不到
|
||||
//! 会停在加载态而不是谎报「没有版本」——加载态的说明文案里就写着这件事。安装失败的错误态在
|
||||
//! [`super::install`] 里(那里的 `Failed` 阶段是结构化字段,可以放心翻译)。
|
||||
|
||||
use iced::widget::column;
|
||||
use iced::{Element, Length};
|
||||
|
||||
use unlucky_design::color::Role;
|
||||
use unlucky_design::icons::IconKind;
|
||||
use unlucky_design::spacing::Space;
|
||||
use unlucky_design::typography::TypeRole;
|
||||
|
||||
use unlucky_i18n::{Catalog, Key};
|
||||
|
||||
use crate::app::components::feedback::{empty_state, linear, EmptyState, Progress};
|
||||
use crate::theme::Ui;
|
||||
|
||||
use super::super::frame;
|
||||
use super::super::{Action, Message};
|
||||
|
||||
/// 不确定态进度条的相位(没有帧订阅,取一帧静态相位;见 `install.rs` 同名常量)。
|
||||
const INDETERMINATE_PHASE: f32 = 0.35;
|
||||
|
||||
/// 加载态。
|
||||
pub(super) fn loading<'a>(ui: &'a Ui, catalog: Catalog) -> Element<'a, Message> {
|
||||
column![
|
||||
frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodyLarge,
|
||||
true,
|
||||
catalog.text(Key::DownloadLoading),
|
||||
ui.color(Role::OnSurface),
|
||||
),
|
||||
linear(ui, Progress::indeterminate(INDETERMINATE_PHASE)),
|
||||
frame::text_role(
|
||||
ui,
|
||||
TypeRole::BodySmall,
|
||||
false,
|
||||
catalog.text(Key::DownloadLoadingHint),
|
||||
ui.color(Role::OnSurfaceVariant),
|
||||
),
|
||||
]
|
||||
.spacing(ui.space(Space::X3))
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
}
|
||||
|
||||
/// 空态(真 `EmptyState`:CTA 就是标准 Filled 按钮,走按钮家族)。
|
||||
pub(super) fn empty<'a>(ui: &'a Ui, catalog: Catalog) -> Element<'a, Message> {
|
||||
empty_state(
|
||||
ui,
|
||||
EmptyState::new(
|
||||
IconKind::Download,
|
||||
catalog.text(Key::DownloadEmptyTitle),
|
||||
catalog.text(Key::DownloadEmptyBody),
|
||||
)
|
||||
.action(
|
||||
catalog.text(Key::DownloadRefresh),
|
||||
Message::Action(Action::RefreshSources),
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
//! 下载页的判据:**快照 → 模型 → 控件树**三段各自的断言。
|
||||
//!
|
||||
//! 每条都写清「抓得住什么 / 抓不住什么」——这里只测纯转换与树能构建,**像素**由报告里的
|
||||
//! 四张图与数值表负责(同 `pages/tests.rs` 的口径)。
|
||||
|
||||
use unlucky_design::color::SchemeFlavor;
|
||||
use unlucky_design::typography::Platform;
|
||||
use unlucky_i18n::{Key, Lang};
|
||||
use unlucky_presenter::dto::{
|
||||
AncientKind, AppEvent, CoreEvent, InstallProgressView, InstallStage, VersionCategory,
|
||||
VersionKind, VersionSummary,
|
||||
};
|
||||
use unlucky_presenter::state::AppState;
|
||||
|
||||
use crate::theme::{Families, Ui};
|
||||
|
||||
use super::super::layout::{content_column_width, frame_metrics, measure_cap_px, PaneKit};
|
||||
use super::super::Message;
|
||||
use super::model::{Category, Download};
|
||||
|
||||
const FAMILIES: Families = Families {
|
||||
text: "Segoe UI",
|
||||
display: "Segoe UI",
|
||||
mono: "Consolas",
|
||||
};
|
||||
|
||||
fn ui() -> Ui {
|
||||
Ui::with_platform(SchemeFlavor::Light, Platform::Windows, FAMILIES)
|
||||
}
|
||||
|
||||
fn version(id: &str, kind: VersionKind, installed: bool) -> VersionSummary {
|
||||
VersionSummary {
|
||||
id: id.to_string(),
|
||||
kind,
|
||||
released: "2026-09-20".to_string(),
|
||||
installed,
|
||||
}
|
||||
}
|
||||
|
||||
fn state_with(versions: Vec<VersionSummary>) -> AppState {
|
||||
let mut state = AppState::new();
|
||||
state.apply(AppEvent::Core(CoreEvent::VersionListChanged(versions)));
|
||||
state
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------- 版面(M84 的三条,M94 一条没动)
|
||||
|
||||
/// 单列页:任何窗口宽度都不许出现第二列,正文列不许超过行宽上限。
|
||||
///
|
||||
/// 抓得住:`layout` 把下载页切到两列、或把正文列放过 424。
|
||||
/// 抓不住:页面内部又套了一层更宽的容器(那要看真像素,见报告的量测表)。
|
||||
#[test]
|
||||
fn download_is_single_column_at_every_width() {
|
||||
for width in [600.0, 840.0, 900.0, 1180.0, 2400.0] {
|
||||
let metrics = frame_metrics(PaneKit::Single, width);
|
||||
assert!(metrics.secondary.is_none(), "{width} 宽下载页出现了第二列");
|
||||
assert!(metrics.column <= measure_cap_px() + f32::EPSILON);
|
||||
assert_eq!(metrics.column, content_column_width(width));
|
||||
}
|
||||
}
|
||||
|
||||
/// 宽窗下多出来的宽度必须留白(不是把卡片拉宽)——1180 的正文列 < 可用宽度。
|
||||
#[test]
|
||||
fn extra_width_goes_to_margin_not_to_the_column() {
|
||||
let metrics = frame_metrics(PaneKit::Single, 1180.0);
|
||||
assert_eq!(metrics.column, measure_cap_px());
|
||||
assert!(
|
||||
metrics.available - metrics.column >= 400.0,
|
||||
"1180 宽下应留出大片留白(M68 的全宽卡就是没有这段留白)"
|
||||
);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------- 快照 → 模型
|
||||
|
||||
/// 真快照进得来:行数、分类、选中项、已装标记全部来自 `AppState`。
|
||||
///
|
||||
/// 抓得住:页面自己造数据、或把 `installed` / `kind` 丢了。
|
||||
/// 抓不住:快照字段在 `app/view.rs` 被漏接(那由 `app/update.rs` 的接线测试兜)。
|
||||
#[test]
|
||||
fn the_snapshot_becomes_the_page_model() {
|
||||
let mut state = state_with(vec![
|
||||
version("1.21.9", VersionKind::Release, false),
|
||||
version("1.21.8", VersionKind::Release, true),
|
||||
]);
|
||||
state.apply(AppEvent::Core(CoreEvent::InstallProgress(Some(
|
||||
InstallProgressView {
|
||||
version: "1.21.9".to_string(),
|
||||
loader: "Vanilla".to_string(),
|
||||
stage: InstallStage::Downloading,
|
||||
files_done: 128,
|
||||
files_total: 512,
|
||||
speed_bps: 1_258_291,
|
||||
eta_secs: 75,
|
||||
..InstallProgressView::new()
|
||||
},
|
||||
))));
|
||||
|
||||
let model = Download::from_snapshot(&state, Lang::En.catalog());
|
||||
|
||||
assert_eq!(model.rows.len(), 2);
|
||||
assert_eq!(model.rows[0].id, "1.21.9");
|
||||
assert!(model.rows[1].installed, "快照说装了就是装了");
|
||||
assert!(!model.rows[0].installed);
|
||||
assert_eq!(
|
||||
model.category,
|
||||
Category::Release,
|
||||
"整份列表都是正式版 → 反推出正式版分类"
|
||||
);
|
||||
assert_eq!(
|
||||
model.selected.as_deref(),
|
||||
Some("1.21.9"),
|
||||
"正在安装的版本 = 选中行"
|
||||
);
|
||||
assert!(model.loaded, "有版本 = 已加载");
|
||||
|
||||
let install = model.install.expect("安装进度要转进来");
|
||||
assert!(install.running(), "Downloading 还没收尾");
|
||||
assert!(!install.failed());
|
||||
assert_eq!(install.detail, "128/512 files");
|
||||
assert_eq!(
|
||||
install.rate.as_deref(),
|
||||
Some("1.2 MB/s · 1m15s left"),
|
||||
"速率与剩余时间走 key,不搬 core 的中文串"
|
||||
);
|
||||
}
|
||||
|
||||
/// 快照里的两个过滤条件(`installed_only` / `download_query`)原样照用。
|
||||
///
|
||||
/// 抓得住:页面把 presenter 的过滤条件丢了(用户设了「仅已装」,页面照画全部)。
|
||||
/// 抓不住:过滤词大小写之外的语言学规则(那属于 presenter 的搜索口径)。
|
||||
#[test]
|
||||
fn presenter_filters_still_apply() {
|
||||
let mut state = state_with(vec![
|
||||
version("1.21.9", VersionKind::Release, false),
|
||||
version("1.21.8", VersionKind::Release, true),
|
||||
version("1.20.4", VersionKind::Release, true),
|
||||
]);
|
||||
|
||||
let installed_only = {
|
||||
state.installed_only = true;
|
||||
Download::from_snapshot(&state, Lang::En.catalog())
|
||||
};
|
||||
assert_eq!(installed_only.rows.len(), 2, "仅已装");
|
||||
|
||||
let queried = {
|
||||
state.installed_only = false;
|
||||
state.download_query = " 1.21 ".to_string();
|
||||
Download::from_snapshot(&state, Lang::En.catalog())
|
||||
};
|
||||
assert_eq!(queried.rows.len(), 2, "版本号片段匹配两个");
|
||||
assert!(queried.rows.iter().all(|row| row.id.starts_with("1.21")));
|
||||
}
|
||||
|
||||
/// 空快照 = 加载态;过滤掉所有行 = 空态。两者都**不许**是白屏。
|
||||
///
|
||||
/// 抓得住:把「还没拉到」画成「没有版本」(谎报空态),或反过来。
|
||||
/// 抓不住:真机上卡在加载态多久(没有超时信号,见模块文档的缺口表)。
|
||||
#[test]
|
||||
fn loading_and_empty_are_different_states() {
|
||||
let loading = Download::from_snapshot(&AppState::new(), Lang::En.catalog());
|
||||
assert!(loading.is_loading() && !loading.is_empty());
|
||||
|
||||
let mut state = state_with(vec![version("1.21.9", VersionKind::Release, false)]);
|
||||
state.download_query = "no-such-version".to_string();
|
||||
let empty = Download::from_snapshot(&state, Lang::En.catalog());
|
||||
assert!(!empty.is_loading(), "列表拉到了,不是加载中");
|
||||
assert!(empty.is_empty(), "过滤后没有行 = 空态");
|
||||
}
|
||||
|
||||
/// 分类反推:混合 = 全部,远古 = 远古(不看子类)。
|
||||
#[test]
|
||||
fn the_category_is_derived_from_the_list() {
|
||||
let mixed = vec![
|
||||
version("1.21.9", VersionKind::Release, false),
|
||||
version("1.21.9-pre3", VersionKind::Snapshot, false),
|
||||
];
|
||||
assert_eq!(Category::of(&mixed), Category::All);
|
||||
assert_eq!(
|
||||
Category::of(&[version("x", VersionKind::Snapshot, false)]),
|
||||
Category::Snapshot
|
||||
);
|
||||
assert_eq!(
|
||||
Category::of(&[version(
|
||||
"rd-132211",
|
||||
VersionKind::Ancient(AncientKind::OldBeta),
|
||||
false
|
||||
)]),
|
||||
Category::Ancient
|
||||
);
|
||||
assert_eq!(Category::of(&[]), Category::All);
|
||||
}
|
||||
|
||||
/// 分类 chip 派的是**真指令**:`VersionCategory` 直接喂给 `AppCommand::ListVersions`。
|
||||
///
|
||||
/// 抓得住:chip 点到不存在的指令、或把 `All` 也派出去(那会白拉一次列表)。
|
||||
/// 抓不住:后端是否真按分类回列表(presenter/host 的测试负责)。
|
||||
#[test]
|
||||
fn category_commands_are_real() {
|
||||
assert_eq!(Category::All.command(), None, "全部 = 画现有快照,不派指令");
|
||||
assert_eq!(Category::Release.command(), Some(VersionCategory::Release));
|
||||
assert_eq!(
|
||||
Category::Snapshot.command(),
|
||||
Some(VersionCategory::Snapshot)
|
||||
);
|
||||
assert_eq!(
|
||||
Category::Ancient.command(),
|
||||
Some(VersionCategory::Ancient(AncientKind::Classic)),
|
||||
"远古版先拉 classic(四子类同屏要 presenter 支持,已登记 finding)"
|
||||
);
|
||||
assert!(Category::Ancient.matches(VersionKind::Ancient(AncientKind::Unlisted)));
|
||||
assert!(!Category::Release.matches(VersionKind::Snapshot));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------- 文案(i18n)
|
||||
|
||||
/// 中英两套目录都能把这一页的每个 key 求出来(缺译会露出 `⟪missing⟫`)。
|
||||
///
|
||||
/// 「这一页的 key」按 `Download` 前缀取,不手写清单:清单会漏、会在下一次加 key 时不同步,
|
||||
/// 而前缀遍历顺手还守住了「不许把 key 悄悄删掉」(条数下限)。
|
||||
///
|
||||
/// 抓得住:新增 key 只写了一种语言(另一套会显示 `⟪missing⟫`)。
|
||||
/// 抓不住:译文质量,以及**没有用到的** key(那是 `catalog` 自己的完整性测试)。
|
||||
#[test]
|
||||
fn every_download_key_exists_in_both_catalogs() {
|
||||
let download_keys: Vec<Key> = Key::ALL
|
||||
.iter()
|
||||
.copied()
|
||||
.filter(|key| key.name().starts_with("Download"))
|
||||
.collect();
|
||||
assert!(download_keys.len() >= 25, "下载页的 key 不该被悄悄删掉");
|
||||
|
||||
for lang in [Lang::En, Lang::ZhCn] {
|
||||
let catalog = lang.catalog();
|
||||
for key in &download_keys {
|
||||
let text = catalog.text(*key);
|
||||
assert_ne!(text, unlucky_i18n::catalog::MISSING, "{key:?} 缺译");
|
||||
assert!(!text.is_empty(), "{key:?} 是空串");
|
||||
}
|
||||
assert!(catalog.missing().is_empty(), "内置目录不许有缺译");
|
||||
}
|
||||
}
|
||||
|
||||
/// 页面级的文案全部按 `Catalog` 走:中文目录出中文,英文目录出英文,**且不含 core 的中文业务串**。
|
||||
///
|
||||
/// 抓得住:页面里又出现硬编码英文/中文字面量、或把 `InstallStage::label()` / `progress.message`
|
||||
/// (core 的中文串)画到界面上。
|
||||
/// 抓不住:目录里那条译文本身写错了。
|
||||
#[test]
|
||||
fn the_model_speaks_the_catalog_language() {
|
||||
let versions = vec![version("1.21.9", VersionKind::Release, false)];
|
||||
let state = state_with(versions);
|
||||
|
||||
let en = Download::from_snapshot(&state, Lang::En.catalog());
|
||||
let zh = Download::from_snapshot(&state, Lang::ZhCn.catalog());
|
||||
|
||||
assert_eq!(en.rows[0].supporting, "Release · released 2026-09-20");
|
||||
assert_eq!(zh.rows[0].supporting, "正式版 · 发布于 2026-09-20");
|
||||
|
||||
let progress = InstallProgressView {
|
||||
version: "1.21.9".to_string(),
|
||||
stage: InstallStage::Planning,
|
||||
message: "正在解析版本清单…".to_string(),
|
||||
..InstallProgressView::new()
|
||||
};
|
||||
let install_en = super::model::InstallView::of(&progress, Lang::En.catalog());
|
||||
assert_eq!(install_en.stage_label, "Planning");
|
||||
assert_eq!(install_en.detail, "Waiting for the first file…");
|
||||
assert!(
|
||||
!install_en.stage_label.contains('解'),
|
||||
"core 的中文阶段串不许直接上屏"
|
||||
);
|
||||
assert!(
|
||||
!install_en.detail.contains('正'),
|
||||
"`InstallProgressView::message` 是中文业务串,页面不许画它"
|
||||
);
|
||||
|
||||
let install_zh = super::model::InstallView::of(&progress, Lang::ZhCn.catalog());
|
||||
assert_eq!(install_zh.stage_label, "解析版本");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------- 控件树
|
||||
|
||||
/// 五个状态都能构建出控件树(分支走到、不 panic、消息类型对得上)。
|
||||
///
|
||||
/// 抓得住:某个状态分支漏了返回值、或消息类型接错(编译期就红);空态/加载态忘了给内容。
|
||||
/// 抓不住:**画出来长什么样**——像素由报告里的四张图负责,这条只保证「有树」。
|
||||
#[test]
|
||||
fn every_state_builds_a_tree() {
|
||||
let ui = ui();
|
||||
let metrics = frame_metrics(PaneKit::Single, 1180.0);
|
||||
let catalog = Lang::En.catalog();
|
||||
|
||||
let mut loading = Download::loading();
|
||||
loading.selected = None;
|
||||
|
||||
let empty = Download {
|
||||
loaded: true,
|
||||
..Download::loading()
|
||||
};
|
||||
|
||||
let ready = Download {
|
||||
rows: vec![super::model::VersionRow::of(
|
||||
&version("1.21.9", VersionKind::Release, false),
|
||||
catalog,
|
||||
)],
|
||||
category: Category::Release,
|
||||
selected: Some("1.21.9".to_string()),
|
||||
install: None,
|
||||
loaded: true,
|
||||
};
|
||||
|
||||
let installing = Download {
|
||||
install: Some(super::model::InstallView::of(
|
||||
&InstallProgressView {
|
||||
version: "1.21.9".to_string(),
|
||||
stage: InstallStage::Downloading,
|
||||
files_done: 128,
|
||||
files_total: 512,
|
||||
..InstallProgressView::new()
|
||||
},
|
||||
catalog,
|
||||
)),
|
||||
..ready.clone()
|
||||
};
|
||||
|
||||
let failed = Download {
|
||||
install: Some(super::model::InstallView::of(
|
||||
&InstallProgressView {
|
||||
version: "1.21.9".to_string(),
|
||||
stage: InstallStage::Failed,
|
||||
..InstallProgressView::new()
|
||||
},
|
||||
catalog,
|
||||
)),
|
||||
..ready.clone()
|
||||
};
|
||||
|
||||
for model in [loading, empty, ready, installing, failed] {
|
||||
let _: iced::Element<'_, Message> = super::view(&ui, metrics, &model, Lang::En);
|
||||
}
|
||||
}
|
||||
|
||||
/// 安装失败的模型:可读文案 + 出口都有(不静默)。
|
||||
///
|
||||
/// 抓得住:失败态被画成「已完成」或什么都不给。
|
||||
/// 抓不住:失败原因的具体内容(core 只给中文 `message`,页面按规矩不画它,见模块文档)。
|
||||
#[test]
|
||||
fn a_failed_install_stays_visible() {
|
||||
let model = super::model::InstallView::of(
|
||||
&InstallProgressView {
|
||||
version: "1.21.9".to_string(),
|
||||
stage: InstallStage::Failed,
|
||||
..InstallProgressView::new()
|
||||
},
|
||||
Lang::En.catalog(),
|
||||
);
|
||||
assert!(model.failed());
|
||||
assert!(model.terminal());
|
||||
assert!(!model.running(), "失败之后不再给「取消安装」");
|
||||
assert_eq!(model.stage_label, "Install failed");
|
||||
}
|
||||
|
||||
/// 演示数据自己也得守规矩(它是出图的基线)。
|
||||
///
|
||||
/// 抓得住:演示数据里混进中文字面量、或行数与分类对不上。
|
||||
/// 抓不住:图上好不好看。
|
||||
#[test]
|
||||
fn the_demo_data_is_sane() {
|
||||
let catalog = Lang::En.catalog();
|
||||
let demo = super::demo(catalog);
|
||||
assert!(demo.loaded);
|
||||
assert_eq!(demo.rows.len(), 6);
|
||||
assert_eq!(demo.category, Category::All, "混合列表没有单个分类该亮");
|
||||
assert!(
|
||||
demo.rows
|
||||
.iter()
|
||||
.all(|row| row.supporting.contains("released")),
|
||||
"英文目录下的副文案走英文 key"
|
||||
);
|
||||
assert!(
|
||||
demo.rows.iter().all(|row| !row.supporting.contains('版')),
|
||||
"英文目录下不许出现中文类型词"
|
||||
);
|
||||
}
|
||||
@@ -106,6 +106,7 @@ mod settings;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub use download::{Category, Download};
|
||||
pub use layout::{FrameMetrics, PageLayout, PaneKit, WidthClass};
|
||||
pub use model::{Detail, Instances, Meta, Model, Row};
|
||||
|
||||
@@ -141,6 +142,14 @@ pub enum Message {
|
||||
/// 载荷是**用户请求值**(未钳位):钳位与 CPU 档降级在 `appearance::alpha` 里做,
|
||||
/// 页面只表达意图(与组件库「不持有业务状态」同一条纪律)。
|
||||
Appearance(appearance::Change),
|
||||
/// 选中下载页的一个版本(M94):**页面内选中**,app 层只改视图模型,不 dispatch。
|
||||
SelectVersion(String),
|
||||
/// 安装指定版本(M94;app 层翻成 `AppCommand::InstallVersion`)。
|
||||
InstallVersion(String),
|
||||
/// 取消正在跑的安装(M94;`AppCommand::CancelInstall`)。
|
||||
CancelInstall,
|
||||
/// 切换下载页分类(M94;app 层翻成 `AppCommand::ListVersions`,`All` 只画现有快照)。
|
||||
SetCategory(Category),
|
||||
}
|
||||
|
||||
/// 页面动作清单(骨架期够用就行;接线时按业务语义重命名/扩充)。
|
||||
@@ -316,7 +325,7 @@ fn render<'a>(
|
||||
|
||||
match model.screen {
|
||||
Screen::Instances => instances::view(ui, metrics, model),
|
||||
Screen::Download => download::view(ui, metrics),
|
||||
Screen::Download => download::view(ui, metrics, &model.download, unlucky_i18n::Lang::En),
|
||||
Screen::Settings => settings::view(ui, metrics, appearance),
|
||||
Screen::Logs => logs::view(ui, metrics),
|
||||
}
|
||||
@@ -353,6 +362,9 @@ pub fn demo_model(screen: Screen, window_width: f32) -> Model {
|
||||
if screen == Screen::Instances {
|
||||
model.instances = instances::demo();
|
||||
}
|
||||
if screen == Screen::Download {
|
||||
model.download = download::demo(unlucky_i18n::Lang::En.catalog());
|
||||
}
|
||||
model
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use unlucky_presenter::router::NavSection;
|
||||
|
||||
use crate::app::components::interaction::Interaction;
|
||||
|
||||
use super::Screen;
|
||||
use super::{Download, Screen};
|
||||
|
||||
/// 实例列表的一行(`ListItem` 的槽位:overline = 运行状态,headline = 名字,supporting = 版本)。
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -83,6 +83,8 @@ pub struct Model {
|
||||
pub active: Option<NavSection>,
|
||||
/// 实例页的数据(其它三页还是占位视觉,不读)
|
||||
pub instances: Instances,
|
||||
/// 下载页的数据(M94:版本列表 / 选中 / 安装进度,全部来自 presenter 快照)
|
||||
pub download: Download,
|
||||
/// 取证用的强制交互态(`--force-state`):`Some` 时页面里的控件按该态画。
|
||||
///
|
||||
/// M90 r2(P3-1)之前这个开关只作用到 `shell` 回退路径,产品页是**静默失效**的;
|
||||
@@ -98,6 +100,7 @@ impl Model {
|
||||
window_width,
|
||||
active,
|
||||
instances: Instances::default(),
|
||||
download: Download::loading(),
|
||||
forced: None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user