Show announcements on index page.

master
Icedream 2021-01-03 18:44:30 +01:00
parent 0184eff590
commit 309f8a3afc
1 changed files with 12 additions and 3 deletions

View File

@ -11,17 +11,18 @@ import { VideoOnDemandIndex } from '../util/datatypes/VideoOnDemandIdentifier';
import { getIndex } from '../util/api'; import { getIndex } from '../util/api';
export async function getServerSideProps() { export async function getServerSideProps() {
// Fetch VOD IDs // Fetch VOD IDs and announcements
const { ids } = await getIndex(); const { announcements, ids } = await getIndex();
return { return {
props: { props: {
announcements,
ids, ids,
}, },
}; };
} }
export default function Home({ ids }: VideoOnDemandIndex) { export default function Home({ announcements, ids }: VideoOnDemandIndex) {
const intl = useIntl(); const intl = useIntl();
return ( return (
<div> <div>
@ -62,6 +63,14 @@ export default function Home({ ids }: VideoOnDemandIndex) {
/> />
</p> </p>
{
announcements.map(announcement => (
<p>
<b>Announcement:</b> {announcement}
</p>
))
}
<ListGroup> <ListGroup>
{ids.map(({ id, title }) => ( {ids.map(({ id, title }) => (
<Link key={id} passHref href="/[id]" as={`/${id}`}> <Link key={id} passHref href="/[id]" as={`/${id}`}>