From 65c4989d08b85a821a0932e4376f2ab088f50d0c Mon Sep 17 00:00:00 2001 From: giles Date: Tue, 24 Feb 2026 13:56:29 +0000 Subject: [PATCH] Replace account widgets with fragment composition (Phase 5) Account nav links and page panels (tickets, bookings) now fetched as HTML fragments from events app instead of using widget registry. All three widget registration functions are now no-ops. Co-Authored-By: Claude Opus 4.6 --- .../_types/auth/_fragment_panel.html | 1 + browser/templates/_types/auth/_nav.html | 16 ++------ services/widgets/calendar_widgets.py | 39 ++----------------- services/widgets/cart_widgets.py | 17 +++----- 4 files changed, 13 insertions(+), 60 deletions(-) create mode 100644 browser/templates/_types/auth/_fragment_panel.html diff --git a/browser/templates/_types/auth/_fragment_panel.html b/browser/templates/_types/auth/_fragment_panel.html new file mode 100644 index 0000000..f27345c --- /dev/null +++ b/browser/templates/_types/auth/_fragment_panel.html @@ -0,0 +1 @@ +{{ page_fragment_html | safe }} diff --git a/browser/templates/_types/auth/_nav.html b/browser/templates/_types/auth/_nav.html index 93499a8..ff5de92 100644 --- a/browser/templates/_types/auth/_nav.html +++ b/browser/templates/_types/auth/_nav.html @@ -2,16 +2,6 @@ {% call links.link(account_url('/newsletters/'), hx_select_search, select_colours, True, aclass=styles.nav_button) %} newsletters {% endcall %} -{% for link in account_nav_links %} - {% if link.external %} - - {% else %} - {% call links.link(link.href_fn(), hx_select_search, select_colours, True, aclass=styles.nav_button) %} - {{ link.label }} - {% endcall %} - {% endif %} -{% endfor %} +{% if account_nav_html %} + {{ account_nav_html | safe }} +{% endif %} diff --git a/services/widgets/calendar_widgets.py b/services/widgets/calendar_widgets.py index ee35c3d..d9fc2ff 100644 --- a/services/widgets/calendar_widgets.py +++ b/services/widgets/calendar_widgets.py @@ -1,43 +1,10 @@ -"""Calendar-domain widgets: account pages (tickets & bookings). +"""Calendar-domain widgets. -Container nav and card widgets have been replaced by fragments +All calendar widgets have been replaced by fragments (events app serves them at /internal/fragments/). """ from __future__ import annotations -from shared.contracts.widgets import AccountPageWidget -from shared.services.widget_registry import widgets -from shared.services.registry import services - - -# -- account pages: tickets & bookings --------------------------------------- - -async def _tickets_context(session, *, user_id, **kw): - tickets = await services.calendar.user_tickets(session, user_id=user_id) - return {"tickets": tickets} - - -async def _bookings_context(session, *, user_id, **kw): - bookings = await services.calendar.user_bookings(session, user_id=user_id) - return {"bookings": bookings} - - -# -- registration entry point ------------------------------------------------ def register_calendar_widgets() -> None: - widgets.add_account_page(AccountPageWidget( - domain="calendar", - slug="tickets", - label="tickets", - order=20, - context_fn=_tickets_context, - template="_types/auth/_tickets_panel.html", - )) - widgets.add_account_page(AccountPageWidget( - domain="calendar", - slug="bookings", - label="bookings", - order=30, - context_fn=_bookings_context, - template="_types/auth/_bookings_panel.html", - )) + pass diff --git a/services/widgets/cart_widgets.py b/services/widgets/cart_widgets.py index f48f5ee..a45ab90 100644 --- a/services/widgets/cart_widgets.py +++ b/services/widgets/cart_widgets.py @@ -1,15 +1,10 @@ -"""Cart-domain widgets: orders link on account page.""" -from __future__ import annotations +"""Cart-domain widgets. -from shared.contracts.widgets import AccountNavLink -from shared.services.widget_registry import widgets -from shared.infrastructure.urls import cart_url +Account nav link has been replaced by fragments +(cart app serves account-nav-item at /internal/fragments/). +""" +from __future__ import annotations def register_cart_widgets() -> None: - widgets.add_account_link(AccountNavLink( - label="orders", - order=100, - href_fn=lambda: cart_url("/orders/"), - external=True, - )) + pass