mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
Fix last-added build issue
This commit is contained in:
parent
b41bead1c8
commit
f334a00c26
2 changed files with 8 additions and 8 deletions
|
|
@ -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'>«</span>
|
||||
|
|
@ -31,7 +31,7 @@ const currentList = pageList[currentListIndex]
|
|||
<span aria-hidden='true'><</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'>»</span>
|
||||
</FooterNavItem>
|
||||
</>
|
||||
)
|
||||
) : null
|
||||
}
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue