Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imple alpine #78

Merged
14 commits merged into from
Sep 21, 2021
34 changes: 2 additions & 32 deletions lib/archethic_web/live/transaction_details_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ defmodule ArchEthicWeb.TransactionDetailsLive do
alias ArchEthic.PubSub

alias ArchEthic.TransactionChain.Transaction
alias ArchEthic.TransactionChain.TransactionData

alias ArchEthicWeb.ExplorerView

Expand All @@ -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

Expand All @@ -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, %{})

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
Loading