Phase 0: Add _ctx_to_env() and render_to_sx_with_env() to shared/sx/helpers.py, register_sx_layout() to shared/sx/layouts.py, and ~root-header/~root-mobile wrapper defcomps to layout.sx. Convert built-in "root" layout to .sx. Phases 1-3: Convert account (65→19 lines), federation (105→97 lines), and orders (88→21 lines) to use register_sx_layout with .sx defcomps that read ctx values as free variables from the evaluation environment. No more Python building SX strings via SxExpr(await root_header_sx(ctx)). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
810 B
Python
22 lines
810 B
Python
"""Orders defpage setup — registers layouts and loads .sx pages."""
|
|
from __future__ import annotations
|
|
|
|
|
|
def setup_orders_pages() -> None:
|
|
"""Register orders-specific layouts and load page definitions."""
|
|
_register_orders_layouts()
|
|
_load_orders_page_files()
|
|
|
|
|
|
def _load_orders_page_files() -> None:
|
|
"""Load defpage definitions from orders/sxc/pages/*.sx."""
|
|
import os
|
|
from shared.sx.pages import load_page_dir
|
|
load_page_dir(os.path.dirname(__file__), "orders")
|
|
|
|
|
|
def _register_orders_layouts() -> None:
|
|
from shared.sx.layouts import register_sx_layout
|
|
register_sx_layout("orders", "orders-layout-full", "orders-layout-oob", "orders-layout-mobile")
|
|
register_sx_layout("order-detail", "order-detail-layout-full", "order-detail-layout-oob", "order-detail-layout-mobile")
|