Skip to content

Commit

Permalink
chore: minor styling changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruioliveira02 committed Feb 6, 2025
1 parent d1a89b6 commit 5414a8f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
7 changes: 4 additions & 3 deletions lib/safira_web/live/sponsor/home_live/components/attendee.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ defmodule SafiraWeb.Sponsor.HomeLive.Components.Attendee do
"""
use SafiraWeb, :component

alias Safira.Accounts.User

import SafiraWeb.Components.Avatar

attr :id, :string, required: true
attr :name, :string, required: true
attr :image, :string, required: true
attr :user, User, required: true

def attendee(assigns) do
~H"""
Expand All @@ -18,7 +19,7 @@ defmodule SafiraWeb.Sponsor.HomeLive.Components.Attendee do
<div class="m-auto w-fit">
<.avatar size={:lg} handle={@user.handle} />
</div>
<p class="font-terminal text-center uppercase text-xl">
<p class="text-center text-lg mt-2">
<%= @user.name %>
</p>
</div>
Expand Down
17 changes: 10 additions & 7 deletions lib/safira_web/live/sponsor/home_live/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ defmodule SafiraWeb.Sponsor.HomeLive.Index do
import SafiraWeb.Components.Table
import SafiraWeb.Components.TableSearch

@limit 12

@impl true
def mount(_params, _session, socket) do
{:ok,
Expand All @@ -22,7 +24,7 @@ defmodule SafiraWeb.Sponsor.HomeLive.Index do
def handle_params(params, _url, socket) do
badge_id = socket.assigns.current_user.company.badge_id

case get_users(socket.assigns.all_enabled and socket.assigns.all, badge_id, params) do
case list_users(socket.assigns.all_enabled and socket.assigns.all, badge_id, params) do
{:ok, {users, meta}} ->
{:noreply,
socket
Expand All @@ -36,10 +38,11 @@ defmodule SafiraWeb.Sponsor.HomeLive.Index do
end
end

@impl true
def handle_event("validate", %{"all" => all}, socket) do
badge_id = socket.assigns.current_user.company.badge_id

case get_users(
case list_users(
socket.assigns.all_enabled and string_to_bool(all),
badge_id,
socket.assigns.params
Expand All @@ -57,10 +60,10 @@ defmodule SafiraWeb.Sponsor.HomeLive.Index do
end
end

defp get_users(_, nil, _), do: {:ok, {[], %Flop.Meta{current_offset: 0, current_page: 0}}}
defp list_users(_, nil, _), do: {:ok, {[], %Flop.Meta{current_offset: 0, current_page: 0}}}

defp get_users(false, badge_id, params) do
case Contest.list_badge_redeems_meta(badge_id, params) do
defp list_users(false, badge_id, params) do
case Contest.list_badge_redeems_meta(badge_id, Map.put(params, "page_size", @limit)) do
{:ok, {redeems, meta}} ->
{:ok, {Enum.map(redeems, & &1.attendee.user), meta}}

Expand All @@ -69,8 +72,8 @@ defmodule SafiraWeb.Sponsor.HomeLive.Index do
end
end

defp get_users(true, _, params) do
Accounts.list_attendees(params)
defp list_users(true, _, params) do
Accounts.list_attendees(Map.put(params, "page_size", @limit))
end

defp has_all_access?(company) do
Expand Down
2 changes: 1 addition & 1 deletion lib/safira_web/live/sponsor/home_live/index.html.heex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<.page title={gettext("Visitors")} title_class="font-terminal uppercase" size={:xl}>
<.page title={gettext("Visitors")}>
<div>
<.table_search
id="visitor-table-name-search"
Expand Down

0 comments on commit 5414a8f

Please sign in to comment.