From e93f2a39fdddcbc85d2ea8dcce17f66912964997 Mon Sep 17 00:00:00 2001 From: kraleppa Date: Mon, 26 May 2025 15:32:52 +0200 Subject: [PATCH 01/15] Added settings button --- assets/icons/settings.svg | 4 ++++ lib/live_debugger_web/components/navbar.ex | 11 +++++++++++ lib/live_debugger_web/live/channel_dashboard_live.ex | 2 +- .../live/live_views_dashboard_live.ex | 2 +- lib/live_debugger_web/live/window_dashboard_live.ex | 2 +- 5 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 assets/icons/settings.svg diff --git a/assets/icons/settings.svg b/assets/icons/settings.svg new file mode 100644 index 000000000..0b3a407a0 --- /dev/null +++ b/assets/icons/settings.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/live_debugger_web/components/navbar.ex b/lib/live_debugger_web/components/navbar.ex index 2cd9c4a52..1526c663b 100644 --- a/lib/live_debugger_web/components/navbar.ex +++ b/lib/live_debugger_web/components/navbar.ex @@ -68,6 +68,7 @@ defmodule LiveDebuggerWeb.Components.Navbar do @doc """ Renders a theme toggle button. """ + # TODO: move it to settings page def theme_toggle(assigns) do ~H"""
@@ -82,6 +83,16 @@ defmodule LiveDebuggerWeb.Components.Navbar do """ end + attr(:class, :any, default: nil, doc: "Additional classes to add to the link.") + + def settings_button(assigns) do + ~H""" + <.link class={@class}> + <.nav_icon icon="icon-settings" /> + + """ + end + @doc """ Renders an icon with navbar styles. """ diff --git a/lib/live_debugger_web/live/channel_dashboard_live.ex b/lib/live_debugger_web/live/channel_dashboard_live.ex index 667e34e45..30c7d3ad1 100644 --- a/lib/live_debugger_web/live/channel_dashboard_live.ex +++ b/lib/live_debugger_web/live/channel_dashboard_live.ex @@ -40,7 +40,7 @@ defmodule LiveDebuggerWeb.ChannelDashboardLive do connected?={@lv_process.result.alive?} pid={Parsers.pid_to_string(@lv_process.result.pid)} /> - + - +
diff --git a/lib/live_debugger_web/live/window_dashboard_live.ex b/lib/live_debugger_web/live/window_dashboard_live.ex index 469f78547..dea89fb23 100644 --- a/lib/live_debugger_web/live/window_dashboard_live.ex +++ b/lib/live_debugger_web/live/window_dashboard_live.ex @@ -32,7 +32,7 @@ defmodule LiveDebuggerWeb.WindowDashboardLive do - +
From 926f7dd02cac32922858f0e77165ee40e1ecf94a Mon Sep 17 00:00:00 2001 From: kraleppa Date: Mon, 26 May 2025 15:36:16 +0200 Subject: [PATCH 02/15] Basic settings view --- lib/live_debugger_web/components/navbar.ex | 3 ++- lib/live_debugger_web/helpers/routes_helper.ex | 5 +++++ lib/live_debugger_web/live/settings_live.ex | 16 ++++++++++++++++ lib/live_debugger_web/router.ex | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 lib/live_debugger_web/live/settings_live.ex diff --git a/lib/live_debugger_web/components/navbar.ex b/lib/live_debugger_web/components/navbar.ex index 1526c663b..60be00924 100644 --- a/lib/live_debugger_web/components/navbar.ex +++ b/lib/live_debugger_web/components/navbar.ex @@ -6,6 +6,7 @@ defmodule LiveDebuggerWeb.Components.Navbar do use LiveDebuggerWeb, :component alias LiveDebugger.Utils.Parsers + alias LiveDebuggerWeb.Helpers.RoutesHelper @doc """ Renders base navbar component. @@ -87,7 +88,7 @@ defmodule LiveDebuggerWeb.Components.Navbar do def settings_button(assigns) do ~H""" - <.link class={@class}> + <.link navigate={RoutesHelper.settings()} class={@class}> <.nav_icon icon="icon-settings" /> """ diff --git a/lib/live_debugger_web/helpers/routes_helper.ex b/lib/live_debugger_web/helpers/routes_helper.ex index 496b14c73..1f5b4757a 100644 --- a/lib/live_debugger_web/helpers/routes_helper.ex +++ b/lib/live_debugger_web/helpers/routes_helper.ex @@ -26,4 +26,9 @@ defmodule LiveDebuggerWeb.Helpers.RoutesHelper do def error(error) do ~p"/error/#{error}" end + + @spec settings() :: String.t() + def settings() do + ~p"/settings" + end end diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex new file mode 100644 index 000000000..ad9c9e94b --- /dev/null +++ b/lib/live_debugger_web/live/settings_live.ex @@ -0,0 +1,16 @@ +defmodule LiveDebuggerWeb.SettingsLive do + @moduledoc """ + LiveView for the settings page. + """ + + use LiveDebuggerWeb, :live_view + + @impl true + def render(assigns) do + ~H""" +
+

Settings

+
+ """ + end +end diff --git a/lib/live_debugger_web/router.ex b/lib/live_debugger_web/router.ex index 7782bb49d..c0b47f512 100644 --- a/lib/live_debugger_web/router.ex +++ b/lib/live_debugger_web/router.ex @@ -22,6 +22,7 @@ defmodule LiveDebuggerWeb.Router do live("/pid/:pid", ChannelDashboardLive) live("/transport_pid/:transport_pid", WindowDashboardLive) + live("/settings", SettingsLive) live("/", LiveViewsDashboardLive) end end From 0cec2477681fd10bba99bda0b6de8a68d3a9afc7 Mon Sep 17 00:00:00 2001 From: kraleppa Date: Mon, 26 May 2025 15:51:37 +0200 Subject: [PATCH 03/15] Added navbar and stuff --- lib/live_debugger_web/live/settings_live.ex | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex index ad9c9e94b..2c2597598 100644 --- a/lib/live_debugger_web/live/settings_live.ex +++ b/lib/live_debugger_web/live/settings_live.ex @@ -5,11 +5,28 @@ defmodule LiveDebuggerWeb.SettingsLive do use LiveDebuggerWeb, :live_view + alias LiveDebuggerWeb.Components.Navbar + alias LiveDebuggerWeb.Helpers.RoutesHelper + @impl true def render(assigns) do ~H""" -
-

Settings

+
+ + + + +
+
+ <.h1>Settings +
+ +
+
+
+
+
+
""" end From 6bdf9402cb365a0b121abde3b075633f5fb3d38a Mon Sep 17 00:00:00 2001 From: kraleppa Date: Mon, 26 May 2025 16:34:48 +0200 Subject: [PATCH 04/15] Added appearance select --- lib/live_debugger_web/components/navbar.ex | 18 ----- lib/live_debugger_web/live/settings_live.ex | 83 ++++++++++++++++++++- 2 files changed, 81 insertions(+), 20 deletions(-) diff --git a/lib/live_debugger_web/components/navbar.ex b/lib/live_debugger_web/components/navbar.ex index 60be00924..5dc7d1fc8 100644 --- a/lib/live_debugger_web/components/navbar.ex +++ b/lib/live_debugger_web/components/navbar.ex @@ -66,24 +66,6 @@ defmodule LiveDebuggerWeb.Components.Navbar do """ end - @doc """ - Renders a theme toggle button. - """ - # TODO: move it to settings page - def theme_toggle(assigns) do - ~H""" -
- <.nav_icon id="light-mode-switch" class="dark:hidden" icon="icon-moon" phx-hook="ToggleTheme" /> - <.nav_icon - id="dark-mode-switch" - class="hidden dark:block" - icon="icon-sun" - phx-hook="ToggleTheme" - /> -
- """ - end - attr(:class, :any, default: nil, doc: "Additional classes to add to the link.") def settings_button(assigns) do diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex index 2c2597598..58e0c4d71 100644 --- a/lib/live_debugger_web/live/settings_live.ex +++ b/lib/live_debugger_web/live/settings_live.ex @@ -22,12 +22,91 @@ defmodule LiveDebuggerWeb.SettingsLive do
-
-
+
+
+

Appearance

+
+ <.dark_mode_button /> + <.light_mode_button /> +
+
+
""" end + + defp dark_mode_button(assigns) do + ~H""" + <.mode_button + id="dark-mode-switch" + icon="icon-moon" + text="Dark" + class="dark:hidden text-button-secondary-content bg-button-secondary-bg hover:bg-button-secondary-bg-hover border border-default-border" + phx-hook="ToggleTheme" + /> + <.mode_button + icon="icon-moon" + text="Dark" + class="hidden dark:flex text-button-primary-content bg-button-primary-bg" + /> + """ + end + + defp light_mode_button(assigns) do + ~H""" + <.mode_button + id="light-mode-switch" + icon="icon-sun" + text="Light" + class="hidden dark:flex text-button-secondary-content bg-button-secondary-bg hover:bg-button-secondary-bg-hover border border-default-border" + phx-hook="ToggleTheme" + /> + <.mode_button + icon="icon-sun" + text="Light" + class="dark:hidden text-button-primary-content bg-button-primary-bg" + /> + """ + end + + attr(:icon, :string, required: true) + attr(:text, :string, required: true) + attr(:class, :string, default: "") + attr(:rest, :global) + + defp mode_button(assigns) do + ~H""" + + """ + end + + # @doc """ + # Renders a theme toggle button. + # """ + # # TODO: move it to settings page + # def theme_toggle(assigns) do + # ~H""" + #
+ # <.nav_icon id="light-mode-switch" class="dark:hidden" icon="icon-moon" phx-hook="ToggleTheme" /> + # <.nav_icon + # id="dark-mode-switch" + # class="hidden dark:block" + # icon="icon-sun" + # phx-hook="ToggleTheme" + # /> + #
+ # """ + # end end From 862984bb9359f3e7d0032ca62b6fa6fb2538811a Mon Sep 17 00:00:00 2001 From: kraleppa Date: Mon, 26 May 2025 16:35:02 +0200 Subject: [PATCH 05/15] Removed comment --- lib/live_debugger_web/live/settings_live.ex | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex index 58e0c4d71..53d073e56 100644 --- a/lib/live_debugger_web/live/settings_live.ex +++ b/lib/live_debugger_web/live/settings_live.ex @@ -91,22 +91,4 @@ defmodule LiveDebuggerWeb.SettingsLive do """ end - - # @doc """ - # Renders a theme toggle button. - # """ - # # TODO: move it to settings page - # def theme_toggle(assigns) do - # ~H""" - #
- # <.nav_icon id="light-mode-switch" class="dark:hidden" icon="icon-moon" phx-hook="ToggleTheme" /> - # <.nav_icon - # id="dark-mode-switch" - # class="hidden dark:block" - # icon="icon-sun" - # phx-hook="ToggleTheme" - # /> - #
- # """ - # end end From 5cb499ad536589fcbe1cc4e23fd0b6d8398524fd Mon Sep 17 00:00:00 2001 From: kraleppa Date: Mon, 26 May 2025 16:54:57 +0200 Subject: [PATCH 06/15] All buttons added --- lib/live_debugger_web/components.ex | 6 ++- lib/live_debugger_web/live/settings_live.ex | 45 ++++++++++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/lib/live_debugger_web/components.ex b/lib/live_debugger_web/components.ex index a8058277f..2d92007d5 100644 --- a/lib/live_debugger_web/components.ex +++ b/lib/live_debugger_web/components.ex @@ -598,11 +598,15 @@ defmodule LiveDebuggerWeb.Components do """ attr(:checked, :boolean, default: false, doc: "Whether the switch is checked.") attr(:label, :string, default: "", doc: "Label for the switch.") + attr(:wrapper_class, :any, default: nil, doc: "Additional classes to add to the switch.") attr(:rest, :global) def toggle_switch(assigns) do ~H""" -
-
+
+
+ <.toggle_switch checked={false} wrapper_class="pr-3 py-0" /> +
+

