From cd0a9f222ad3505a4bddc746a99199a06e1f4c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sof=C3=ADa=20Aritz?= Date: Wed, 5 Jul 2023 14:56:58 +0000 Subject: [PATCH] Improve rendering of Watch History videos --- src/invidious/routes/feeds.cr | 1 + src/invidious/views/feeds/history.ecr | 41 +++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr index fc62c5a3..201d324b 100644 --- a/src/invidious/routes/feeds.cr +++ b/src/invidious/routes/feeds.cr @@ -128,6 +128,7 @@ module Invidious::Routes::Feeds watched = user.watched.reverse[(page - 1) * max_results, max_results] end watched ||= [] of String + watched = watched.map { |id| get_video(id) } templated "feeds/history" end diff --git a/src/invidious/views/feeds/history.ecr b/src/invidious/views/feeds/history.ecr index 2234b297..e19e3bb0 100644 --- a/src/invidious/views/feeds/history.ecr +++ b/src/invidious/views/feeds/history.ecr @@ -31,20 +31,51 @@ <% watched.each do |item| %>
- + <% if !env.get("preferences").as(Preferences).thin_mode %>
- -
" method="post"> + + <% if item.responds_to?(:live_now) && item.live_now %> +

<%= translate(locale, "LIVE") %>

+ <% elsif item.length_seconds != 0 %> +

<%= recode_length_seconds(item.length_seconds) %>

+ <% end %> + + " method="post"> ">

- +

-

<% end %> +

<%= HTML.escape(item.title) %>

+ +
+ + + <% endpoint_params = "?v=#{item.id}" %> + <%= rendered "components/video-context-buttons" %> +
+ +
+
+ <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp.try &.> Time.utc %> +

<%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.utc).ago, locale)) %>

+ <% elsif Time.utc - item.published > 1.minute %> +

<%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %>

+ <% end %> +
+ + <% if item.responds_to?(:views) && item.views %> +
+

<%= translate_count(locale, "generic_views_count", item.views || 0, NumberFormatting::Short) %>

+
+ <% end %> +
<% end %>