diff --git a/explorer/.env.dev b/explorer/.env.dev index 6e989f54f1..da4e2516d9 100644 --- a/explorer/.env.dev +++ b/explorer/.env.dev @@ -14,3 +14,6 @@ DB_HOST=localhost # Config file ALIGNED_CONFIG_FILE="../contracts/script/output/devnet/alignedlayer_deployment_output.json" + +# Debug +DEBUG_ERRORS=true diff --git a/explorer/.env.example b/explorer/.env.example index 688bf3aadf..5701c445b0 100644 --- a/explorer/.env.example +++ b/explorer/.env.example @@ -14,3 +14,6 @@ DB_HOST= # Config file ALIGNED_CONFIG_FILE="" + +# Debug +DEBUG_ERRORS= diff --git a/explorer/config/config.exs b/explorer/config/config.exs index b98353e0c5..237a62943d 100644 --- a/explorer/config/config.exs +++ b/explorer/config/config.exs @@ -16,7 +16,7 @@ config :explorer, ExplorerWeb.Endpoint, adapter: Bandit.PhoenixAdapter, render_errors: [ formats: [html: ExplorerWeb.ErrorHTML, json: ExplorerWeb.ErrorJSON], - layout: false + root_layout: {ExplorerWeb.Layouts, :root} ], pubsub_server: Explorer.PubSub, live_view: [signing_salt: "XkOXIXZ0"] diff --git a/explorer/config/dev.exs b/explorer/config/dev.exs index a0a3fa350c..9490802972 100644 --- a/explorer/config/dev.exs +++ b/explorer/config/dev.exs @@ -12,7 +12,7 @@ config :explorer, ExplorerWeb.Endpoint, http: [ip: {127, 0, 0, 1}, port: 4000], check_origin: false, code_reloader: true, - debug_errors: true, + debug_errors: System.get_env("DEBUG_ERRORS") || false, secret_key_base: "Ar8XKULLilwSeaCoCwlrv0KVM8dhzo97yhNOZi5e5wXlk7O0UdjZJJbuyzJx1YuX", watchers: [ esbuild: {Esbuild, :install_and_run, [:explorer, ~w(--sourcemap=inline --watch)]}, diff --git a/explorer/config/runtime.exs b/explorer/config/runtime.exs index 465eecc15c..2f21e4460d 100644 --- a/explorer/config/runtime.exs +++ b/explorer/config/runtime.exs @@ -33,7 +33,7 @@ if config_env() == :prod do You can generate one by calling: mix phx.gen.secret """ - host = System.get_env("PHX_HOST") || "explorer.alignedlayer.com" + host = System.get_env("PHX_HOST") || "http://localhost:4000" port = String.to_integer(System.get_env("PORT") || "4000") config :explorer, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY") diff --git a/explorer/lib/explorer_web/components/core_components.ex b/explorer/lib/explorer_web/components/core_components.ex index 886c0056b8..ce662079ca 100644 --- a/explorer/lib/explorer_web/components/core_components.ex +++ b/explorer/lib/explorer_web/components/core_components.ex @@ -244,6 +244,21 @@ defmodule ExplorerWeb.CoreComponents do """ end + @doc """ + Root background component. + """ + slot :inner_block, default: nil + + def root_background(assigns) do + ~H""" +
+
+ <%= render_slot(@inner_block) %> +
+
+ """ + end + @doc """ Renders a card background. """ diff --git a/explorer/lib/explorer_web/components/dark_mode.ex b/explorer/lib/explorer_web/components/dark_mode.ex index a4fb6accb6..939e36e679 100644 --- a/explorer/lib/explorer_web/components/dark_mode.ex +++ b/explorer/lib/explorer_web/components/dark_mode.ex @@ -9,6 +9,7 @@ defmodule DarkMode do phx-update="ignore" phx-hook="DarkThemeToggle" class="text-foreground hover:bg-foreground/10 rounded-lg text-sm p-2 drop-shadow-md" + aria-label="Toggle dark/light mode" > + Toggle light mode @@ -27,6 +29,7 @@ defmodule DarkMode do viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" > + Toggle dark mode -
- <.link class="text-3xl hover:scale-105 transform duration-150 active:scale-95" navigate={~p"/"}> - 🟩 - Aligned Explorer - - <.link class="text-foreground/80 hover:text-foreground font-semibold" navigate={~p"/batches"}> - Batches - - <.live_component module={SearchComponent} id="nav_search" /> -
- - -
+<.live_component module={NavComponent} id="navbar" /> +<.root_background> <.flash_group flash={@flash} /> -
- <%= @inner_content %> -
-
+ <%= @inner_content %> + diff --git a/explorer/lib/explorer_web/components/nav.ex b/explorer/lib/explorer_web/components/nav.ex new file mode 100644 index 0000000000..b198297731 --- /dev/null +++ b/explorer/lib/explorer_web/components/nav.ex @@ -0,0 +1,36 @@ +defmodule NavComponent do + use ExplorerWeb, :live_component + + @impl true + def render(assigns) do + ~H""" + + """ + end +end diff --git a/explorer/lib/explorer_web/components/search.ex b/explorer/lib/explorer_web/components/search.ex index 1ca4a5144a..9068481165 100644 --- a/explorer/lib/explorer_web/components/search.ex +++ b/explorer/lib/explorer_web/components/search.ex @@ -1,7 +1,7 @@ defmodule SearchComponent do use ExplorerWeb, :live_component - # do live redirect + @impl true def handle_event("search_batch", %{"batch" => batch_params}, socket) do batch_merkle_root = Map.get(batch_params, "merkle_root") is_batch_merkle_root_valid = String.match?(batch_merkle_root, ~r/^0x[a-fA-F0-9]+$/) @@ -21,6 +21,7 @@ defmodule SearchComponent do attr :class, :string, default: nil + @impl true def render(assigns) do ~H"""
+ +