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 @@