simplify footer categories: fetch directly instead of threading assigns

shop_footer now calls PreviewData.categories() itself, removing the
need to thread categories through CartHook, shop_layout, and all 8
page templates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-11 08:20:50 +00:00
parent 209ae7aee7
commit e9a824ec0b
10 changed files with 5 additions and 14 deletions

View File

@@ -65,7 +65,6 @@ defmodule SimpleshopThemeWeb.ShopComponents.Layout do
attr :cart_subtotal, :string, required: true
attr :cart_drawer_open, :boolean, default: false
attr :cart_status, :string, default: nil
attr :categories, :list, default: []
attr :active_page, :string, required: true
attr :error_page, :boolean, default: false
@@ -96,7 +95,7 @@ defmodule SimpleshopThemeWeb.ShopComponents.Layout do
{render_slot(@inner_block)}
<.shop_footer theme_settings={@theme_settings} mode={@mode} categories={@categories} />
<.shop_footer theme_settings={@theme_settings} mode={@mode} />
<.cart_drawer
cart_items={@cart_items}
@@ -406,10 +405,12 @@ defmodule SimpleshopThemeWeb.ShopComponents.Layout do
"""
attr :theme_settings, :map, required: true
attr :mode, :atom, default: :live
attr :categories, :list, default: []
def shop_footer(assigns) do
assigns = assign(assigns, :current_year, Date.utc_today().year)
assigns =
assigns
|> assign(:current_year, Date.utc_today().year)
|> assign(:categories, SimpleshopTheme.Theme.PreviewData.categories())
~H"""
<footer style="background-color: var(--t-surface-raised); border-top: 1px solid var(--t-border-default);">