Phase 5: Page layouts as s-expressions — components, fragments, error pages
Add 9 new shared s-expression components (cart-mini, auth-menu, account-nav-item, calendar-entry-nav, calendar-link-nav, market-link-nav, post-card, base-shell, error-page) and wire them into all fragment route handlers. 404/403 error pages now render entirely via s-expressions as a full-page proof-of-concept, with Jinja fallback on failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,10 @@ def register():
|
||||
# --- container-nav fragment: market links --------------------------------
|
||||
|
||||
async def _container_nav_handler():
|
||||
from quart import current_app
|
||||
from shared.infrastructure.urls import market_url
|
||||
from shared.sexp.jinja_bridge import sexp as render_sexp
|
||||
|
||||
container_type = request.args.get("container_type", "page")
|
||||
container_id = int(request.args.get("container_id", 0))
|
||||
post_slug = request.args.get("post_slug", "")
|
||||
@@ -42,10 +46,16 @@ def register():
|
||||
)
|
||||
if not markets:
|
||||
return ""
|
||||
return await render_template(
|
||||
"fragments/container_nav_markets.html",
|
||||
markets=markets, post_slug=post_slug,
|
||||
)
|
||||
styles = current_app.jinja_env.globals.get("styles", {})
|
||||
nav_class = styles.get("nav_button_less_pad", "")
|
||||
parts = []
|
||||
for m in markets:
|
||||
href = market_url(f"/{post_slug}/{m.slug}/")
|
||||
parts.append(render_sexp(
|
||||
'(~market-link-nav :href href :name name :nav-class nav-class)',
|
||||
href=href, name=m.name, **{"nav-class": nav_class},
|
||||
))
|
||||
return "\n".join(parts)
|
||||
|
||||
_handlers["container-nav"] = _container_nav_handler
|
||||
|
||||
|
||||
Reference in New Issue
Block a user