Implement Highlight SidebarSection

This commit is contained in:
Jorge Vargas 2025-02-16 00:40:18 -06:00
parent f2b5945f64
commit 2dbc27d4f7
7 changed files with 59 additions and 3 deletions

View file

@ -7,7 +7,7 @@ import yt from 'img/socials/yt.png'
import twitter from 'img/socials/twitter.png'
import SidebarSection from './sidebar/SidebarSection.astro'
// import Highlight from './sidebar/Highlight.astro'
import Highlight from './sidebar/Highlight.astro'
const listClass =
'uppercase text-3xl font-semibold w-full text-center py-3 hover:bg-dark-hover hover:text-cyan-400 hover:underline'
@ -39,6 +39,6 @@ const listClass =
</a>
</div>
</SidebarSection>
<!-- <Highlight /> -->
<Highlight />
</div>
</div>

View file

@ -0,0 +1,8 @@
---
import Content from './highlight/content.astro'
import Loading from './highlight/loading.astro'
---
<Content server:defer>
<Loading slot='fallback' />
</Content>

View file

@ -0,0 +1,10 @@
---
interface Props {
class?: string
}
const { class: className } = Astro.props
---
<div class:list={['relative bg-gray rounded-md p-3.5', className]}>
<slot />
</div>

View file

@ -0,0 +1,27 @@
---
import prismaClient from 'utils/prisma-client'
import AlbumBox from 'components/AlbumBox.astro'
import SidebarSection from '../SidebarSection.astro'
const highlightConfig = await prismaClient.config.findUnique({
where: { name: 'highlight' },
select: { value: true }
})
const album = highlightConfig?.value
? await prismaClient.albums.findUnique({
where: { id: parseInt(highlightConfig.value) },
select: { title: true, id: true }
})
: null
---
{
album ? (
<SidebarSection>
<div class='uppercase text-center text-2xl/6 font-semibold'>Highlight Soundtrack</div>
<AlbumBox href={`/album/${album.id}`} title={album.title ?? 'Unknown Title'} image={`/album/${album.id}.png`} />
</SidebarSection>
) : null
}

View file

@ -0,0 +1,9 @@
---
import AlbumBox from 'components/AlbumBox.astro'
import SidebarSection from '../SidebarSection.astro'
---
<SidebarSection>
<div class='uppercase text-center text-2xl/6 font-semibold'>Highlight Soundtrack</div>
<AlbumBox loading />
</SidebarSection>