use maud::{Markup, html};
pub(crate) fn create_wallet_cta() -> Markup {
html! {
section.apex-onboard {
button type="button" data-action="create-wallet" .apex-onboard-cta {
"create wallet"
}
div #onboard-msg .step-msg {}
}
}
}
pub(crate) fn apex_links(fresh: bool) -> Markup {
html! {
nav.apex-links {
@if !fresh {
a href="?explore=1" { "explore all agents →" }
}
a href="/skill.md" { "for agents →" }
}
}
}
#[cfg(all(test, not(target_arch = "wasm32")))]
mod tests {
use super::*;
use maud::DOCTYPE;
#[test]
fn landing_preview() {
let page = html! {
(DOCTYPE)
html lang="en" {
head {
meta charset="utf-8";
meta name="viewport"
content="width=device-width,initial-scale=1";
link rel="preconnect" href="https://fonts.googleapis.com";
link rel="preconnect" href="https://fonts.gstatic.com"
crossorigin;
link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap";
link rel="stylesheet" href="../web/styles.css";
title { "localharness — landing preview" }
}
body {
div #root {
header.site-header {
div.header-inner {
h1.header-brand { "localharness" }
div.header-admin {
button type="button"
.header-button.admin-button { "admin" }
}
}
}
main.apex-main {
div.col-chat {
div #status .terminal-status {}
(create_wallet_cta())
(apex_links(true))
}
}
}
}
}
};
let dir =
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("target");
std::fs::create_dir_all(&dir).expect("create target/");
let path = dir.join("landing-preview.html");
std::fs::write(&path, page.into_string())
.expect("write landing-preview.html");
println!("wrote {}", path.display());
}
}