diff --git a/lib/atomic_web/components/socials.ex b/lib/atomic_web/components/socials.ex
index f026a074..85bef986 100644
--- a/lib/atomic_web/components/socials.ex
+++ b/lib/atomic_web/components/socials.ex
@@ -2,28 +2,32 @@ defmodule AtomicWeb.Components.Socials do
@moduledoc false
use Phoenix.Component
+ attr :socials, :map, required: true
+
def socials(assigns) do
~H"""
- <%= if @entity.socials do %>
-
- <%= for {social, icon, url_base} <- [
- {:tiktok, "tiktok.svg", "https://tiktok.com/"},
- {:instagram, "instagram.svg", "https://instagram.com/"},
- {:facebook, "facebook.svg", "https://facebook.com/"},
- {:x, "x.svg", "https://x.com/"}
- ] do %>
- <% social_value = Map.get(@entity.socials, social) %>
- <%= if social_value do %>
-
-
icon} class="h-5 w-5" alt={social |> Atom.to_string() |> String.capitalize()} />
- <.link class="text-blue-500" target="_blank" href={url_base <> social_value}>
- <%= social |> Atom.to_string() |> String.capitalize() %>
-
-
- <% end %>
+
+ <%= for {social, icon, url_base} <- get_socials() do %>
+ <% social_value = Map.get(@entity, social) %>
+ <%= if social_value do %>
+
+
icon} class="h-5 w-5" alt={social |> Atom.to_string() |> String.capitalize()} />
+ <.link class="text-blue-500" target="_blank" href={url_base <> social_value}>
+ <%= social |> Atom.to_string() |> String.capitalize() %>
+
+
<% end %>
-
- <% end %>
+ <% end %>
+
"""
end
+
+ def get_socials do
+ [
+ {:tiktok, "tiktok.svg", "https://tiktok.com/"},
+ {:instagram, "instagram.svg", "https://instagram.com/"},
+ {:facebook, "facebook.svg", "https://facebook.com/"},
+ {:x, "x.svg", "https://x.com/"}
+ ]
+ end
end
diff --git a/lib/atomic_web/live/partner_live/form_component.ex b/lib/atomic_web/live/partner_live/form_component.ex
index bd6ec775..f8fdfe07 100644
--- a/lib/atomic_web/live/partner_live/form_component.ex
+++ b/lib/atomic_web/live/partner_live/form_component.ex
@@ -20,11 +20,12 @@ defmodule AtomicWeb.PartnerLive.FormComponent do
<.field field={location_form[:name]} label="Address" type="text" placeholder="Address" help_text={gettext("Address of the partner")} required />
+
<.inputs_for :let={socials_form} field={f[:socials]}>
<.field field={socials_form[:instagram]} type="text" class="w-full" />
<.field field={socials_form[:facebook]} type="text" class="w-full" />
<.field field={socials_form[:x]} type="text" class="w-full" />
+ <.field field={socials_form[:tiktok]} type="text" class="w-full" />
<.field field={socials_form[:website]} type="text" class="w-full" />
diff --git a/lib/atomic_web/live/partner_live/show.ex b/lib/atomic_web/live/partner_live/show.ex
index 375cc426..c67b4409 100644
--- a/lib/atomic_web/live/partner_live/show.ex
+++ b/lib/atomic_web/live/partner_live/show.ex
@@ -1,8 +1,7 @@
defmodule AtomicWeb.PartnerLive.Show do
use AtomicWeb, :live_view
- import AtomicWeb.Components.Avatar
- import AtomicWeb.Components.Socials
+ import AtomicWeb.Components.{Avatar, Socials}
alias Atomic.Accounts
alias Atomic.Organizations
diff --git a/lib/atomic_web/live/partner_live/show.html.heex b/lib/atomic_web/live/partner_live/show.html.heex
index ce1795ba..8e6642e7 100644
--- a/lib/atomic_web/live/partner_live/show.html.heex
+++ b/lib/atomic_web/live/partner_live/show.html.heex
@@ -21,7 +21,7 @@
<%= if @partner.location do %>
-
+
<.icon name="hero-map-pin" class="h-5 w-5 text-zinc-400" />
<.link class="text-blue-500" href={"https://www.google.com/maps/search/?api=1&query=#{@partner.location.name}"}>
@@ -31,7 +31,7 @@
<% end %>
<%= if @partner.socials do %>
-
+
<%= if @partner.socials.website do %>
@@ -40,8 +40,10 @@
<.link class="text-blue-500" href={@partner.socials.website}>Website
<% end %>
-
- <.socials entity={@partner} />
+
+ <%= if @partner.socials do %>
+ <.socials entity={@partner.socials} />
+ <% end %>
<% end %>