diff --git a/lib/alchemy_pub_web/page_live.ex b/lib/alchemy_pub_web/page_live.ex index 405f105..1c36cb4 100644 --- a/lib/alchemy_pub_web/page_live.ex +++ b/lib/alchemy_pub_web/page_live.ex @@ -148,6 +148,7 @@ defmodule AlchemyPubWeb.PageLive do fullscreen = params["f"] == "true" mute = params["m"] == "true" all_pages = params["a"] == "true" + page_count = Enum.count(content) socket = socket @@ -161,7 +162,8 @@ defmodule AlchemyPubWeb.PageLive do subpage: subpage, fullscreen: fullscreen && !all_pages, mute: mute && !all_pages, - all_pages: all_pages + all_pages: all_pages, + page_count: page_count ) if all_pages do @@ -175,7 +177,7 @@ defmodule AlchemyPubWeb.PageLive do animation: [], }, at: -1, - limit: -Enum.count(content) + limit: -page_count ) end) else diff --git a/lib/alchemy_pub_web/page_live.html.heex b/lib/alchemy_pub_web/page_live.html.heex index 8c6d6b2..e2922e5 100644 --- a/lib/alchemy_pub_web/page_live.html.heex +++ b/lib/alchemy_pub_web/page_live.html.heex @@ -142,9 +142,14 @@ phx-update="stream" class={ cond do - @all_pages -> "flex flex-col md:w-[34rem] lg:min-w-[42rem] print:min-w-[50rem] deck" - @fullscreen -> "absolute top-0 left-0 w-full h-full z-1 deck overflow-hidden" - true -> "relative md:w-[34rem] lg:min-w-[42rem] print:min-w-[50rem] aspect-16/10 deck" + @all_pages -> + "flex flex-col md:w-[34rem] lg:min-w-[42rem] print:min-w-[50rem] deck" + + @fullscreen -> + "absolute top-0 left-0 w-full h-full z-1 deck overflow-hidden" + + true -> + "relative md:w-[34rem] lg:min-w-[42rem] print:min-w-[50rem] aspect-16/10 deck" end } phx-window-keyup="key" @@ -157,13 +162,24 @@ "p-4 bg-base-200 border-1 border-accent rounded-box", "overflow-hidden duration-250 ease-in-out transform transition", "@container", - if @all_pages do "aspect-16/10 print:break-after-page" else "w-full h-full absolute top-0 left-0" end, + if @all_pages do + "aspect-16/10 print:break-after-page" + else + "w-full h-full absolute top-0 left-0" + end, content.animation ]} phx-mounted={remove_animation(content.animation, id)} >