File tree 4 files changed +83
-1
lines changed
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
131
131
"""
132
132
end
133
133
134
- attr :name , :string , values: ~w[ bell bell-slash]
134
+ attr :name , :string , values: ~w[ bell bell-slash arrow-left arrow-right ]
135
135
136
136
def icon ( assigns = % { name: "bell" } ) do
137
137
~H"""
@@ -167,4 +167,38 @@ defmodule ErrorTracker.Web.CoreComponents do
167
167
</ svg >
168
168
"""
169
169
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
170
204
end
Original file line number Diff line number Diff line change @@ -126,9 +126,27 @@ defmodule ErrorTracker.Web.Live.Show do
126
126
|> Ecto . assoc ( :occurrences )
127
127
|> Repo . aggregate ( :count )
128
128
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
+
129
145
socket
130
146
|> assign ( :occurrences , occurrences )
131
147
|> assign ( :total_occurrences , total_occurrences )
148
+ |> assign ( :next , next_occurrence )
149
+ |> assign ( :prev , prev_occurrence )
132
150
end
133
151
134
152
defp related_occurrences ( query , num_results ) do
Original file line number Diff line number Diff line change 97
97
</ option >
98
98
</ select >
99
99
</ 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 >
100
113
</ . section >
101
114
102
115
< . section title = "Error kind " >
Original file line number Diff line number Diff line change @@ -766,6 +766,10 @@ select {
766
766
border-width : 0 ;
767
767
}
768
768
769
+ .static {
770
+ position : static;
771
+ }
772
+
769
773
.absolute {
770
774
position : absolute;
771
775
}
@@ -841,6 +845,10 @@ select {
841
845
margin-top : 1.5rem ;
842
846
}
843
847
848
+ .mt-2 {
849
+ margin-top : 0.5rem ;
850
+ }
851
+
844
852
.block {
845
853
display : block;
846
854
}
@@ -873,6 +881,11 @@ select {
873
881
display : none;
874
882
}
875
883
884
+ .size-4 {
885
+ width : 1rem ;
886
+ height : 1rem ;
887
+ }
888
+
876
889
.\!h-4 {
877
890
height : 1rem !important ;
878
891
}
@@ -925,6 +938,10 @@ select {
925
938
grid-template-columns : repeat (2 , minmax (0 , 1fr ));
926
939
}
927
940
941
+ .grid-cols-4 {
942
+ grid-template-columns : repeat (4 , minmax (0 , 1fr ));
943
+ }
944
+
928
945
.flex-col {
929
946
flex-direction : column;
930
947
}
You can’t perform that action at this time.
0 commit comments