Made the homepage _slightly_ more useful

This commit is contained in:
Kieran Eglin 2024-03-01 15:27:33 -08:00
parent b54e69c609
commit dc5c7c4f7c
No known key found for this signature in database
GPG key ID: 193984967FCF432D
2 changed files with 35 additions and 6 deletions

View file

@ -1,8 +1,10 @@
defmodule PinchflatWeb.Pages.PageController do
alias Pinchflat.Media.MediaItem
use PinchflatWeb, :controller
alias Pinchflat.Repo
alias Pinchflat.Sources.Source
alias Pinchflat.Media.MediaItem
alias Pinchflat.Profiles.MediaProfile
def home(conn, params) do
@ -18,9 +20,17 @@ defmodule PinchflatWeb.Pages.PageController do
end
defp render_home_page(conn) do
media_profile_count = Repo.aggregate(MediaProfile, :count, :id)
source_count = Repo.aggregate(Source, :count, :id)
media_item_count = Repo.aggregate(MediaItem, :count, :id)
conn
|> put_session(:onboarding, false)
|> render(:home)
|> render(:home,
media_profile_count: media_profile_count,
source_count: source_count,
media_item_count: media_item_count
)
end
defp render_onboarding_page(conn, media_profiles_exist, sources_exist) do

View file

@ -1,8 +1,27 @@
<div class="rounded-sm border border-stroke bg-white shadow-default dark:border-strokedark dark:bg-boxdark">
<div class="max-w-full overflow-x-auto">
<div class="flex flex-col gap-10 text-center my-10">
<h2 class="text-2xl">TODO: Put some useful info or analytics here</h2>
<p>For now, the options in the sidebar have what you need</p>
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
<div class="rounded-sm border px-7.5 py-6 shadow-default border-strokedark bg-boxdark">
<div class="mt-4 flex flex-col items-center justify-center">
<span class="text-md font-medium">Media Profile(s)</span>
<h4 class="text-title-md font-bold text-white">
<%= @media_profile_count %>
</h4>
</div>
</div>
<div class="rounded-sm border px-7.5 py-6 shadow-default border-strokedark bg-boxdark">
<div class="mt-4 flex flex-col items-center justify-center">
<span class="text-md font-medium">Source(s)</span>
<h4 class="text-title-md font-bold text-white">
<%= @source_count %>
</h4>
</div>
</div>
<div class="rounded-sm border px-7.5 py-6 shadow-default border-strokedark bg-boxdark">
<div class="mt-4 flex flex-col items-center justify-center">
<span class="text-md font-medium">Media Item(s)</span>
<h4 class="text-title-md font-bold text-white">
<%= @media_item_count %>
</h4>
</div>
</div>
<span class="text-strokedark">I know this page isn't super useful yet, but give it time :&rpar;</span>
</div>