diff --git a/lib/simpleshop_theme_web/cart_hook.ex b/lib/simpleshop_theme_web/cart_hook.ex index 3317cff..a5770f2 100644 --- a/lib/simpleshop_theme_web/cart_hook.ex +++ b/lib/simpleshop_theme_web/cart_hook.ex @@ -19,7 +19,6 @@ defmodule SimpleshopThemeWeb.CartHook do import Phoenix.LiveView, only: [attach_hook: 4, connected?: 1, push_event: 3] alias SimpleshopTheme.Cart - alias SimpleshopTheme.Theme.PreviewData def on_mount(:mount_cart, _params, session, socket) do cart_items = Cart.get_from_session(session) @@ -29,7 +28,6 @@ defmodule SimpleshopThemeWeb.CartHook do |> update_cart_assigns(cart_items) |> assign(:cart_drawer_open, false) |> assign(:cart_status, nil) - |> assign(:categories, PreviewData.categories()) |> attach_hook(:cart_events, :handle_event, &handle_cart_event/3) |> attach_hook(:cart_info, :handle_info, &handle_cart_info/2) diff --git a/lib/simpleshop_theme_web/components/page_templates/cart.html.heex b/lib/simpleshop_theme_web/components/page_templates/cart.html.heex index 51f3022..670b588 100644 --- a/lib/simpleshop_theme_web/components/page_templates/cart.html.heex +++ b/lib/simpleshop_theme_web/components/page_templates/cart.html.heex @@ -8,7 +8,6 @@ cart_subtotal={@cart_subtotal} cart_drawer_open={assigns[:cart_drawer_open] || false} cart_status={assigns[:cart_status]} - categories={assigns[:categories] || []} active_page="cart" >
diff --git a/lib/simpleshop_theme_web/components/page_templates/checkout_success.html.heex b/lib/simpleshop_theme_web/components/page_templates/checkout_success.html.heex index 6706a53..125f108 100644 --- a/lib/simpleshop_theme_web/components/page_templates/checkout_success.html.heex +++ b/lib/simpleshop_theme_web/components/page_templates/checkout_success.html.heex @@ -8,7 +8,6 @@ cart_subtotal={@cart_subtotal} cart_drawer_open={assigns[:cart_drawer_open] || false} cart_status={assigns[:cart_status]} - categories={assigns[:categories] || []} active_page="checkout" >
diff --git a/lib/simpleshop_theme_web/components/page_templates/collection.html.heex b/lib/simpleshop_theme_web/components/page_templates/collection.html.heex index e2b24db..bf971ea 100644 --- a/lib/simpleshop_theme_web/components/page_templates/collection.html.heex +++ b/lib/simpleshop_theme_web/components/page_templates/collection.html.heex @@ -8,7 +8,6 @@ cart_subtotal={@cart_subtotal} cart_drawer_open={assigns[:cart_drawer_open] || false} cart_status={assigns[:cart_status]} - categories={assigns[:categories] || []} active_page="collection" >
diff --git a/lib/simpleshop_theme_web/components/page_templates/contact.html.heex b/lib/simpleshop_theme_web/components/page_templates/contact.html.heex index 716adc3..0c65f12 100644 --- a/lib/simpleshop_theme_web/components/page_templates/contact.html.heex +++ b/lib/simpleshop_theme_web/components/page_templates/contact.html.heex @@ -8,7 +8,6 @@ cart_subtotal={@cart_subtotal} cart_drawer_open={assigns[:cart_drawer_open] || false} cart_status={assigns[:cart_status]} - categories={assigns[:categories] || []} active_page="contact" >
diff --git a/lib/simpleshop_theme_web/components/page_templates/content.html.heex b/lib/simpleshop_theme_web/components/page_templates/content.html.heex index cbc60a0..7ff3ab2 100644 --- a/lib/simpleshop_theme_web/components/page_templates/content.html.heex +++ b/lib/simpleshop_theme_web/components/page_templates/content.html.heex @@ -8,7 +8,6 @@ cart_subtotal={@cart_subtotal} cart_drawer_open={assigns[:cart_drawer_open] || false} cart_status={assigns[:cart_status]} - categories={assigns[:categories] || []} active_page={@active_page} >
diff --git a/lib/simpleshop_theme_web/components/page_templates/error.html.heex b/lib/simpleshop_theme_web/components/page_templates/error.html.heex index c76d6e9..d0da345 100644 --- a/lib/simpleshop_theme_web/components/page_templates/error.html.heex +++ b/lib/simpleshop_theme_web/components/page_templates/error.html.heex @@ -8,7 +8,6 @@ cart_subtotal={@cart_subtotal} cart_drawer_open={assigns[:cart_drawer_open] || false} cart_status={assigns[:cart_status]} - categories={assigns[:categories] || []} active_page="error" error_page > diff --git a/lib/simpleshop_theme_web/components/page_templates/home.html.heex b/lib/simpleshop_theme_web/components/page_templates/home.html.heex index 389c7ac..b04e503 100644 --- a/lib/simpleshop_theme_web/components/page_templates/home.html.heex +++ b/lib/simpleshop_theme_web/components/page_templates/home.html.heex @@ -8,7 +8,6 @@ cart_subtotal={@cart_subtotal} cart_drawer_open={assigns[:cart_drawer_open] || false} cart_status={assigns[:cart_status]} - categories={assigns[:categories] || []} active_page="home" >
diff --git a/lib/simpleshop_theme_web/components/page_templates/pdp.html.heex b/lib/simpleshop_theme_web/components/page_templates/pdp.html.heex index 1036888..14d9f6d 100644 --- a/lib/simpleshop_theme_web/components/page_templates/pdp.html.heex +++ b/lib/simpleshop_theme_web/components/page_templates/pdp.html.heex @@ -8,7 +8,6 @@ cart_subtotal={@cart_subtotal} cart_drawer_open={assigns[:cart_drawer_open] || false} cart_status={assigns[:cart_status]} - categories={assigns[:categories] || []} active_page="pdp" >
diff --git a/lib/simpleshop_theme_web/components/shop_components/layout.ex b/lib/simpleshop_theme_web/components/shop_components/layout.ex index 18e8e02..ef468cd 100644 --- a/lib/simpleshop_theme_web/components/shop_components/layout.ex +++ b/lib/simpleshop_theme_web/components/shop_components/layout.ex @@ -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"""