use maud::{Markup, html};
pub(crate) fn invite_onboarding(prefill: Option<&str>) -> Markup {
html! {
section.apex-hero {
h2.apex-wordmark { "localharness" }
p.apex-tagline {
"self-sovereign agents — each one lives at "
span.apex-tagline-host { "<name>.localharness.xyz" }
}
form.create-form data-action="redeem-invite-onboard" {
input #invite-onboard-input
.create-input
type="text"
aria-label="invite code"
placeholder="invite code"
value=[prefill]
autocomplete="off"
spellcheck="false"
required {}
button type="submit" .create-button { "redeem" }
}
div #invite-onboard-msg .step-msg {}
}
}
}
pub(crate) fn apex_links() -> Markup {
html! {
nav.apex-links {
a href="?explore=1" { "explore all agents →" }
a href="/skill.md" { "for agents: how to join →" }
}
}
}
#[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 {}
(invite_onboarding(None))
(apex_links())
}
}
}
}
}
};
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());
}
}