diff --git a/lib/pinchflat_web/controllers/media_sources/source_controller.ex b/lib/pinchflat_web/controllers/media_sources/source_controller.ex index 63f4cbe..e4b28ad 100644 --- a/lib/pinchflat_web/controllers/media_sources/source_controller.ex +++ b/lib/pinchflat_web/controllers/media_sources/source_controller.ex @@ -2,6 +2,7 @@ defmodule PinchflatWeb.MediaSources.SourceController do use PinchflatWeb, :controller alias Pinchflat.Repo + alias Pinchflat.Media alias Pinchflat.Profiles alias Pinchflat.MediaSource alias Pinchflat.MediaSource.Source @@ -36,7 +37,10 @@ defmodule PinchflatWeb.MediaSources.SourceController do |> MediaSource.get_source!() |> Repo.preload(:media_profile) - render(conn, :show, source: source) + pending_media = Media.list_pending_media_items_for(source) + downloaded_media = Media.list_downloaded_media_items_for(source) + + render(conn, :show, source: source, pending_media: pending_media, downloaded_media: downloaded_media) end def edit(conn, %{"id" => id}) do diff --git a/lib/pinchflat_web/controllers/media_sources/source_html/show.html.heex b/lib/pinchflat_web/controllers/media_sources/source_html/show.html.heex index 1d947d5..63a5b6e 100644 --- a/lib/pinchflat_web/controllers/media_sources/source_html/show.html.heex +++ b/lib/pinchflat_web/controllers/media_sources/source_html/show.html.heex @@ -33,6 +33,38 @@

Attributes

<.list_items_from_map map={Map.from_struct(@source)} /> + +

Downloaded Media

+ <%= if length(@downloaded_media) > 0 do %> + <.table rows={@downloaded_media} table_class="text-black dark:text-white"> + <:col :let={media_item} label="Title"> + <%= String.slice(media_item.title, 0..50) %>... + + <:col :let={media_item} label="" class="flex place-content-evenly"> + <.link navigate={~p"/media/#{media_item.id}"} class="hover:text-secondary duration-200 ease-in-out mx-0.5"> + <.icon name="hero-eye" /> + + + + <% else %> +

Nothing Here!

+ <% end %> + +

Pending Media

+ <%= if length(@pending_media) > 0 do %> + <.table rows={@pending_media} table_class="text-black dark:text-white"> + <:col :let={media_item} label="Title"> + <%= String.slice(media_item.title, 0..50) %>... + + <:col :let={media_item} label="" class="flex place-content-evenly"> + <.link navigate={~p"/media/#{media_item.id}"} class="hover:text-secondary duration-200 ease-in-out mx-0.5"> + <.icon name="hero-eye" /> + + + + <% else %> +

Nothing Here!

+ <% end %>