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

@ -25,6 +25,7 @@ export default defineConfig({
icon({ iconDir: 'src/img/icons' }), icon({ iconDir: 'src/img/icons' }),
react() react()
], ],
image: { domains: ['cdn.sittingonclouds.net'] },
output: 'server', output: 'server',
adapter: node({ mode: 'standalone' }) adapter: node({ mode: 'standalone' })
}) })

View file

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

View file

@ -11,7 +11,8 @@ export default {
'dark-hover': '#2b3035', 'dark-hover': '#2b3035',
gray: '#3f3f3f', gray: '#3f3f3f',
'gray-hover': '#4f4f4f', 'gray-hover': '#4f4f4f',
'soc-green': '#4b7667' 'soc-green': '#4b7667',
'hover-link': '#00d4ff'
} }
} }
}, },