defmodule LiveDebuggerWeb.SettingsLive do
@moduledoc """
LiveView for the settings page.
"""
use LiveDebuggerWeb, :live_view
alias LiveDebugger.GenServers.CallbackTracingServer
alias LiveDebugger.GenServers.SettingsServer
alias LiveDebuggerWeb.Components.Navbar
alias LiveDebuggerWeb.Helpers.RoutesHelper
@impl true
def handle_params(params, _url, socket) do
socket
|> assign(:return_to, params["return_to"])
|> assign_settings()
|> noreply()
end
@impl true
def render(assigns) do
~H"""
<.h1>Settings
<%!-- Upper section --%>
<%!-- Appearance --%>
Appearance
<.dark_mode_button />
<.light_mode_button />
<%!-- Checkboxes --%>
<.settings_switch
id="dead-view-mode-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={@settings[:dead_view_mode]}
phx-click="update"
phx-value-setting="dead_view_mode"
/>
<.settings_switch
id="tracing-update-on-reload-switch"
label="Refresh tracing after recompilation"
description="Tracing in LiveDebugger may be interrupted when modules are recompiled. With this option enabled, LiveDebugger will refresh tracing after project recompilation. It may have a negative impact on application performance."
checked={@settings[:tracing_update_on_code_reload]}
phx-click="update"
phx-value-setting="tracing_update_on_code_reload"
/>
<%!-- Lower section --%>
<%!-- Refresh tracing button --%>
Refresh LiveDebugger Tracing
Manually refresh traced modules and callbacks. Use this when you don't see traces from your application.