Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/dwarves

dwarves-gui/src/about.rs

//! **dwarves About** — the app identity for the shared [`facett_about`] card.
//!
//! dwarves' About popup CONSUMES the shared `facett-about` widget (L5) — the SAME
//! egui `Window` korp (raven logo) and holger use, not a dwarves twin. This module
//! only supplies the DATA: a [`facett_about::Identity`] carrying the embedded forge
//! logo (`assets/dwarves.webp`, transcoded to PNG by `build.rs`) + the wordmark,
//! tagline, and the flavour/framework lines. The render + dismiss + logo decode all
//! live in `facett-about`.

/// The dwarves forge logo, PNG-transcoded from `assets/dwarves.webp` by `build.rs`
/// (two dwarves at the rune-anvil forge, wielding the znippy-rabbit hammer).
pub const DWARVES_LOGO_PNG: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/dwarves_logo.png"));

/// The stable accessible name for the logo (a robot asserts on this alt-text).
pub const LOGO_ALT: &str =
    "dwarves logo — two dwarves at the rune-anvil forge with the znippy-rabbit hammer";

/// Build dwarves' [`facett_about::Identity`] — the data the shared About card renders.
pub fn identity() -> facett_about::Identity {
    facett_about::Identity {
        logo_png: Some(DWARVES_LOGO_PNG.to_vec()),
        logo_alt: LOGO_ALT.to_string(),
        // korp maps its raven flavour line onto `engines`; dwarves maps the forge line.
        engines: vec![
            "Brokkr & Sindri at the rune-anvil — the znippy-rabbit hammer strikes; sparks become artifacts.".to_string(),
        ],
        // holger's FRAMEWORK[] pattern — the shared nordisk leaves dwarves rides on.
        framework: vec![
            "jera — the shared job/zone manager".to_string(),
            "facett — the egui UI framework".to_string(),
            "skidbladnir — service lifecycle + dedicated system user".to_string(),
            "nornir — the workspace/warehouse/funnel brain".to_string(),
        ],
        ..facett_about::Identity::new(
            "dwarves",
            "dwarves",
            // `v<version> (<git hash>)` — the SAME build stamp `dwarves-ui --version`
            // prints, so the About box names WHICH build is running. `DWARVES_GIT_HASH`
            // comes from `build.rs` (pure-fs git read, zero-shell).
            concat!(env!("CARGO_PKG_VERSION"), " (", env!("DWARVES_GIT_HASH"), ")"),
            "the nordisk CI/CD forge — brokkr · sindri · runner",
        )
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    /// The embedded logo is a REAL, decodable PNG (build.rs transcoded the webp) —
    /// RED-when-broken: if the transcode produced garbage / an un-pulled pointer, the
    /// shared widget's LFS-tolerant decode returns None and this fails.
    #[test]
    fn logo_is_a_decodable_png_and_identity_is_well_formed() {
        assert!(!DWARVES_LOGO_PNG.is_empty(), "the logo bytes are embedded");
        let ctx = egui::Context::default();
        let id = identity();
        assert!(id.has_logo(), "identity carries the logo bytes");
        assert!(
            facett_about::logo_texture(&ctx, &id).is_some(),
            "the transcoded PNG decodes to a texture (not an LFS pointer / garbage)"
        );
        // The identity oracle carries the wordmark + logo alt-text a robot asserts.
        let st = facett_about::state_json(&id, false);
        let ok = id.has_logo()
            && facett_about::logo_texture(&ctx, &id).is_some()
            && st["wordmark"] == "dwarves"
            && st["has_logo"] == serde_json::json!(true)
            && st["logo_alt"] == LOGO_ALT;
        assert_eq!(st["wordmark"], "dwarves");
        assert_eq!(st["has_logo"], serde_json::json!(true));
        assert_eq!(st["logo_alt"], LOGO_ALT);

        // The About card is a SHIPPED surface (the shell's startup popup + the Profile
        // tab's identity), so it owes the coverage board a row — reuse edda's testmatrix.
        #[cfg(feature = "testmatrix")]
        nornir_testmatrix::functional_status(
            "dwarves-gui",
            "about_identity_logo_decodes_and_is_well_formed",
            ok,
            "the shared facett-about identity dwarves ships (the startup About card + the Profile tab): build.rs's webp→PNG transcode produces a REALLY decodable texture (not an un-pulled LFS pointer or garbage) and the identity oracle carries the dwarves wordmark, has_logo and logo alt-text",
        );
        let _ = ok;
    }
}