2022-12-03 20:02:13 +00:00
|
|
|
import Head from 'next/head'
|
|
|
|
import fsPromises from 'fs/promises'
|
|
|
|
import path from 'path'
|
2022-12-10 02:00:40 +00:00
|
|
|
import type { CustomLink, EntryList } from '../interfaces/LinkTypes'
|
2022-12-15 23:11:30 +00:00
|
|
|
import { PageContentBox, PageCard, PageDescription, PageTitle, CardContentGame } from '../components/styles/content'
|
2022-12-15 22:20:26 +00:00
|
|
|
import Link from 'next/link'
|
2022-12-03 20:02:13 +00:00
|
|
|
|
2022-12-10 02:00:40 +00:00
|
|
|
function Servers(props: EntryList) {
|
2022-12-03 20:02:13 +00:00
|
|
|
const serverList = props.games
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Head>
|
2022-12-15 22:20:26 +00:00
|
|
|
<title>Neshweb - Games</title>
|
2022-12-03 20:02:13 +00:00
|
|
|
<meta charSet='utf-8' />
|
|
|
|
<link rel="icon" href="/favicon.ico" />
|
|
|
|
</Head>
|
|
|
|
|
2022-12-15 22:20:26 +00:00
|
|
|
<PageTitle>
|
2022-12-03 20:02:13 +00:00
|
|
|
Server List
|
2022-12-15 22:20:26 +00:00
|
|
|
</PageTitle>
|
2022-12-03 20:02:13 +00:00
|
|
|
|
2022-12-15 22:20:26 +00:00
|
|
|
<PageDescription>
|
2022-12-03 20:02:13 +00:00
|
|
|
Lists all available Services, probably up-to-date
|
2022-12-15 22:20:26 +00:00
|
|
|
</PageDescription>
|
|
|
|
|
|
|
|
<PageContentBox>
|
2022-12-03 20:02:13 +00:00
|
|
|
{Object.values(serverList).map((item: CustomLink) => {
|
|
|
|
if (item.href != null) {
|
|
|
|
return (
|
2022-12-15 22:20:26 +00:00
|
|
|
<PageCard key={item.name}>
|
|
|
|
<Link href={item.href}>
|
2022-12-15 23:11:30 +00:00
|
|
|
<CardContentGame content={item} />
|
2022-12-15 22:20:26 +00:00
|
|
|
</Link>
|
|
|
|
</PageCard>
|
2022-12-03 20:02:13 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return (
|
2022-12-15 22:20:26 +00:00
|
|
|
<PageCard key={item.name}>
|
2022-12-15 23:11:30 +00:00
|
|
|
<CardContentGame content={item} />
|
2022-12-15 22:20:26 +00:00
|
|
|
</PageCard>
|
2022-12-03 20:02:13 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)}
|
2022-12-15 22:20:26 +00:00
|
|
|
</PageContentBox>
|
2022-12-03 20:02:13 +00:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function getServerSideProps() {
|
2022-12-09 21:36:42 +00:00
|
|
|
const filePath = path.join(process.cwd(), '/public/pages.json')
|
2022-12-03 20:02:13 +00:00
|
|
|
const jsonData = await fsPromises.readFile(filePath)
|
|
|
|
const list = JSON.parse(jsonData.toString())
|
|
|
|
|
|
|
|
return { props: list }
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Servers
|