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' ;
2022-07-16 15:34:44 +10:00
import { getPodcastList } from "../data/external/cms.js" ;
2021-09-29 21:25:05 +10:00
export async function getServerSideProps ( context ) {
const { serverRuntimeConfig , publicRuntimeConfig } = getConfig ( )
const secres = await fetch ( serverRuntimeConfig . base _path + ` /api/sections ` )
const secdata = await secres . json ( )
2022-07-16 15:34:44 +10:00
const currpodcastlist = await getPodcastList ( true )
2021-09-30 21:10:11 +10:00
2022-07-16 15:34:44 +10:00
const archpodcastlist = await getPodcastList ( false )
2021-09-29 21:25:05 +10:00
const episodedata = "hi there"
const pagedata = { 'title' : 'Angry Beanie - Current Podcast Projects' }
return {
2022-07-16 15:34:44 +10:00
props : { sections : secdata , currpodcastlist : currpodcastlist . data , archpodcastlist , episodedata , pagedata , serverRuntimeConfig } , // will be passed to the page component as props
2021-09-29 21:25:05 +10:00
}
}
2022-08-23 14:25:38 +10:00
const Podcasts = ( { sections , currpodcastlist , archpodcastlist , episodedata , pagedata , serverRuntimeConfig } ) => {
return (
2021-09-30 21:10:11 +10:00
< Layout sections = { sections } episodedata = { episodedata } pagedata = { pagedata } serverRuntimeConfig >
2022-07-16 15:34:44 +10:00
< h1 className = "page_title col-sm-12" > Podcasts < / h 1 >
< div className = "page_body col-sm-12" > < p > Over the years I have made a number of podcasts . < / p > < / d i v >
< div className = "row col-sm-12" >
2021-09-30 21:10:11 +10:00
< div className = "col-sm-6" >
< h2 > Current Podcasts < / h 2 >
2022-06-12 15:12:28 +10:00
{ currpodcastlist . map ( ( podcast ) => (
< div >
2022-07-16 15:34:44 +10:00
< Image
src = { serverRuntimeConfig . media _path + "/" + podcast . attributes . Logo . data . attributes . formats . thumbnail . url }
height = { podcast . attributes . Logo . data . attributes . formats . thumbnail . height }
width = { podcast . attributes . Logo . data . attributes . formats . thumbnail . width }
alt = { podcast . attributes . Title }
> < /Image><br / >
2022-06-12 15:12:28 +10:00
< Link href = { "/podcasts/shows/" + podcast . attributes . Slug } > { podcast . attributes . Title } < / L i n k > < / d i v >
2021-09-30 21:10:11 +10:00
) ) }
< / d i v >
< div className = "col-sm-6" >
< h2 > Archived Podcasts < / h 2 >
2022-08-23 14:25:38 +10:00
{ archpodcastlist . length > 0 &&
archpodcastlist . map ( ( podcast ) => (
2022-06-12 15:12:28 +10:00
< div >
2022-07-16 15:34:44 +10:00
< Image
src = { serverRuntimeConfig . media _path + "/" + podcast . attributes . Logo . data . attributes . formats . thumbnail . url }
height = { podcast . attributes . Logo . data . attributes . formats . thumbnail . height }
width = { podcast . attributes . Logo . data . attributes . formats . thumbnail . width }
alt = { podcast . attributes . Title }
> < / I m a g e >
< Link href = { "/podcasts/shows/" + podcast . attributes . Slug } > { podcast . attributes . Title } < / L i n k > < / d i v >
2021-09-30 21:10:11 +10:00
) ) }
< / d i v >
< / d i v >
2022-08-23 14:25:38 +10:00
< / L a y o u t > )
}
2021-09-29 21:25:05 +10:00
export default Podcasts