Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge recent changes from main #137

Merged
merged 8 commits into from
Sep 16, 2024
10 changes: 6 additions & 4 deletions components/showPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 2 additions & 0 deletions components/upcomingShowPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/contentful/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 3 additions & 1 deletion lib/contentful/pages/artists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 6 additions & 2 deletions lib/contentful/pages/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pages/submission-v2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function SubmissionForm({
return (
<div className="my-32">
<p>
Issue loading submission form. If this error pursists please contact
Issue loading submission form. If this error persists please contact
[email protected]
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down
12 changes: 0 additions & 12 deletions views/radio/showBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,6 @@ export default function ShowBody({
<Prose>{documentToReactComponents(content?.json)}</Prose>
</div>
</section>

<section className="border-t-2 bg-white">
<div className="container-md p-4 md:p-8">
<Pill>
<span className="font-serif">Persons</span>
</Pill>

<div className="h-8" />

<p className="font-medium">{persons}</p>
</div>
</section>
</Fragment>
);
}
Loading