Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ defmodule PlausibleWeb.CustomerSupport.Team.Components.Sites do
<.th invisible>Dashboard</.th>
<th
scope="col"
class="px-6 first:pl-0 last:pr-0 py-3 text-left text-sm font-semibold cursor-pointer select-none"
class="max-w-40 px-6 first:pl-0 last:pr-0 py-3 text-left text-sm font-semibold cursor-pointer select-none"
phx-click="sort"
phx-value-by="traffic"
phx-target={@myself}
Expand All @@ -129,6 +129,10 @@ defmodule PlausibleWeb.CustomerSupport.Team.Components.Sites do
class="cursor-pointer flex block items-center"
>
{site.domain}

<span :if={@index_state.pins[site.id]}>
<PlausibleWeb.Components.Icons.pin_icon class="w-4 ml-2" />
</span>
</.styled_link>
</div>
</.td>
Expand All @@ -150,7 +154,7 @@ defmodule PlausibleWeb.CustomerSupport.Team.Components.Sites do
Settings
</.styled_link>
</.td>
<.td>
<.td max_width="max-w-40">
<span class="h-[24px] text-indigo-500">
<PlausibleWeb.Live.Components.Visitors.chart
:if={is_map(@hourly_stats[site.domain])}
Expand Down
20 changes: 20 additions & 0 deletions lib/plausible_web/components/icons.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ defmodule PlausibleWeb.Components.Icons do
"""
use Phoenix.Component

attr(:rest, :global)
attr(:filled, :boolean, default: false)

def pin_icon(assigns) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

~H"""
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill={if @filled, do: "currentColor", else: "none"}
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.5"
{@rest}
>
<path d="m4 20 4.5-4.5-.196.196M14.314 21.005l-5.657-5.657L3 9.69l1.228-1.228a3 3 0 0 1 3.579-.501l.58.322 7.34-5.664 5.658 5.657-5.665 7.34.323.581a3 3 0 0 1-.501 3.578l-1.228 1.229Z" />
</svg>
"""
end

attr :class, :any, default: []

def external_link_icon(assigns) do
Expand Down
24 changes: 2 additions & 22 deletions lib/plausible_web/live/sites.ex
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,12 @@ defmodule PlausibleWeb.Live.Sites do
}
phx-value-domain={@site.domain}
>
<.icon_pin
<PlausibleWeb.Components.Icons.pin_icon
:if={@site.pinned_at}
filled={true}
class={PrimaDropdown.dropdown_item_icon_class()}
/>
<.icon_pin
<PlausibleWeb.Components.Icons.pin_icon
:if={!@site.pinned_at}
class={PrimaDropdown.dropdown_item_icon_class()}
/>
Expand All @@ -587,26 +587,6 @@ defmodule PlausibleWeb.Live.Sites do
"""
end

attr(:rest, :global)
attr(:filled, :boolean, default: false)

def icon_pin(assigns) do
~H"""
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill={if @filled, do: "currentColor", else: "none"}
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.5"
{@rest}
>
<path d="m4 20 4.5-4.5-.196.196M14.314 21.005l-5.657-5.657L3 9.69l1.228-1.228a3 3 0 0 1 3.579-.501l.58.322 7.34-5.664 5.658 5.657-5.665 7.34.323.581a3 3 0 0 1-.501 3.578l-1.228 1.229Z" />
</svg>
"""
end

attr(:sparkline, :any, required: true)

def site_stats(assigns) do
Expand Down
Loading