Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
better looking format for versions (#379)
Browse files Browse the repository at this point in the history
Co-authored-by: Santiago Pittella <[email protected]>
  • Loading branch information
SantiagoPittella and Santiago Pittella authored Nov 24, 2023
1 parent 1f4fd73 commit c84aca4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/starknet_explorer_web/live/contract_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ defmodule StarknetExplorerWeb.ContractDetailLive do
<%= if is_nil(@class) do %>
-
<% else %>
<%= @class.version %>
<%= Utils.format_version(@class.version) %>
<% end %>
</span>
</div>
Expand Down Expand Up @@ -314,7 +314,7 @@ defmodule StarknetExplorerWeb.ContractDetailLive do
</div>
<div>
<div class="list-h">Version</div>
<div><%= version %></div>
<div><%= Utils.format_version(version) %></div>
</div>
</div>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion lib/starknet_explorer_web/live/pages/block_detail.ex
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ defmodule StarknetExplorerWeb.BlockDetailLive do
</div>
<div>
<div class="list-h">Version</div>
<div><%= version %></div>
<div><%= Utils.format_version(version) %></div>
</div>
<div>
<div class="list-h">Status</div>
Expand Down
4 changes: 4 additions & 0 deletions lib/starknet_explorer_web/live/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,8 @@ defmodule StarknetExplorerWeb.Utils do
def network_path(:testnet, remaining_path) do
"/testnet/#{remaining_path}"
end

def format_version(<<"0x", hex_val::binary>>), do: "Cairo " <> hex_val
def format_version(nil), do: "-"
def format_version(version), do: version
end

0 comments on commit c84aca4

Please sign in to comment.