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

Stats: sunset "Overview" and "Mento" tabs #1009

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions apps/block_scout_web/assets/js/pages/stats.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import $ from 'jquery'

$('.stats-link').on('click', function () {
if ($(this).hasClass('stats-link-no-selection')) {
return
}

$('ul#topnav .selected').removeClass('selected')
$(this).addClass('selected')
})

$(window).on('load resize', function () {
const width = $(window).width()
if (width < 768) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,43 @@ defmodule BlockScoutWeb.StatsController do
use BlockScoutWeb, :controller

def index(conn, _params) do
conn
|> redirect(to: "/stats/overview")
end

def overview(conn, _params) do
conn
|> put_status(200)
|> render("notification.html", active: "overview")
end

def addresses(conn, _params) do
conn
|> put_status(200)
|> render("iframe.html", active: "addresses")
end

def mento(conn, _params) do
conn
|> put_status(200)
|> render("notification.html", active: "mento")
end

def mento_reserve(conn, _params) do
conn
|> put_status(200)
|> render("notification.html", active: "mento-reserve")
end

def transactions(conn, _params) do
conn
|> put_status(200)
|> render("iframe.html", active: "transactions")
end

def epochs(conn, _params) do
conn
|> put_status(200)
|> render("index.html", token: nil)
|> render("iframe.html", active: "epoch")
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h2 class="card-title">
<%= gettext "Looking for Mento reserve stats?" %>
</h2>
<%= gettext "You can find them at" %>
<a target='_blank' href='https://reserve.mento.org/'><%= gettext "reserve.mento.org" %></a>.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h2 class="card-title">
<%= gettext "Looking for Mento statistics?" %>
</h2>
<%= gettext "You can find them at " %>
<a target='_blank' href='https://dune.com/mento-labs-eng'><%= gettext "dune.com/mento-labs-eng" %></a>.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h2 class="card-title">
<%= gettext "Looking for blockchain statistics?" %>
</h2>
<%= gettext "You can find them at" %>
<a target='_blank' href='https://dune.com/celo/celo-blockchain-overview'><%= gettext "dune.com/celo/celo-blockchain-overview" %></a>.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<nav class="menu-wrap container" data-selector="stats-nabvar">
<ul class="topnav" id="topnav">
<li class="stats-link<%= if @active == "overview" do %> selected <% end %>">
<%= link gettext("Overview"), to: stats_overview_path(@conn, :overview) %>
</li>
<li class="stats-link<%= if @active == "addresses" do %> selected <% end %>">
<%= link gettext("Addresses"), to: stats_addresses_path(@conn, :addresses) %>
</li>
<li class="stats-link<%= if @active == "mento" do %> selected <% end %>">
<%= link gettext("Mento"), to: stats_mento_path(@conn, :mento) %>
</li>
<li class="stats-link<%= if @active == "mento-reserve" do %> selected <% end %>">
<%= link gettext("Mento Reserve"), to: stats_mento_reserve_path(@conn, :mento_reserve) %>
</li>
<li class="stats-link<%= if @active == "transactions" do %> selected <% end %>">
<%= link gettext("Transactions"), to: stats_transactions_path(@conn, :transactions) %>
</li>
<li class="stats-link<%= if @active == "epoch" do %> selected <% end %>">
<%= link gettext("Epoch Rewards"), to: stats_epoch_rewards_path(@conn, :epochs) %>
</li>
</ul>
</nav>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<% stats_enabled = Application.get_env(:block_scout_web, :stats_enabled) %>
<% stats_report_url = Application.get_env(:block_scout_web, :stats_report_url) %>
<%= render BlockScoutWeb.StatsView, "_tabs.html", active: assigns[:active], conn: @conn %>

<section class="container" data-page="stats-list" id="stats-container">
<section class="fs-14" data-page="stats-details">
<div class="row">
<div class="col-md-12">
<%= if stats_enabled do %>
<div class="google-data-studio">
<iframe width=100% src="<%= get_url(stats_report_url, assigns[:active]) %>" name="myiframe" id="myiframe" frameborder="0" style="border:0;height:100vh;width:100%;" allowfullscreen></iframe>
</div>
<% end %>
</div>
</div>
</section>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/stats.js") %>"></script>
</section>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%= render BlockScoutWeb.StatsView, "_tabs.html", active: assigns[:active], conn: @conn %>

<section class="container" data-page="stats-list" id="stats-container">
<section class="fs-14" data-page="stats-details">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<%= render BlockScoutWeb.StatsView, "_notification_#{assigns[:active]}.html", active: assigns[:active] %>
</div>
</div>
</div>
</div>
</section>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/stats.js") %>"></script>
</section>
10 changes: 9 additions & 1 deletion apps/block_scout_web/lib/block_scout_web/web_router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,15 @@ defmodule BlockScoutWeb.WebRouter do

get("/token-counters", Tokens.TokenController, :token_counters)

get("/stats", StatsController, :index)
scope "/stats" do
get("/", StatsController, :index, as: :stats_index)
get("/overview", StatsController, :overview, as: :stats_overview)
get("/addresses", StatsController, :addresses, as: :stats_addresses)
get("/mento", StatsController, :mento, as: :stats_mento)
get("/mento-reserve", StatsController, :mento_reserve, as: :stats_mento_reserve)
get("/transactions", StatsController, :transactions, as: :stats_transactions)
get("/epoch-rewards", StatsController, :epochs, as: :stats_epoch_rewards)
end

get("/visualize/sol2uml", VisualizeSol2umlController, :index)

Expand Down
51 changes: 41 additions & 10 deletions apps/block_scout_web/priv/gettext/default.pot
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ msgid "Address*"
msgstr ""

#: lib/block_scout_web/templates/address/index.html.eex:4
#: lib/block_scout_web/templates/stats/index.html.eex:17
#: lib/block_scout_web/templates/stats/_tabs.html.eex:7
#, elixir-autogen, elixir-format
msgid "Addresses"
msgstr ""
Expand Down Expand Up @@ -2838,7 +2838,7 @@ msgstr ""
#: lib/block_scout_web/templates/block/overview.html.eex:120
#: lib/block_scout_web/templates/chain/show.html.eex:210
#: lib/block_scout_web/templates/layout/_topnav.html.eex:46
#: lib/block_scout_web/templates/stats/index.html.eex:37
#: lib/block_scout_web/templates/stats/_tabs.html.eex:16
#: lib/block_scout_web/views/address_view.ex:433
#, elixir-autogen, elixir-format
msgid "Transactions"
Expand Down Expand Up @@ -3496,7 +3496,7 @@ msgstr ""
msgid "Epoch Blocks"
msgstr ""

#: lib/block_scout_web/templates/stats/index.html.eex:42
#: lib/block_scout_web/templates/stats/_tabs.html.eex:19
#, elixir-autogen, elixir-format
msgid "Epoch Rewards"
msgstr ""
Expand Down Expand Up @@ -3574,12 +3574,12 @@ msgstr ""
msgid "Locked CELO Balance"
msgstr ""

#: lib/block_scout_web/templates/stats/index.html.eex:22
#: lib/block_scout_web/templates/stats/_tabs.html.eex:10
#, elixir-autogen, elixir-format
msgid "Mento"
msgstr ""

#: lib/block_scout_web/templates/stats/index.html.eex:32
#: lib/block_scout_web/templates/stats/_tabs.html.eex:13
#, elixir-autogen, elixir-format
msgid "Mento Reserve"
msgstr ""
Expand Down Expand Up @@ -3609,7 +3609,7 @@ msgstr ""
msgid "Online"
msgstr ""

#: lib/block_scout_web/templates/stats/index.html.eex:12
#: lib/block_scout_web/templates/stats/_tabs.html.eex:4
#, elixir-autogen, elixir-format
msgid "Overview"
msgstr ""
Expand Down Expand Up @@ -3890,12 +3890,43 @@ msgstr ""
msgid "There are no unsigned blocks for this address."
msgstr ""

#: lib/block_scout_web/templates/stats/index.html.eex:30
#: lib/block_scout_web/templates/stats/_notification_mento-reserve.html.eex:5
#, elixir-autogen, elixir-format
msgid "Looking for Mento reserve stats? You can find them at "
msgid "reserve.mento.org"
msgstr ""

#: lib/block_scout_web/templates/stats/index.html.eex:30
#: lib/block_scout_web/templates/stats/_notification_mento-reserve.html.eex:2
#, elixir-autogen, elixir-format
msgid "reserve.mento.org"
msgid "Looking for Mento reserve stats?"
msgstr ""

#: lib/block_scout_web/templates/stats/_notification_mento.html.eex:2
#, elixir-autogen, elixir-format
msgid "Looking for Mento statistics?"
msgstr ""

#: lib/block_scout_web/templates/stats/_notification_overview.html.eex:2
#, elixir-autogen, elixir-format
msgid "Looking for blockchain statistics?"
msgstr ""

#: lib/block_scout_web/templates/stats/_notification_mento-reserve.html.eex:4
#: lib/block_scout_web/templates/stats/_notification_overview.html.eex:4
#, elixir-autogen, elixir-format
msgid "You can find them at"
msgstr ""

#: lib/block_scout_web/templates/stats/_notification_mento.html.eex:4
#, elixir-autogen, elixir-format
msgid "You can find them at "
msgstr ""

#: lib/block_scout_web/templates/stats/_notification_overview.html.eex:5
#, elixir-autogen, elixir-format
msgid "dune.com/celo/celo-blockchain-overview"
msgstr ""

#: lib/block_scout_web/templates/stats/_notification_mento.html.eex:5
#, elixir-autogen, elixir-format
msgid "dune.com/mento-labs-eng"
msgstr ""
Loading
Loading