Refactor code structure for improved readability and maintainability

This commit is contained in:
Alex Lion
2026-02-17 16:54:41 +01:00
parent 71f5542dcb
commit 5ea07f077d
14 changed files with 3991 additions and 3354 deletions

View File

@@ -49,7 +49,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
<span class="text-sm font-medium text-gray-600">{gettext("Processing...")}</span> <span class="text-sm font-medium text-gray-600">{gettext("Processing...")}</span>
</div> </div>
</div> </div>
<!-- Status Badge --> <!-- Status Badge -->
<div class="absolute top-4 left-4 z-10"> <div class="absolute top-4 left-4 z-10">
<%= if Event.started?(@event) && !Event.finished?(@event) do %> <%= if Event.started?(@event) && !Event.finished?(@event) do %>
@@ -69,7 +69,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
</div> </div>
<% end %> <% end %>
</div> </div>
<!-- LTI Badge --> <!-- LTI Badge -->
<div :if={@event.lti_resource} class="absolute top-4 right-4 z-10"> <div :if={@event.lti_resource} class="absolute top-4 right-4 z-10">
<span class="badge badge-neutral gap-1"> <span class="badge badge-neutral gap-1">
@@ -88,7 +88,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
LTI LTI
</span> </span>
</div> </div>
<!-- Sliding Bottom Panel --> <!-- Sliding Bottom Panel -->
<div <div
class="absolute bottom-0 left-0 right-0 bg-white transition-transform duration-300 ease-out z-20" class="absolute bottom-0 left-0 right-0 bg-white transition-transform duration-300 ease-out z-20"
@@ -105,7 +105,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
# {@event.code} # {@event.code}
</p> </p>
</div> </div>
<!-- 3-dot Menu --> <!-- 3-dot Menu -->
<div class="relative shrink-0"> <div class="relative shrink-0">
<button <button
@@ -135,7 +135,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
</div> </div>
</div> </div>
</div> </div>
<!-- Action Buttons (revealed on hover) --> <!-- Action Buttons (revealed on hover) -->
<div <div
:if={@event.presentation_file.status == "done" && !Event.finished?(@event)} :if={@event.presentation_file.status == "done" && !Event.finished?(@event)}
@@ -222,7 +222,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
/> />
<path d="M5.082 14.254a8.287 8.287 0 0 0-1.308 5.135 9.687 9.687 0 0 1-1.764-.44l-.115-.04a.563.563 0 0 1-.373-.487l-.01-.121a3.75 3.75 0 0 1 3.57-4.047ZM20.226 19.389a8.287 8.287 0 0 0-1.308-5.135 3.75 3.75 0 0 1 3.57 4.047l-.01.121a.563.563 0 0 1-.373.486l-.115.04c-.567.2-1.156.349-1.764.441Z" /> <path d="M5.082 14.254a8.287 8.287 0 0 0-1.308 5.135 9.687 9.687 0 0 1-1.764-.44l-.115-.04a.563.563 0 0 1-.373-.487l-.01-.121a3.75 3.75 0 0 1 3.57-4.047ZM20.226 19.389a8.287 8.287 0 0 0-1.308-5.135 3.75 3.75 0 0 1 3.57 4.047l-.01.121a.563.563 0 0 1-.373.486l-.115.04c-.567.2-1.156.349-1.764.441Z" />
</svg> </svg>
<span class="font-medium">{gettext("Attendant Room")}</span> <span class="font-medium">{gettext("Attendees Room")}</span>
</a> </a>
</div> </div>
</div> </div>
@@ -247,14 +247,14 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
{gettext("End Event")} {gettext("End Event")}
</.link> </.link>
</div> </div>
<!-- Error Status --> <!-- Error Status -->
<div :if={@event.presentation_file.status == "fail"} class="px-2 pb-2"> <div :if={@event.presentation_file.status == "fail"} class="px-2 pb-2">
<span class="text-sm text-supporting-red-500"> <span class="text-sm text-supporting-red-500">
{gettext("Error when processing the file")} {gettext("Error when processing the file")}
</span> </span>
</div> </div>
<!-- Finished Event Actions --> <!-- Finished Event Actions -->
<div :if={Event.finished?(@event)} class="px-2 pb-2"> <div :if={Event.finished?(@event)} class="px-2 pb-2">
<a href={~p"/events/#{@event.uuid}/stats"} class="btn btn-primary w-full"> <a href={~p"/events/#{@event.uuid}/stats"} class="btn btn-primary w-full">
@@ -297,7 +297,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
<img src="/images/logo.svg" class="h-6 animate-pulse" alt="Loading" /> <img src="/images/logo.svg" class="h-6 animate-pulse" alt="Loading" />
</div> </div>
</div> </div>
<!-- Event Info --> <!-- Event Info -->
<div class="min-w-0"> <div class="min-w-0">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
@@ -353,7 +353,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
</span> </span>
</div> </div>
</div> </div>
<!-- Actions --> <!-- Actions -->
<div class="flex items-center gap-2 ml-auto"> <div class="flex items-center gap-2 ml-auto">
<%= if @event.presentation_file.status == "done" && !Event.finished?(@event) do %> <%= if @event.presentation_file.status == "done" && !Event.finished?(@event) do %>
@@ -438,7 +438,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
/> />
<path d="M5.082 14.254a8.287 8.287 0 0 0-1.308 5.135 9.687 9.687 0 0 1-1.764-.44l-.115-.04a.563.563 0 0 1-.373-.487l-.01-.121a3.75 3.75 0 0 1 3.57-4.047ZM20.226 19.389a8.287 8.287 0 0 0-1.308-5.135 3.75 3.75 0 0 1 3.57 4.047l-.01.121a.563.563 0 0 1-.373.486l-.115.04c-.567.2-1.156.349-1.764.441Z" /> <path d="M5.082 14.254a8.287 8.287 0 0 0-1.308 5.135 9.687 9.687 0 0 1-1.764-.44l-.115-.04a.563.563 0 0 1-.373-.487l-.01-.121a3.75 3.75 0 0 1 3.57-4.047ZM20.226 19.389a8.287 8.287 0 0 0-1.308-5.135 3.75 3.75 0 0 1 3.57 4.047l-.01.121a.563.563 0 0 1-.373.486l-.115.04c-.567.2-1.156.349-1.764.441Z" />
</svg> </svg>
<span class="font-medium">{gettext("Attendant Room")}</span> <span class="font-medium">{gettext("Attendees Room")}</span>
</a> </a>
</div> </div>
</div> </div>
@@ -491,7 +491,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
{gettext("View report")} {gettext("View report")}
</a> </a>
<% end %> <% end %>
<!-- 3-dot Menu --> <!-- 3-dot Menu -->
<div class="relative"> <div class="relative">
<button <button
@@ -550,7 +550,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
<img src="/images/logo.svg" class="h-8 animate-pulse" alt="Loading" /> <img src="/images/logo.svg" class="h-8 animate-pulse" alt="Loading" />
</div> </div>
</div> </div>
<!-- Event Info --> <!-- Event Info -->
<div class="flex-1 min-w-0 py-1"> <div class="flex-1 min-w-0 py-1">
<h3 class="font-semibold text-gray-800 text-lg leading-tight truncate"> <h3 class="font-semibold text-gray-800 text-lg leading-tight truncate">
@@ -577,7 +577,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
<% end %> <% end %>
</div> </div>
</div> </div>
<!-- 3-dot Menu --> <!-- 3-dot Menu -->
<div class="relative shrink-0"> <div class="relative shrink-0">
<button <button
@@ -606,7 +606,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
</div> </div>
</div> </div>
</div> </div>
<!-- Bottom Row: Action Buttons --> <!-- Bottom Row: Action Buttons -->
<div class="flex gap-2"> <div class="flex gap-2">
<%= if @event.presentation_file.status == "done" && !Event.finished?(@event) do %> <%= if @event.presentation_file.status == "done" && !Event.finished?(@event) do %>
@@ -691,7 +691,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do
/> />
<path d="M5.082 14.254a8.287 8.287 0 0 0-1.308 5.135 9.687 9.687 0 0 1-1.764-.44l-.115-.04a.563.563 0 0 1-.373-.487l-.01-.121a3.75 3.75 0 0 1 3.57-4.047ZM20.226 19.389a8.287 8.287 0 0 0-1.308-5.135 3.75 3.75 0 0 1 3.57 4.047l-.01.121a.563.563 0 0 1-.373.486l-.115.04c-.567.2-1.156.349-1.764.441Z" /> <path d="M5.082 14.254a8.287 8.287 0 0 0-1.308 5.135 9.687 9.687 0 0 1-1.764-.44l-.115-.04a.563.563 0 0 1-.373-.487l-.01-.121a3.75 3.75 0 0 1 3.57-4.047ZM20.226 19.389a8.287 8.287 0 0 0-1.308-5.135 3.75 3.75 0 0 1 3.57 4.047l-.01.121a.563.563 0 0 1-.373.486l-.115.04c-.567.2-1.156.349-1.764.441Z" />
</svg> </svg>
<span class="font-medium">{gettext("Attendant Room")}</span> <span class="font-medium">{gettext("Attendees Room")}</span>
</a> </a>
</div> </div>
</div> </div>

