Skip to content

Commit

Permalink
fix: update highlighted content pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
rccsousa committed Oct 22, 2024
1 parent fe918cc commit 651f732
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Globals/HubHighlights/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export const HomePageSettings: GlobalConfig = {
name: "mainHighlight",
label: "Main Highlight",
type: "relationship",
relationTo: "blogposts",
relationTo: ["blogposts", 'podcasts', 'talks-and-roundtables'],
},
{
name: "secondaryHighlight",
label: "Secondary Highlight",
type: "relationship",
relationTo: "blogposts",
relationTo: ["blogposts", 'podcasts', 'talks-and-roundtables'],
},
],
}
9 changes: 5 additions & 4 deletions src/app/_blocks/HubHead/Highlights/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { formatDateTime } from "../../../_utilities/formatDateTime";
import styles from "./styles.module.css";
import { AuthorPill } from '@/app/_components/AuthorPill'
import Link from "next/link";
import ArchiveButton from "@/app/_components/ArchiveButton";

const placeholder = {
title: "Placeholder",
Expand All @@ -18,17 +19,17 @@ export async function Highlights({ content, main }) {
content = placeholder;
}

const { title, publishedAt, categories, authors } = content;

const { title, publishedAt, categories, authors, slug } = content.value;
const contentType = content.relationTo
return (
<>

<div
className={`${styles.highlights} ${main ? styles.mainHighlight : styles.secondaryHighlight}`}
>
<p className={styles.overline}> HIGHLIGHTS </p>
{/* TODO: Adapt to other types of content as well */}
<Link href={`./blogposts/${content.slug}`}>
<ArchiveButton color={main ? 'var(--soft-white-100)' : 'var(--dark-rock-800)'} collection={contentType}/>
<Link href={`./${contentType}/${slug}`}>
<h6> {title} </h6>
</Link>
{content === placeholder ? (<h5>Please setup the highlights</h5>) : (
Expand Down
28 changes: 26 additions & 2 deletions src/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,32 @@ export interface Social {
*/
export interface HomepageSetting {
id: string;
mainHighlight?: (string | null) | Blogpost;
secondaryHighlight?: (string | null) | Blogpost;
mainHighlight?:
| ({
relationTo: 'blogposts';
value: string | Blogpost;
} | null)
| ({
relationTo: 'podcasts';
value: string | Podcast;
} | null)
| ({
relationTo: 'talks-and-roundtables';
value: string | TalksAndRoundtable;
} | null);
secondaryHighlight?:
| ({
relationTo: 'blogposts';
value: string | Blogpost;
} | null)
| ({
relationTo: 'podcasts';
value: string | Podcast;
} | null)
| ({
relationTo: 'talks-and-roundtables';
value: string | TalksAndRoundtable;
} | null);
updatedAt?: string | null;
createdAt?: string | null;
}
Expand Down

0 comments on commit 651f732

Please sign in to comment.