Latest changes

This commit is contained in:
James Purser 2021-09-05 16:12:45 +10:00
parent 1009ed22dc
commit 3c68e8f3cf
31 changed files with 1854 additions and 4078 deletions

2
.gitignore vendored Normal file → Executable file
View file

@ -12,3 +12,5 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
#VSCode #VSCode
.vscode/ .vscode/
#ideaj
.idea/

0
Dockerfile Normal file → Executable file
View file

0
components/audioplayer.js Normal file → Executable file
View file

53
components/css/styles.css Normal file → Executable file
View file

@ -1,15 +1,15 @@
body{ body{
font-family: Jaldi; font-family: Jaldi;
font-size: 1.5em; font-size: 2em;
margin: 0; margin: 0;
padding: 0; padding: 0;
text-align: center; text-align: center;
font-display: swap; font-display: swap;
} }
div #header { html {
text-align: center; font-size: 10px;
padding-top: 1em; margin-bottom: 60px
} }
.menu{ .menu{
@ -20,10 +20,6 @@
display: inline-block display: inline-block
} }
h1 {
}
.header_image { .header_image {
margin-bottom: 10px; margin-bottom: 10px;
} }
@ -65,7 +61,7 @@
} }
div .ep-title{ div .ep-title{
font-size: 1.5em; font-size: 2em;
font-weight: bold; font-weight: bold;
} }
@ -88,8 +84,7 @@
.show_block{ .show_block{
*display: inline; *display: inline;
zoom: 1; zoom: 1;
width: 340px; height: 100%;
height: 200px;
padding: 5px; padding: 5px;
margin: 5px; margin: 5px;
border-style: solid; border-style: solid;
@ -171,13 +166,6 @@
margin: 10px; margin: 10px;
} }
footer {
position: absolute;
bottom: 0;
width: 100%;
background-color: #c7c2c2;
}
div .show_list ul li div { div .show_list ul li div {
display: inline-block; display: inline-block;
text-align: justify; text-align: justify;
@ -237,10 +225,37 @@
width: 75%; width: 75%;
float: left float: left
} }
div #header {
text-align: center;
padding-top: 12rem;
padding-bottom: 12rem;
background-color: lightgray;
}
} }
@media screen and (min-width: 1200px) { @media screen and (min-width: 1200px) {
.col-lg-4 { .col-lg-4 {
width: 33.33333333%; width: 33.33333333%;
} }
}
.navbar .dropdown-menu a{
font-size: 2em !important
}
div .footer {
height: 2rem;
background-color: black;
}
.container {
min-height: 100vh;
position: relative;
}
footer {
position: absolute;
bottom: 0;
left: 0;
} }

0
components/episodepager.js Normal file → Executable file
View file

9
components/featureimage.js Normal file → Executable file
View file

@ -1,11 +1,12 @@
import Image from 'next/image'; import Image from 'next/image';
const FeatureImage = ({ imagedata }) => ( const FeatureImage = ({ imagedata, basepath }) => (
<div className="featuredimage"> <div className="featuredimage">
<Image <Image
src={'https://www.angrybeanie.com' + imagedata.image.src} src={basepath + imagedata.src}
height={imagedata.image.height} height={imagedata.height}
width={imagedata.image.width} width={imagedata.width}
priority={true}
/> />
</div> </div>
); );

9
components/footer.js Normal file → Executable file
View file

@ -0,0 +1,9 @@
//components/Footer.js
const Footer = () => (
<footer>
Blah
</footer>
)
export default Footer;

14
components/header.js Normal file → Executable file
View file

