core/pages/servers/index.tsx
SKINMAKER bec6aa3554
chore: deps (#566)
* chore: remove zlib-sync

* chore: pin version of @types/react

* chore: remove next-session

* chore: update tailwind

* chore: update tailwind

* chore: update lint

* chore: remove abort-controller

* chore: regen lock file

* fix: remove transparent

* chore: set plugin to not mutate existing style
2023-06-20 12:59:42 +09:00

59 lines
1.9 KiB
TypeScript

import { NextPage } from 'next'
import dynamic from 'next/dynamic'
import { Server, List } from '@types'
import * as Query from '@utils/Query'
const Advertisement = dynamic(() => import('@components/Advertisement'))
const ResponsiveGrid = dynamic(() => import('@components/ResponsiveGrid'))
const Container = dynamic(() => import('@components/Container'))
const ServerCard = dynamic(() => import('@components/ServerCard'))
const Paginator = dynamic(() => import('@components/Paginator'))
const Hero = dynamic(() => import('@components/Hero'))
const ServerIndex: NextPage<ServerIndexProps> = ({ votes, trusted }) => {
return <>
<Hero type='servers' />
<Container className='pb-10'>
<Advertisement />
<h1 className='text-3xl font-bold mt-10 mb-2'>
<i className='far fa-heart mr-3 text-pink-600' />
</h1>
<p className='text-base'> !</p>
<ResponsiveGrid>
{
votes.data.map(server=> <ServerCard type='list' key={server.id} server={server} />)
}
</ResponsiveGrid>
<Paginator totalPage={votes.totalPage} currentPage={votes.currentPage} pathname='/servers/list/votes' />
<Advertisement />
<h1 className='text-3xl font-bold mb-2'>
<i className='fa fa-check mr-3 mt-10 text-emerald-500' />
</h1>
<p className='text-base'> !!</p>
<ResponsiveGrid>
{
trusted.data.slice(0, 4).map(server=> <ServerCard type='list' key={server.id} server={server} />)
}
</ResponsiveGrid>
<Advertisement />
</Container>
</>
}
export const getServerSideProps = async() => {
const votes = await Query.get.serverList.votes.load(1)
const trusted = await Query.get.serverList.trusted.load(1)
return { props: { votes,trusted }}
}
interface ServerIndexProps {
votes: List<Server>
newBots: List<Server>
trusted: List<Server>
}
export default ServerIndex