From 71a130b81ed229f4bf86211256be234a96d6b4e8 Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Thu, 19 Nov 2026 13:30:46 +0000 Subject: [PATCH] look-dialogs-b: Param::options_in_row for radio rows, AboutLayout::Listed for the About tab, with stories and trials Co-Authored-By: Claude Opus 5.5 --- .../src/patterns/form_dialogs/about.rs | 67 +++++++++++++++++-- .../patterns/form_dialogs/about/stories.rs | 11 ++- .../src/patterns/form_dialogs/mod.rs | 2 +- .../src/patterns/form_dialogs/param.rs | 15 +++++ .../src/patterns/form_dialogs/rows.rs | 43 ++++++++---- .../src/patterns/form_dialogs/rows/stories.rs | 5 +- .../tests/it/form_dialogs/about.rs | 31 ++++++++- .../tests/it/form_dialogs/params.rs | 23 +++++++ 8 files changed, 170 insertions(+), 27 deletions(-) diff --git a/crates/ui-patterns/src/patterns/form_dialogs/about.rs b/crates/ui-patterns/src/patterns/form_dialogs/about.rs index 54be862f1..f035242f8 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/about.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/about.rs @@ -45,6 +45,8 @@ craft_ui::words! { about_tab: "aboutDialog.tab" = "About"; contributors_tab: "aboutDialog.contributors" = "Contributors"; models_tab: "aboutDialog.models" = "Models"; + /// The footer button of the listed layout ([`AboutLayout::Listed`]). + close: "aboutDialog.close" = "Close"; version: template "aboutDialog.version" = "Version {version}"; show: "aboutDialog.show" = "Show"; username: "aboutDialog.username" = "Username"; @@ -108,6 +110,18 @@ pub enum AboutTab { App(u8), } +/// How the About tab lays out the app's [`AboutInfo`], and the dialog's footer button. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum AboutLayout { + /// The blurb, the version, the community button and the link row centred, the built-with line faint; OK closes. + #[default] + Centred, + /// From the start edge, one item to a line: the app's name as a heading, the version, the blurb, the community + /// link and then the other links in their order, the built-with line as a faint caption; Close closes. + Listed, +} + /// A tab the app adds after Models: a name for the hosted dialog's `tab` field, a title and a body. /// /// The body is `Send` because a [`HostedAbout`] lives on the dialog stack, which needs its dialogs `Send`. @@ -212,7 +226,8 @@ impl Outcome for AboutOutput { /// Help > About: tabs About, Contributors and Models over the app's [`AboutInfo`] and [`Credits`], with an OK button. /// -/// - **About.** The blurb, the version, the community button and the link row centred, the built-with line faint. +/// - **About.** The blurb, the version, the community button and the link row centred, the built-with line faint; or, +/// with [`AboutLayout::Listed`], the name, version, blurb and links one to a line, and Close for OK. /// - **Contributors.** Show (Username, Display name, Real name), Sort (the list, with a button to reverse) and View /// (Grab bag or Table). The grab bag flows the names as links: a click reports the contributor's profile URL as the /// link (nothing for one without a profile), and the link's tooltip is the summary. The table has every figure; a @@ -237,12 +252,20 @@ pub struct AboutDialog<'a> { #[prop] tab: Option>, app_tabs: Option<&'a mut [AboutAppTab]>, + layout: AboutLayout, } impl<'a> AboutDialog<'a> { /// The dialog over `info` and `credits`, opening on the About tab. pub fn new(info: &'a AboutInfo, credits: &'a Credits) -> Self { - AboutDialog { info, credits, open: None, tab: None, app_tabs: None } + AboutDialog { info, credits, open: None, tab: None, app_tabs: None, layout: AboutLayout::default() } + } + + /// How the About tab lays out the info, and the footer button that goes with it. + #[must_use] + pub fn layout(mut self, layout: AboutLayout) -> Self { + self.layout = layout; + self } /// The app's own tabs, shown after Models. @@ -253,7 +276,7 @@ impl<'a> AboutDialog<'a> { /// Shows the dialog. pub fn show(self, ui: &mut Ui) -> AboutOutput { - let AboutDialog { info, credits, open, tab, mut app_tabs } = self; + let AboutDialog { info, credits, open, tab, mut app_tabs, layout } = self; // The strip shows the titles while the body draws a tab, so it reads its own copy of them. let app_titles: Vec