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 <noreply@anthropic.com>
This commit is contained in:
1
browser/templates/_types/auth/_fragment_panel.html
Normal file
1
browser/templates/_types/auth/_fragment_panel.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ page_fragment_html | safe }}
|
||||
@@ -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 %}
|
||||
<div class="relative nav-group">
|
||||
<a href="{{ link.href_fn() }}" class="{{styles.nav_button}}" data-hx-disable>
|
||||
{{ link.label }}
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
{% call links.link(link.href_fn(), hx_select_search, select_colours, True, aclass=styles.nav_button) %}
|
||||
{{ link.label }}
|
||||
{% endcall %}
|
||||
{% if account_nav_html %}
|
||||
{{ account_nav_html | safe }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user