diff --git a/assets/css/admin/components.css b/assets/css/admin/components.css index 6e8f76a..d060229 100644 --- a/assets/css/admin/components.css +++ b/assets/css/admin/components.css @@ -375,7 +375,7 @@ position: fixed; top: 1rem; right: 1rem; - z-index: 50; + z-index: 100; } .admin-alert { @@ -389,15 +389,15 @@ } .admin-alert-info { - background-color: color-mix(in oklch, var(--color-info) 10%, transparent); + background-color: color-mix(in oklch, var(--color-info) 12%, var(--color-base-100)); color: var(--color-info); - border: 1px solid color-mix(in oklch, var(--color-info) 25%, transparent); + border: 1px solid color-mix(in oklch, var(--color-info) 25%, var(--color-base-100)); } .admin-alert-error { - background-color: color-mix(in oklch, var(--color-error) 10%, transparent); + background-color: color-mix(in oklch, var(--color-error) 12%, var(--color-base-100)); color: var(--color-error); - border: 1px solid color-mix(in oklch, var(--color-error) 25%, transparent); + border: 1px solid color-mix(in oklch, var(--color-error) 25%, var(--color-base-100)); } /* ── Modal ── */ diff --git a/lib/berrypod/products.ex b/lib/berrypod/products.ex index cfb4605..186023a 100644 --- a/lib/berrypod/products.ex +++ b/lib/berrypod/products.ex @@ -90,6 +90,13 @@ defmodule Berrypod.Products do |> Repo.update_all(set: [sync_status: "idle"]) end + @doc """ + Returns the total count of all products. + """ + def count_products do + Repo.aggregate(Product, :count) + end + @doc """ Returns the count of products for a provider connection. """ diff --git a/lib/berrypod_web/admin_layout_hook.ex b/lib/berrypod_web/admin_layout_hook.ex index 62ed2c8..20cf44e 100644 --- a/lib/berrypod_web/admin_layout_hook.ex +++ b/lib/berrypod_web/admin_layout_hook.ex @@ -8,10 +8,14 @@ defmodule BerrypodWeb.AdminLayoutHook do socket = socket |> assign(:current_path, "") + |> assign(:site_live, Berrypod.Settings.site_live?()) |> Phoenix.LiveView.attach_hook(:set_current_path, :handle_params, fn _params, uri, socket -> - {:cont, assign(socket, :current_path, URI.parse(uri).path)} + {:cont, + socket + |> assign(:current_path, URI.parse(uri).path) + |> assign(:site_live, Berrypod.Settings.site_live?())} end) {:cont, socket} diff --git a/lib/berrypod_web/components/core_components.ex b/lib/berrypod_web/components/core_components.ex index 314c64f..a070de0 100644 --- a/lib/berrypod_web/components/core_components.ex +++ b/lib/berrypod_web/components/core_components.ex @@ -81,16 +81,24 @@ defmodule BerrypodWeb.CoreComponents do """ attr :rest, :global, include: ~w(href navigate patch method download name value disabled) attr :class, :string - attr :variant, :string, values: ~w(primary) + attr :variant, :string, values: ~w(primary outline) slot :inner_block, required: true def button(%{rest: rest} = assigns) do - variants = %{"primary" => "admin-btn-primary", nil => "admin-btn-primary admin-btn-soft"} + variants = %{ + "primary" => "admin-btn-primary", + "outline" => "admin-btn-outline", + nil => "admin-btn-primary admin-btn-soft" + } + + variant_class = Map.fetch!(variants, assigns[:variant]) assigns = - assign_new(assigns, :class, fn -> - ["admin-btn", Map.fetch!(variants, assigns[:variant])] - end) + assign(assigns, :class, [ + "admin-btn", + variant_class, + assigns[:class] + ]) if rest[:href] || rest[:navigate] || rest[:patch] do ~H""" diff --git a/lib/berrypod_web/components/layouts/admin.html.heex b/lib/berrypod_web/components/layouts/admin.html.heex index 8734c43..f480237 100644 --- a/lib/berrypod_web/components/layouts/admin.html.heex +++ b/lib/berrypod_web/components/layouts/admin.html.heex @@ -43,6 +43,14 @@ <%!-- nav links --%>