diff --git a/components/showPreview.tsx b/components/showPreview.tsx index d465230..70d369b 100644 --- a/components/showPreview.tsx +++ b/components/showPreview.tsx @@ -117,10 +117,12 @@ export function ShowPreviewWithoutPlayer({ fields: { genres, coverImage, title, slug, date }, }: TypeShow) { const parsedGenres = parseGenres({ - items: genres.map((genre) => ({ - name: genre.fields.name, - sys: { id: genre.sys.id }, - })), + items: genres + .filter((genre) => genre.fields) + .map((genre) => ({ + name: genre.fields.name, + sys: { id: genre.sys.id }, + })), }).slice(0, 3); return ( diff --git a/components/upcomingShowPreview.tsx b/components/upcomingShowPreview.tsx index dd96b2e..22f455b 100644 --- a/components/upcomingShowPreview.tsx +++ b/components/upcomingShowPreview.tsx @@ -17,6 +17,8 @@ export default function UpcomingShowPreview({ }: UpcomingShowType) { const genres = parseGenres(genresCollection); + console.log(artistsCollection.items); + const artists = formatArtistNames(artistsCollection.items); // remove artists from title diff --git a/lib/contentful/client.ts b/lib/contentful/client.ts index 82432e7..9328bee 100644 --- a/lib/contentful/client.ts +++ b/lib/contentful/client.ts @@ -59,7 +59,7 @@ export const createPastShowSchema = (show: TypeShow): PastShowSchema => ({ slug: show.fields.slug, mixcloudLink: show.fields.mixcloudLink, coverImage: show.fields.coverImage.fields.file.url, - genres: show.fields.genres.map((genre) => genre.fields.name), + genres: show.fields.genres.map((genre) => genre.fields?.name).filter(Boolean), }); export async function getPastShows( @@ -137,7 +137,7 @@ export async function getPastShows( slug: show.slug, mixcloudLink: show.mixcloudLink, coverImage: show.coverImage.url, - genres: show.genresCollection.items.map((genre) => genre.name), + genres: show.genresCollection.items.map((genre) => genre?.name), })); const filtered = processed.filter( diff --git a/lib/contentful/pages/artists.ts b/lib/contentful/pages/artists.ts index 9fb42ac..3f7d76a 100644 --- a/lib/contentful/pages/artists.ts +++ b/lib/contentful/pages/artists.ts @@ -140,7 +140,9 @@ export async function getArtistsPageSingle(slug: string, preview: boolean) { slug: show.slug, mixcloudLink: show.mixcloudLink, coverImage: show.coverImage.url, - genres: show.genresCollection.items.map((genre) => genre.name), + genres: show.genresCollection.items + .map((genre) => genre?.name) + .filter(Boolean), })); if (processed.length > 0) { diff --git a/lib/contentful/pages/radio.ts b/lib/contentful/pages/radio.ts index 3d3c7e2..16303d4 100644 --- a/lib/contentful/pages/radio.ts +++ b/lib/contentful/pages/radio.ts @@ -83,7 +83,9 @@ export async function getRadioPageSingle(slug: string, preview: boolean) { throw new Error(`No Show found for slug '${slug}'`); } - const genres = entry.genresCollection.items.map((genre) => genre.name); + console.log(entry.genresCollection); + + const genres = entry.genresCollection.items.map((genre) => genre?.name); const relatedShows = await getRelatedShows(slug, genres, 7, 0); @@ -246,7 +248,9 @@ export async function getRelatedShows( slug: show.slug, mixcloudLink: show.mixcloudLink, coverImage: show.coverImage.url, - genres: show.genresCollection.items.map((genre) => genre.name), + genres: show.genresCollection.items + .map((genre) => genre?.name) + .filter(Boolean), })); // filter should only take first 2 genres. diff --git a/pages/submission-v2.tsx b/pages/submission-v2.tsx index 736936c..0d8a853 100644 --- a/pages/submission-v2.tsx +++ b/pages/submission-v2.tsx @@ -110,7 +110,7 @@ function SubmissionForm({ return (

- Issue loading submission form. If this error pursists please contact + Issue loading submission form. If this error persists please contact hello@refugeworldwide.com

diff --git a/util.ts b/util.ts index 66e59ec..25a225d 100644 --- a/util.ts +++ b/util.ts @@ -119,7 +119,7 @@ export const formatArtistNames = (data: ArtistInterface[]) => { } if (names.length === 3) { - return `with ${names.slice(0, 2).join(", ")} and ${names[3]}`; + return `with ${names.slice(0, 2).join(", ")} and ${names[2]}`; } return `with ${names.slice(0, 2).join(", ")} and others`; diff --git a/views/radio/showBody.tsx b/views/radio/showBody.tsx index bdc4ac7..513c7ca 100644 --- a/views/radio/showBody.tsx +++ b/views/radio/showBody.tsx @@ -113,18 +113,6 @@ export default function ShowBody({ {documentToReactComponents(content?.json)} - -
-
- - Persons - - -
- -

{persons}

-
-
); }