View File

@@ -39,19 +39,6 @@ defmodule ClaperWeb.EventLive.ManageAttendeesOptionsComponent do
</svg> </svg>
</:icon> </:icon>
</.toggle_row> </.toggle_row>
<.toggle_row
label={if @state.show_attendee_count, do: gettext("Hide attendee count"), else: gettext("Show attendee count")}
checked={@state.show_attendee_count}
key={:show_attendee_count}
shortcut={if @create == nil, do: "R", else: nil}
show_shortcut={@show_shortcut}
>
<:icon>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
<path d="M7 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM14.5 9a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM1.615 16.428a1.224 1.224 0 0 1-.569-1.175 6.002 6.002 0 0 1 11.908 0c.058.467-.172.92-.57 1.174A9.953 9.953 0 0 1 7 18a9.953 9.953 0 0 1-5.385-1.572ZM14.5 16h-.106c.07-.297.088-.611.048-.933a7.47 7.47 0 0 0-1.588-3.755 4.502 4.502 0 0 1 5.874 2.636.818.818 0 0 1-.36.98A7.465 7.465 0 0 1 14.5 16Z" />
</svg>
</:icon>
</.toggle_row>
</div> </div>
</div> </div>
""" """

View File

@@ -37,7 +37,7 @@ defmodule ClaperWeb.EventLive.ManageAudienceResponsesComponent do
phx-value-tab="posts" phx-value-tab="posts"
class={"px-3 py-1.5 rounded-full text-sm font-medium transition-colors #{if @list_tab == :posts, do: "bg-secondary-500 text-white", else: "text-gray-600 hover:bg-gray-100"}"} class={"px-3 py-1.5 rounded-full text-sm font-medium transition-colors #{if @list_tab == :posts, do: "bg-secondary-500 text-white", else: "text-gray-600 hover:bg-gray-100"}"}
> >
{gettext("Chat")} ({@post_count}) {gettext("Messages")} ({@post_count})
</button> </button>
</li> </li>
<li> <li>