@ -9,17 +9,11 @@ const headerStyle = {
const Header = () => ( const Header = () => (
<div id="header"> <div id="header">
<div className="social_block"> <div className="col-md-12">
<div className="social_twitter"> <a href="/" alt="Home">
<a href="https://www.twitter.com/angrybeanie"><img src="/images/twitter.png" alt="Angry Beanie on Twitter" target="_blank"/></a> <img className="header_image img-fluid" src="/images/logo.png" alt="Angry Beanie" />
<a href="https://www.facebook.com/angrybeanie"><img src="/images/facebok.png" alt="Angry Beanie on Facebook" target="_blank"/></a> </a>
</div> </div>
</div>
<div className="col-md-12">
<a href="/" alt="Home">
<img className="header_image img-fluid" src="/images/logo.png" alt="Angry Beanie" />
</a>
</div>
</div> </div>
); );

0
components/latestepisodes.js Normal file → Executable file
View file

4
components/main.js Normal file → Executable file
View file

@ -1,4 +1,5 @@
import Header from "./header" import Header from "./header"
import Footer from "./footer"
import NavBar from "./navbar" import NavBar from "./navbar"
import SideBar from "./sidebar" import SideBar from "./sidebar"
import Head from 'next/head' import Head from 'next/head'
@ -15,8 +16,9 @@ const Layout = (props) => (
<Header /> <Header />
<div className="container"> <div className="container">
<NavBar sections={props.sections}/> <NavBar sections={props.sections}/>
{props.children} {props.children}
</div> </div>
</div> </div>
) )

11
components/navbar.js Normal file → Executable file
View file

@ -11,21 +11,21 @@ const NavBar = (props, sections) => {
const toggle = () => setIsOpen(prevState => !prevState); const toggle = () => setIsOpen(prevState => !prevState);
return ( return (
<Navbar expand="lg" collapseOnSelect bg="dark" variant="dark"> <Navbar expand="lg" collapseOnSelect bg="light" variant="light">
<Navbar.Toggle aria-controls="responsive-navbar-nav" /> <Navbar.Toggle aria-controls="responsive-navbar-nav" />
<Navbar.Collapse> <Navbar.Collapse>
<Nav> <Nav className="m-auto">
<NavLink href="/">Home</NavLink> <NavLink href="/">Home</NavLink>
</Nav> </Nav>
<NavDropdown title="Podcasts"> <NavDropdown className="m-auto" title="Podcasts">
<NavDropdown.Item key="current" href="/podcasts/current">Current Podcasts</NavDropdown.Item> <NavDropdown.Item key="current" href="/podcasts/current">Current Podcasts</NavDropdown.Item>
<NavDropdown.Item key="archived" href="/podcasts/archived">Archived Podcasts</NavDropdown.Item> <NavDropdown.Item key="archived" href="/podcasts/archived">Archived Podcasts</NavDropdown.Item>
</NavDropdown> </NavDropdown>
<NavItem> <NavItem className="m-auto">
<NavLink href="/news">News and such</NavLink> <NavLink href="/news">News and such</NavLink>
</NavItem> </NavItem>
{props.sections.sections.map((section) => ( {props.sections.sections.map((section) => (
<NavDropdown title={section.title}> <NavDropdown className="m-auto" title={section.title}>
{section.pages.map((page) => ( {section.pages.map((page) => (
<NavDropdown.Item key={page.page_slug} href={"/sections/" + page.page_slug}>{page.page_title}</NavDropdown.Item> <NavDropdown.Item key={page.page_slug} href={"/sections/" + page.page_slug}>{page.page_title}</NavDropdown.Item>
))} ))}
@ -33,6 +33,7 @@ const NavBar = (props, sections) => {
))} ))}
</Navbar.Collapse> </Navbar.Collapse>
</Navbar> </Navbar>
); );
} }

0
components/showlist.js Normal file → Executable file
View file

0
components/showsidebar.js Normal file → Executable file
View file

0
components/sidebar.js Normal file → Executable file
View file

0
components/storypager.js Normal file → Executable file
View file

0
components/storysidebar.js Normal file → Executable file
View file

0
lib/gtag.js Normal file → Executable file
View file

0
lib/usePageTracking.js Normal file → Executable file
View file

14
next.config.js Normal file → Executable file
View file

