pub const LOGO_PNG: &[u8] = include_bytes!("../assets/holger-znippy-logo.png");
pub const LOGO_ALT: &str = "holger logo — low-poly Norse warrior with the znippy lightning-rabbit shield";
pub const WORDMARK: &str = "holger";
pub const TAGLINE: &str = "Secure, airgap-ready artifact registry — znippy-backed, immutable, auditable.";
pub const FRAMEWORK: &[&str] = &[
"skidbladnir — service lifecycle (install/start/status/health + dedicated user)",
"nornir-service — the one tonic serve loop + auth interceptor",
"jera — the shared job manager (promote/GC + the Tools demo container)",
"facett — the shared egui UI framework (look, menu, tables, 3D graph)",
];
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn state_json(open: bool) -> serde_json::Value {
serde_json::json!({
"open": open,
"wordmark": WORDMARK,
"version": VERSION,
"tagline": TAGLINE,
"logo_alt": LOGO_ALT,
"has_logo": !LOGO_PNG.is_empty(),
"framework": FRAMEWORK,
})
}
#[cfg(feature = "gui")]
pub fn logo_texture(ctx: &egui::Context) -> Option<egui::TextureHandle> {
let img = image::load_from_memory(LOGO_PNG).ok()?.to_rgba8();
let (w, h) = img.dimensions();
let color = egui::ColorImage::from_rgba_unmultiplied([w as usize, h as usize], img.as_raw());
Some(ctx.load_texture("holger_about_logo", color, egui::TextureOptions::LINEAR))
}
#[cfg(feature = "gui")]
pub fn draw_about_window(
ctx: &egui::Context,
open: &mut bool,
logo: Option<&egui::TextureHandle>,
) -> bool {
if !*open {
return false;
}
let mut window_open = true;
let mut close_clicked = false;
egui::Window::new("About holger")
.collapsible(false)
.resizable(false)
.anchor(egui::Align2::CENTER_CENTER, egui::vec2(0.0, 0.0))
.open(&mut window_open)
.show(ctx, |ui| {
ui.vertical_centered(|ui| {
if let Some(logo) = logo {
ui.add(
egui::Image::from_texture(logo)
.max_width(360.0)
.alt_text(LOGO_ALT),
);
}
ui.add_space(10.0);
ui.heading(WORDMARK);
ui.label(egui::RichText::new(format!("v{VERSION}")).monospace().strong());
ui.label(TAGLINE);
ui.add_space(8.0);
ui.label(egui::RichText::new("Built on the shared nordisk framework:").weak());
for line in FRAMEWORK {
ui.label(egui::RichText::new(format!("· {line}")).small());
}
ui.add_space(10.0);
if ui.button("Close").clicked() {
close_clicked = true;
}
});
});
let dismissed = !window_open || close_clicked;
if dismissed {
*open = false;
}
dismissed
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn about_oracle_carries_identity_and_framework() {
assert!(!LOGO_PNG.is_empty(), "the holger logo is embedded (non-empty)");
let real_png = LOGO_PNG.starts_with(b"\x89PNG");
let lfs_pointer = LOGO_PNG.starts_with(b"version https://git-lfs");
assert!(real_png || lfs_pointer, "the embedded logo is a real PNG or its LFS pointer");
let closed = state_json(false);
assert_eq!(closed["open"], serde_json::json!(false));
assert_eq!(closed["wordmark"], serde_json::json!(WORDMARK));
assert_eq!(closed["version"], serde_json::json!(VERSION));
assert!(!VERSION.is_empty(), "the About popup presents a real version string");
assert_eq!(closed["has_logo"], serde_json::json!(true));
let fw = closed["framework"].as_array().expect("framework list");
assert!(!fw.is_empty(), "About names the shared framework components");
assert!(
fw.iter().any(|c| c.as_str().unwrap_or("").contains("jera")),
"About names jera (the shared job manager the Tools demo uses): {fw:?}"
);
let open = state_json(true);
assert_eq!(open["open"], serde_json::json!(true));
#[cfg(feature = "testmatrix")]
nornir_testmatrix::functional_status(
"holger-ui/about",
"oracle_carries_identity_and_framework",
!LOGO_PNG.is_empty()
&& closed["version"] == serde_json::json!(VERSION)
&& !fw.is_empty(),
"the About popup embeds the holger logo + wordmark + version + shared-framework list",
);
}
}