Improve mobile UI and add infinite scroll
This commit is contained in:
@@ -118,3 +118,21 @@ func Pct(num, total int) int {
|
||||
}
|
||||
return num * 100 / total
|
||||
}
|
||||
|
||||
func PaginateProgressRows(rows []ProgressRow, page, pageSize int) ([]ProgressRow, bool) {
|
||||
if page < 1 {
|
||||
page = 1
|
||||
}
|
||||
if pageSize < 1 {
|
||||
pageSize = 30
|
||||
}
|
||||
start := (page - 1) * pageSize
|
||||
if start >= len(rows) {
|
||||
return []ProgressRow{}, false
|
||||
}
|
||||
end := start + pageSize
|
||||
if end > len(rows) {
|
||||
end = len(rows)
|
||||
}
|
||||
return rows[start:end], end < len(rows)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user