@ -1,12 +1,10 @@
// next.config.js // next.config.js
const withLess = require('@zeit/next-less')
const withCSS = require('@zeit/next-css'); const withCSS = require('@zeit/next-css');
module.exports = withLess({ const withFonts = require('next-fonts');
/* config options here */ const withImages = require('next-images');
}) const withPlugins = require("next-compose-plugins");
module.exports = withCSS({
/* config options here */ module.exports = withPlugins([withCSS, withFonts, withImages])
});
module.exports = { module.exports = {
serverRuntimeConfig: { serverRuntimeConfig: {
// Will only be available on the server side // Will only be available on the server side
@ -14,7 +12,7 @@ module.exports = {
audio_path: 'https://audio.angrybeanie.com/' audio_path: 'https://audio.angrybeanie.com/'
}, },
images: { images: {
domains: ['www.angrybeanie.com', 'localhost'] domains: ['www.angrybeanie.com', 'localhost', 'cms.local.angrybeanie.com']
}, },
publicRuntimeConfig: { publicRuntimeConfig: {
analytics_code: 'UA-2497299-19' analytics_code: 'UA-2497299-19'

5723
package-lock.json generated Normal file → Executable file

File diff suppressed because it is too large Load diff

19
package.json Normal file → Executable file
View file

@ -11,17 +11,22 @@
"author": "James Purser", "author": "James Purser",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@zeit/next-css": "^1.0.1",
"@zeit/next-less": "^1.0.1", "@zeit/next-less": "^1.0.1",
"bootstrap": "^4.5.3", "bootstrap": "^4.6.0",
"less": "^3.13.0", "less": "^3.13.1",
"next": "^10.0.3", "mdbreact": "^5.1.0",
"next-images": "^1.6.2", "next": "^10.2.3",
"next-compose-plugins": "^2.2.1",
"next-fonts": "^1.5.1",
"next-images": "^1.8.1",
"postcss": "^8.3.6",
"react": "^16.14.0", "react": "^16.14.0",
"react-bootstrap": "^1.4.0", "react-bootstrap": "^1.6.1",
"react-dom": "^16.14.0", "react-dom": "^16.14.0",
"react-ga": "^3.3.0", "react-ga": "^3.3.0",
"react-h5-audio-player": "^3.5.0", "react-h5-audio-player": "^3.7.1",
"react-paginate": "^6.5.0", "react-paginate": "^6.5.0",
"react-router-dom": "^5.2.0" "react-router-dom": "^5.2.1"
} }
} }

9
pages/_app.js Normal file → Executable file
View file

@ -1,8 +1,9 @@
// import App from 'next/app' // import App from 'next/app'
import 'bootstrap/dist/css/bootstrap.min.css'; import "@fortawesome/fontawesome-free/css/all.min.css";
import 'bootstrap-css-only/css/bootstrap.min.css';
import 'mdbreact/dist/css/mdb.css';
import { Fragment, useEffect } from 'react'; import { Fragment, useEffect } from 'react';
import "../components/css/styles.css" import "../components/css/styles.css"
import * as gtag from '../lib/gtag'
import { Router, useRouter } from 'next/router' import { Router, useRouter } from 'next/router'
//Router.events.on('routeChangeComplete', (url) => gtag.pageview(url)) //Router.events.on('routeChangeComplete', (url) => gtag.pageview(url))
@ -11,8 +12,8 @@ function MyApp({ Component, pageProps }) {
const router = useRouter() const router = useRouter()
useEffect(() => { useEffect(() => {
const handleRouteChange = (url) => { const handleRouteChange = (url) => {
gtag.pageview(url); // gtag.pageview(url);
console.log("Pageview is happening") // console.log("Pageview is happening")
}; };
router.events.on("routeChangeComplete", handleRouteChange); router.events.on("routeChangeComplete", handleRouteChange);
return () => { return () => {

4
pages/_document.js Normal file → Executable file
View file

@ -22,10 +22,10 @@ class CustomDocument extends Document {
function gtag(){dataLayer.push(arguments);} function gtag(){dataLayer.push(arguments);}
gtag('js', new Date()); gtag('js', new Date());
/*gtag('config', '${GA_TRACKING_ID}', { gtag('config', '${GA_TRACKING_ID}', {
page_path: window.location.pathname, page_path: window.location.pathname,
}); });
console.log("Page View")*/ console.log("Page View")
`, `,
}} }}
/> />

6
pages/index.js Normal file → Executable file
View file

@ -24,8 +24,12 @@ export async function getServerSideProps(context) {
function HomePage (props) { function HomePage (props) {
return (<Layout sections={props.sections} pagedata={props.pagedata}> return (<Layout sections={props.sections} pagedata={props.pagedata}>
{props.articles.articles.map((article) => ( {props.articles.articles.map((article) => (
<h1><Link href="/news/[slug]" as={"/news/" + article.slug}><a>{article.title}</a></Link></h1> <div>
<h1><Link href="/news/[slug]" as={"/news/" + article.slug}><a>{article.title}</a></Link></h1>
<div dangerouslySetInnerHTML={{ __html: article.lead}} ></div>
</div>
))} ))}
<hr />
<LatestEpisodes episodedata={props.episodedata} config={props.config}></LatestEpisodes> <LatestEpisodes episodedata={props.episodedata} config={props.config}></LatestEpisodes>
</Layout>); </Layout>);
} }

2
pages/news.js Normal file → Executable file
View file

@ -2,8 +2,6 @@ import "../components/main"
import getConfig from 'next/config' import getConfig from 'next/config'
import Layout from "../components/main" import Layout from "../components/main"
import StoryPager from "../components/storypager" import StoryPager from "../components/storypager"
import Link from 'next/link'
import StorySideBar from "../components/storysidebar"
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
if(context.query.page == null || context.query.page == '0') { if(context.query.page == null || context.query.page == '0') {

8
pages/news/[slug].js Normal file → Executable file
View file

@ -3,6 +3,8 @@ import "../../components/main.js"
import Layout from "../../components/main.js" import Layout from "../../components/main.js"
import FeatureImage from "../../components/featureimage.js" import FeatureImage from "../../components/featureimage.js"
import StorySideBar from '../../components/storysidebar.js' import StorySideBar from '../../components/storysidebar.js'
import * as gtag from "../../lib/gtag"
import Image from 'next/image';
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig() const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
@ -23,14 +25,14 @@ export async function getServerSideProps(context) {
const secdata = await secres.json() const secdata = await secres.json()
return { return {
props: { article_obj, sections: secdata, pagedata, storydata}, // will be passed to the page component as props props: { article_obj, sections: secdata, pagedata, storydata, serverRuntimeConfig}, // will be passed to the page component as props
} }
} }
const Article = ({article_obj, sections, pagedata, storydata}) => ( const Article = ({article_obj, sections, pagedata, storydata, serverRuntimeConfig}) => (
<Layout sections={sections} pagedata={pagedata}> <Layout sections={sections} pagedata={pagedata}>
<div className="main_content col-md-9 col-sm-12"> <div className="main_content col-md-9 col-sm-12">
<FeatureImage imagedata={article_obj}></FeatureImage> <FeatureImage imagedata = {article_obj.image} basepath = {serverRuntimeConfig.base_path} ></FeatureImage>
<h1>{article_obj.title}</h1> <h1>{article_obj.title}</h1>
<div className="article_body" dangerouslySetInnerHTML={{ __html: article_obj.body }}></div> <div className="article_body" dangerouslySetInnerHTML={{ __html: article_obj.body }}></div>
</div> </div>

7
pages/podcasts/archived.js Normal file → Executable file
View file

@ -2,6 +2,7 @@ import "../../components/main.js"
import Layout from "../../components/main.js" import Layout from "../../components/main.js"
import Link from 'next/link' import Link from 'next/link'
import getConfig from 'next/config' import getConfig from 'next/config'
import Image from "next/image"
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig() const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
@ -22,7 +23,11 @@ const PodcastArchived = ({sections, podcastdata, pagedata}) => (
<Layout sections={sections} pagedata={pagedata}> <Layout sections={sections} pagedata={pagedata}>
<h1>Archived Podcasts</h1> <h1>Archived Podcasts</h1>
{podcastdata.shows.map((podcast) => ( {podcastdata.shows.map((podcast) => (
<h1><Link href={"/podcasts/shows/" + podcast.slug}>{podcast.title}</Link></h1> <h1><Image
src="https://www.angrybeanie.com/uploads/media/default/0001/01/thumb_185_default_small.png"
height=""
width=""
></Image><Link href={"/podcasts/shows/" + podcast.slug}>{podcast.title}</Link></h1>
))} ))}
</Layout> </Layout>

7
pages/podcasts/current.js Normal file → Executable file
View file

@ -2,6 +2,7 @@ import "../../components/main.js"
import Layout from "../../components/main.js" import Layout from "../../components/main.js"
import Link from 'next/link' import Link from 'next/link'
import getConfig from 'next/config' import getConfig from 'next/config'
import Image from 'next/image';
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig() const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
@ -24,7 +25,11 @@ const PodcastCurrent = ({sections, podcastdata, episodedata, pagedata}) => (
<Layout sections={sections} episodedata={episodedata} pagedata={pagedata}> <Layout sections={sections} episodedata={episodedata} pagedata={pagedata}>
<h1>Current Podcasts</h1> <h1>Current Podcasts</h1>
{podcastdata.shows.map((podcast) => ( {podcastdata.shows.map((podcast) => (
<h1><Link href={"/podcasts/shows/" + podcast.slug}>{podcast.title}</Link></h1> <h1><Image
src="https://www.angrybeanie.com/uploads/media/default/0001/01/thumb_185_default_small.png"
height=""
width=""
></Image><Link href={"/podcasts/shows/" + podcast.slug}>{podcast.title}</Link></h1>
))} ))}
</Layout> </Layout>

31
pages/podcasts/shows/[...episode].js Normal file → Executable file
View file

@ -4,6 +4,8 @@ import Layout from "../../../components/main.js"
import * as gtag from "../../../lib/gtag" import * as gtag from "../../../lib/gtag"
import AudioPlayer from "react-h5-audio-player"; import AudioPlayer from "react-h5-audio-player";
import 'react-h5-audio-player/lib/styles.css'; import 'react-h5-audio-player/lib/styles.css';
//import EpisodeSideBar from "../../../components/episodesidebar"
import EpisodePager from '../../../components/episodepager.js';
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig() const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
@ -17,6 +19,9 @@ export async function getServerSideProps(context) {
const epres = await fetch(serverRuntimeConfig.base_path + "/api/podcast/episode/"+slug[1]) const epres = await fetch(serverRuntimeConfig.base_path + "/api/podcast/episode/"+slug[1])
const epdata = await epres.json() const epdata = await epres.json()
const sepres = await fetch(serverRuntimeConfig.base_path + "/api/podcasts/episodes/"+epdata.episode_show+"/0/5")
const sepdata = await sepres.json()
const audiodata = { const audiodata = {
audio_path: serverRuntimeConfig.audio_path, audio_path: serverRuntimeConfig.audio_path,
audio_mp3: epdata.audio_mp3 audio_mp3: epdata.audio_mp3
@ -27,20 +32,28 @@ export async function getServerSideProps(context) {
} }
return { return {
props: { pagedata, sections: secdata, episode: epdata, audiodata } props: { pagedata, sections: secdata, episode: epdata, audiodata, sepdata }
} }
} }
const Episode = ( props ) => { const Episode = ( props ) => {
return (<Layout pagedata={props.pagedata} sections={props.sections} episode={props.episode} audiodata={props.audiodata}> return (<Layout
pagedata={props.pagedata}
sections={props.sections}
episode={props.episode}
audiodata={props.audiodata}
sepdata={props.sepdata}>
<h1>{props.episode.episode_title}</h1> <h1>{props.episode.episode_title}</h1>
<AudioPlayer <div className="main_content col-md-9 col-sm-12">
src={props.audiodata.audio_path + props.audiodata.audio_mp3} <AudioPlayer
onPlay={e => gtag.event({action: "play", category:"audio", label: "audio started", value: props.audiodata.audio_mp3})} src={props.audiodata.audio_path + props.audiodata.audio_mp3}
onPause={e => gtag.event({action: "pause", category:"audio", label: "audio paused", value: props.audiodata.audio_mp3})} onPlay={e => gtag.event({action: "play", category:"audio", label: "audio started", value: props.audiodata.audio_mp3})}
onEnded={e => gtag.event({action: "end", category:"audio", label: "audio ended", value: props.audiodata.audio_mp3})} onPause={e => gtag.event({action: "pause", category:"audio", label: "audio paused", value: props.audiodata.audio_mp3})}
/> onEnded={e => gtag.event({action: "end", category:"audio", label: "audio ended", value: props.audiodata.audio_mp3})}
<div className="article_body" dangerouslySetInnerHTML={{ __html: props.episode.episode_body}} /> />
<div className="article_body" dangerouslySetInnerHTML={{ __html: props.episode.episode_body}} />
</div>
<EpisodePager episodedata={props.sepdata} />
</Layout>) </Layout>)
} }

0
pages/podcasts/shows/[podcast].js Normal file → Executable file
View file

0
pages/sections/[page].js Normal file → Executable file
View file