Enable DeadView mode

+

+ TODO write description +

+
+
+
+ <.toggle_switch checked={false} wrapper_class="pr-3 py-0" /> +
+

Enable global tracing

+

+ Enabling this feature may have a negative impact on application performance. +

+
+
+
+ <.toggle_switch checked={false} wrapper_class="pr-3 py-0" /> +
+

Refresh tracing on reload

+

+ Enabling this feature may have a negative impact on application performance. +

+
+
+
+
+
+
+
+
+
+
+

Restart LiveDebugger

+

+ Use this option if LiveDebugger appears to stop responding or not working properly. +

+
+ <.button variant="secondary">Restart LiveDebugger +
+
From e6d176f6655cc596717f97c274affbe9ac59d756 Mon Sep 17 00:00:00 2001 From: kraleppa Date: Tue, 27 May 2025 08:21:54 +0200 Subject: [PATCH 07/15] Added description of deadview --- lib/live_debugger_web/live/settings_live.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex index 14bee03dc..16dd19425 100644 --- a/lib/live_debugger_web/live/settings_live.ex +++ b/lib/live_debugger_web/live/settings_live.ex @@ -36,7 +36,7 @@ defmodule LiveDebuggerWeb.SettingsLive do

Enable DeadView mode

- TODO write description + When enabled, LiveDebugger won't redirect to new LiveView after page redirect or reload, allowing you to browse assigns and traces of dead LiveViews.

