use leptos::prelude::*; use leptos_meta::*; use leptos_router::{ components::{Route, Router, Routes}, path, }; use crate::components::shell::AacShell; /// Where the app is mounted: "" at a site root (aac.transaction.science), or a /// sub-path such as "/app" when a host serves it under its own site. Fixed at /// build time so the prerendered shell and the hydrated client agree. pub const BASE_PATH: &str = match option_env!("AAC_BASE_PATH") { Some(p) => p, None => "", }; /// The service worker to register. A host that serves the app under a /// sub-path usually runs one worker for its whole site, so this is separate /// from `BASE_PATH`. pub const SW_URL: &str = match option_env!("AAC_SW_URL") { Some(p) => p, None => "/sw.js", }; /// Whether to show the session energy meter in the navigation bar. On by /// default (the standard's energy receipt); a host can hide it with /// AAC_HIDE_ENERGY=1 at build time. pub const SHOW_ENERGY: bool = option_env!("AAC_HIDE_ENERGY").is_none(); /// Document title, so a host can present the app under its own name. pub const APP_TITLE: &str = match option_env!("AAC_APP_TITLE") { Some(t) => t, None => "AAC — reference app", // i18n: not UI (the app's name, set by the host) }; /// Before the first paint: the colours the person chose (Settings → Display, /// kept as `aac_display`, persistence.rs) on ``, so the /// starting screen is drawn in them, with no flash of light colours on a dark /// setting. The app applies them fully once its saved state is restored. // i18n: not UI (a script) const COLOR_MODE_SCRIPT: &str = "try{var d=JSON.parse(localStorage.getItem('aac_display')||'null');\ if(d&&typeof d.color_mode==='string')document.documentElement.setAttribute('data-color-mode',d.color_mode)}catch(e){}"; /// HTML document shell for SSR. pub fn shell(options: LeptosOptions) -> impl IntoView { view! {