diff --git a/lib/archethic_web/live/transaction_details_live.ex b/lib/archethic_web/live/transaction_details_live.ex index e94f76521..cdae5957b 100644 --- a/lib/archethic_web/live/transaction_details_live.ex +++ b/lib/archethic_web/live/transaction_details_live.ex @@ -9,7 +9,6 @@ defmodule ArchEthicWeb.TransactionDetailsLive do alias ArchEthic.PubSub alias ArchEthic.TransactionChain.Transaction - alias ArchEthic.TransactionChain.TransactionData alias ArchEthicWeb.ExplorerView @@ -18,11 +17,7 @@ defmodule ArchEthicWeb.TransactionDetailsLive do assign(socket, %{ exists: false, previous_address: nil, - transaction: nil, - hide_content: true, - tab_panel: "tx", - data_section: "code", - operation_section: "transaction_movements" + transaction: nil })} end @@ -41,30 +36,6 @@ defmodule ArchEthicWeb.TransactionDetailsLive do end end - def handle_event("switch_tab", %{"tab_panel" => tab_panel}, socket) do - {:noreply, assign(socket, :tab_panel, tab_panel)} - end - - def handle_event("switch_data", %{"data_section" => data_section}, socket) do - {:noreply, assign(socket, :data_section, data_section)} - end - - def handle_event( - "switch_ledger_operations", - %{"operation_section" => operation_section}, - socket - ) do - {:noreply, assign(socket, :operation_section, operation_section)} - end - - def handle_event("hide_content", _value, socket = %{assigns: %{hide_content: false}}) do - {:noreply, assign(socket, :hide_content, true)} - end - - def handle_event("show_content", _value, socket = %{assigns: %{hide_content: true}}) do - {:noreply, assign(socket, :hide_content, false)} - end - def handle_info({:new_transaction, address}, socket) do {:ok, tx} = get_transaction(address, %{}) @@ -98,7 +69,7 @@ defmodule ArchEthicWeb.TransactionDetailsLive do defp handle_transaction( socket, - tx = %Transaction{address: address, data: %TransactionData{content: content}} + tx = %Transaction{address: address} ) do balance = ArchEthic.get_balance(address) previous_address = Transaction.previous_address(tx) @@ -114,7 +85,6 @@ defmodule ArchEthicWeb.TransactionDetailsLive do |> assign(:inputs, ledger_inputs) |> assign(:calls, contract_inputs) |> assign(:address, address) - |> assign(:hide_content, byte_size(content) > 1000) end def handle_not_existing_transaction(socket, address) do diff --git a/lib/archethic_web/templates/explorer/transaction_details.html.leex b/lib/archethic_web/templates/explorer/transaction_details.html.leex index 3a8af8b40..034b48d77 100644 --- a/lib/archethic_web/templates/explorer/transaction_details.html.leex +++ b/lib/archethic_web/templates/explorer/transaction_details.html.leex @@ -15,9 +15,7 @@ Please check the transaction address validity. <% else %> - <%= if assigns[:error] == nil do %> -
<%= link class: "button is-primary is-outlined is-fullwidth", to: Routes.live_path(@socket, ArchEthicWeb.TransactionDetailsLive, Base.encode16(@previous_address)) do%> @@ -30,22 +28,30 @@ <% end %>
- <% end %> - -
+

Transaction - <%= Base.encode16(@address) %>

- -
+
-
"> - +
<%= if assigns[:error] != nil and @error == :not_exists do %>

The transaction does not exists yet.


@@ -64,78 +70,79 @@ <%= format_date(@transaction.validation_stamp.timestamp) %>
- -
+
-
- <%= if @data_section == "code" do %> +
+

Smart Contract code

<%= if byte_size(@transaction.data.code) == 0 do %> N/A <% else %>
<%= @transaction.data.code %>
<% end %> - <% end %> - - <%= if @data_section == "content" do %> -

Content +

+
+

Content <%= format_bytes(byte_size(@transaction.data.content)) %> - <%= if @hide_content do %> - Show - <% else %> - Hide - <% end %> +

<%= if byte_size(@transaction.data.content) == 0 do %> N/A <% end %> - <%= unless @hide_content do %> +
<%= format_transaction_content(@transaction.type, @transaction.data.content) %>
- <% end %> - <% end %> - - <%= if @data_section == "uco_ledger" do %> +
+
+

UCO Ledger

<%= if Enum.count(@transaction.data.ledger.uco.transfers) == 0 do %> N/A @@ -158,9 +165,8 @@
<% end %> - <% end %> - - <%= if @data_section == "nft_ledger" do %> +
+

NFT Ledger

<%= if Enum.count(@transaction.data.ledger.nft.transfers) == 0 do %> N/A @@ -189,34 +195,32 @@
<% end %> - <% end %> - - <%= if @data_section == "keys" do %> +
+

Keys and Secrets

<%= for { secret, index } <- Enum.with_index(@transaction.data.keys.secrets) do %> -
-
-
-

Secret: <%= Base.encode16(secret) %>

-
-
-
-
-

Authorized keys

-
+
+
+
+

Secret: <%= Base.encode16(secret) %>

+
+
+
+
+

Authorized keys

+
+
+ <%= for { key, _enc_key} <- Enum.at(@transaction.data.keys.authorized_keys, index) do %> +
+
+ <%= Base.encode16(key) %> +
+
+ <% end %>
- <%= for { key, _enc_key} <- Enum.at(@transaction.data.keys.authorized_keys, index) do %> -
-
- <%= Base.encode16(key) %> -
-
- <% end %> -
<% end %> - <% end %> - - <%= if @data_section == "recipients" do %> +
+

Recipients addresses

<%= if Enum.count(@transaction.data.recipients) == 0 do %> N/A @@ -232,7 +236,7 @@
<% end %> - <% end %> +
@@ -280,22 +284,26 @@