From 51e0efcd0391eb6fbf5b3bb07e3d0d6e08c35754 Mon Sep 17 00:00:00 2001 From: tenmoves Date: Thu, 19 Jan 2023 12:37:12 +0100 Subject: [PATCH] fix previous on first page and next on last page of pagination component --- lib/archethic_web/components/pagination.ex | 4 ++-- lib/archethic_web/live/chains/beacon_live.ex | 2 ++ lib/archethic_web/live/chains/node_shared_secrets_live.ex | 2 ++ lib/archethic_web/live/chains/oracle_live.ex | 2 ++ lib/archethic_web/live/chains/reward_live.ex | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/archethic_web/components/pagination.ex b/lib/archethic_web/components/pagination.ex index f7f3da57f..e8a993829 100644 --- a/lib/archethic_web/components/pagination.ex +++ b/lib/archethic_web/components/pagination.ex @@ -15,13 +15,13 @@ defmodule ArchethicWeb.Pagination do <%= if @current_page > 1 do %> Previous <% else %> - Previous + Previous <% end %> <%= if @current_page + 1 <= @total_pages do %> Next page <% else %> - Next page + Next page <% end %>

diff --git a/lib/archethic_web/live/chains/beacon_live.ex b/lib/archethic_web/live/chains/beacon_live.ex index d4b8bc0f2..10f893323 100644 --- a/lib/archethic_web/live/chains/beacon_live.ex +++ b/lib/archethic_web/live/chains/beacon_live.ex @@ -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 diff --git a/lib/archethic_web/live/chains/node_shared_secrets_live.ex b/lib/archethic_web/live/chains/node_shared_secrets_live.ex index f3b7d5c2e..f26092d37 100644 --- a/lib/archethic_web/live/chains/node_shared_secrets_live.ex +++ b/lib/archethic_web/live/chains/node_shared_secrets_live.ex @@ -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()}, diff --git a/lib/archethic_web/live/chains/oracle_live.ex b/lib/archethic_web/live/chains/oracle_live.ex index 288f46ca1..eb840eeb2 100644 --- a/lib/archethic_web/live/chains/oracle_live.ex +++ b/lib/archethic_web/live/chains/oracle_live.ex @@ -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}} diff --git a/lib/archethic_web/live/chains/reward_live.ex b/lib/archethic_web/live/chains/reward_live.ex index b9ad345cf..f0250ae62 100644 --- a/lib/archethic_web/live/chains/reward_live.ex +++ b/lib/archethic_web/live/chains/reward_live.ex @@ -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()