mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-26 03:49:11 +00:00
Restore About link icon buttons
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
//! Help ▸ About: the framework's hosted About dialog over the app's info and the baked credits.
|
||||
|
||||
use craft::behavior::IconId;
|
||||
use craft::ui::patterns::form_dialogs::{AboutImage, AboutInfo, AboutLink, AboutTab, HostedAbout};
|
||||
|
||||
use crate::PdfCraftApp;
|
||||
@@ -13,7 +14,7 @@ const LOGO_WHITE: &[u8] = include_bytes!("../../../../docs/brand/artcraft-logo-w
|
||||
|
||||
/// What the About tab shows: PdfCraft's name, blurb and version, the ArtCraft brand, and the community links.
|
||||
fn info() -> AboutInfo {
|
||||
let mut info = AboutInfo::new(
|
||||
let info = AboutInfo::new(
|
||||
"PdfCraft",
|
||||
tl!("A clean-room, open-source PDF application written in Rust. MIT OR Apache-2.0."),
|
||||
pdfcraft_engine::build_info::version(),
|
||||
@@ -21,12 +22,7 @@ fn info() -> AboutInfo {
|
||||
.mark(AboutImage::svg("ArtCraft", MARK))
|
||||
.part_of(AboutImage::svg("ArtCraft", LOGO).dark(LOGO_WHITE))
|
||||
.built_with("Rendering: hayro (bootstrap) · UI: egui · Icons: Lucide (ISC) · Fonts: Inter, JetBrains Mono, Dancing Script (OFL)");
|
||||
let (community, others): (Vec<&pdfcraft_engine::links::Link>, Vec<&pdfcraft_engine::links::Link>) =
|
||||
pdfcraft_engine::links::LINKS.iter().partition(|l| l.url == pdfcraft_engine::links::DISCORD);
|
||||
if let Some(l) = community.first() {
|
||||
info = info.community(AboutLink::new(tl!(l.label).to_string(), l.url));
|
||||
}
|
||||
info.links(others.into_iter().map(|l| AboutLink::new(tl!(l.label).to_string(), l.url)))
|
||||
info.links(pdfcraft_engine::links::LINKS.iter().map(|l| AboutLink::new(tl!(l.label).to_string(), l.url).icon(IconId::new(l.icon))))
|
||||
}
|
||||
|
||||
impl PdfCraftApp {
|
||||
@@ -43,3 +39,16 @@ impl PdfCraftApp {
|
||||
self.open_url(&url);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn about_community_links_keep_their_icons_and_destinations() {
|
||||
let info = super::info();
|
||||
assert_eq!(info.links.len(), pdfcraft_engine::links::LINKS.len());
|
||||
for (shown, expected) in info.links.iter().zip(pdfcraft_engine::links::LINKS) {
|
||||
assert_eq!(shown.url, expected.url);
|
||||
assert_eq!(shown.icon, Some(craft::behavior::IconId::new(expected.icon)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user