@@ -37,6 +37,10 @@ defmodule LiveDebuggerWeb.Live.Traces.Components.Trace do
3737 attr ( :id , :string , required: true )
3838 attr ( :wrapped_trace , :map , required: true , doc: "The Trace to render" )
3939
40+ slot :label , required: true do
41+ attr ( :class , :string , doc: "Additional class for label" )
42+ end
43+
4044 def trace ( assigns ) do
4145 assigns =
4246 assigns
@@ -51,15 +55,17 @@ defmodule LiveDebuggerWeb.Live.Traces.Components.Trace do
5155 icon = "icon-chevron-right "
5256 chevron_class = "w-5 h-5 text-accent-icon "
5357 class = "max-w-full border border-default-border rounded last:mb-4 "
54- label_class = "font-semibold bg-surface-1-bg h-10 p-2 "
58+ label_class = "font-semibold bg-surface-1-bg p-2 py-3 "
5559 phx-click = { if ( @ render_body? , do: nil , else: "toggle-collapsible" ) }
5660 phx-value-trace-id = { @ trace . id }
5761 >
5862 <: label >
59- < div id = { @ id <> "-label" } class = "w-[90%] grow flex items-center ml-2 gap-3 " >
60- < p class = "font-medium text-sm " > <%= @ callback_name %> </ p >
61- < . short_trace_content trace = { @ trace } />
62- < . trace_time_info id = { @ id } trace = { @ trace } from_tracing? = { @ from_tracing? } />
63+ < div
64+ :for = { label <- @ label }
65+ id = { @ id <> "-label" }
66+ class = { [ "w-[90%] grow grid items-center gap-x-3 ml-2" | List . wrap ( label [ :class ] ) ] }
67+ >
68+ <%= render_slot ( @ label , assigns ) %>
6369 </ div >
6470 </: label >
6571 < div class = "relative " >
@@ -85,9 +91,29 @@ defmodule LiveDebuggerWeb.Live.Traces.Components.Trace do
8591 """
8692 end
8793
94+ attr ( :trace , Trace , required: true )
95+ attr ( :class , :string , default: "" )
96+
97+ def module ( assigns ) do
98+ ~H"""
99+ < div class = { [ "text-primary text-2xs font-normal truncate" , @ class ] } >
100+ <%= Parsers . module_to_string ( @ trace . module ) %>
101+ <%= if ( @ trace . cid , do: "(#{ @ trace . cid } )" ) %>
102+ </ div >
103+ """
104+ end
105+
106+ attr ( :content , :string , required: true )
107+
108+ def callback_name ( assigns ) do
109+ ~H"""
110+ < p class = "font-medium text-sm " > <%= @ content %> </ p >
111+ """
112+ end
113+
88114 attr ( :trace , :map , default: nil )
89115
90- defp short_trace_content ( assigns ) do
116+ def short_trace_content ( assigns ) do
91117 assigns = assign ( assigns , :content , Enum . map_join ( assigns . trace . args , " " , & inspect / 1 ) )
92118
93119 ~H"""
@@ -101,7 +127,7 @@ defmodule LiveDebuggerWeb.Live.Traces.Components.Trace do
101127 attr ( :trace , :map , default: nil )
102128 attr ( :from_tracing? , :boolean , default: false )
103129
104- defp trace_time_info ( assigns ) do
130+ def trace_time_info ( assigns ) do
105131 ~H"""
106132 < div class = "flex text-xs font-normal text-secondary-text align-center " >
107133 < . tooltip id = { @ id <> "-timestamp" } content = "timestamp " class = "min-w-24 " >
0 commit comments