From 0e0d349e31be14881245c685393b3e9158a324b7 Mon Sep 17 00:00:00 2001 From: Berenice Medel Date: Tue, 23 Nov 2021 11:52:43 -0600 Subject: [PATCH] hide play button on playlist --- lib/live_beats_web/live/live_helpers.ex | 4 +++- lib/live_beats_web/live/profile_live.ex | 1 + lib/live_beats_web/live/profile_live/song_row_component.ex | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/live_beats_web/live/live_helpers.ex b/lib/live_beats_web/live/live_helpers.ex index b871a98..f297589 100644 --- a/lib/live_beats_web/live/live_helpers.ex +++ b/lib/live_beats_web/live/live_helpers.ex @@ -534,6 +534,7 @@ defmodule LiveBeatsWeb.LiveHelpers do assigns |> assign_new(:row_id, fn -> false end) |> assign_new(:active_id, fn -> nil end) + |> assign_new(:owns_profile?, fn -> assigns.owns_profile? end) |> assign(:col, for(col <- assigns.col, col[:if] != false, do: col)) ~H""" @@ -558,7 +559,8 @@ defmodule LiveBeatsWeb.LiveHelpers do row={row} col={@col} index={i} active_id={@active_id} - class="hover:bg-gray-50" + class="hover:bg-gray-50", + owns_profile?={@owns_profile?} /> <% end %> diff --git a/lib/live_beats_web/live/profile_live.ex b/lib/live_beats_web/live/profile_live.ex index 0d057f2..82e42ae 100644 --- a/lib/live_beats_web/live/profile_live.ex +++ b/lib/live_beats_web/live/profile_live.ex @@ -58,6 +58,7 @@ defmodule LiveBeatsWeb.ProfileLive do module={SongRowComponent} rows={@songs} row_id={fn song -> "song-#{song.id}" end} + owns_profile?= {@owns_profile?} > <:col let={%{song: song}} label="Title"><%= song.title %> <:col let={%{song: song}} label="Artist"><%= song.artist %> diff --git a/lib/live_beats_web/live/profile_live/song_row_component.ex b/lib/live_beats_web/live/profile_live/song_row_component.ex index f1184f6..0ddcb69 100644 --- a/lib/live_beats_web/live/profile_live/song_row_component.ex +++ b/lib/live_beats_web/live/profile_live/song_row_component.ex @@ -28,7 +28,9 @@ defmodule LiveBeatsWeb.ProfileLive.SongRowComponent do <% end %> <%= if @status == :stopped do %> + <%= if @owns_profile? do %> <.icon name={:play} class="h-5 w-5 text-gray-400"/> + <% end %> <% end %> <% end %> @@ -52,7 +54,8 @@ defmodule LiveBeatsWeb.ProfileLive.SongRowComponent do col: assigns.col, class: assigns.class, index: assigns.index, - status: :stopped + status: :stopped, + owns_profile?: assigns.owns_profile? )} end end