diff --git a/apps/block_scout_web/assets/css/app.scss b/apps/block_scout_web/assets/css/app.scss index b5dde2f6e0..af841d277b 100644 --- a/apps/block_scout_web/assets/css/app.scss +++ b/apps/block_scout_web/assets/css/app.scss @@ -91,6 +91,7 @@ $fa-font-path: "~@fortawesome/fontawesome-free/webfonts"; @import "components/copy_icon"; @import "components/btn_add_full"; @import "components/stakes"; +@import "components/check"; :export { primary: $primary; diff --git a/apps/block_scout_web/assets/css/components/address-overview.scss b/apps/block_scout_web/assets/css/components/_address-overview.scss similarity index 100% rename from apps/block_scout_web/assets/css/components/address-overview.scss rename to apps/block_scout_web/assets/css/components/_address-overview.scss diff --git a/apps/block_scout_web/assets/css/components/_card.scss b/apps/block_scout_web/assets/css/components/_card.scss index 69476df93e..e868457af2 100644 --- a/apps/block_scout_web/assets/css/components/_card.scss +++ b/apps/block_scout_web/assets/css/components/_card.scss @@ -1,8 +1,12 @@ $card-background-color: #fff !default; +$card-tab-active: $primary !default; +$card-default-border-radius: 10px !default; +$card-horizontal-padding: 30px; +$card-vertical-padding: 30px; .card { background-color: $card-background-color; - border-radius: 10px; + border-radius: $card-default-border-radius; border: none; box-shadow: 0 0 30px 0 rgba(202, 199, 226, 0.5); margin-bottom: 3rem; @@ -26,10 +30,30 @@ $card-background-color: #fff !default; font-weight: normal; line-height: 2.2rem; margin-bottom: 2rem; + + .card-title-container & { + line-height: 1.2; + margin: 0; + + @include media-breakpoint-down(sm) { + margin-bottom: 25px; + } + } +} + +.card-title-container { + align-items: center; + display: flex; + justify-content: space-between; + padding: 25px $card-horizontal-padding; + + @include media-breakpoint-down(sm) { + flex-direction: column; + } } .card-body { - padding: 30px; + padding: $card-horizontal-padding; } .card-server-response-body { @@ -43,4 +67,45 @@ $card-background-color: #fff !default; @include media-breakpoint-down(md) { height: 595px; } +} + +.card-tabs { + align-items: center; + border-top-left-radius: $card-default-border-radius; + border-top-right-radius: $card-default-border-radius; + border-bottom: 1px solid $base-border-color; + display: flex; + justify-content: flex-start; + overflow: hidden; + + @include media-breakpoint-down(sm) { + flex-direction: column; + } +} + +.card-tab { + background-color: $card-background-color; + color: #333; + cursor: pointer; + font-size: 14px; + font-weight: normal; + height: 70px; + line-height: 70px; + padding: 0 30px; + text-align: center; + + &:hover { + text-decoration: underline; + } + + &.active { + background-color: $card-tab-active; + color: #fff; + cursor: default; + text-decoration: none; + } + + @include media-breakpoint-down(sm) { + width: 100%; + } } \ No newline at end of file diff --git a/apps/block_scout_web/assets/css/components/_check.scss b/apps/block_scout_web/assets/css/components/_check.scss new file mode 100644 index 0000000000..912605f7b8 --- /dev/null +++ b/apps/block_scout_web/assets/css/components/_check.scss @@ -0,0 +1,47 @@ +$check-color: $primary !default; +$check-dimensions: 14px !default; + +.check { + align-items: center; + display: flex; + position: relative; + + input[type="checkbox"] { + height: 100%; + opacity: 0; + position: absolute; + width: 100%; + z-index: 5; + + &:checked + .check-icon::before { + background-color: $check-color; + content: ""; + height: 6px; + left: 50%; + position: absolute; + top: 50%; + transform: translateX(-50%) translateY(-50%); + width: 6px; + } + } + + .check-icon { + border: 1px solid $base-border-color; + flex-grow: 0; + flex-shrink: 0; + height: $check-dimensions; + margin: 0 10px 0 0; + position: relative; + width: $check-dimensions; + z-index: 1; + } + + .check-text { + font-size: 14px; + font-weight: normal; + line-height: 1.2; + position: relative; + white-space: nowrap; + z-index: 1; + } +} \ No newline at end of file diff --git a/apps/block_scout_web/assets/css/theme/_neutral_variables.scss b/apps/block_scout_web/assets/css/theme/_neutral_variables.scss index 1d61c621d8..a2bca9f858 100644 --- a/apps/block_scout_web/assets/css/theme/_neutral_variables.scss +++ b/apps/block_scout_web/assets/css/theme/_neutral_variables.scss @@ -1,25 +1,5 @@ -// ------------------------------- // -// Neutral Theme 1: Blue Shifted -// ------------------------------- // - -// $primary: #254F8D; -// $secondary: #72B0FB; -// $tertiary: #72B0FB; - - -// ------------------------------- // -// Neutral Theme 2: Black and Blue -// ------------------------------- // - -// $primary: #34373E; -// $secondary: #72B0FB; -// $tertiary: #72B0FB; - - -// ------------------------------- // -// Neutral Theme 3: Purple Shifted -// ------------------------------- // - $primary: #262D62; $secondary: #687BF6; $tertiary: #687BF6; + +$base-border-color: #e2e5ec !default; \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/active_pools_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/active_pools_controller.ex new file mode 100644 index 0000000000..31c95a0169 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/active_pools_controller.ex @@ -0,0 +1,14 @@ +defmodule BlockScoutWeb.ActivePoolsController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.ActivePoolsView + + def index(conn, params) do + [] + |> handle_render(conn, params) + end + + defp handle_render(full_options, conn, _params) do + render(conn, "index.html") + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/inactive_pools_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/inactive_pools_controller.ex new file mode 100644 index 0000000000..b664c55044 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/inactive_pools_controller.ex @@ -0,0 +1,14 @@ +defmodule BlockScoutWeb.InactivePoolsController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.InactivePoolsView + + def index(conn, params) do + [] + |> handle_render(conn, params) + end + + defp handle_render(full_options, conn, _params) do + render(conn, "index.html") + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/validators_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/validators_controller.ex new file mode 100644 index 0000000000..a3c3225f97 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/validators_controller.ex @@ -0,0 +1,14 @@ +defmodule BlockScoutWeb.ValidatorsController do + use BlockScoutWeb, :controller + + alias BlockScoutWeb.ValidatorsView + + def index(conn, params) do + [] + |> handle_render(conn, params) + end + + defp handle_render(full_options, conn, _params) do + render(conn, "index.html") + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/router.ex b/apps/block_scout_web/lib/block_scout_web/router.ex index 26d6d3bf12..b711e93767 100644 --- a/apps/block_scout_web/lib/block_scout_web/router.ex +++ b/apps/block_scout_web/lib/block_scout_web/router.ex @@ -84,7 +84,9 @@ defmodule BlockScoutWeb.Router do get("/uncles", BlockController, :uncle, as: :uncle) - resources("/stakes", StakesController, only: [:index]) + resources("/validators", ValidatorsController, only: [:index]) + resources("/active_pools", ActivePoolsController, only: [:index]) + resources("/inactive_pools", InactivePoolsController, only: [:index]) resources("/pending_transactions", PendingTransactionController, only: [:index]) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/active_pools/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/active_pools/index.html.eex new file mode 100644 index 0000000000..7437ddbc68 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/active_pools/index.html.eex @@ -0,0 +1,7 @@ +<%= render BlockScoutWeb.StakesView, "_stakes_top.html" %> +
+
+ <%= render BlockScoutWeb.StakesView, "_stakes_tabs.html", conn: @conn %> + <%= render BlockScoutWeb.StakesView, "_stakes_title.html", title: "Active Pools" %> +
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/inactive_pools/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/inactive_pools/index.html.eex new file mode 100644 index 0000000000..363e09eeba --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/inactive_pools/index.html.eex @@ -0,0 +1,7 @@ +<%= render BlockScoutWeb.StakesView, "_stakes_top.html" %> +
+
+ <%= render BlockScoutWeb.StakesView, "_stakes_tabs.html", conn: @conn %> + <%= render BlockScoutWeb.StakesView, "_stakes_title.html", title: "Inactive Pools" %> +
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex index d50e46d959..f1d8fed852 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex @@ -16,13 +16,13 @@ <%= gettext("Blocks") %> @@ -37,19 +37,19 @@ diff --git a/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_tabs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_tabs.html.eex new file mode 100644 index 0000000000..1feb419a69 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_tabs.html.eex @@ -0,0 +1,23 @@ +
+ <%= + link( + gettext("Validators"), + class: "card-tab #{tab_status("validators", @conn.request_path)}", + to: validators_path(@conn, :index) + ) + %> + <%= + link( + gettext("Active Pools"), + class: "card-tab #{tab_status("active_pools", @conn.request_path)}", + to: active_pools_path(@conn, :index) + ) + %> + <%= + link( + gettext("Inactive Pools"), + class: "card-tab #{tab_status("inactive_pools", @conn.request_path)}", + to: inactive_pools_path(@conn, :index) + ) + %> +
\ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_title.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_title.html.eex new file mode 100644 index 0000000000..1b3b47f1f3 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/stakes/_stakes_title.html.eex @@ -0,0 +1,8 @@ +
+
<%= @title %>
+
+ +
+
Show only those I staked into
+
+
\ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/stakes/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/stakes/index.html.eex deleted file mode 100644 index 06e9788b6b..0000000000 --- a/apps/block_scout_web/lib/block_scout_web/templates/stakes/index.html.eex +++ /dev/null @@ -1,8 +0,0 @@ -<%= render BlockScoutWeb.StakesView, "_stakes_top.html" %> -
-
-
- card body -
-
-
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/validators/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/validators/index.html.eex new file mode 100644 index 0000000000..35d65f4eba --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/templates/validators/index.html.eex @@ -0,0 +1,7 @@ +<%= render BlockScoutWeb.StakesView, "_stakes_top.html" %> +
+
+ <%= render BlockScoutWeb.StakesView, "_stakes_tabs.html", conn: @conn %> + <%= render BlockScoutWeb.StakesView, "_stakes_title.html", title: "Validators" %> +
+
diff --git a/apps/block_scout_web/lib/block_scout_web/views/active_pools_view.ex b/apps/block_scout_web/lib/block_scout_web/views/active_pools_view.ex new file mode 100644 index 0000000000..2da1a89fe6 --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/active_pools_view.ex @@ -0,0 +1,3 @@ +defmodule BlockScoutWeb.ActivePoolsView do + use BlockScoutWeb, :view +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/inactive_pools_view.ex b/apps/block_scout_web/lib/block_scout_web/views/inactive_pools_view.ex new file mode 100644 index 0000000000..83512cac1d --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/inactive_pools_view.ex @@ -0,0 +1,3 @@ +defmodule BlockScoutWeb.InactivePoolsView do + use BlockScoutWeb, :view +end diff --git a/apps/block_scout_web/lib/block_scout_web/views/validators_view.ex b/apps/block_scout_web/lib/block_scout_web/views/validators_view.ex new file mode 100644 index 0000000000..59024aa9be --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/views/validators_view.ex @@ -0,0 +1,3 @@ +defmodule BlockScoutWeb.ValidatorsView do + use BlockScoutWeb, :view +end