diff --git a/lib/kobrakai_web/controllers/page_controller.ex b/lib/kobrakai_web/controllers/page_controller.ex index 9d60cb8..5fd49df 100644 --- a/lib/kobrakai_web/controllers/page_controller.ex +++ b/lib/kobrakai_web/controllers/page_controller.ex @@ -2,6 +2,14 @@ defmodule KobrakaiWeb.PageController do use KobrakaiWeb, :controller def home(conn, _params) do + videos = + Kobrakai.Bold.list_videos!().body["data"] + |> Enum.sort_by(& &1["published_at"]) + |> Enum.take(4) + |> Enum.map(&Kobrakai.Bold.video_response_mapping/1) + |> Stream.concat(Stream.repeatedly(fn -> nil end)) + |> Enum.take(4) + # The home page is often custom made, # so skip the default app layout. conn @@ -9,7 +17,8 @@ defmodule KobrakaiWeb.PageController do |> render(:home, projects: Kobrakai.Portfolio.featured_projects(), posts: Kobrakai.Blog.all_posts(), - images: Kobrakai.Photography.homepage() + images: Kobrakai.Photography.homepage(), + videos: videos ) end end diff --git a/lib/kobrakai_web/views/page_html/home.html.heex b/lib/kobrakai_web/views/page_html/home.html.heex index aa77040..bdb7439 100644 --- a/lib/kobrakai_web/views/page_html/home.html.heex +++ b/lib/kobrakai_web/views/page_html/home.html.heex @@ -1,5 +1,34 @@

Benjamin Milde

+
+

Video

+
+ <%= for {video, index} <- Enum.with_index(@videos, 1) do %> + <.link + :if={video} + class={[ + "opacity-0", + "animate-in-small animation-fill-mode-forwards animation-delay-#{index * 55}" + ]} + href={url(@conn, ~p"/videos/#{video.id}")} + > + <.image class="border-white border-2 mb-1" src={video.thumbnail} size={{640, 0}} /> +
+ {Calendar.strftime(video.date, "%d.%m.%Y")} +
+ +
+
+
+
+ <% end %> +
+
4}> + <.link navigate={~p"/videos"}> + Alle Videos <.arrow /> + +
+

Projekte