Skip to content

Commit

Permalink
feat: add pagination to backoffice badges listing
Browse files Browse the repository at this point in the history
  • Loading branch information
joaodiaslobo committed Feb 9, 2025
1 parent 368447e commit 5ed5a72
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/safira_web/live/backoffice/badge_live/index.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule SafiraWeb.Backoffice.BadgeLive.Index do
use SafiraWeb, :backoffice_view

import SafiraWeb.Components.{Badge, TableSearch}
import SafiraWeb.Components.{Badge, Table, TableSearch}

alias Safira.Contest
alias Safira.Contest.{Badge, BadgeCategory, BadgeCondition, BadgeTrigger}
Expand Down
3 changes: 2 additions & 1 deletion lib/safira_web/live/backoffice/badge_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<div
id="badges-grid"
class="grid grid-cols-1 gap-x-10 gap-y-5 xs:grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6"
class="grid grid-cols-1 gap-x-10 gap-y-5 xs:grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 mb-6"
phx-update="stream"
>
<%= for {id, badge} <- @streams.badges do %>
Expand All @@ -40,6 +40,7 @@
</.link>
<% end %>
</div>
<.pagination :if={@meta.total_pages > 1} meta={@meta} params={@params} />
</.page>

<.modal
Expand Down
2 changes: 1 addition & 1 deletion lib/safira_web/live/backoffice/scanner_live/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule SafiraWeb.Backoffice.ScannerLive.Index do

alias Safira.Contest

import SafiraWeb.Components.{Badge, TableSearch, Tabs}
import SafiraWeb.Components.{Badge, Table, TableSearch, Tabs}

@impl true
def mount(_params, _session, socket) do
Expand Down
5 changes: 4 additions & 1 deletion lib/safira_web/live/backoffice/scanner_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@
<div
id="badges-grid"
phx-update="stream"
class="grid grid-cols-1 gap-x-10 gap-y-5 xs:grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6"
class="grid grid-cols-1 gap-x-10 gap-y-5 xs:grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 mb-6"
>
<%= for {id, badge} <- @streams.badges do %>
<.link id={id} patch={~p"/dashboard/scanner/badge/#{badge.id}/give"}>
<.badge id={badge.id} badge={badge} hover_zoom />
</.link>
<% end %>
</div>
<div class="w-full">
<.pagination :if={@meta.total_pages > 1} meta={@meta} params={@params} />
</div>
</div>
</.page>
</div>

0 comments on commit 5ed5a72

Please sign in to comment.