feat(ui): Improve Artist Album pagination

- use maximum of albumartist/artist credits for determining pagination
- reduce default maxPerPage considerably. This gives values of 36/72/108 at largest size
This commit is contained in:
Kendall Garner 2025-02-20 21:53:16 -08:00
parent 74348a340f
commit 4a69507e3e
No known key found for this signature in database
GPG Key ID: 18D2767419676C87

View File

@ -56,11 +56,16 @@ const AlbumShowLayout = (props) => {
const { width } = props
const [, perPageOptions] = useAlbumsPerPage(width)
const maxPerPage = 90
const maxPerPage = 36
let perPage = 0
let pagination = null
if (record?.stats?.['artist']?.albumCount > maxPerPage) {
const count = Math.max(
record?.stats?.['albumartist']?.albumCount || 0,
record?.stats?.['artist']?.albumCount ?? 0,
)
if (count > maxPerPage) {
perPage = Math.trunc(maxPerPage / perPageOptions[0]) * perPageOptions[0]
const rowsPerPageOptions = [1, 2, 3].map((option) => option * perPage)
pagination = <Pagination rowsPerPageOptions={rowsPerPageOptions} />