Add OOB header swaps for sx docs navigation + enable OAuth + fragments
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m10s

- OOB nav updates: AJAX navigation now swaps both menu bar levels
  (main nav highlighting + sub-nav with current page) using the same
  oob_header_sx/oob_page_sx pattern as blog/market/events
- Enable OAuth for sx and test apps (removed from _NO_OAUTH, added sx
  to ALLOWED_CLIENTS, added app_urls for sx/test/orders)
- Fetch real cross-service fragments (cart-mini, auth-menu, nav-tree)
  instead of hardcoding empty values
- Add :selected param to ~menu-row-sx for white text current-page label
- Fix duplicate element IDs: use menu-row-sx child_id/child mechanism
  instead of manual header_child_sx wrappers
- Fix home page copy: "Server-rendered DOM over the wire (no HTML)"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 23:22:01 +00:00
parent 3d55145e5f
commit 13bcf755f6
8 changed files with 461 additions and 316 deletions

View File

@@ -3,28 +3,41 @@ import path_setup # noqa: F401
import sxc.sx_components as sx_components # noqa: F401
from shared.infrastructure.factory import create_base_app
from shared.sx.jinja_bridge import render
from bp import register_pages
from services import register_domain_services
async def sx_docs_context() -> dict:
"""SX docs app context processor — minimal, no cross-service fragments."""
"""SX docs app context processor — fetches cross-service fragments."""
from quart import request, g
from shared.infrastructure.context import base_context
from shared.infrastructure.cart_identity import current_cart_identity
from shared.infrastructure.fragments import fetch_fragments
ctx = await base_context()
ctx["menu_items"] = []
blog_url = ctx.get("blog_url", "")
if callable(blog_url):
blog_url_str = blog_url("")
else:
blog_url_str = str(blog_url or "")
ctx["cart_mini"] = render(
"cart-mini", cart_count=0, blog_url=blog_url_str, cart_url="",
)
ctx["auth_menu"] = ""
ctx["nav_tree"] = ""
ident = current_cart_identity()
user = getattr(g, "user", None)
cart_params = {}
if ident.get("user_id"):
cart_params["user_id"] = ident["user_id"]
if ident.get("session_id"):
cart_params["session_id"] = ident["session_id"]
auth_params = {"email": user.email} if user else None
cart_mini, auth_menu, nav_tree = await fetch_fragments([
("cart", "cart-mini", cart_params or None),
("account", "auth-menu", auth_params),
("blog", "nav-tree", {"app_name": "sx", "path": request.path}),
], required=False)
ctx["cart_mini"] = cart_mini
ctx["auth_menu"] = auth_menu
ctx["nav_tree"] = nav_tree
return ctx