Start with visible links. Each destination is a real route that can be opened directly, refreshed or shared. Page keeps stable paths separate from translated wording; root accounts for the route's depth so links also work beneath an embedded preview directory.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"fission.toml","value":"fission-toml"},{"index":1,"label":"src/lib.rs","value":"src-lib-rs"},{"index":2,"label":"src/page.rs","value":"src-page-rs"},{"index":3,"label":"src/navigation.rs","value":"src-navigation-rs"},{"index":4,"label":"src/translations.rs","value":"src-translations-rs"},{"index":5,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"},{"index":6,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"},{"index":7,"label":"assets/navigation.css","value":"assets-navigation-css"}]}
{"id":"fission-tabs-1","index":0,"label":"fission.toml","value":"fission-toml"}
targets = ["static-site"]
[app]
name = "harbour-site"
app_id = "rs.example.harbour.site"
[site]
routes = []
entry = "crate::site_app"
title = "Harbour software"
description = "Project tools for desktop and mobile work."
base_url = "https://harbour-site.example.com"
out_dir = "dist/site"
default_locale = "en-US"
locales = ["en-US", "es-ES"]
generate_sitemap = true
generate_robots = true
asset_dirs = ["assets"]
css_files = ["assets/navigation.css"]
{"id":"fission-tabs-1","index":1,"label":"src/lib.rs","value":"src-lib-rs"}
pub mod page;
mod navigation;
mod translations;
pub fn site_app() -> fission::site::FissionSite {
use page::{Page, ProductPage};
let mut site = fission::site::FissionSite::new().with_env(translations::create_env());
for page in [Page::Home, Page::Overview, Page::Desktop, Page::Mobile] {
site = site.route_widget::<(), _>(page.path(), page.title(),
Some(page.description().into()), ProductPage::new(page));
}
site
}
pub fn build_site() -> anyhow::Result<()> {
fission::site::build_from_cli(site_app())
}
{"id":"fission-tabs-1","index":2,"label":"src/page.rs","value":"src-page-rs"}
use crate::navigation::ProductNavigation;
use fission::prelude::*;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Page { Home, Overview, Desktop, Mobile }
impl Page {
pub fn path(self) -> &'static str {
match self { Self::Home => "/", Self::Overview => "/products/",
Self::Desktop => "/products/desktop/", Self::Mobile => "/products/mobile/" }
}
pub fn root(self) -> &'static str {
match self { Self::Home => "", Self::Overview => "../", _ => "../../" }
}
pub fn title(self) -> &'static str {
match self { Self::Home => "Harbour software", Self::Overview => "Harbour products",
Self::Desktop => "Harbour desktop tools", Self::Mobile => "Harbour mobile tools" }
}
pub fn description(self) -> &'static str {
match self {
Self::Home => "Keep a project plan available at the desk and in the field.",
Self::Overview => "Compare Harbour's desktop and mobile project tools.",
Self::Desktop => "Review the plan and assign the next task from a desktop.",
Self::Mobile => "Take the next task into the field on Android and iOS.",
}
}
pub fn content_keys(self) -> (&'static str, &'static str) {
match self { Self::Home => ("home.title", "home.body"),
Self::Overview => ("overview.title", "overview.body"),
Self::Desktop => ("desktop.title", "desktop.body"),
Self::Mobile => ("mobile.title", "mobile.body") }
}
}
fission_component! {
pub ProductPage<()> { props { page: Page } }
view(site, _state, cx) {
let tokens = &cx.view.env().theme.tokens;
let (title, body) = site.page.content_keys();
} =>
Container(Column(gap: tokens.spacing.xl, children: [
ProductNavigation(site.page),
SemanticsRegion(identifier: Some("site-main".into()), child:
Column(gap: tokens.spacing.m, children: [
SemanticsRegion(identifier: Some("site-heading-1:title".into()), child:
Text(cx.tr(title)).size(tokens.typography.heading1_size)),
Text(cx.tr(body)),
Link::to(cx.tr("nav.overview"), format!("{}products/", site.page.root())),
])),
])).padding_all(tokens.spacing.l).bg(tokens.colors.background)
}
{"id":"fission-tabs-1","index":3,"label":"src/navigation.rs","value":"src-navigation-rs"}
use crate::page::Page;
use fission::prelude::*;
fission_component! {
pub ProductNavigation<()> { props { page: Page } }
view(nav, _state, cx) {
let tokens = &cx.view.env().theme.tokens;
let root = nav.page.root();
} =>
SemanticsRegion(identifier: Some("site-navigation".into()), label: Some(cx.tr("nav.label")), child:
Row(gap: tokens.spacing.m, wrap: ir_op::FlexWrap::Wrap, children: [
Link::to(cx.tr("brand"), if root.is_empty() { "./" } else { root }),
Link::to(cx.tr("nav.overview"), format!("{root}products/")),
Link::to(cx.tr("nav.desktop"), format!("{root}products/desktop/")),
Link::to(cx.tr("nav.mobile"), format!("{root}products/mobile/")),
]))
}
{"id":"fission-tabs-1","index":4,"label":"src/translations.rs","value":"src-translations-rs"}
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;
use std::collections::HashMap;
pub fn create_env() -> Env {
let mut env = Env::default();
env.locale = Locale::from("en-US");
for (locale, source) in [
("en-US", include_str!("../i18n/en-US.yaml")),
("es-ES", include_str!("../i18n/es-ES.yaml")),
] {
let messages: HashMap<String, String> =
serde_yaml::from_str(source).expect("checked-in translations must be valid YAML");
env.i18n.add_bundle(TranslationBundle { locale: Locale::from(locale), messages });
}
env
}
{"id":"fission-tabs-1","index":5,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"}
brand: "Harbour"
nav.label: "Product navigation"
nav.overview: "Products overview"
nav.desktop: "Desktop tools"
nav.mobile: "Mobile tools"
nav.pages: "Product pages"
home.title: "Keep the plan available where the work happens"
home.body: "A team needs the same task and owner at the desk and in the field. Harbour's product pages explain what each interface is intended to do."
overview.title: "Choose the interface for the next task"
overview.body: "Use a desktop to review and assign work. Use a phone to consult the next task away from the desk. These are fictional product descriptions, not downloads or promises of an implemented service."
desktop.title: "Review the plan at a desk"
desktop.body: "Compare tasks, check the owner and decide what should happen next. A wider screen makes those related facts easier to inspect together."
mobile.title: "Take the next task into the field"
mobile.body: "A phone view should put the assigned task and useful context first. It should not shrink a desktop dashboard until every control becomes difficult to reach."
{"id":"fission-tabs-1","index":6,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}
brand: "Harbour"
nav.label: "Navegación de productos"
nav.overview: "Resumen de productos"
nav.desktop: "Herramientas de escritorio"
nav.mobile: "Herramientas móviles"
nav.pages: "Páginas de productos"
home.title: "Mantén el plan disponible donde se realiza el trabajo"
home.body: "El equipo necesita la misma tarea y responsable en la oficina y fuera de ella. Estas páginas explican para qué sirve cada interfaz."
overview.title: "Elige la interfaz para la siguiente tarea"
overview.body: "Usa el escritorio para revisar y asignar trabajo. Consulta la tarea en el teléfono fuera de la oficina. Son descripciones de productos ficticios, no descargas ni servicios implementados."
desktop.title: "Revisa el plan en el escritorio"
desktop.body: "Compara tareas, revisa quién es responsable y decide qué sigue. Una pantalla amplia permite consultar esos datos relacionados juntos."
mobile.title: "Lleva la siguiente tarea contigo"
mobile.body: "La vista móvil debe mostrar primero la tarea asignada y su contexto. No debe reducir un panel de escritorio hasta volver difíciles sus controles."
{"id":"fission-tabs-1","index":7,"label":"assets/navigation.css","value":"assets-navigation-css"}
a:focus-visible, summary:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }
{"id":"fission-tabs-1"}