From 60e32facabcaa20707264561f15e6e1f33655b23 Mon Sep 17 00:00:00 2001 From: kraleppa Date: Tue, 27 May 2025 08:24:49 +0200 Subject: [PATCH 08/15] Added clicks --- lib/live_debugger_web/live/settings_live.ex | 33 ++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex index 16dd19425..e0ef5006f 100644 --- a/lib/live_debugger_web/live/settings_live.ex +++ b/lib/live_debugger_web/live/settings_live.ex @@ -32,7 +32,12 @@ defmodule LiveDebuggerWeb.SettingsLive do
- <.toggle_switch checked={false} wrapper_class="pr-3 py-0" /> + <.toggle_switch + checked={false} + wrapper_class="pr-3 py-0" + phx-click="update" + phx-value-setting="deadview_mode" + />

Enable DeadView mode

@@ -41,7 +46,12 @@ defmodule LiveDebuggerWeb.SettingsLive do

- <.toggle_switch checked={false} wrapper_class="pr-3 py-0" /> + <.toggle_switch + checked={false} + wrapper_class="pr-3 py-0" + phx-click="update" + phx-value-setting="global_tracing" + />

Enable global tracing

@@ -50,7 +60,12 @@ defmodule LiveDebuggerWeb.SettingsLive do

