From 5432cd82aa5c651bf18d86c0f2a80af2c4e62f32 Mon Sep 17 00:00:00 2001 From: Lee Araneta Date: Tue, 6 Aug 2024 08:49:24 -0400 Subject: [PATCH] add "listen on spotify" links --- assets/spotify_logo.svg | 7 --- lib/snippit/spotify_api.ex | 2 +- .../components/custom_components.ex | 56 +++++++++++++------ .../components/layouts/root.html.heex | 44 +++++++-------- lib/snippit_web/live/add_snippet_live.ex | 4 +- lib/snippit_web/live/hello_live.ex | 13 ++++- lib/snippit_web/live/snippets_live.ex | 2 + 7 files changed, 76 insertions(+), 52 deletions(-) delete mode 100644 assets/spotify_logo.svg diff --git a/assets/spotify_logo.svg b/assets/spotify_logo.svg deleted file mode 100644 index 9b47990..0000000 --- a/assets/spotify_logo.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/lib/snippit/spotify_api.ex b/lib/snippit/spotify_api.ex index 35e0200..621c0c5 100644 --- a/lib/snippit/spotify_api.ex +++ b/lib/snippit/spotify_api.ex @@ -56,7 +56,7 @@ defmodule Snippit.SpotifyApi do spotify_url: track["uri"], artist: track["artists"] |> Enum.map(fn artist -> artist["name"] end) - |> Enum.join(" "), + |> Enum.join(", "), track: track["name"], duration_ms: track["duration_ms"] } diff --git a/lib/snippit_web/components/custom_components.ex b/lib/snippit_web/components/custom_components.ex index c74f50f..18894f5 100644 --- a/lib/snippit_web/components/custom_components.ex +++ b/lib/snippit_web/components/custom_components.ex @@ -42,13 +42,18 @@ defmodule SnippitWeb.CustomComponents do def snippet_display(assigns) do ~H"""
- + {"#{@snippet.snippet.album}
- <%!-- <.icon name="hero-heart" class="cursor-pointer"/> --%> +
+ + + +
<%= render_slot(@inner_block) %>
@@ -125,21 +130,38 @@ defmodule SnippitWeb.CustomComponents do attr :artist, :string, required: true attr :thumbnail_url, :string, required: true attr :spotify_url, :string, required: true + attr :album, :string, required: true def track_display(assigns) do ~H"""
- -
- <%= @track %> - <%= @artist %> + {"#{@album} +
+ + <%= @track %> + + + <%= @artist %> + + + Listen on +
+ + + + +
+
""" diff --git a/lib/snippit_web/components/layouts/root.html.heex b/lib/snippit_web/components/layouts/root.html.heex index be16098..850cdbd 100644 --- a/lib/snippit_web/components/layouts/root.html.heex +++ b/lib/snippit_web/components/layouts/root.html.heex @@ -12,32 +12,30 @@ - <%= if @current_user do %> -
-
- - - - -
-
+
+
+ <%= if @current_user do %> +
+
+ <%= @current_user.username %> +
+
+ <.link + href={~p"/auth/logout"} + class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700" > - <%= @current_user.username %> -
-
- <.link - href={~p"/auth/logout"} - class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700" - > - Log out - -
+ Log out +
-
- <% end %> + <% end %> + +
+ <%= @inner_content %> diff --git a/lib/snippit_web/live/add_snippet_live.ex b/lib/snippit_web/live/add_snippet_live.ex index e33fc90..32db582 100644 --- a/lib/snippit_web/live/add_snippet_live.ex +++ b/lib/snippit_web/live/add_snippet_live.ex @@ -263,7 +263,7 @@ defmodule SnippitWeb.AddSnippet do
  • @@ -286,6 +287,7 @@ defmodule SnippitWeb.AddSnippet do <.track_display track={@selected_track.track} artist={@selected_track.artist} + album={@selected_track.album} thumbnail_url={@selected_track.thumbnail_url} spotify_url={@selected_track.spotify_url} /> diff --git a/lib/snippit_web/live/hello_live.ex b/lib/snippit_web/live/hello_live.ex index 9042de3..760e647 100644 --- a/lib/snippit_web/live/hello_live.ex +++ b/lib/snippit_web/live/hello_live.ex @@ -119,12 +119,19 @@ defmodule SnippitWeb.HelloLive do

diff --git a/lib/snippit_web/live/snippets_live.ex b/lib/snippit_web/live/snippets_live.ex index 634e021..8c509e1 100644 --- a/lib/snippit_web/live/snippets_live.ex +++ b/lib/snippit_web/live/snippets_live.ex @@ -179,6 +179,7 @@ defmodule SnippitWeb.SnippetsLive do
<.snippet_display snippet={@snippet_to_delete} @@ -254,6 +255,7 @@ defmodule SnippitWeb.SnippetsLive do <.track_display track={@now_playing_snippet.snippet.track} artist={@now_playing_snippet.snippet.artist} + album={@now_playing_snippet.snippet.album} thumbnail_url={@now_playing_snippet.snippet.thumbnail_url} spotify_url={@now_playing_snippet.snippet.spotify_url} />