Useful data on homepage v1 (#43)

* Made the homepage _slightly_ more useful

* Very minor refactor in alpine body-level object
This commit is contained in:
Kieran
2024-03-01 16:25:55 -08:00
committed by GitHub
parent b54e69c609
commit 6738071613
3 changed files with 36 additions and 7 deletions
@@ -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