43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import Head from 'next/head'
|
|
import fsPromises from 'fs/promises'
|
|
import path from 'path'
|
|
import { EntryList, Game } from '../interfaces/CardTypes';
|
|
import { PageContentBox, PageDescription, PageTitle, CardContentGame } from '../components/styles/content'
|
|
import Link from 'next/link'
|
|
|
|
function Servers(props: EntryList) {
|
|
const serverList = props.games
|
|
return (
|
|
<>
|
|
<Head>
|
|
<title>Neshweb - Games</title>
|
|
<meta charSet='utf-8' />
|
|
<link rel="icon" href="/favicon.ico" />
|
|
</Head>
|
|
|
|
<PageTitle>
|
|
Server List
|
|
</PageTitle>
|
|
|
|
<PageDescription>
|
|
Lists all available Services, probably up-to-date
|
|
</PageDescription>
|
|
|
|
<PageContentBox>
|
|
{Object.values(serverList).map((item: Game) => (
|
|
<CardContentGame key={item.name} content={item} />
|
|
))}
|
|
</PageContentBox>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export async function getServerSideProps() {
|
|
const filePath = path.join(process.cwd(), '/public/pages.json')
|
|
const jsonData = await fsPromises.readFile(filePath)
|
|
const list = JSON.parse(jsonData.toString())
|
|
|
|
return { props: list }
|
|
}
|
|
|
|
export default Servers |