From d37480fb7204dfd79488b6ac95f34223f8866c24 Mon Sep 17 00:00:00 2001 From: slhx agent Date: Fri, 5 Jun 2026 09:22:52 +0200 Subject: [PATCH] feat(examples): derive saas dashboard template Replace the SaaS tutorial dashboard's hand-written Hemplate implementation with the real hemplate-derived dashboard template. This closes the tutorial skeleton shortcut and keeps the provider-light production app path on generated/derived rendering. req: examples/001 req: canonical_authoring/001 req: view/001 --- examples/saas/src/lib.rs | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/examples/saas/src/lib.rs b/examples/saas/src/lib.rs index 848b706..76fb134 100644 --- a/examples/saas/src/lib.rs +++ b/examples/saas/src/lib.rs @@ -7,7 +7,7 @@ use hemx_axum::{ interactions, Form, HandlerErrorContext, HandlerFailure, IntoHandlerFailure, Registry, State, }; use std::convert::Infallible; -use std::fmt::{Display, Write as _}; +use std::fmt::Display; use std::str::FromStr; use std::sync::{Arc, Mutex}; @@ -174,6 +174,7 @@ impl IntoHandlerFailure for AppError { } } +#[derive(Hemplate)] pub struct Dashboard { csrf: CsrfToken, flash: String, @@ -203,42 +204,6 @@ pub struct ProjectRow { owner: String, } -impl Hemplate for Dashboard { - fn render_into(&self, buf: &mut String) -> Result<(), hemplate::error::HemplateError> { - buf.push_str("
\n"); - buf.push_str("

Production-shaped SaaS path

Projects

Auth-gated mutations, CSRF checks, local persistence, typed forms, generated swaps, page swaps, live status, plain CSS, and one explicit island.

\n"); - buf.push_str(" \n"); - buf.push_str("
\n"); - buf.push_str("
\n"); - write!( - buf, - " \n", - hemplate::HtmlEscape(&self.csrf.to_string()) - )?; - buf.push_str("

\n
\n"); - write!( - buf, - "

{}

\n", - hemplate::HtmlEscape(&self.flash) - )?; - write!( - buf, - "

{}

\n", - hemplate::HtmlEscape(&self.summary) - )?; - buf.push_str("
    \n"); - for row in &self.rows { - buf.push_str(" "); - row.render_into(buf)?; - buf.push('\n'); - } - buf.push_str("
\n
\n

Waiting for status…

"); - write!(buf, "

Metrics island

Waiting for island script…

", self.project_count)?; - buf.push_str("
\n
\n"); - Ok(()) - } -} - impl From for ProjectRow { fn from(record: ProjectRecord) -> Self { Self {