File tree Expand file tree Collapse file tree 4 files changed +83
-1
lines changed
Expand file tree Collapse file tree 4 files changed +83
-1
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ defmodule ErrorTracker.Web.CoreComponents do
131131 """
132132 end
133133
134- attr :name , :string , values: ~w[ bell bell-slash]
134+ attr :name , :string , values: ~w[ bell bell-slash arrow-left arrow-right ]
135135
136136 def icon ( assigns = % { name: "bell" } ) do
137137 ~H"""
@@ -167,4 +167,38 @@ defmodule ErrorTracker.Web.CoreComponents do
167167 </ svg >
168168 """
169169 end
170+
171+ def icon ( assigns = % { name: "arrow-left" } ) do
172+ ~H"""
173+ < svg
174+ xmlns = "http://www.w3.org/2000/svg "
175+ viewBox = "0 0 16 16 "
176+ fill = "currentColor "
177+ class = "!h-4 !w-4 inline-block "
178+ >
179+ < path
180+ fill-rule = "evenodd "
181+ d = "M14 8a.75.75 0 0 1-.75.75H4.56l3.22 3.22a.75.75 0 1 1-1.06 1.06l-4.5-4.5a.75.75 0 0 1 0-1.06l4.5-4.5a.75.75 0 0 1 1.06 1.06L4.56 7.25h8.69A.75.75 0 0 1 14 8Z "
182+ clip-rule = "evenodd "
183+ />
184+ </ svg >
185+ """
186+ end
187+
188+ def icon ( assigns = % { name: "arrow-right" } ) do
189+ ~H"""
190+ < svg
191+ xmlns = "http://www.w3.org/2000/svg "
192+ viewBox = "0 0 16 16 "
193+ fill = "currentColor "
194+ class = "!h-4 !w-4 inline-block "
195+ >
196+ < path
197+ fill-rule = "evenodd "
198+ d = "M2 8a.75.75 0 0 1 .75-.75h8.69L8.22 4.03a.75.75 0 0 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 0 1-1.06-1.06l3.22-3.22H2.75A.75.75 0 0 1 2 8Z "
199+ clip-rule = "evenodd "
200+ />
201+ </ svg >
202+ """
203+ end
170204end
Original file line number Diff line number Diff line change @@ -126,9 +126,27 @@ defmodule ErrorTracker.Web.Live.Show do
126126 |> Ecto . assoc ( :occurrences )
127127 |> Repo . aggregate ( :count )
128128
129+ next_occurrence =
130+ base_query
131+ |> where ( [ o ] , o . id > ^ current_occurrence . id )
132+ |> order_by ( [ o ] , asc: o . id )
133+ |> limit ( 1 )
134+ |> select ( [ :id , :error_id , :inserted_at ] )
135+ |> Repo . one ( )
136+
137+ prev_occurrence =
138+ base_query
139+ |> where ( [ o ] , o . id < ^ current_occurrence . id )
140+ |> order_by ( [ o ] , desc: o . id )
141+ |> limit ( 1 )
142+ |> select ( [ :id , :error_id , :inserted_at ] )
143+ |> Repo . one ( )
144+
129145 socket
130146 |> assign ( :occurrences , occurrences )
131147 |> assign ( :total_occurrences , total_occurrences )
148+ |> assign ( :next , next_occurrence )
149+ |> assign ( :prev , prev_occurrence )
132150 end
133151
134152 defp related_occurrences ( query , num_results ) do
Original file line number Diff line number Diff line change 9797 </ option >
9898 </ select >
9999 </ form >
100+
101+ < nav class = "grid grid-cols-2 gap-2 mt-2 " >
102+ < div class = "text-left " >
103+ < . link :if = { @ prev } patch = { occurrence_path ( @ socket , @ prev , @ search ) } >
104+ < . icon name = "arrow-left " /> Prev
105+ </ . link >
106+ </ div >
107+ < div class = "text-right " >
108+ < . link :if = { @ next } patch = { occurrence_path ( @ socket , @ next , @ search ) } >
109+ Next < . icon name = "arrow-right " />
110+ </ . link >
111+ </ div >
112+ </ nav >
100113 </ . section >
101114
102115 < . section title = "Error kind " >
Original file line number Diff line number Diff line change @@ -766,6 +766,10 @@ select {
766766 border-width : 0 ;
767767}
768768
769+ .static {
770+ position : static;
771+ }
772+
769773.absolute {
770774 position : absolute;
771775}
@@ -841,6 +845,10 @@ select {
841845 margin-top : 1.5rem ;
842846}
843847
848+ .mt-2 {
849+ margin-top : 0.5rem ;
850+ }
851+
844852.block {
845853 display : block;
846854}
@@ -873,6 +881,11 @@ select {
873881 display : none;
874882}
875883
884+ .size-4 {
885+ width : 1rem ;
886+ height : 1rem ;
887+ }
888+
876889.\!h-4 {
877890 height : 1rem !important ;
878891}
@@ -925,6 +938,10 @@ select {
925938 grid-template-columns : repeat (2 , minmax (0 , 1fr ));
926939}
927940
941+ .grid-cols-4 {
942+ grid-template-columns : repeat (4 , minmax (0 , 1fr ));
943+ }
944+
928945.flex-col {
929946 flex-direction : column;
930947}
You can’t perform that action at this time.
0 commit comments