Skip to content

Commit

Permalink
feat: add minutes remaining on continue watching component
Browse files Browse the repository at this point in the history
  • Loading branch information
trueChazza committed Mar 2, 2022
1 parent 45f30dc commit 5d4c0aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/media_server_web/components/watch_component.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
<%= live_redirect to: @link, class: "hover:text-slate-800 hover:underline" do %>
<%= @title %>
<% end %>
<div class="w-full bg-slate-200 h-1 mt-4">
<div class="bg-red-300 h-1" style={"width: #{ @percentage_complete }%"}></div>
<div class="w-full flex mt-2">
<div class="flex-none text-xs text-slate-500">
<%= @minutes_remaining %> min left
</div>
<div class="flex-1 w-full bg-slate-200 h-1 mt-2 ml-2">
<div class="bg-red-300 h-1" style={"width: #{ @percentage_complete }%"}></div>
</div>
</div>
</div>
<div class="flex-shrink-0 pr-2">
Expand Down
2 changes: 2 additions & 0 deletions lib/media_server_web/live/home_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
id_item: item.id,
image_url: item.image_url,
title: item.title,
minutes_remaining: floor((item.duration - item.current_time) / 60),
percentage_complete: (item.current_time / item.duration) * 100,
link: Routes.watch_movie_show_path(@socket, :show, item.movie_id, seconds: item.current_time),
event: "delete_movie",
Expand All @@ -64,6 +65,7 @@
id_item: item.id,
image_url: item.image_url,
title: item.title,
minutes_remaining: floor((item.duration - item.current_time) / 60),
percentage_complete: (item.current_time / item.duration) * 100,
link: Routes.watch_episode_show_path(@socket, :show, item.episode_id, seconds: item.current_time),
event: "delete_episode",
Expand Down
2 changes: 2 additions & 0 deletions lib/media_server_web/live/watches_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
id_item: item.id,
image_url: item.image_url,
title: item.title,
minutes_remaining: floor((item.duration - item.current_time) / 60),
percentage_complete: (item.current_time / item.duration) * 100,
link: Routes.watch_movie_show_path(@socket, :show, item.movie_id, seconds: item.current_time),
event: "delete_movie",
Expand All @@ -30,6 +31,7 @@
id_item: item.id,
image_url: item.image_url,
title: item.title,
minutes_remaining: floor((item.duration - item.current_time) / 60),
percentage_complete: (item.current_time / item.duration) * 100,
link: Routes.watch_episode_show_path(@socket, :show, item.episode_id, seconds: item.current_time),
event: "delete_episode",
Expand Down

0 comments on commit 5d4c0aa

Please sign in to comment.