Skip to content

Commit 35f423b

Browse files
authored
Bug: fixed responsive design of channel dashboard (#281)
* Added example of long assign * Added width for channel dashboard sections * Fixed fullscreen button
1 parent 202b522 commit 35f423b

4 files changed

Lines changed: 31 additions & 22 deletions

File tree

dev/live_views/main.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ defmodule LiveDebuggerDev.LiveViews.Main do
1111
|> assign(name: random_name())
1212
|> assign(single_element_list: [%Phoenix.LiveComponent.CID{cid: 1}])
1313
|> assign(list: [%Phoenix.LiveComponent.CID{cid: 1}, %Phoenix.LiveComponent.CID{cid: 2}])
14+
|> assign(
15+
long_assign:
16+
"flex items-center gap-2 flex grow flex-col xl:flex-row flex items-center gap-2 flex grow flex-col xl:flex-row gap-4 xl:gap-8 p-8 overflow-y-auto xl:overflow-y-hidden max-w-screen-2xl mx-auto"
17+
)
1418

1519
{:ok, socket}
1620
end

lib/live_debugger/components/traces.ex

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,27 +93,30 @@ defmodule LiveDebugger.Components.Traces do
9393
</p>
9494
</div>
9595
</:label>
96-
<div class="relative flex flex-col gap-4 overflow-x-auto max-w-full h-[30vh] max-h-max overflow-y-auto">
97-
<.fullscreen_button
98-
id={"trace-fullscreen-#{@id}"}
99-
class="absolute right-2 top-2"
100-
phx-click="open-trace"
101-
phx-value-data={@trace.id}
102-
/>
103-
104-
<%= if @render_body? do %>
105-
<%= for {args, index} <- Enum.with_index(@trace.args) do %>
106-
<ElixirDisplay.term
107-
id={@id <> "-#{index}"}
108-
node={TermParser.term_to_display_tree(args)}
109-
level={1}
110-
/>
96+
<div class="relative">
97+
<div class="absolute right-[17px] top-0 z-50">
98+
<.fullscreen_button
99+
id={"trace-fullscreen-#{@id}"}
100+
class="m-2"
101+
phx-click="open-trace"
102+
phx-value-data={@trace.id}
103+
/>
104+
</div>
105+
<div class="flex flex-col gap-4 overflow-x-auto max-w-full h-[30vh] max-h-max overflow-y-auto p-4">
106+
<%= if @render_body? do %>
107+
<%= for {args, index} <- Enum.with_index(@trace.args) do %>
108+
<ElixirDisplay.term
109+
id={@id <> "-#{index}"}
110+
node={TermParser.term_to_display_tree(args)}
111+
level={1}
112+
/>
113+
<% end %>
114+
<% else %>
115+
<div class="w-full flex items-center justify-center">
116+
<.spinner size="sm" />
117+
</div>
111118
<% end %>
112-
<% else %>
113-
<div class="w-full flex items-center justify-center">
114-
<.spinner size="sm" />
115-
</div>
116-
<% end %>
119+
</div>
117120
</div>
118121
</.collapsible>
119122
"""

lib/live_debugger/live_views/channel_dashboard_live.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ defmodule LiveDebugger.LiveViews.ChannelDashboardLive do
7272
/>
7373
7474
<div class="flex grow flex-col xl:flex-row gap-4 xl:gap-8 p-8 overflow-y-auto xl:overflow-y-hidden max-w-screen-2xl mx-auto">
75-
<div class="xl:flex-1 shrink">
75+
<div class="xl:w-1/2">
7676
<StateLive.live_render
7777
id="node-state-lv"
7878
socket={@socket}
@@ -82,6 +82,7 @@ defmodule LiveDebugger.LiveViews.ChannelDashboardLive do
8282
</div>
8383
<TracesLive.live_render
8484
id="traces-list"
85+
class="xl:w-1/2"
8586
socket={@socket}
8687
lv_process={lv_process}
8788
node_id={@node_id || lv_process.pid}

lib/live_debugger/live_views/traces_live.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ defmodule LiveDebugger.LiveViews.TracesLive do
2525
attr(:lv_process, :map, required: true)
2626
attr(:node_id, :string, required: true)
2727
attr(:root_pid, :any, required: true)
28+
attr(:class, :string, required: true)
2829

2930
def live_render(assigns) do
3031
session = %{
@@ -41,7 +42,7 @@ defmodule LiveDebugger.LiveViews.TracesLive do
4142
<%= live_render(@socket, __MODULE__,
4243
id: @id,
4344
session: @session,
44-
container: {:div, class: "flex flex-1"}
45+
container: {:div, class: "flex #{@class}"}
4546
) %>
4647
"""
4748
end

0 commit comments

Comments
 (0)