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:
parent
be8bcf0eb2
commit
36f27c76e8
3 changed files with 36 additions and 7 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
|
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body x-data="{ 'sidebarVisible': false }" class="dark text-bodydark bg-boxdark-2">
|
<body x-data="{ sidebarVisible: false }" class="dark text-bodydark bg-boxdark-2">
|
||||||
<%= @inner_content %>
|
<%= @inner_content %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
defmodule PinchflatWeb.Pages.PageController do
|
defmodule PinchflatWeb.Pages.PageController do
|
||||||
|
alias Pinchflat.Media.MediaItem
|
||||||
use PinchflatWeb, :controller
|
use PinchflatWeb, :controller
|
||||||
|
|
||||||
alias Pinchflat.Repo
|
alias Pinchflat.Repo
|
||||||
alias Pinchflat.Sources.Source
|
alias Pinchflat.Sources.Source
|
||||||
|
alias Pinchflat.Media.MediaItem
|
||||||
alias Pinchflat.Profiles.MediaProfile
|
alias Pinchflat.Profiles.MediaProfile
|
||||||
|
|
||||||
def home(conn, params) do
|
def home(conn, params) do
|
||||||
|
|
@ -18,9 +20,17 @@ defmodule PinchflatWeb.Pages.PageController do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp render_home_page(conn) do
|
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
|
conn
|
||||||
|> put_session(:onboarding, false)
|
|> 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
|
end
|
||||||
|
|
||||||
defp render_onboarding_page(conn, media_profiles_exist, sources_exist) do
|
defp render_onboarding_page(conn, media_profiles_exist, sources_exist) do
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,27 @@
|
||||||
<div class="rounded-sm border border-stroke bg-white shadow-default dark:border-strokedark dark:bg-boxdark">
|
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||||
<div class="max-w-full overflow-x-auto">
|
<div class="rounded-sm border px-7.5 py-6 shadow-default border-strokedark bg-boxdark">
|
||||||
<div class="flex flex-col gap-10 text-center my-10">
|
<div class="mt-4 flex flex-col items-center justify-center">
|
||||||
<h2 class="text-2xl">TODO: Put some useful info or analytics here</h2>
|
<span class="text-md font-medium">Media Profile(s)</span>
|
||||||
<p>For now, the options in the sidebar have what you need</p>
|
<h4 class="text-title-md font-bold text-white">
|
||||||
|
<%= @media_profile_count %>
|
||||||
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
</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 :)</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue