fix(packui): M113 收口 —— 导出的「Save to」字段形状与「没进包」标题承诺
复审看图挑出的两处,只改这两处,其余不动。
1. **Save to 字段**:原来是 `label("Save to (empty = suggested)")` + 空值,看起来像「这句提示就是字段值」,
与上面 Pack name / Version 的「标签在上、值在下」不一致。改成短标签 `Save to` + 占位
`empty = suggested path`(新增 `PackExportOutputPlaceholder` 一个键)。
2. **`Not in the pack (listed one by one)` 与 `...and 6 more files` 自相矛盾**:13 条没进包的其实全列了,
但紧随其后的「还有 6 个」说的是**内联样例**的截断,两句挨着会被读成一件事。
改法:「没进包」标题带真实计数(`Not in the pack: {count}`),内联样例加自己的标题
`Copied into overrides/ (first {shown}):`,截断那句改成 `…and {count} more files (not shown here)`
—— 谁被截断、截了几条,写在它自己的那一块里。
`tolerable_title` 因此改成收 `String`(计数是运行时 format 出来的),`golden.rs` 同步三个键。
门禁:`cargo fmt --all --check` 通过;`cargo test -p unlucky-app-iced --lib -j 2`
504 passed / 0 failed(TEST_EXIT=0);`cargo check -p unlucky-app-iced --all-targets` 零 warning。
出图:`04-export-light.png` / `04-export-dark.png` 已重出(其余 8 张未受影响、未改动)。
This commit is contained in:
1 parent
5f09b8113a
commit
27bbc74eaa
5 files changed
+51
-19
No files matched your search
@@ -101,9 +101,12 @@ pub(super) fn export_block<'a>(
|
|||||||
Field::new(export.version.as_str()).label(catalog.text(Key::PackExportVersion)),
|
Field::new(export.version.as_str()).label(catalog.text(Key::PackExportVersion)),
|
||||||
move |text| intent(PackMessage::SetExportVersion(text)),
|
move |text| intent(PackMessage::SetExportVersion(text)),
|
||||||
));
|
));
|
||||||
|
// 标签在上、占位在下:**别让占位文字看起来像已填的值**(复审提过这张图的观感)
|
||||||
block = block.push(text_field(
|
block = block.push(text_field(
|
||||||
ui,
|
ui,
|
||||||
Field::new(export.output.as_str()).label(catalog.text(Key::PackExportOutput)),
|
Field::new(export.output.as_str())
|
||||||
|
.label(catalog.text(Key::PackExportOutput))
|
||||||
|
.placeholder(catalog.text(Key::PackExportOutputPlaceholder)),
|
||||||
move |text| intent(PackMessage::SetOutput(text)),
|
move |text| intent(PackMessage::SetOutput(text)),
|
||||||
));
|
));
|
||||||
block = block.push(
|
block = block.push(
|
||||||
@@ -224,10 +227,14 @@ pub(super) fn preview_block<'a>(
|
|||||||
.width(Length::Fill);
|
.width(Length::Fill);
|
||||||
|
|
||||||
if !preview.skipped.is_empty() {
|
if !preview.skipped.is_empty() {
|
||||||
|
// 标题写成「Not in the pack: 13」而不是「逐条列出」:13 条**确实**全列出来了,
|
||||||
|
// 但下面那个「…还有 N 个(这里不展开)」说的是**内联样例**,两句挨着容易被读成矛盾
|
||||||
block = block.push(tolerable_title(
|
block = block.push(tolerable_title(
|
||||||
ui,
|
ui,
|
||||||
catalog,
|
catalog.render(
|
||||||
catalog.text(Key::PackPreviewSkippedTitle),
|
Key::PackPreviewSkippedTitle,
|
||||||
|
&[("count", &preview.skipped.len().to_string())],
|
||||||
|
),
|
||||||
));
|
));
|
||||||
block = block.push(rows_block(ui, catalog, &preview.skipped));
|
block = block.push(rows_block(ui, catalog, &preview.skipped));
|
||||||
}
|
}
|
||||||
@@ -235,6 +242,19 @@ pub(super) fn preview_block<'a>(
|
|||||||
// 样例 + 已知损失一起套有界滚动:预检是「摊开给你看」的块,条目多时它会把
|
// 样例 + 已知损失一起套有界滚动:预检是「摊开给你看」的块,条目多时它会把
|
||||||
// 「确认写盘」顶出屏幕(出图时实测到了)
|
// 「确认写盘」顶出屏幕(出图时实测到了)
|
||||||
let mut extras = column![].spacing(ui.space(Space::X1)).width(Length::Fill);
|
let mut extras = column![].spacing(ui.space(Space::X1)).width(Length::Fill);
|
||||||
|
if !preview.inline_sample.is_empty() {
|
||||||
|
// 给样例一句自己的标题 + 说明只列前几条(截断要说出来)
|
||||||
|
extras = extras.push(frame::text_role_owned(
|
||||||
|
ui,
|
||||||
|
TypeRole::LabelMedium,
|
||||||
|
false,
|
||||||
|
catalog.render(
|
||||||
|
Key::PackPreviewInlineTitle,
|
||||||
|
&[("shown", &preview.inline_sample.len().to_string())],
|
||||||
|
),
|
||||||
|
ui.color(Role::OnSurfaceVariant),
|
||||||
|
));
|
||||||
|
}
|
||||||
for path in &preview.inline_sample {
|
for path in &preview.inline_sample {
|
||||||
extras = extras.push(frame::text_role(
|
extras = extras.push(frame::text_role(
|
||||||
ui,
|
ui,
|
||||||
|
|||||||
@@ -41,15 +41,14 @@ pub(super) fn marker_box<'a>(
|
|||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn tolerable_title<'a>(
|
/// 容忍域的标题(`Warn` 图标 + 三级色)。
|
||||||
ui: &'a Ui,
|
///
|
||||||
catalog: Catalog,
|
/// 收 `String` 而不是 `&str`:标题要带计数(`Not in the pack: 13`),而计数是运行时 `format!`
|
||||||
title: &'a str,
|
/// 出来的,借用不出去。
|
||||||
) -> Element<'a, PageMessage> {
|
pub(super) fn tolerable_title(ui: &Ui, title: String) -> Element<'_, PageMessage> {
|
||||||
let _ = catalog;
|
|
||||||
row![
|
row![
|
||||||
frame::glyph(IconKind::Warn, ui.color(Role::Tertiary), frame::ICON_PX),
|
frame::glyph(IconKind::Warn, ui.color(Role::Tertiary), frame::ICON_PX),
|
||||||
frame::text_role(
|
frame::text_role_owned(
|
||||||
ui,
|
ui,
|
||||||
TypeRole::LabelLarge,
|
TypeRole::LabelLarge,
|
||||||
true,
|
true,
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ pub(super) fn report_block<'a>(
|
|||||||
if let Some(title) = &report.missing_title {
|
if let Some(title) = &report.missing_title {
|
||||||
block = block.push(
|
block = block.push(
|
||||||
column![
|
column![
|
||||||
tolerable_title(ui, catalog, title.as_str()),
|
tolerable_title(ui, title.clone()),
|
||||||
bounded(
|
bounded(
|
||||||
ui,
|
ui,
|
||||||
rows_block(ui, catalog, &report.missing),
|
rows_block(ui, catalog, &report.missing),
|
||||||
@@ -138,7 +138,7 @@ pub(super) fn report_block<'a>(
|
|||||||
if let Some(title) = &report.conflicts_title {
|
if let Some(title) = &report.conflicts_title {
|
||||||
block = block.push(
|
block = block.push(
|
||||||
column![
|
column![
|
||||||
tolerable_title(ui, catalog, title.as_str()),
|
tolerable_title(ui, title.clone()),
|
||||||
bounded(
|
bounded(
|
||||||
ui,
|
ui,
|
||||||
column(
|
column(
|
||||||
|
|||||||
@@ -173,7 +173,11 @@ macro_rules! content_entries {
|
|||||||
PackExportFormat => ("Format", "格式"),
|
PackExportFormat => ("Format", "格式"),
|
||||||
PackExportName => ("Pack name", "包名"),
|
PackExportName => ("Pack name", "包名"),
|
||||||
PackExportVersion => ("Version", "版本"),
|
PackExportVersion => ("Version", "版本"),
|
||||||
PackExportOutput => ("Save to (empty = suggested)", "保存到(留空 = 自动)"),
|
PackExportOutput => ("Save to", "保存到"),
|
||||||
|
PackExportOutputPlaceholder => (
|
||||||
|
"empty = suggested path",
|
||||||
|
"留空 = 自动给一个路径"
|
||||||
|
),
|
||||||
PackExportPrecheck => ("Dry run", "预检"),
|
PackExportPrecheck => ("Dry run", "预检"),
|
||||||
PackExportConfirm => ("Write the pack", "确认写盘"),
|
PackExportConfirm => ("Write the pack", "确认写盘"),
|
||||||
PackExportAbort => ("Back", "返回"),
|
PackExportAbort => ("Back", "返回"),
|
||||||
@@ -196,13 +200,20 @@ macro_rules! content_entries {
|
|||||||
"{bytes} copied into overrides/",
|
"{bytes} copied into overrides/",
|
||||||
"{bytes} 会原样拷进 overrides/"
|
"{bytes} 会原样拷进 overrides/"
|
||||||
),
|
),
|
||||||
|
PackPreviewInlineTitle => (
|
||||||
|
"Copied into overrides/ (first {shown}):",
|
||||||
|
"原样拷进 overrides/(只列前 {shown} 个):"
|
||||||
|
),
|
||||||
PackPreviewSkippedTitle => (
|
PackPreviewSkippedTitle => (
|
||||||
"Not in the pack (listed one by one)",
|
"Not in the pack: {count}",
|
||||||
"没进包(逐条列出)"
|
"没进包:{count} 项"
|
||||||
),
|
),
|
||||||
PackPreviewNotes => ("Known losses", "已知损失"),
|
PackPreviewNotes => ("Known losses", "已知损失"),
|
||||||
PackPreviewTarget => ("Will be written to {path}", "将写到 {path}"),
|
PackPreviewTarget => ("Will be written to {path}", "将写到 {path}"),
|
||||||
PackPreviewMore => ("…and {count} more files", "…还有 {count} 个文件"),
|
PackPreviewMore => (
|
||||||
|
"…and {count} more files (not shown here)",
|
||||||
|
"…还有 {count} 个文件(这里不展开)"
|
||||||
|
),
|
||||||
PackPreviewComplete => ("Nothing is left out", "没有遗漏任何文件"),
|
PackPreviewComplete => ("Nothing is left out", "没有遗漏任何文件"),
|
||||||
PackPreviewIncomplete => (
|
PackPreviewIncomplete => (
|
||||||
"Some files will not be in the pack",
|
"Some files will not be in the pack",
|
||||||
|
|||||||
@@ -272,7 +272,8 @@ pub(super) const GOLDEN: &[(&str, &str, &str)] = &[
|
|||||||
("PackExportFormat", "Format", "格式"),
|
("PackExportFormat", "Format", "格式"),
|
||||||
("PackExportName", "Pack name", "包名"),
|
("PackExportName", "Pack name", "包名"),
|
||||||
("PackExportVersion", "Version", "版本"),
|
("PackExportVersion", "Version", "版本"),
|
||||||
("PackExportOutput", "Save to (empty = suggested)", "保存到(留空 = 自动)"),
|
("PackExportOutput", "Save to", "保存到"),
|
||||||
|
("PackExportOutputPlaceholder", "empty = suggested path", "留空 = 自动给一个路径"),
|
||||||
("PackExportPrecheck", "Dry run", "预检"),
|
("PackExportPrecheck", "Dry run", "预检"),
|
||||||
("PackExportConfirm", "Write the pack", "确认写盘"),
|
("PackExportConfirm", "Write the pack", "确认写盘"),
|
||||||
("PackExportAbort", "Back", "返回"),
|
("PackExportAbort", "Back", "返回"),
|
||||||
@@ -283,10 +284,11 @@ pub(super) const GOLDEN: &[(&str, &str, &str)] = &[
|
|||||||
("PackPreviewHead", "Will inline {inline} files · cannot export: {skipped}", "将内联 {inline} 个文件 · 无法导出 {skipped} 项"),
|
("PackPreviewHead", "Will inline {inline} files · cannot export: {skipped}", "将内联 {inline} 个文件 · 无法导出 {skipped} 项"),
|
||||||
("PackPreviewRemote", "{count} files can be referenced remotely", "{count} 个文件可走远程引用"),
|
("PackPreviewRemote", "{count} files can be referenced remotely", "{count} 个文件可走远程引用"),
|
||||||
("PackPreviewInlineBytes", "{bytes} copied into overrides/", "{bytes} 会原样拷进 overrides/"),
|
("PackPreviewInlineBytes", "{bytes} copied into overrides/", "{bytes} 会原样拷进 overrides/"),
|
||||||
("PackPreviewSkippedTitle", "Not in the pack (listed one by one)", "没进包(逐条列出)"),
|
("PackPreviewInlineTitle", "Copied into overrides/ (first {shown}):", "原样拷进 overrides/(只列前 {shown} 个):"),
|
||||||
|
("PackPreviewSkippedTitle", "Not in the pack: {count}", "没进包:{count} 项"),
|
||||||
("PackPreviewNotes", "Known losses", "已知损失"),
|
("PackPreviewNotes", "Known losses", "已知损失"),
|
||||||
("PackPreviewTarget", "Will be written to {path}", "将写到 {path}"),
|
("PackPreviewTarget", "Will be written to {path}", "将写到 {path}"),
|
||||||
("PackPreviewMore", "…and {count} more files", "…还有 {count} 个文件"),
|
("PackPreviewMore", "…and {count} more files (not shown here)", "…还有 {count} 个文件(这里不展开)"),
|
||||||
("PackPreviewComplete", "Nothing is left out", "没有遗漏任何文件"),
|
("PackPreviewComplete", "Nothing is left out", "没有遗漏任何文件"),
|
||||||
("PackPreviewIncomplete", "Some files will not be in the pack", "有文件不会进包"),
|
("PackPreviewIncomplete", "Some files will not be in the pack", "有文件不会进包"),
|
||||||
("PackReasonModrinthSha1", "Modrinth match (SHA-1)", "Modrinth 命中(SHA-1)"),
|
("PackReasonModrinthSha1", "Modrinth match (SHA-1)", "Modrinth 命中(SHA-1)"),
|
||||||
|
|||||||
Reference in new issue
Block a user