-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #446 from midarrlabs/feature/add-people
feat: add people
- Loading branch information
Showing
8 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
defmodule MediaServerWeb.PeopleLive.Show do | ||
use MediaServerWeb, :live_view | ||
|
||
@impl true | ||
def mount(_params, session, socket) do | ||
{ | ||
:ok, | ||
socket | ||
|> assign( | ||
:current_user, | ||
MediaServer.Accounts.get_user_by_session_token(session["user_token"]) | ||
) | ||
} | ||
end | ||
|
||
@impl true | ||
def handle_params(%{"id" => id}, _url, socket) do | ||
pid = self() | ||
|
||
Task.start(fn -> | ||
send(pid, {:person, OapiTmdb.Operations.person_details(id)}) | ||
end) | ||
|
||
{ | ||
:noreply, | ||
socket | ||
|> assign(:id, id) | ||
} | ||
end | ||
|
||
@impl true | ||
def handle_info({:person, person}, socket) do | ||
{ | ||
:noreply, | ||
socket | ||
|> assign(:page_title, person["name"]) | ||
|> assign(:person, person) | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<%= if assigns[:person] do %> | ||
|
||
<div class="flex-auto prose dark:prose-invert"> | ||
|
||
<div class="relative overflow-visible bg-zinc-900 w-40 mb-6"> | ||
<img | ||
src={"https://image.tmdb.org/t/p/original/#{ @person["profile_path"] }"} | ||
alt="" | ||
class="h-full w-full object-cover object-center" | ||
loading="lazy" | ||
/> | ||
</div> | ||
|
||
<header class="flex flex-col gap-y-2"> | ||
<div class="flex items-center gap-6"> | ||
<div class="flex flex-col"> | ||
<h1 class="text-4xl font-bold text-slate-900"><%= @person["name"] %></h1> | ||
</div> | ||
</div> | ||
<div class="flex gap-x-4 items-center"> | ||
<.live_component | ||
module={MediaServerWeb.Components.FollowComponent} | ||
id="followComponent" | ||
media_id={@person["id"]} | ||
media_type="person" | ||
user_id={@current_user.id} | ||
return_to={~p"/people/#{@person["id"]}"} | ||
/> | ||
</div> | ||
</header> | ||
|
||
<h2>Overview</h2> | ||
|
||
<p class="lead"> | ||
<%= @person["biography"] %> | ||
</p> | ||
|
||
</div> | ||
|
||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters