@@ -6,7 +6,6 @@ defmodule LiveDebugger.LiveComponents.DetailView do
6
6
7
7
alias LiveDebugger.Services.TreeNode
8
8
alias Phoenix.LiveView.AsyncResult
9
- alias PetalComponents.Alert
10
9
alias LiveDebugger.Services.ChannelStateScraper
11
10
12
11
use LiveDebuggerWeb , :live_component
@@ -30,20 +29,20 @@ defmodule LiveDebugger.LiveComponents.DetailView do
30
29
@ impl true
31
30
def render ( assigns ) do
32
31
~H"""
33
- < div class = "flex flex-col w-full h-screen max-h-screen gap-4 p-2 overflow-x-hidden overflow-y-auto md:overflow-y-hidden " >
32
+ < div class = "flex flex-col w-full h-screen max-h-screen p-2 overflow-x-hidden overflow-y-auto md:overflow-y-hidden " >
34
33
< . async_result :let = { node } assign = { @ node } >
35
34
<: loading >
36
35
< div class = "w-full flex items-center justify-center " >
37
36
< . spinner size = "md " />
38
37
</ div >
39
38
</: loading >
40
39
<: failed :let = { reason } >
41
- < Alert . alert color = "danger " >
40
+ < . alert color = "danger " >
42
41
Failed to fetch node details: { inspect ( reason ) }
43
- </ Alert . alert >
42
+ </ . alert >
44
43
</: failed >
45
- < div class = "grid grid-cols-1 gap-2 md:grid-cols-2 md:h-full " >
46
- < div class = "flex flex-col gap-4 max " >
44
+ < div class = "grid grid-cols-1 md:grid-cols-2 md:h-full " >
45
+ < div class = "flex flex-col max md:border-r-2 border-swm-blue md:overflow-y-hidden " >
47
46
< . info_card node = { node } node_type = { @ node_type . result } />
48
47
< . assigns_card assigns = { node . assigns } />
49
48
</ div >
@@ -59,13 +58,13 @@ defmodule LiveDebugger.LiveComponents.DetailView do
59
58
60
59
defp info_card ( assigns ) do
61
60
~H"""
62
- < . basic_card title = { title ( @ node_type ) } >
61
+ < . section title = { title ( @ node_type ) } class = " border-b-2 border-swm-blue " >
63
62
< div class = " flex flex-col gap-1 " >
64
63
< . info_row name = { id_type ( @ node_type ) } value = { TreeNode . parsed_id ( @ node ) } />
65
64
< . info_row name = "Module " value = { inspect ( @ node . module ) } />
66
65
< . info_row name = "HTML ID " value = { @ node . id } />
67
66
</ div >
68
- </ . basic_card >
67
+ </ . section >
69
68
"""
70
69
end
71
70
@@ -75,7 +74,7 @@ defmodule LiveDebugger.LiveComponents.DetailView do
75
74
defp info_row ( assigns ) do
76
75
~H"""
77
76
< div class = "flex gap-1 overflow-x-hidden " >
78
- < div class = "font-bold text-swm-blue " >
77
+ < div class = "font-bold w-20 text-swm-blue " >
79
78
{ @ name }
80
79
</ div >
81
80
< div class = "break-all " >
@@ -95,24 +94,29 @@ defmodule LiveDebugger.LiveComponents.DetailView do
95
94
96
95
defp assigns_card ( assigns ) do
97
96
~H"""
98
- < . basic_card title = "Assigns " >
99
- < div class = "w-full whitespace-pre-wrap break-words overflow-y-auto " >
100
- { inspect ( @ assigns , pretty: true ) }
97
+ < . section title = "Assigns " class = "border-b-2 md:border-b-0 border-swm-blue h-max overflow-y-hidden " >
98
+ < div class = "w-full flex flex-col gap-1 overflow-y-auto " >
99
+ <%= for { key , value } <- @ assigns do %>
100
+ < div class = "overflow-x-hidden whitespace-pre-wrap break-words flex flex gap-2 min-h-max " >
101
+ < div class = "text-swm-blue font-bold " > { key } </ div >
102
+ < div class = "whitespace-pre-wrap " > { inspect ( value ) } </ div >
103
+ </ div >
104
+ <% end %>
101
105
</ div >
102
- </ . basic_card >
106
+ </ . section >
103
107
"""
104
108
end
105
109
106
110
defp events_card ( assigns ) do
107
111
~H"""
108
- < . basic_card title = "Events " class = "h-full " >
112
+ < . section title = "Events " class = "h-full md:overflow-y-auto " >
109
113
< . live_component
110
114
id = "event-list "
111
115
module = { LiveDebugger.LiveComponents.EventsList }
112
116
debugged_node_id = { @ pid }
113
117
socket_id = { @ socket_id }
114
118
/>
115
- </ . basic_card >
119
+ </ . section >
116
120
"""
117
121
end
118
122
@@ -121,13 +125,13 @@ defmodule LiveDebugger.LiveComponents.DetailView do
121
125
122
126
slot ( :inner_block )
123
127
124
- defp basic_card ( assigns ) do
128
+ defp section ( assigns ) do
125
129
~H"""
126
130
< div class = { [
127
- "flex flex-col gap-4 p-4 bg-swm-blue text-white rounded-xl shadow-xl " ,
131
+ "flex flex-col p-4" ,
128
132
@ class
129
133
] } >
130
- < . h3 class = "text-white " > { @ title } </ . h3 >
134
+ < . h3 class = "text-swm-blue " > { @ title } </ . h3 >
131
135
< div class = "flex h-full overflow-y-auto overflow-x-hidden rounded-md bg-white opacity-90 text-black p-2 " >
132
136
{ render_slot ( @ inner_block ) }
133
137
</ div >
0 commit comments