- <.toggle_switch checked={false} wrapper_class="pr-3 py-0" /> + <.toggle_switch + checked={false} + wrapper_class="pr-3 py-0" + phx-click="update" + phx-value-setting="refresh_tracing_on_reload" + />

Refresh tracing on reload

@@ -71,7 +86,7 @@ defmodule LiveDebuggerWeb.SettingsLive do Use this option if LiveDebugger appears to stop responding or not working properly.

- <.button variant="secondary">Restart LiveDebugger + <.button variant="secondary" phx-click="restart">Restart LiveDebugger
@@ -81,6 +96,16 @@ defmodule LiveDebuggerWeb.SettingsLive do """ end + @impl true + def handle_event("update", %{"setting" => _setting}, socket) do + {:noreply, socket} + end + + @impl true + def handle_event("restart", _, socket) do + {:noreply, socket} + end + defp dark_mode_button(assigns) do ~H""" <.mode_button From 0498788294e4e1c013bf177bdba8f4a22cac8b5d Mon Sep 17 00:00:00 2001 From: kraleppa Date: Tue, 27 May 2025 08:51:37 +0200 Subject: [PATCH 09/15] Added tests with checks for settings button --- test/live_debugger/channel_dashboard_test.exs | 15 +++++++++++++++ test/live_debugger/live_views_dashboard_test.exs | 14 ++++++++++++++ test/live_debugger/window_dashboard_test.exs | 16 ++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/test/live_debugger/channel_dashboard_test.exs b/test/live_debugger/channel_dashboard_test.exs index c8da63d0e..df22f1d73 100644 --- a/test/live_debugger/channel_dashboard_test.exs +++ b/test/live_debugger/channel_dashboard_test.exs @@ -108,6 +108,21 @@ defmodule LiveDebugger.ChannelDashboardTest do end) end + @sessions 2 + feature "settings button exists and redirects to settings page", %{ + sessions: [dev_app, debugger] + } do + dev_app + |> visit(@dev_app_url) + + debugger + |> visit("/") + |> click(first_link()) + |> assert_has(css("navbar a[href=\"/settings\"]")) + |> click(css("navbar a[href=\"/settings\"]")) + |> assert_has(css("h1", text: "Settings")) + end + @sessions 2 feature "user can change nodes using node tree and see their assigns and callback traces", %{ sessions: [dev_app, debugger] diff --git a/test/live_debugger/live_views_dashboard_test.exs b/test/live_debugger/live_views_dashboard_test.exs index 4f888b9cb..847a05d99 100644 --- a/test/live_debugger/live_views_dashboard_test.exs +++ b/test/live_debugger/live_views_dashboard_test.exs @@ -22,6 +22,20 @@ defmodule LiveDebugger.LiveViewsDashboardTest do |> assert_has(live_sessions(count: 2)) end + @sessions 2 + feature "settings button exists and redirects to settings page", %{ + sessions: [dev_app, debugger] + } do + dev_app + |> visit(@dev_app_url) + + debugger + |> visit("/") + |> assert_has(css("navbar a[href=\"/settings\"]")) + |> click(css("navbar a[href=\"/settings\"]")) + |> assert_has(css("h1", text: "Settings")) + end + defp title(text: text), do: css("h1", text: text) defp live_sessions(count: count), do: css("#live-sessions > div", count: count) diff --git a/test/live_debugger/window_dashboard_test.exs b/test/live_debugger/window_dashboard_test.exs index 9257e0762..c91177e44 100644 --- a/test/live_debugger/window_dashboard_test.exs +++ b/test/live_debugger/window_dashboard_test.exs @@ -31,6 +31,22 @@ defmodule LiveDebugger.WindowDashboardTest do |> assert_has(live_sessions(count: 1)) end + @sessions 2 + feature "settings button exists and redirects to settings page", %{ + sessions: [dev_app, debugger] + } do + dev_app + |> visit(@dev_app_url) + + debugger + |> visit("/") + |> click(window_link()) + |> assert_has(title(text: "Active LiveViews in a single window")) + |> assert_has(css("navbar a[href=\"/settings\"]")) + |> click(css("navbar a[href=\"/settings\"]")) + |> assert_has(css("h1", text: "Settings")) + end + defp title(text: text), do: css("h1", text: text) defp live_sessions(count: count), do: css("#live-sessions ", count: count) From f34eb5f33946d3dfd4938ea42e3bc5106d0eb9cc Mon Sep 17 00:00:00 2001 From: kraleppa Date: Tue, 27 May 2025 11:25:43 +0200 Subject: [PATCH 10/15] Post merge fix --- lib/live_debugger_web/components/navbar.ex | 1 - lib/live_debugger_web/live/settings_live.ex | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/live_debugger_web/components/navbar.ex b/lib/live_debugger_web/components/navbar.ex index 32e965720..0efb84665 100644 --- a/lib/live_debugger_web/components/navbar.ex +++ b/lib/live_debugger_web/components/navbar.ex @@ -5,7 +5,6 @@ defmodule LiveDebuggerWeb.Components.Navbar do use LiveDebuggerWeb, :component - alias LiveDebugger.Utils.Parsers alias LiveDebuggerWeb.Helpers.RoutesHelper @doc """ diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex index e0ef5006f..8672dcd4b 100644 --- a/lib/live_debugger_web/live/settings_live.ex +++ b/lib/live_debugger_web/live/settings_live.ex @@ -13,7 +13,7 @@ defmodule LiveDebuggerWeb.SettingsLive do ~H"""
- +
From 38cb3f0be22c219eb99250640dd13e7f62664a81 Mon Sep 17 00:00:00 2001 From: kraleppa Date: Tue, 27 May 2025 11:26:48 +0200 Subject: [PATCH 11/15] Removed obsolete margin from callback traces --- lib/live_debugger_web/live/traces_live.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/live_debugger_web/live/traces_live.ex b/lib/live_debugger_web/live/traces_live.ex index d0bbb5eb7..06d0ffeb6 100644 --- a/lib/live_debugger_web/live/traces_live.ex +++ b/lib/live_debugger_web/live/traces_live.ex @@ -84,7 +84,7 @@ defmodule LiveDebuggerWeb.TracesLive do def render(assigns) do ~H"""
- <.section title="Callback traces" id="traces" inner_class="mx-0 my-4 px-4" class="flex-1"> + <.section title="Callback traces" id="traces" inner_class="mx-0 mt-4 px-4" class="flex-1"> <:right_panel>
From 79773fe0840662c4c1c379b0dc2958a8d63533c6 Mon Sep 17 00:00:00 2001 From: kraleppa Date: Tue, 27 May 2025 11:28:33 +0200 Subject: [PATCH 12/15] Added margins for load more button --- lib/live_debugger_web/live/traces_live.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/live_debugger_web/live/traces_live.ex b/lib/live_debugger_web/live/traces_live.ex index 06d0ffeb6..ed8578719 100644 --- a/lib/live_debugger_web/live/traces_live.ex +++ b/lib/live_debugger_web/live/traces_live.ex @@ -145,13 +145,13 @@ defmodule LiveDebuggerWeb.TracesLive do <.button :if={not @tracing_helper.tracing_started? && @traces_continuation != :end_of_table} phx-click="load-more" - class="w-40" + class="w-4 mb-4" variant="secondary" > Load more <% else %> - <.spinner size="sm" /> + <.spinner size="sm" class="mb-4" /> <% end %>
From 4db834747aea039e8cdcd5de86055747eb451700 Mon Sep 17 00:00:00 2001 From: kraleppa Date: Tue, 27 May 2025 11:43:14 +0200 Subject: [PATCH 13/15] Simplified html --- lib/live_debugger_web/live/settings_live.ex | 114 ++++++++++---------- 1 file changed, 54 insertions(+), 60 deletions(-) diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex index 8672dcd4b..bc1353c04 100644 --- a/lib/live_debugger_web/live/settings_live.ex +++ b/lib/live_debugger_web/live/settings_live.ex @@ -21,74 +21,68 @@ defmodule LiveDebuggerWeb.SettingsLive do <.h1>Settings
-
-
-
-

Appearance

-
- <.dark_mode_button /> - <.light_mode_button /> -
+
+
+

Appearance

+
+ <.dark_mode_button /> + <.light_mode_button />
-
-
- <.toggle_switch - checked={false} - wrapper_class="pr-3 py-0" - phx-click="update" - phx-value-setting="deadview_mode" - /> -
-

Enable DeadView mode

-

- When enabled, LiveDebugger won't redirect to new LiveView after page redirect or reload, allowing you to browse assigns and traces of dead LiveViews. -

-
+
+
+
+ <.toggle_switch + checked={false} + wrapper_class="pr-3 py-0" + phx-click="update" + phx-value-setting="deadview_mode" + /> +
+

Enable DeadView mode

+

+ When enabled, LiveDebugger won't redirect to new LiveView after page redirect or reload, allowing you to browse assigns and traces of dead LiveViews. +

-
- <.toggle_switch - checked={false} - wrapper_class="pr-3 py-0" - phx-click="update" - phx-value-setting="global_tracing" - /> -
-

Enable global tracing

-

- Enabling this feature may have a negative impact on application performance. -

-
+
+
+ <.toggle_switch + checked={false} + wrapper_class="pr-3 py-0" + phx-click="update" + phx-value-setting="global_tracing" + /> +
+

Enable global tracing

+

+ Enabling this feature may have a negative impact on application performance. +

-
- <.toggle_switch - checked={false} - wrapper_class="pr-3 py-0" - phx-click="update" - phx-value-setting="refresh_tracing_on_reload" - /> -
-

Refresh tracing on reload

-

- Enabling this feature may have a negative impact on application performance. -

-
+
+
+ <.toggle_switch + checked={false} + wrapper_class="pr-3 py-0" + phx-click="update" + phx-value-setting="refresh_tracing_on_reload" + /> +
+

Refresh tracing on reload

+

+ Enabling this feature may have a negative impact on application performance. +

-
-
-
-
-
-

Restart LiveDebugger

-

- Use this option if LiveDebugger appears to stop responding or not working properly. -

-
- <.button variant="secondary" phx-click="restart">Restart LiveDebugger -
+
+
+
+

Restart LiveDebugger

+

+ Use this option if LiveDebugger appears to stop responding or not working properly. +

+ <.button variant="secondary" phx-click="restart">Restart LiveDebugger
From 649445092a4cb61ff999f2d3915884d48577c57e Mon Sep 17 00:00:00 2001 From: kraleppa Date: Tue, 27 May 2025 11:49:43 +0200 Subject: [PATCH 14/15] Refactored settings --- lib/live_debugger_web/live/settings_live.ex | 94 ++++++++++++--------- 1 file changed, 52 insertions(+), 42 deletions(-) diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex index bc1353c04..7ff226cae 100644 --- a/lib/live_debugger_web/live/settings_live.ex +++ b/lib/live_debugger_web/live/settings_live.ex @@ -21,7 +21,9 @@ defmodule LiveDebuggerWeb.SettingsLive do <.h1>Settings
+ <%!-- Upper section --%>
+ <%!-- Appearance --%>

Appearance

@@ -29,52 +31,37 @@ defmodule LiveDebuggerWeb.SettingsLive do <.light_mode_button />
+ <%!-- Checkboxes --%>
-
- <.toggle_switch - checked={false} - wrapper_class="pr-3 py-0" - phx-click="update" - phx-value-setting="deadview_mode" - /> -
-

Enable DeadView mode

-

- When enabled, LiveDebugger won't redirect to new LiveView after page redirect or reload, allowing you to browse assigns and traces of dead LiveViews. -

-
-
-
- <.toggle_switch - checked={false} - wrapper_class="pr-3 py-0" - phx-click="update" - phx-value-setting="global_tracing" - /> -
-

Enable global tracing

-

- Enabling this feature may have a negative impact on application performance. -

-
-
-
- <.toggle_switch - checked={false} - wrapper_class="pr-3 py-0" - phx-click="update" - phx-value-setting="refresh_tracing_on_reload" - /> -
-

Refresh tracing on reload

-

- Enabling this feature may have a negative impact on application performance. -

-
-
+ <.settings_switch + label="Enable DeadView mode" + description="When enabled, LiveDebugger won't redirect to new LiveView after page redirect or reload, allowing you to browse assigns and traces of dead LiveViews." + checked={false} + phx-click="update" + phx-value-setting="deadview_mode" + /> + + <.settings_switch + label="Enable global tracing" + description="Enabling this feature may have a negative impact on application performance." + checked={false} + phx-click="update" + phx-value-setting="global_tracing" + /> + + <.settings_switch + label="Refresh tracing on reload" + description="Enabling this feature may have a negative impact on application performance." + checked={false} + phx-click="update" + phx-value-setting="refresh_tracing_on_reload" + />
+ + <%!-- Lower section --%>
+ <%!-- Restart button --%>

Restart LiveDebugger

@@ -100,6 +87,29 @@ defmodule LiveDebuggerWeb.SettingsLive do {:noreply, socket} end + attr(:label, :string, required: true) + attr(:description, :string, required: true) + attr(:checked, :boolean, default: false) + attr(:rest, :global) + + defp settings_switch(assigns) do + ~H""" +
+ <.toggle_switch + checked={@checked} + wrapper_class="pr-3 py-0" + phx-click="update" + phx-value-setting="deadview_mode" + {@rest} + /> +
+

<%= @label %>

+

<%= @description %>

+
+
+ """ + end + defp dark_mode_button(assigns) do ~H""" <.mode_button From 6e23e5da1d9c05187f82f5fb8e9c7472d778fc80 Mon Sep 17 00:00:00 2001 From: kraleppa Date: Tue, 27 May 2025 11:50:49 +0200 Subject: [PATCH 15/15] Removed phx-click --- lib/live_debugger_web/live/settings_live.ex | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/live_debugger_web/live/settings_live.ex b/lib/live_debugger_web/live/settings_live.ex index 7ff226cae..092811a90 100644 --- a/lib/live_debugger_web/live/settings_live.ex +++ b/lib/live_debugger_web/live/settings_live.ex @@ -95,13 +95,7 @@ defmodule LiveDebuggerWeb.SettingsLive do defp settings_switch(assigns) do ~H"""
- <.toggle_switch - checked={@checked} - wrapper_class="pr-3 py-0" - phx-click="update" - phx-value-setting="deadview_mode" - {@rest} - /> + <.toggle_switch checked={@checked} wrapper_class="pr-3 py-0" {@rest} />

<%= @label %>

<%= @description %>