Fix last-added build issue

This commit is contained in:
Jorge Vargas 2025-02-24 20:09:33 -06:00
parent b41bead1c8
commit f334a00c26
2 changed files with 8 additions and 8 deletions

View file

@ -22,7 +22,7 @@ const currentList = pageList[currentListIndex]
<ul class:list={[className, 'bg-dark mb-0 py-2 justify-center']}>
{
currentListIndex > 0 && (
currentListIndex > 0 ? (
<>
<FooterNavItem href='/last-added/1' aria-label='First'>
<span aria-hidden='true'>&laquo;</span>
@ -31,7 +31,7 @@ const currentList = pageList[currentListIndex]
<span aria-hidden='true'>&lt;</span>
</FooterNavItem>
</>
)
) : null
}
{
currentList.map((item) => (
@ -44,7 +44,7 @@ const currentList = pageList[currentListIndex]
))
}
{
currentListIndex !== pageList.length - 1 && (
currentListIndex !== pageList.length - 1 ? (
<>
<FooterNavItem
href={`/last-added/${currentList[currentList.length - 1] + 1}`}
@ -56,6 +56,6 @@ const currentList = pageList[currentListIndex]
<span aria-hidden='true'>&raquo;</span>
</FooterNavItem>
</>
)
) : null
}
</ul>

View file

@ -12,7 +12,7 @@ const limitMD = 12
const limitXS = 5
if (page < 1) {
return Astro.redirect('/last-added')
Astro.redirect('/last-added')
}
const lastAlbums = await prismaClient.albums.findMany({
@ -25,7 +25,7 @@ const lastAlbums = await prismaClient.albums.findMany({
const count = await prismaClient.albums.count({ where: { status: 'show' } })
if (lastAlbums.length === 0) {
return Astro.redirect('/404')
Astro.redirect('/404')
}
const fullPageList = [...Array(Math.ceil(count / take))].map((v, i) => i + 1)
@ -47,8 +47,8 @@ const listProps = { fullPageList, page }
</div>
</div>
<nav class='bg-dark p-2'>
<FooterNav class='flex md:hidden' pageLimit={limitXS} {...listProps} client:visible />
<FooterNav class='hidden md:flex' pageLimit={limitMD} {...listProps} client:visible />
<FooterNav class='flex md:hidden' pageLimit={limitXS} {...listProps} />
<FooterNav class='hidden md:flex' pageLimit={limitMD} {...listProps} />
</nav>
</div>
</BaseLayout>