@@ -27,6 +27,7 @@ import {
2727 RUNS_PAGE_SIZE_OPTIONS ,
2828 type RunsPaginationSearch ,
2929 resolveRunsPageSize ,
30+ shouldShowPaginationControls ,
3031 validateRunsPaginationSearch ,
3132} from "@/lib/runs-page-pagination" ;
3233import { usePolling } from "@/lib/use-polling" ;
@@ -117,6 +118,7 @@ function HomePage() {
117118 const [ isCreateRunOpen , setIsCreateRunOpen ] = useState ( false ) ;
118119 const pageSize = resolveRunsPageSize ( search . limit ) ;
119120 const runs = data ;
121+ const showRunsPagination = shouldShowPaginationControls ( pagination ) ;
120122
121123 function updateRunsSearch ( next : Partial < RunsPaginationSearch > ) {
122124 void navigate ( {
@@ -196,51 +198,53 @@ function HomePage() {
196198 showHeader = { false }
197199 />
198200
199- < div className = "flex flex-wrap items-center justify-between gap-3" >
200- < p className = "text-muted-foreground text-xs" >
201- Showing { runs . length } run{ runs . length === 1 ? "" : "s" }
202- </ p >
203- < div className = "flex w-full flex-wrap items-center gap-2 sm:w-auto sm:justify-end" >
204- < div className = "flex items-center gap-2 sm:mr-1" >
205- < p className = "text-muted-foreground text-xs" > Page size</ p >
206- < Select
207- value = { String ( pageSize ) }
208- onValueChange = { handlePageSizeChange }
201+ { showRunsPagination && (
202+ < div className = "flex flex-wrap items-center justify-between gap-3" >
203+ < p className = "text-muted-foreground text-xs" >
204+ Showing { runs . length } run{ runs . length === 1 ? "" : "s" }
205+ </ p >
206+ < div className = "flex w-full flex-wrap items-center gap-2 sm:w-auto sm:justify-end" >
207+ < div className = "flex items-center gap-2 sm:mr-1" >
208+ < p className = "text-muted-foreground text-xs" > Page size</ p >
209+ < Select
210+ value = { String ( pageSize ) }
211+ onValueChange = { handlePageSizeChange }
212+ >
213+ < SelectTrigger className = "h-8 w-20" >
214+ < SelectValue />
215+ </ SelectTrigger >
216+ < SelectContent >
217+ { RUNS_PAGE_SIZE_OPTIONS . map ( ( option ) => (
218+ < SelectItem key = { option } value = { String ( option ) } >
219+ { option }
220+ </ SelectItem >
221+ ) ) }
222+ </ SelectContent >
223+ </ Select >
224+ </ div >
225+ < Button
226+ variant = "outline"
227+ size = "sm"
228+ className = "flex-1 sm:flex-none"
229+ type = "button"
230+ onClick = { goToPreviousPage }
231+ disabled = { ! pagination . prev }
232+ >
233+ Previous
234+ </ Button >
235+ < Button
236+ variant = "outline"
237+ size = "sm"
238+ className = "flex-1 sm:flex-none"
239+ type = "button"
240+ onClick = { goToNextPage }
241+ disabled = { ! pagination . next }
209242 >
210- < SelectTrigger className = "h-8 w-20" >
211- < SelectValue />
212- </ SelectTrigger >
213- < SelectContent >
214- { RUNS_PAGE_SIZE_OPTIONS . map ( ( option ) => (
215- < SelectItem key = { option } value = { String ( option ) } >
216- { option }
217- </ SelectItem >
218- ) ) }
219- </ SelectContent >
220- </ Select >
243+ Next
244+ </ Button >
221245 </ div >
222- < Button
223- variant = "outline"
224- size = "sm"
225- className = "flex-1 sm:flex-none"
226- type = "button"
227- onClick = { goToPreviousPage }
228- disabled = { ! pagination . prev }
229- >
230- Previous
231- </ Button >
232- < Button
233- variant = "outline"
234- size = "sm"
235- className = "flex-1 sm:flex-none"
236- type = "button"
237- onClick = { goToNextPage }
238- disabled = { ! pagination . next }
239- >
240- Next
241- </ Button >
242246 </ div >
243- </ div >
247+ ) }
244248 </ div >
245249 </ div >
246250
0 commit comments