Skip to content

Commit 1b18d1f

Browse files
committed
refactor: update load more indicator to use data attribute
- Replaced the id "load-more-indicator" with a data attribute "data-load-more-indicator" across multiple components to improve consistency and facilitate better targeting in JavaScript. - Adjusted related logic in the app to ensure proper functionality with the new data attribute.
1 parent fa29fdf commit 1b18d1f

File tree

7 files changed

+11
-9
lines changed

7 files changed

+11
-9
lines changed

assets/js/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,9 @@ const Hooks = {
486486
);
487487

488488
// Look for the indicator inside this.el rather than document-wide
489-
const loadMoreIndicator = this.el.querySelector("#load-more-indicator");
489+
const loadMoreIndicator = this.el.querySelector(
490+
"[data-load-more-indicator]"
491+
);
490492
if (loadMoreIndicator) {
491493
this.observer.observe(loadMoreIndicator);
492494
}

lib/algora_web/live/bounties_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ defmodule AlgoraWeb.BountiesLive do
141141
<% else %>
142142
<div id="bounties-container" phx-hook="InfiniteScroll">
143143
<.bounties bounties={@bounties} />
144-
<div :if={@has_more_bounties} class="flex justify-center mt-4" id="load-more-indicator">
144+
<div :if={@has_more_bounties} class="flex justify-center mt-4" data-load-more-indicator>
145145
<div class="animate-pulse text-muted-foreground">
146146
<.icon name="tabler-loader" class="h-6 w-6 animate-spin" />
147147
</div>

lib/algora_web/live/org/bounties_live.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ defmodule AlgoraWeb.Org.BountiesLive do
217217
</tbody>
218218
</table>
219219
</div>
220-
<div :if={@has_more_bounties} class="flex justify-center mt-4" id="load-more-indicator">
220+
<div :if={@has_more_bounties} class="flex justify-center mt-4" data-load-more-indicator>
221221
<div class="animate-pulse text-gray-400">
222222
<.icon name="tabler-loader" class="h-6 w-6 animate-spin" />
223223
</div>
@@ -261,7 +261,7 @@ defmodule AlgoraWeb.Org.BountiesLive do
261261
</div>
262262
</div>
263263
<% end %>
264-
<div :if={@has_more_transactions} class="flex justify-center mt-4" id="load-more-indicator">
264+
<div :if={@has_more_transactions} class="flex justify-center mt-4" data-load-more-indicator>
265265
<div class="animate-pulse text-gray-400">
266266
<.icon name="tabler-loader" class="h-6 w-6 animate-spin" />
267267
</div>

lib/algora_web/live/org/dashboard_live.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ defmodule AlgoraWeb.Org.DashboardLive do
384384
<div
385385
:if={@has_more_bounties}
386386
class="flex justify-center mt-4"
387-
id="load-more-indicator"
387+
data-load-more-indicator
388388
>
389389
<div class="animate-pulse text-muted-foreground">
390390
<.icon name="tabler-loader" class="h-6 w-6 animate-spin" />
@@ -447,7 +447,7 @@ defmodule AlgoraWeb.Org.DashboardLive do
447447
<div
448448
:if={@has_more_transactions}
449449
class="flex justify-center mt-4"
450-
id="load-more-indicator"
450+
data-load-more-indicator
451451
>
452452
<div class="animate-pulse text-gray-400">
453453
<.icon name="tabler-loader" class="h-6 w-6 animate-spin" />

lib/algora_web/live/orgs_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ defmodule AlgoraWeb.OrgsLive do
117117
</li>
118118
<% end %>
119119
</ul>
120-
<div :if={@has_more_orgs} class="flex justify-center mt-4" id="load-more-indicator">
120+
<div :if={@has_more_orgs} class="flex justify-center mt-4" data-load-more-indicator>
121121
<div class="animate-pulse text-muted-foreground">
122122
<.icon name="tabler-loader" class="h-6 w-6 animate-spin" />
123123
</div>

lib/algora_web/live/user/dashboard_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ defmodule AlgoraWeb.User.DashboardLive do
128128
<%= if length(@bounties) > 0 do %>
129129
<div id="bounties-container" phx-hook="InfiniteScroll">
130130
<.bounties bounties={@bounties} />
131-
<div :if={@has_more_bounties} class="flex justify-center mt-4" id="load-more-indicator">
131+
<div :if={@has_more_bounties} class="flex justify-center mt-4" data-load-more-indicator>
132132
<div class="animate-pulse text-muted-foreground">
133133
<.icon name="tabler-loader" class="h-6 w-6 animate-spin" />
134134
</div>

lib/algora_web/live/user/profile_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ defmodule AlgoraWeb.User.ProfileLive do
167167
<div
168168
:if={@has_more_transactions}
169169
class="flex justify-center mt-4"
170-
id="load-more-indicator"
170+
data-load-more-indicator
171171
>
172172
<div class="animate-pulse text-muted-foreground">
173173
<.icon name="tabler-loader" class="h-6 w-6 animate-spin" />

0 commit comments

Comments
 (0)