feat(storefront): homepage, module gating, widget protocol, i18n fixes
Some checks failed
Some checks failed
Storefront homepage & module gating:
- CMS owns storefront GET / (slug="home" with 3-tier resolution)
- Catalog loses GET / (keeps /products only)
- Store root redirect (GET / → /store/dashboard or /store/login)
- Route gating: non-core modules return 404 when disabled for platform
- Seed store default homepages per platform
Widget protocol for customer dashboard:
- StorefrontDashboardCard contract in widgets.py
- Widget aggregator get_storefront_dashboard_cards()
- Orders and Loyalty module widget providers
- Dashboard template renders contributed cards (no module names)
Landing template module-agnostic:
- CTAs driven by storefront_nav (not hardcoded module names)
- Header actions check nav item IDs (not enabled_modules)
- Remove hardcoded "Add Product" sidebar button
- Remove all enabled_modules checks from storefront templates
i18n fixes:
- Title placeholder resolution ({{store_name}}) for store default pages
- Storefront nav label_keys prefixed with module code
- Add storefront.account.* keys to 6 modules (en/fr/de/lb)
- Header/footer CMS pages use get_translated_title(current_language)
- Footer labels use i18n keys instead of hardcoded English
Icon cleanup:
- Standardize on map-pin (remove location-marker alias)
- Replace all location-marker references across templates and docs
Docs:
- Storefront builder vision proposal (6 phases)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,44 @@ class WidgetContext:
|
||||
include_details: bool = False
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Storefront Dashboard Card
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@dataclass
|
||||
class StorefrontDashboardCard:
|
||||
"""
|
||||
A card contributed by a module to the storefront customer dashboard.
|
||||
|
||||
Modules implement get_storefront_dashboard_cards() to provide these.
|
||||
The dashboard template renders them without knowing which module provided them.
|
||||
|
||||
Attributes:
|
||||
key: Unique identifier (e.g. "orders.summary", "loyalty.points")
|
||||
icon: Lucide icon name (e.g. "shopping-bag", "gift")
|
||||
title: Card title (i18n key or plain text)
|
||||
subtitle: Card subtitle / description
|
||||
route: Link destination relative to base_url (e.g. "account/orders")
|
||||
value: Primary display value (e.g. order count, points balance)
|
||||
value_label: Label for the value (e.g. "Total Orders", "Points Balance")
|
||||
order: Sort order (lower = shown first)
|
||||
template: Optional custom template path for complex rendering
|
||||
extra_data: Additional data for custom template rendering
|
||||
"""
|
||||
|
||||
key: str
|
||||
icon: str
|
||||
title: str
|
||||
subtitle: str
|
||||
route: str
|
||||
value: str | int | None = None
|
||||
value_label: str | None = None
|
||||
order: int = 100
|
||||
template: str | None = None
|
||||
extra_data: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Widget Item Types
|
||||
# =============================================================================
|
||||
@@ -330,6 +368,30 @@ class DashboardWidgetProviderProtocol(Protocol):
|
||||
"""
|
||||
...
|
||||
|
||||
def get_storefront_dashboard_cards(
|
||||
self,
|
||||
db: "Session",
|
||||
store_id: int,
|
||||
customer_id: int,
|
||||
context: WidgetContext | None = None,
|
||||
) -> list["StorefrontDashboardCard"]:
|
||||
"""
|
||||
Get cards for the storefront customer dashboard.
|
||||
|
||||
Called by the customer account dashboard. Each module contributes
|
||||
its own cards (e.g. orders summary, loyalty points).
|
||||
|
||||
Args:
|
||||
db: Database session for queries
|
||||
store_id: ID of the store
|
||||
customer_id: ID of the logged-in customer
|
||||
context: Optional filtering/scoping context
|
||||
|
||||
Returns:
|
||||
List of StorefrontDashboardCard objects
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
__all__ = [
|
||||
# Context
|
||||
@@ -343,6 +405,8 @@ __all__ = [
|
||||
"WidgetData",
|
||||
# Main envelope
|
||||
"DashboardWidget",
|
||||
# Storefront
|
||||
"StorefrontDashboardCard",
|
||||
# Protocol
|
||||
"DashboardWidgetProviderProtocol",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user