2021-09-29 21:25:05 +10:00
|
|
|
import "../components/main.js"
|
|
|
|
|
import Layout from "../components/main.js"
|
|
|
|
|
import Link from 'next/link'
|
|
|
|
|
import getConfig from 'next/config'
|
|
|
|
|
import Image from 'next/image';
|
|
|
|
|
|
|
|
|
|
export async function getServerSideProps(context) {
|
|
|
|
|
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
|
|
|
|
|
const secres = await fetch(serverRuntimeConfig.base_path + `/api/sections`)
|
|
|
|
|
const secdata = await secres.json()
|
|
|
|
|
|
2021-09-30 21:10:11 +10:00
|
|
|
const currpodcastres = await fetch(serverRuntimeConfig.base_path + `/api/podcasts/bystatus/1`)
|
|
|
|
|
const currpodcastdata = await currpodcastres.json()
|
|
|
|
|
|
|
|
|
|
const archpodcastres = await fetch(serverRuntimeConfig.base_path + `/api/podcasts/bystatus/0`)
|
|
|
|
|
const archpodcastdata = await archpodcastres.json()
|
2021-09-29 21:25:05 +10:00
|
|
|
|
|
|
|
|
const episodedata = "hi there"
|
|
|
|
|
|
|
|
|
|
const pagedata = {'title': 'Angry Beanie - Current Podcast Projects'}
|
|
|
|
|
|
|
|
|
|
return {
|
2021-09-30 21:10:11 +10:00
|
|
|
props: { sections : secdata, currpodcastdata, archpodcastdata, episodedata, pagedata, serverRuntimeConfig }, // will be passed to the page component as props
|
2021-09-29 21:25:05 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-30 21:10:11 +10:00
|
|
|
const Podcasts = ({sections, currpodcastdata, archpodcastdata, episodedata, pagedata, serverRuntimeConfig}) => (
|
|
|
|
|
<Layout sections={sections} episodedata={episodedata} pagedata={pagedata} serverRuntimeConfig>
|
|
|
|
|
<h1>Podcasts</h1>
|
|
|
|
|
<div className="page_body">Over the years I have made a number of podcasts.</div>
|
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="col-sm-6">
|
|
|
|
|
<h2>Current Podcasts</h2>
|
|
|
|
|
{currpodcastdata.shows.map((podcast) => (
|
|
|
|
|
<div><Image
|
|
|
|
|
src={serverRuntimeConfig.base_path + "/" + podcast.logo.src}
|
|
|
|
|
height={podcast.logo.height}
|
|
|
|
|
width={podcast.logo.width}
|
|
|
|
|
></Image><Link href={"/podcasts/shows/" + podcast.slug}>{podcast.title}</Link></div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="col-sm-6">
|
|
|
|
|
<h2>Archived Podcasts</h2>
|
|
|
|
|
{archpodcastdata.shows.map((podcast) => (
|
|
|
|
|
<div><Image
|
|
|
|
|
src={serverRuntimeConfig.base_path + "/" + podcast.logo.src}
|
|
|
|
|
height={podcast.logo.height}
|
|
|
|
|
width={podcast.logo.width}
|
|
|
|
|
></Image><Link href={"/podcasts/shows/" + podcast.slug}>{podcast.title}</Link></div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Layout>
|
2021-09-29 21:25:05 +10:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
export default Podcasts
|