Skip to content

Commit

Permalink
fix previous on first page and next on last page of pagination component
Browse files Browse the repository at this point in the history
  • Loading branch information
tenmoves committed Jan 19, 2023
1 parent be48860 commit 72c4fa7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/archethic_web/components/pagination.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ defmodule ArchethicWeb.Pagination do
<%= if @current_page > 1 do %>
<a class="pagination-previous" phx-value-page={@current_page - 1} phx-click="goto">Previous</a>
<% else %>
<a class="pagination-previous is-disabled">Previous</a>
<a class="pagination-previous is-disabled" phx-click="first_page">Previous</a>
<% end %>
<%= if @current_page + 1 <= @total_pages do %>
<a class="pagination-next" phx-value-page={@current_page + 1} phx-click="goto">Next page</a>
<% else %>
<a class="pagination-next is-disabled">Next page</a>
<a class="pagination-next is-disabled" phx-click="last_page">Next page</a>
<% end %>
<p class="pagination-list has-text-white">
Expand Down
2 changes: 2 additions & 0 deletions lib/archethic_web/live/chains/beacon_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ defmodule ArchethicWeb.BeaconChainLive do
{:noreply, push_patch(socket, to: Routes.live_path(socket, __MODULE__, %{"page" => page}))}
end

def handle_event(_, _, socket), do: {:noreply, socket}

def handle_info(
:initial_load,
socket
Expand Down
2 changes: 2 additions & 0 deletions lib/archethic_web/live/chains/node_shared_secrets_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ defmodule ArchethicWeb.NodeSharedSecretsChainLive do
{:noreply, push_patch(socket, to: Routes.live_path(socket, __MODULE__, %{"page" => page}))}
end

def handle_event(_, _, socket), do: {:noreply, socket}

@spec handle_info(
_msg ::
{:new_transaction, address :: binary(), :node_shared_secrets, DateTime.t()},
Expand Down
2 changes: 2 additions & 0 deletions lib/archethic_web/live/chains/oracle_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ defmodule ArchethicWeb.OracleChainLive do
{:noreply, push_patch(socket, to: Routes.live_path(socket, __MODULE__, %{"page" => page}))}
end

def handle_event(_, _, socket), do: {:noreply, socket}

def handle_info(
{:new_transaction, address, :oracle, timestamp},
socket = %{assigns: assigns = %{current_date_page: current_page}}
Expand Down
2 changes: 2 additions & 0 deletions lib/archethic_web/live/chains/reward_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ defmodule ArchethicWeb.RewardChainLive do
{:noreply, push_patch(socket, to: Routes.live_path(socket, __MODULE__, %{"page" => page}))}
end

def handle_event(_, _, socket), do: {:noreply, socket}

@spec handle_info(
{:new_transaction, binary(), :mint_rewards | :node_rewards, DateTime.t()},
socket :: Phoenix.LiveView.Socket.t()
Expand Down

0 comments on commit 72c4fa7

Please sign in to comment.