Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
5.5 kB · 113 lines
Rust
at dev
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114//! Page shell and landing page. maud fragments pair with HTMX swaps; the one//! deliberate JS island (static/sky.js) only wraps the SVG viewport — every//! page functions without it (docs/06).
use axum::extract::State;use axum::http::header;use axum::response::IntoResponse;use maud::{html, Markup, DOCTYPE};
use crate::state::SharedState;
pub const HTMX_CDN: &str = "https://unpkg.com/htmx.org@2";
pub fn shell(title: &str, logged_in: bool, body: Markup) -> Markup { html! { (DOCTYPE) html lang="en" { head { meta charset="utf-8"; meta name="viewport" content="width=device-width, initial-scale=1"; title { (title) " · Ideonomics" } script src=(HTMX_CDN) {} style { (maud::PreEscaped(CSS)) } } body { header { a href="/" { "Ideonomics" } nav { a href="/atlas" { "atlas" } @if logged_in { a href="/session" { "session" } form method="post" action="/oauth/logout" style="display:inline" { button type="submit" class="linkish" { "log out" } } } } } main { (body) } footer { p { "The instrument measures articulation, not agreement. Your completions live in your own atproto repo; anyone may build a rival analysis on the same public corpus." } } } } }}
const CSS: &str = r#":root { color-scheme: dark; }* { box-sizing: border-box; }body { margin: 0; background: #05060f; color: #c9d4f0; font-family: Georgia, 'Times New Roman', serif; line-height: 1.55; }a { color: #8fb0e8; }header { display: flex; justify-content: space-between; padding: 1rem 2rem; border-bottom: 1px solid #1a2138; }header a { text-decoration: none; margin-right: 1rem; }main { max-width: 62rem; margin: 0 auto; padding: 2rem; }footer { max-width: 62rem; margin: 2rem auto; padding: 0 2rem; color: #5d6784; font-size: .85rem; }input[type=text] { background: #0b1026; color: #c9d4f0; border: 1px solid #2a3457; padding: .55rem .8rem; font: inherit; border-radius: 4px; width: 100%; max-width: 24rem; }button { background: #1c2749; color: #c9d4f0; border: 1px solid #33406b; padding: .5rem 1rem; font: inherit; border-radius: 4px; cursor: pointer; }button:hover { background: #26345f; }button.linkish { background: none; border: none; color: #8fb0e8; text-decoration: underline; padding: 0; }.square { font-size: 1.7rem; text-align: center; margin: 2.5rem 0 1.5rem; letter-spacing: .02em; }.square .open { color: #e8c76a; border-bottom: 2px dotted #e8c76a; padding: 0 .35em; }.modes { display: flex; gap: .6rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }.modes button.alt { background: #10152b; color: #7d89ad; font-size: .85rem; }.rivals { margin-top: 2.2rem; border-top: 1px solid #1a2138; padding-top: 1.2rem; }.rival { display: flex; gap: .7rem; align-items: baseline; margin: .5rem 0; }.rival .text { color: #e0e6f5; }.rival button { font-size: .78rem; padding: .2rem .55rem; }.skywrap { border: 1px solid #1a2138; border-radius: 6px; overflow: hidden; }.skywrap svg { display: block; width: 100%; height: auto; }.frame-note { color: #5d6784; font-size: .82rem; margin-top: .6rem; }.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }.termlist { columns: 2; font-size: .95rem; }table { border-collapse: collapse; }td, th { padding: .3rem .7rem; border-bottom: 1px solid #1a2138; text-align: left; }.err { color: #d98a7a; }@media (prefers-reduced-motion: no-preference) { .star, .dark-star { transition: transform .6s ease; } }"#;
pub async fn landing(State(state): State<SharedState>) -> Markup { let _ = &state; shell( "an instrument", false, html! { h1 { "a : b :: c : ?" } p { "This instrument presents analogical squares — three terms fixed, the fourth yours — " "and iterates, chaining your own completions back into new squares. What it measures is not " "the words you pick but the relations you are forced to abduce. The reward is a constellation: " "a rendered sky of your semantic graph, honest enough to show a bright pole star, diffuse static, " "or a dimensional smear, depending on what your data actually supports." } p { "Your completions are testimony: they are written to your own atproto repo under " code { "app.ideonomics.*" } ", portable and app-independent. What this app concludes about them stays here, versioned and auditable." } form method="post" action="/oauth/login" { label for="handle" { "Log in with your atproto handle (e.g. you.bsky.social):" } br; input type="text" id="handle" name="handle" placeholder="handle.example.com" required; button type="submit" { "begin" } } }, )}
pub async fn sky_js() -> impl IntoResponse { ( [(header::CONTENT_TYPE, "application/javascript")], include_str!("../../static/sky.js"), )}