mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
qqwqdqwd
This commit is contained in:
parent
491d72bd3c
commit
ec8e97a82f
7 changed files with 143 additions and 47 deletions
|
|
@ -49,9 +49,7 @@ export default defineConfig({
|
||||||
adapter: node({ mode: 'standalone' }),
|
adapter: node({ mode: 'standalone' }),
|
||||||
redirects: {
|
redirects: {
|
||||||
'/anim/[id]': { status: 307, destination: '/maintenance' },
|
'/anim/[id]': { status: 307, destination: '/maintenance' },
|
||||||
'/anim/list': { status: 307, destination: '/maintenance' },
|
|
||||||
'/game/[slug]': { status: 307, destination: '/maintenance' },
|
'/game/[slug]': { status: 307, destination: '/maintenance' },
|
||||||
'/game/list': { status: 307, destination: '/maintenance' },
|
|
||||||
'/platform/list': { status: 307, destination: '/maintenance' },
|
'/platform/list': { status: 307, destination: '/maintenance' },
|
||||||
'/platform/[id]': { status: 307, destination: '/maintenance' },
|
'/platform/[id]': { status: 307, destination: '/maintenance' },
|
||||||
'/profile': { status: 307, destination: '/maintenance' },
|
'/profile': { status: 307, destination: '/maintenance' },
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const albums = await prismaClient.albums.findMany({
|
||||||
})
|
})
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class='flex flex-col gap-y-1'>
|
<Fragment>
|
||||||
{
|
{
|
||||||
albums.map((a) => (
|
albums.map((a) => (
|
||||||
<a class='text-left' href={`/album/${a.id}`}>
|
<a class='text-left' href={`/album/${a.id}`}>
|
||||||
|
|
@ -21,4 +21,4 @@ const albums = await prismaClient.albums.findMany({
|
||||||
</a>
|
</a>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</div>
|
</Fragment>
|
||||||
23
src/components/listPage/GameLetterSection.astro
Normal file
23
src/components/listPage/GameLetterSection.astro
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
import prismaClient from 'utils/prisma-client'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
letter: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const { letter } = Astro.props
|
||||||
|
const games = await prismaClient.game.findMany({
|
||||||
|
where: { name: { startsWith: letter } },
|
||||||
|
select: { slug: true, name: true }
|
||||||
|
})
|
||||||
|
---
|
||||||
|
|
||||||
|
<Fragment>
|
||||||
|
{
|
||||||
|
games.map((g) => (
|
||||||
|
<a class='text-left' href={`/game/${g.slug}`}>
|
||||||
|
{g.name}
|
||||||
|
</a>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Fragment>
|
||||||
35
src/layouts/ListLayout.astro
Normal file
35
src/layouts/ListLayout.astro
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
interface Props {
|
||||||
|
letters: { letter: string; count: BigInt }[]
|
||||||
|
}
|
||||||
|
|
||||||
|
import Sidebar from 'components/Sidebar.astro'
|
||||||
|
import Base from './base.astro'
|
||||||
|
|
||||||
|
const { letters } = Astro.props
|
||||||
|
---
|
||||||
|
|
||||||
|
<Base>
|
||||||
|
<div class='flex flex-col md:flex-row flex-1 max-w-[2000px]'>
|
||||||
|
<div class='flex-1 px-5 bg-dark'>
|
||||||
|
<div class='flex flex-wrap gap-4 justify-center my-3'>
|
||||||
|
{
|
||||||
|
letters.map((l) => (
|
||||||
|
<div class='bg-btn-gray rounded-md size-14 uppercase font-semibold text-4xl text-white hover:bg-gray-hover'>
|
||||||
|
<a
|
||||||
|
href={`#${l.letter}`}
|
||||||
|
class='flex justify-center items-center size-full hover:no-underline hover:text-white'
|
||||||
|
>
|
||||||
|
{l.letter}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class='flex flex-col gap-y-6'>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Sidebar />
|
||||||
|
</div>
|
||||||
|
</Base>
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
---
|
---
|
||||||
import prismaClient from 'utils/prisma-client'
|
import prismaClient from 'utils/prisma-client'
|
||||||
|
|
||||||
import BaseLayout from 'layouts/base.astro'
|
import ListLayout from 'layouts/ListLayout.astro'
|
||||||
import Sidebar from 'components/Sidebar.astro'
|
import AlbumLetterSection from 'components/listPage/AlbumLetterSection.astro'
|
||||||
import LetterSection from 'components/albumList/letterSection.astro'
|
|
||||||
|
|
||||||
const letters: { letter: string; count: BigInt }[] = await prismaClient.$queryRaw`
|
const letters: { letter: string; count: BigInt }[] = await prismaClient.$queryRaw`
|
||||||
SELECT DISTINCT UPPER(LEFT(title, 1)) AS letter, COUNT(*) AS count
|
SELECT DISTINCT UPPER(LEFT(title, 1)) AS letter, COUNT(*) AS count
|
||||||
|
|
@ -14,44 +13,21 @@ const letters: { letter: string; count: BigInt }[] = await prismaClient.$queryRa
|
||||||
`
|
`
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout>
|
<ListLayout letters={letters}>
|
||||||
<div class='flex flex-col md:flex-row flex-1 max-w-[2000px]'>
|
|
||||||
<div class='flex-1 px-5 bg-dark'>
|
|
||||||
<div class='flex flex-wrap gap-4 justify-center my-3'>
|
|
||||||
{
|
|
||||||
letters.map((l) => (
|
|
||||||
<div class='bg-btn-gray rounded-md size-14 uppercase font-semibold text-4xl text-white hover:bg-gray-hover'>
|
|
||||||
<a
|
|
||||||
href={`#${l.letter}`}
|
|
||||||
class='flex justify-center items-center size-full hover:no-underline hover:text-white'
|
|
||||||
>
|
|
||||||
{l.letter}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div class='flex flex-col gap-y-6'>
|
|
||||||
{
|
{
|
||||||
letters.map((l) => (
|
letters.map((l) => (
|
||||||
<div id={l.letter}>
|
<div id={l.letter}>
|
||||||
<div class='flex uppercase border-y-2 text-4xl justify-center border-white py-1.5'>{l.letter}</div>
|
<div class='flex uppercase border-y-2 text-4xl justify-center border-white py-1.5'>{l.letter}</div>
|
||||||
<div class='my-4'>
|
<div class='flex flex-col my-4 gap-2'>
|
||||||
<LetterSection letter={l.letter} server:defer>
|
<AlbumLetterSection letter={l.letter} server:defer>
|
||||||
<Fragment slot="fallback">
|
<Fragment slot='fallback'>
|
||||||
<div class='flex flex-col gap-y-2'>
|
|
||||||
{Array.from({ length: Number(l.count) }).map(() => (
|
{Array.from({ length: Number(l.count) }).map(() => (
|
||||||
<div class='animate-pulse h-3.5 w-lg bg-gray/85' />
|
<div class='animate-pulse h-3.5 w-full bg-gray/85' />
|
||||||
))}
|
))}
|
||||||
</div>
|
|
||||||
</Fragment>
|
</Fragment>
|
||||||
</LetterSection>
|
</AlbumLetterSection>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</div>
|
</ListLayout>
|
||||||
</div>
|
|
||||||
<Sidebar />
|
|
||||||
</div>
|
|
||||||
</BaseLayout>
|
|
||||||
|
|
|
||||||
32
src/pages/anim/list/index.astro
Normal file
32
src/pages/anim/list/index.astro
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
import prismaClient from 'utils/prisma-client'
|
||||||
|
|
||||||
|
import ListLayout from 'layouts/ListLayout.astro'
|
||||||
|
import GameLetterSection from 'components/listPage/GameLetterSection.astro'
|
||||||
|
|
||||||
|
const letters: { letter: string; count: BigInt }[] = await prismaClient.$queryRaw`
|
||||||
|
SELECT DISTINCT UPPER(LEFT(name, 1)) AS letter, COUNT(*) AS count
|
||||||
|
FROM game
|
||||||
|
GROUP BY letter
|
||||||
|
ORDER BY letter;
|
||||||
|
`
|
||||||
|
---
|
||||||
|
|
||||||
|
<ListLayout letters={letters}>
|
||||||
|
{
|
||||||
|
letters.map((l) => (
|
||||||
|
<div id={l.letter}>
|
||||||
|
<div class='flex uppercase border-y-2 text-4xl justify-center border-white py-1.5'>{l.letter}</div>
|
||||||
|
<div class='grid grid-cols-3 gap-2 my-4'>
|
||||||
|
<GameLetterSection letter={l.letter} server:defer>
|
||||||
|
<Fragment slot='fallback'>
|
||||||
|
{Array.from({ length: Number(l.count) }).map(() => (
|
||||||
|
<div class='animate-pulse h-3.5 w-full bg-gray/85' />
|
||||||
|
))}
|
||||||
|
</Fragment>
|
||||||
|
</GameLetterSection>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</ListLayout>
|
||||||
32
src/pages/game/list/index.astro
Normal file
32
src/pages/game/list/index.astro
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
import prismaClient from 'utils/prisma-client'
|
||||||
|
|
||||||
|
import ListLayout from 'layouts/ListLayout.astro'
|
||||||
|
import GameLetterSection from 'components/listPage/GameLetterSection.astro'
|
||||||
|
|
||||||
|
const letters: { letter: string; count: BigInt }[] = await prismaClient.$queryRaw`
|
||||||
|
SELECT DISTINCT UPPER(LEFT(name, 1)) AS letter, COUNT(*) AS count
|
||||||
|
FROM game
|
||||||
|
GROUP BY letter
|
||||||
|
ORDER BY letter;
|
||||||
|
`
|
||||||
|
---
|
||||||
|
|
||||||
|
<ListLayout letters={letters}>
|
||||||
|
{
|
||||||
|
letters.map((l) => (
|
||||||
|
<div id={l.letter}>
|
||||||
|
<div class='flex uppercase border-y-2 text-4xl justify-center border-white py-1.5'>{l.letter}</div>
|
||||||
|
<div class='grid grid-cols-3 gap-2 my-4'>
|
||||||
|
<GameLetterSection letter={l.letter} server:defer>
|
||||||
|
<Fragment slot='fallback'>
|
||||||
|
{Array.from({ length: Number(l.count) }).map(() => (
|
||||||
|
<div class='animate-pulse h-3.5 w-full bg-gray/85' />
|
||||||
|
))}
|
||||||
|
</Fragment>
|
||||||
|
</GameLetterSection>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</ListLayout>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue