Space Audit: the explanation sits under the title without the repeated row label; save conflict prompt in production's words and buttons

This commit is contained in:
Dylan M. Taylor
2026-11-22 05:05:22 -05:00
parent b533521af9
commit db8a0b656e
2 changed files with 37 additions and 22 deletions
+11 -1
View File
@@ -179,7 +179,17 @@ impl PdfCraftApp {
SaveStep::AskChangedOnDisk { key, .. } => {
// The file on disk is another version than the document came from (#2166).
let name = self.session.get(key).map(|d| d.name.clone()).unwrap_or_default();
let prompt = crate::dialogs::host::open(self, StandardPrompt::changed_on_disk(name));
// Production's wording and buttons: Save anyway is an ordinary answer, not a red Replace.
let message = crate::i18n::fmt(
tl!("“{name}” changed on disk after it was opened or last saved. Saving now replaces that newer version with this one."),
&[("name", &name)],
);
let prompt = StandardPrompt::custom(message)
.title(tl!("Save over the changed file?").to_string())
.button(PromptChoice::Proceed, tl!("Save anyway").to_string())
.button(PromptChoice::Alternate, tl!("Save as…").to_string())
.button(PromptChoice::Cancel, tl!("Cancel").to_string());
let prompt = crate::dialogs::host::open(self, prompt);
if let Some(pending) = self.pending_save.as_mut().filter(|p| p.key == key) {
pending.prompt = Some(prompt);
}
+26 -21
View File
@@ -9,9 +9,10 @@ use std::sync::{Arc, Mutex, PoisonError, RwLock};
use craft::behavior::{ColumnKey, ColumnWidth, DisplayOrder, ItemSource};
use craft::host::queue::{JobQueue, Priority};
use craft::ui::contract::{Bind, ColumnSpec, Props as _, SelectMode, Show as _, ShowCollection as _, Sizing};
use craft::ui::contract::{Bind, ColumnSpec, Props as _, SelectMode, Show as _, ShowCollection as _, ShowContainer as _, Sizing};
use craft::ui::dialog::{DialogResult, dialog_id};
use craft::ui::display::Text;
use craft::ui::layout_components::Stack;
use craft::ui::list::ListRow;
use craft::ui::patterns::form_dialogs::{DialogFields, FieldValue, HostedParamDialog, Param, ParamDialog, ParamKind, ParamTab, SharedRows};
use craft::ui::table::Table;
@@ -499,27 +500,31 @@ impl ItemSource<usize> for AuditRows<'_> {}
fn audit_row(rows: Arc<RwLock<Vec<SpaceUse>>>) -> Param {
Param::custom("space-audit", tl!("Space Audit"), move |ui, _fields, _cx| {
let lines = audit_lines(&rows.read().unwrap_or_else(PoisonError::into_inner));
Text::new(tl!("What takes up the space in this file, by kind of content.")).show(ui);
let columns = vec![
ColumnSpec::new(DESCRIPTION, tl!("Description"), ColumnWidth::Content),
ColumnSpec::new(BYTES, tl!("Bytes"), ColumnWidth::Content).numeric(),
ColumnSpec::new(PERCENTAGE, tl!("Percentage"), ColumnWidth::Content).numeric(),
];
Table::<usize>::new(tl!("Space Audit"), columns)
.select(SelectMode::None)
.sizing(Sizing::Content)
.natural_height(true)
.striped(true)
.show_items(ui, &AuditRows(&lines), &mut |at, icx| {
let Some(line) = lines.get(*at) else { return ListRow::new("") };
ListRow::new(line.description.clone())
.cells(icx.cells())
.striped(icx.row.striped)
.cell(BYTES, line.bytes.clone())
.cell(PERCENTAGE, line.percentage.clone())
})
.response
let shown = Stack::new().fill_width().show(ui, |ui, _| {
Text::new(tl!("What takes up the space in this file, by kind of content.")).show(ui);
let columns = vec![
ColumnSpec::new(DESCRIPTION, tl!("Description"), ColumnWidth::Content),
ColumnSpec::new(BYTES, tl!("Bytes"), ColumnWidth::Content).numeric(),
ColumnSpec::new(PERCENTAGE, tl!("Percentage"), ColumnWidth::Content).numeric(),
];
Table::<usize>::new(tl!("Space Audit"), columns)
.select(SelectMode::None)
.sizing(Sizing::Content)
.natural_height(true)
.striped(true)
.show_items(ui, &AuditRows(&lines), &mut |at, icx| {
let Some(line) = lines.get(*at) else { return ListRow::new("") };
ListRow::new(line.description.clone())
.cells(icx.cells())
.striped(icx.row.striped)
.cell(BYTES, line.bytes.clone())
.cell(PERCENTAGE, line.percentage.clone())
})
.response
});
shown.inner.unwrap_or(shown.output)
})
.full_width()
}
/// The Space Audit row, for a dialog that shows the audit among other rows (Properties ▸ Space Audit): reads the app's shared