View File

@@ -56,7 +56,7 @@ defmodule ClaperWeb.EventLive.ManagePresentationOptionsComponent do
</:icon> </:icon>
</.toggle_row> </.toggle_row>
<.toggle_row <.toggle_row
label={if @state.show_only_pinned, do: gettext("Show all messages"), else: gettext("Show pinned messages")} label={if @state.show_only_pinned, do: gettext("Show all messages"), else: gettext("Show only pinned messages")}
checked={@state.show_only_pinned} checked={@state.show_only_pinned}
key={:show_only_pinned} key={:show_only_pinned}
shortcut={if @create == nil, do: "E", else: nil} shortcut={if @create == nil, do: "E", else: nil}
@@ -105,6 +105,19 @@ defmodule ClaperWeb.EventLive.ManagePresentationOptionsComponent do
</svg> </svg>
</:icon> </:icon>
</.toggle_row> </.toggle_row>
<.toggle_row
label={if @state.show_attendee_count, do: gettext("Hide attendee count"), else: gettext("Show attendee count")}
checked={@state.show_attendee_count}
key={:show_attendee_count}
shortcut={if @create == nil, do: "R", else: nil}
show_shortcut={@show_shortcut}
>
<:icon>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
<path d="M7 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM14.5 9a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM1.615 16.428a1.224 1.224 0 0 1-.569-1.175 6.002 6.002 0 0 1 11.908 0c.058.467-.172.92-.57 1.174A9.953 9.953 0 0 1 7 18a9.953 9.953 0 0 1-5.385-1.572ZM14.5 16h-.106c.07-.297.088-.611.048-.933a7.47 7.47 0 0 0-1.588-3.755 4.502 4.502 0 0 1 5.874 2.636.818.818 0 0 1-.36.98A7.465 7.465 0 0 1 14.5 16Z" />
</svg>
</:icon>
</.toggle_row>
</div> </div>
</div> </div>
""" """

View File

@@ -3,9 +3,7 @@
<div class="flex items-center justify-center gap-2"> <div class="flex items-center justify-center gap-2">
<span class="font-bold text-secondary-500">{gettext("NEWS:")}</span> <span class="font-bold text-secondary-500">{gettext("NEWS:")}</span>
<span class="text-secondary-500"> <span class="text-secondary-500">
{gettext(
"Exciting News: Seamlessly join live events and elevate your audience engagement today!"
)}
</span> </span>
</div> </div>
</div> </div>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff