From 4d383932fadd0cfee231b437e003960c15fa0830 Mon Sep 17 00:00:00 2001 From: BertovDev Date: Thu, 28 Sep 2023 14:41:52 -0300 Subject: [PATCH 01/13] Create loading component --- .../components/core_components.ex | 10 ++++++++++ lib/starknet_explorer_web/live/pages/home/index.ex | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/starknet_explorer_web/components/core_components.ex b/lib/starknet_explorer_web/components/core_components.ex index da4b7bf4..5848bcb5 100644 --- a/lib/starknet_explorer_web/components/core_components.ex +++ b/lib/starknet_explorer_web/components/core_components.ex @@ -679,6 +679,7 @@ defmodule StarknetExplorerWeb.CoreComponents do """ end + @spec tooltip(any) :: Phoenix.LiveView.Rendered.t() def tooltip(assigns) do ~H""" """ end + + @spec loading_state(any) :: Phoenix.LiveView.Rendered.t() + def loading_state(assigns) do + ~H""" +
+ ASASASASASASASAS +
+ """ + end end diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index ac537278..5e6e3d2c 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -50,8 +50,12 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
-
Blocks Height
-
<%= assigns.block_height %>
+
Blocks Height
+ <%= if assigns.block_height do %> +
<%= assigns.block_height %>
+ <% else %> + + <% end %>
From c514c882a90be1fe18decd51822714d19d03a26c Mon Sep 17 00:00:00 2001 From: BertovDev Date: Thu, 28 Sep 2023 15:45:32 -0300 Subject: [PATCH 02/13] Improve component --- .../components/core_components.ex | 10 ++++- .../live/pages/home/index.ex | 38 +++++++++++++++---- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/lib/starknet_explorer_web/components/core_components.ex b/lib/starknet_explorer_web/components/core_components.ex index 5848bcb5..196ecacd 100644 --- a/lib/starknet_explorer_web/components/core_components.ex +++ b/lib/starknet_explorer_web/components/core_components.ex @@ -695,9 +695,15 @@ defmodule StarknetExplorerWeb.CoreComponents do @spec loading_state(any) :: Phoenix.LiveView.Rendered.t() def loading_state(assigns) do ~H""" -
- ASASASASASASASAS + <%= if @content do %> + <%= @content %> + <% else %> +
+ <%= @mock %>
+ <% end %> + + """ end end diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index 5e6e3d2c..366956bb 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -51,11 +51,13 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Blocks Height
- <%= if assigns.block_height do %> -
<%= assigns.block_height %>
- <% else %> - - <% end %> +
+ +
@@ -70,7 +72,13 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Messages
-
<%= @entities_count.message_count %>
+
+ +
@@ -85,7 +93,13 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Events
-
<%= @entities_count.events_count %>
+
+ +
@@ -100,7 +114,15 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Transactions
-
<%= @entities_count.transaction_count %>
+
+
+ +
+
From a787972668b179ecee6973469bd2353ee236c2ec Mon Sep 17 00:00:00 2001 From: BertovDev Date: Thu, 28 Sep 2023 19:37:31 -0300 Subject: [PATCH 03/13] Add components to index --- .../live/pages/home/index.ex | 130 +++++++++++++++++- 1 file changed, 126 insertions(+), 4 deletions(-) diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index 366956bb..8305045a 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -155,7 +155,79 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Status
Age
- <%= for block <- Enum.take(@blocks, 15) do %> + <%= for n <- 1..15 do %> +
+
+
Number
+ + + + + +
+
+
Block Hash
+
+
+ + + + + +
+
+ + +
+
+
+
+
+
+
Status
+
+ + + +
+
+
+
Age
+ +
+
+ <% end %> + + <%!-- <%= for block <- Enum.take(@blocks, 15) do %>
Number
@@ -205,7 +277,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do <%= Utils.get_block_age(block) %>
- <% end %> + <% end %> --%>
@@ -228,7 +300,57 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Status
Age
- <%= for {transaction, idx} <- Enum.take(Enum.with_index(@transactions), 15) do %> + <%!-- <%= for n <- 1..15 do %> +
+ +
+
Type
+
+ + <%= transaction.type %> + +
+
+
+
Status
+
+ + <%= transaction.block_status %> + +
+
+
+
Age
+ <%= Utils.get_block_age_from_timestamp(transaction.block_timestamp) %> +
+
+ <% end %> --%> + <%!-- <%= for {transaction, idx} <- Enum.take(Enum.with_index(@transactions), 15) do %>
Transaction Hash
@@ -277,7 +399,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do <%= Utils.get_block_age_from_timestamp(transaction.block_timestamp) %>
- <% end %> + <% end %> --%> From 3cbf35be3ed71c134e8d468169a7933c96faba18 Mon Sep 17 00:00:00 2001 From: BertovDev Date: Thu, 28 Sep 2023 19:50:02 -0300 Subject: [PATCH 04/13] rollback --- .../live/pages/home/index.ex | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index 8305045a..a46d3704 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -300,24 +300,30 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Status
Age
- <%!-- <%= for n <- 1..15 do %> -
+ <%= for n <- 1..15 do %> +
Transaction Hash
-
+
- <%= Utils.shorten_block_hash(Enum.at(Enum.with_index(@transactions), n-1).hash) %> + + +
Type
- + <%!-- <%= transaction.type %> - + --%>
Status
- + <%!-- <%= transaction.block_status %> - + --%>
Age
- <%= Utils.get_block_age_from_timestamp(transaction.block_timestamp) %> + <%!-- <%= Utils.get_block_age_from_timestamp(transaction.block_timestamp) %> --%>
- <% end %> --%> + <% end %> <%!-- <%= for {transaction, idx} <- Enum.take(Enum.with_index(@transactions), 15) do %>
From 2b6746dc822dd51eac7d456fd72237ccb6470ed5 Mon Sep 17 00:00:00 2001 From: BertovDev Date: Fri, 29 Sep 2023 11:32:47 -0300 Subject: [PATCH 05/13] Mock transaction table --- .../live/pages/home/index.ex | 125 ++---------------- 1 file changed, 12 insertions(+), 113 deletions(-) diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index a46d3704..278ffa80 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -226,58 +226,6 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
<% end %> - - <%!-- <%= for block <- Enum.take(@blocks, 15) do %> -
- -
-
Block Hash
- -
-
-
Status
-
- - <%= block.status %> - -
-
-
-
Age
- <%= Utils.get_block_age(block) %> -
-
- <% end %> --%>
@@ -301,18 +249,18 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Age
<%= for n <- 1..15 do %> -
+
Transaction Hash
-
+ - <% end %> - <%!-- <%= for {transaction, idx} <- Enum.take(Enum.with_index(@transactions), 15) do %> -
- -
-
Type
-
- - <%= transaction.type %> + + <%= Enum.at(@transactions,n).type %>
Status
- - <%= transaction.block_status %> + + <%= Enum.at(@transactions,n).block_status %>
Age
- <%= Utils.get_block_age_from_timestamp(transaction.block_timestamp) %> + <%= Utils.get_block_age_from_timestamp(Enum.at(@transactions,n).block_timestamp) %>
- <% end %> --%> + <% end %> +
From 96d841b87f3a9a40f891fe8587fe1f513f6621fb Mon Sep 17 00:00:00 2001 From: BertovDev Date: Fri, 29 Sep 2023 11:42:42 -0300 Subject: [PATCH 06/13] Merge main --- lib/starknet_explorer_web/live/pages/home/index.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index 2f2f6d55..635e8e0a 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -281,7 +281,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Type
-
+
<%= Enum.at(@transactions,n).type %> From e38ed2eb62a3ebda1b7d7c11071d3c992c29a257 Mon Sep 17 00:00:00 2001 From: BertovDev Date: Fri, 29 Sep 2023 16:37:51 -0300 Subject: [PATCH 07/13] Add loading state to index view --- assets/tailwind.config.js | 3 + .../components/core_components.ex | 4 +- .../live/pages/home/index.ex | 113 +++++++++++++----- 3 files changed, 85 insertions(+), 35 deletions(-) diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index 7e0fad9a..87d046ce 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -13,6 +13,9 @@ module.exports = { "ibm-plex": "'IBM Plex Sans', sans-serif", mono: "'IBM Plex Mono', monospace", }, + animation: { + 'pulseFill' : 'pulse 2s ease-out infinite' + }, colors: { brand: "#AE2EFF", container: "#1A1A24", diff --git a/lib/starknet_explorer_web/components/core_components.ex b/lib/starknet_explorer_web/components/core_components.ex index 196ecacd..da4408c4 100644 --- a/lib/starknet_explorer_web/components/core_components.ex +++ b/lib/starknet_explorer_web/components/core_components.ex @@ -695,10 +695,10 @@ defmodule StarknetExplorerWeb.CoreComponents do @spec loading_state(any) :: Phoenix.LiveView.Rendered.t() def loading_state(assigns) do ~H""" - <%= if @content do %> + <%= if @condition do %> <%= @content %> <% else %> -
+
<%= @mock %>
<% end %> diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index 635e8e0a..f6384bd4 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -9,10 +9,17 @@ defmodule StarknetExplorerWeb.HomeLive.Index do @impl true def mount(_params, _session, socket) do socket = load_blocks(socket) + # Process.send(self(), :load_blocks, []) {:ok, socket} end + # def handle_info(:load_blocks, socket) do + # socket = load_blocks(socket) + + # {:noreply, socket} + # end + @impl true def render(assigns) do ~H""" @@ -75,6 +82,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Blocks Height
Messages
@@ -117,7 +126,8 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Events
@@ -139,7 +149,8 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
@@ -177,16 +188,21 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Age
<%= for n <- 1..15 do %> -
+
Block Hash
-
Status
- + " info-label" end}"}> @@ -228,7 +250,9 @@ defmodule StarknetExplorerWeb.HomeLive.Index do
Type
-
+
" type" end }"}> - <%= Enum.at(@transactions,n).type %> + + <%= %>
Status
- - <%= Enum.at(@transactions,n).block_status %> + " info-label" end}"}> +
Age
- <%= Utils.get_block_age_from_timestamp(Enum.at(@transactions,n).block_timestamp) %> +
<% end %> @@ -350,7 +397,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do {:ok, block_height} = StarknetExplorer.Rpc.get_block_height(socket.assigns.network) block_height = StarknetExplorer.Utils.format_number_for_display(block_height) - assign(socket, + assign(socket, blocks: blocks, transactions: transactions, entities_count: entities_count, From 6868c6fb2ec6c6896e5962422cb5ac5854197375 Mon Sep 17 00:00:00 2001 From: BertovDev Date: Fri, 29 Sep 2023 16:38:26 -0300 Subject: [PATCH 08/13] Remove comment --- lib/starknet_explorer_web/live/pages/home/index.ex | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index f6384bd4..a3c720ee 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -9,17 +9,10 @@ defmodule StarknetExplorerWeb.HomeLive.Index do @impl true def mount(_params, _session, socket) do socket = load_blocks(socket) - # Process.send(self(), :load_blocks, []) {:ok, socket} end - # def handle_info(:load_blocks, socket) do - # socket = load_blocks(socket) - - # {:noreply, socket} - # end - @impl true def render(assigns) do ~H""" From d28cf4f210c4f69cbb518f702432bd7179848acb Mon Sep 17 00:00:00 2001 From: BertovDev Date: Fri, 29 Sep 2023 17:01:15 -0300 Subject: [PATCH 09/13] Fix sizes --- .../components/core_components.ex | 18 +++++++++--------- .../live/pages/home/index.ex | 14 +++++++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/starknet_explorer_web/components/core_components.ex b/lib/starknet_explorer_web/components/core_components.ex index da4408c4..9b01c07b 100644 --- a/lib/starknet_explorer_web/components/core_components.ex +++ b/lib/starknet_explorer_web/components/core_components.ex @@ -665,17 +665,17 @@ defmodule StarknetExplorerWeb.CoreComponents do def copy_button(assigns) do ~H""" -
-
-
- - +
+
+
+ + +
-
""" end diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index a3c720ee..ebeaa1b9 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -211,7 +211,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do href={Utils.network_path(assigns.network, "blocks/#{if Enum.at(@blocks,n-1) do (Enum.at(@blocks,n-1).hash) end}")} class="text-hover-link"> - + - + + <% end %>
@@ -293,8 +295,10 @@ defmodule StarknetExplorerWeb.HomeLive.Index do /> - + <%= if Enum.at(@transactions,n) do%> + + <% end %>
@@ -392,7 +396,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do assign(socket, blocks: blocks, - transactions: transactions, + transactions: [], entities_count: entities_count, latest_block: latest_block, block_height: block_height From ee90d74aec0ed1b28e4bce54baf76bfec81cb99c Mon Sep 17 00:00:00 2001 From: BertovDev Date: Fri, 29 Sep 2023 17:12:23 -0300 Subject: [PATCH 10/13] Remove unused component id --- .../components/core_components.ex | 2 +- .../live/pages/home/index.ex | 20 ++++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/starknet_explorer_web/components/core_components.ex b/lib/starknet_explorer_web/components/core_components.ex index 9b01c07b..720e9774 100644 --- a/lib/starknet_explorer_web/components/core_components.ex +++ b/lib/starknet_explorer_web/components/core_components.ex @@ -698,7 +698,7 @@ defmodule StarknetExplorerWeb.CoreComponents do <%= if @condition do %> <%= @content %> <% else %> -
+
<%= @mock %>
<% end %> diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index ebeaa1b9..29165100 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -78,7 +78,6 @@ defmodule StarknetExplorerWeb.HomeLive.Index do condition={assigns} content={assigns.block_height} mock="300000" - id="loading_state" />
@@ -100,7 +99,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do condition={@entities_count} content={if @entities_count do @entities_count.messages_count end} mock="300000" - id="loading_state" + />
@@ -122,7 +121,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do condition={@entities_count} content={if @entities_count do @entities_count.events_count end} mock="300000" - id="loading_state" + />
@@ -145,7 +144,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do condition={@entities_count} content={if @entities_count do @entities_count.transaction_count end} mock="10" - id="loading_state" + />
@@ -197,7 +196,6 @@ defmodule StarknetExplorerWeb.HomeLive.Index do condition={@blocks && Enum.at(@blocks,n-1)} content={if Enum.at(@blocks,n-1) do Enum.at(@blocks,n-1).number end} mock="00000" - id="loading_state" /> @@ -217,7 +215,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do content={if Enum.at(@blocks,n-1) do Utils.shorten_block_hash(Enum.at(@blocks,n-1).hash) end} mock="00000" - id="loading_state" + /> @@ -237,7 +235,6 @@ defmodule StarknetExplorerWeb.HomeLive.Index do condition={@blocks && Enum.at(@blocks,n-1)} content={if Enum.at(@blocks,n-1) do Enum.at(@blocks,n-1).status end} mock="00000" - id="loading_state" />
@@ -249,7 +246,6 @@ defmodule StarknetExplorerWeb.HomeLive.Index do content={if Enum.at(@blocks,n-1) do Utils.get_block_age(Enum.at(@blocks,n-1)) end} mock="0000" - id="loading_state" />
@@ -291,7 +287,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do condition={@transactions && Enum.at(@transactions,n)} content={if Enum.at(@transactions,n) do Utils.shorten_block_hash(Enum.at(@transactions,n).hash) end} mock="00000" - id="loading_state" + /> @@ -311,7 +307,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do condition={@transactions && Enum.at(@transactions,n)} content={if Enum.at(@transactions,n) do Enum.at(@transactions,n).type end} mock="00000" - id="loading_state" + /> <%= %> @@ -327,7 +323,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do content={ if Enum.at(@transactions,n) do Enum.at(@transactions,n).block_status end} mock="0000" - id="loading_state" + />
@@ -340,7 +336,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do if Enum.at(@transactions,n) do Utils.get_block_age_from_timestamp(Enum.at(@transactions,n).block_timestamp) end} mock="0000" - id="loading_state" + />
From 52b5e4a1c094736a6fe821a7fe7ee47bcfb1ae1b Mon Sep 17 00:00:00 2001 From: BertovDev Date: Fri, 29 Sep 2023 17:14:40 -0300 Subject: [PATCH 11/13] Change pulse animation --- assets/tailwind.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index 87d046ce..5b87048b 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -14,7 +14,7 @@ module.exports = { mono: "'IBM Plex Mono', monospace", }, animation: { - 'pulseFill' : 'pulse 2s ease-out infinite' + 'pulseFill' : 'pulse 2s ease-in-out infinite' }, colors: { brand: "#AE2EFF", From 28768015b78711228a09a8a930a994d74ecc6cd3 Mon Sep 17 00:00:00 2001 From: BertovDev Date: Fri, 29 Sep 2023 17:19:06 -0300 Subject: [PATCH 12/13] Restore transactions assigns --- lib/starknet_explorer_web/live/pages/home/index.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index 29165100..036604f7 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -392,7 +392,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do assign(socket, blocks: blocks, - transactions: [], + transactions: transactions, entities_count: entities_count, latest_block: latest_block, block_height: block_height From b6984cb0f10b11c955470c7edfc348b352aec544 Mon Sep 17 00:00:00 2001 From: BertovDev Date: Fri, 29 Sep 2023 17:49:30 -0300 Subject: [PATCH 13/13] Fix hash responsive --- lib/starknet_explorer_web/live/pages/home/index.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/starknet_explorer_web/live/pages/home/index.ex b/lib/starknet_explorer_web/live/pages/home/index.ex index 036604f7..b489aeed 100644 --- a/lib/starknet_explorer_web/live/pages/home/index.ex +++ b/lib/starknet_explorer_web/live/pages/home/index.ex @@ -282,7 +282,7 @@ defmodule StarknetExplorerWeb.HomeLive.Index do href={if @transactions && Enum.at(@transactions,n) do Utils.network_path(assigns.network, "transactions/#{Enum.at(@transactions,n).hash}") end} class="text-hover-link" > - +