Fix market header ImportError and sx docs menu bar 3 OOB insertion
- market/sx/layouts.sx: Update ~market-header-auto macro to build nav from data fields via ~market-desktop-nav-from-data instead of expecting pre-built "desktop-nav" SxExpr (removed in Phase 9) - shared/sx/primitives_io.py: Import _market_header_data instead of deleted _desktop_category_nav_sx, return individual data fields - sx/sx/layouts.sx: Fix ~sx-section-layout-oob to use ~oob-header-sx for inserting sub-row into always-existing container div Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,13 @@
|
||||
:title (get __mctx "market-title")
|
||||
:top-slug (get __mctx "top-slug")
|
||||
:sub-div (get __mctx "sub-slug"))
|
||||
:nav (get __mctx "desktop-nav")
|
||||
:nav (~market-desktop-nav-from-data
|
||||
:categories (get __mctx "categories")
|
||||
:hx-select (get __mctx "hx-select")
|
||||
:select-colours (get __mctx "select-colours")
|
||||
:all-href (get __mctx "all-href")
|
||||
:all-active (get __mctx "all-active")
|
||||
:admin-href (get __mctx "admin-href"))
|
||||
:child-id "market-header-child"
|
||||
:oob (unquote oob)))))
|
||||
|
||||
|
||||
@@ -876,10 +876,10 @@ async def _io_events_ticket_type_ctx(
|
||||
async def _io_market_header_ctx(
|
||||
args: list[Any], kwargs: dict[str, Any], ctx: RequestContext
|
||||
) -> dict[str, Any]:
|
||||
"""``(market-header-ctx)`` → dict with market header values.
|
||||
"""``(market-header-ctx)`` → dict with market header data.
|
||||
|
||||
Pre-builds desktop-nav and mobile-nav as SxExpr strings using
|
||||
the existing Python helper functions in sxc.pages.layouts.
|
||||
Returns plain data (categories list, hrefs, flags) for the
|
||||
~market-header-auto macro. Mobile nav is pre-built as SxExpr.
|
||||
"""
|
||||
from quart import g, url_for
|
||||
from shared.config import config as get_config
|
||||
@@ -916,9 +916,9 @@ async def _io_market_header_ctx(
|
||||
"category_label": "",
|
||||
}
|
||||
|
||||
# Pre-build nav using existing helper functions (lazy import from market service)
|
||||
from sxc.pages.layouts import _desktop_category_nav_sx, _mobile_nav_panel_sx
|
||||
desktop_nav = _desktop_category_nav_sx(mini_ctx, categories, "", "#main-panel")
|
||||
# Build header + mobile nav data via new data-driven helpers
|
||||
from sxc.pages.layouts import _market_header_data, _mobile_nav_panel_sx
|
||||
header_data = _market_header_data(mini_ctx)
|
||||
mobile_nav = _mobile_nav_panel_sx(mini_ctx)
|
||||
|
||||
return {
|
||||
@@ -926,7 +926,12 @@ async def _io_market_header_ctx(
|
||||
"link-href": link_href,
|
||||
"top-slug": "",
|
||||
"sub-slug": "",
|
||||
"desktop-nav": SxExpr(desktop_nav) if desktop_nav else "",
|
||||
"categories": header_data.get("categories", []),
|
||||
"hx-select": header_data.get("hx-select", "#main-panel"),
|
||||
"select-colours": header_data.get("select-colours", ""),
|
||||
"all-href": header_data.get("all-href", ""),
|
||||
"all-active": header_data.get("all-active", False),
|
||||
"admin-href": header_data.get("admin-href", ""),
|
||||
"mobile-nav": SxExpr(mobile_nav) if mobile_nav else "",
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,9 @@
|
||||
:sub-nav sub-nav :selected selected))))
|
||||
|
||||
(defcomp ~sx-section-layout-oob (&key section sub-label sub-href sub-nav selected)
|
||||
(<> (~sx-sub-row :sub-label sub-label :sub-href sub-href
|
||||
:sub-nav sub-nav :selected selected :oob true)
|
||||
(<> (~oob-header-sx :parent-id "sx-header-child"
|
||||
:row (~sx-sub-row :sub-label sub-label :sub-href sub-href
|
||||
:sub-nav sub-nav :selected selected))
|
||||
(~sx-header-row
|
||||
:nav (~sx-main-nav :section section)
|
||||
:oob true)
|
||||
|
||||
Reference in New Issue
Block a user