diff --git a/templates/website/src/blocks/RenderBlocks.tsx b/templates/website/src/blocks/RenderBlocks.tsx index e87fd8a1b9e..6677dbe754f 100644 --- a/templates/website/src/blocks/RenderBlocks.tsx +++ b/templates/website/src/blocks/RenderBlocks.tsx @@ -36,8 +36,8 @@ export const RenderBlocks: React.FC<{ if (Block) { return (
- {/* @ts-expect-error */} - + {/* @ts-expect-error there may be some mismatch between the expected types here */} +
) } diff --git a/templates/website/src/collections/Posts/index.ts b/templates/website/src/collections/Posts/index.ts index 5053bc188d6..61db3b442a3 100644 --- a/templates/website/src/collections/Posts/index.ts +++ b/templates/website/src/collections/Posts/index.ts @@ -79,6 +79,11 @@ export const Posts: CollectionConfig<'posts'> = { tabs: [ { fields: [ + { + name: 'heroImage', + type: 'upload', + relationTo: 'media', + }, { name: 'content', type: 'richText', diff --git a/templates/website/src/components/ui/card.tsx b/templates/website/src/components/ui/card.tsx index 5d7b80ed67a..6ab031b5e2a 100644 --- a/templates/website/src/components/ui/card.tsx +++ b/templates/website/src/components/ui/card.tsx @@ -1,4 +1,3 @@ -/* eslint-disable jsx-a11y/heading-has-content */ import { cn } from 'src/utilities/cn' import * as React from 'react' diff --git a/templates/website/src/components/ui/pagination.tsx b/templates/website/src/components/ui/pagination.tsx index e0112291ead..c747432f3b5 100644 --- a/templates/website/src/components/ui/pagination.tsx +++ b/templates/website/src/components/ui/pagination.tsx @@ -1,4 +1,3 @@ -/* eslint-disable react/button-has-type */ import type { ButtonProps } from '@/components/ui/button' import { buttonVariants } from '@/components/ui/button' diff --git a/templates/website/src/endpoints/seed/image-hero-1.ts b/templates/website/src/endpoints/seed/image-hero-1.ts new file mode 100644 index 00000000000..b13b816966d --- /dev/null +++ b/templates/website/src/endpoints/seed/image-hero-1.ts @@ -0,0 +1,5 @@ +import type { Media } from '@/payload-types' + +export const imageHero1: Omit = { + alt: 'Straight metallic shapes with a blue gradient', +} diff --git a/templates/website/src/endpoints/seed/index.ts b/templates/website/src/endpoints/seed/index.ts index 2ba8a6fb832..60752caca5c 100644 --- a/templates/website/src/endpoints/seed/index.ts +++ b/templates/website/src/endpoints/seed/index.ts @@ -5,6 +5,7 @@ import { contact as contactPageData } from './contact-page' import { home } from './home' import { image1 } from './image-1' import { image2 } from './image-2' +import { imageHero1 } from './image-hero-1' import { post1 } from './post-1' import { post2 } from './post-2' import { post3 } from './post-3' @@ -72,7 +73,7 @@ export const seed = async ({ depth: 0, where: { email: { - equals: 'demo-author@payloadcms.com', + equals: 'demo-author@example.com', }, }, }) @@ -111,7 +112,7 @@ export const seed = async ({ collection: 'users', data: { name: 'Demo Author', - email: 'demo-author@payloadcms.com', + email: 'demo-author@example.com', password: 'password', }, }), @@ -132,7 +133,7 @@ export const seed = async ({ }), payload.create({ collection: 'media', - data: image2, + data: imageHero1, file: hero1Buffer, }), diff --git a/templates/website/src/endpoints/seed/post-1.ts b/templates/website/src/endpoints/seed/post-1.ts index 1e5be32001d..f2e520efa91 100644 --- a/templates/website/src/endpoints/seed/post-1.ts +++ b/templates/website/src/endpoints/seed/post-1.ts @@ -3,6 +3,7 @@ import type { Post } from '@/payload-types' export const post1: Partial = { slug: 'digital-horizons', _status: 'published', + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore authors: ['{{AUTHOR}}'], content: { @@ -291,10 +292,11 @@ export const post1: Partial = { version: 1, }, }, - + heroImage: '{{IMAGE_1}}', meta: { description: 'Dive into the marvels of modern innovation, where the only constant is change. A journey where pixels and data converge to craft the future.', + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore image: '{{IMAGE_1}}', title: 'Digital Horizons: A Glimpse into Tomorrow', diff --git a/templates/website/src/endpoints/seed/post-2.ts b/templates/website/src/endpoints/seed/post-2.ts index 540754572cc..222db5e4791 100644 --- a/templates/website/src/endpoints/seed/post-2.ts +++ b/templates/website/src/endpoints/seed/post-2.ts @@ -3,6 +3,7 @@ import type { Post } from '@/payload-types' export const post2: Partial = { slug: 'global-gaze', _status: 'published', + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore authors: ['{{AUTHOR}}'], content: { @@ -214,9 +215,11 @@ export const post2: Partial = { version: 1, }, }, + heroImage: '{{IMAGE_1}}', meta: { description: 'Explore the untold and overlooked. A magnified view into the corners of the world, where every story deserves its spotlight.', + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore image: '{{IMAGE_1}}', title: 'Global Gaze: Beyond the Headlines', diff --git a/templates/website/src/endpoints/seed/post-3.ts b/templates/website/src/endpoints/seed/post-3.ts index 55bdde1e876..73daca0d24a 100644 --- a/templates/website/src/endpoints/seed/post-3.ts +++ b/templates/website/src/endpoints/seed/post-3.ts @@ -3,6 +3,7 @@ import type { Post } from '@/payload-types' export const post3: Partial = { slug: 'dollar-and-sense-the-financial-forecast', _status: 'published', + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore authors: ['{{AUTHOR}}'], content: { @@ -251,8 +252,10 @@ export const post3: Partial = { version: 1, }, }, + heroImage: '{{IMAGE_1}}', meta: { description: `Money isn't just currency; it's a language. Dive deep into its nuances, where strategy meets intuition in the vast sea of finance.`, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore image: '{{IMAGE_1}}', title: 'Dollar and Sense: The Financial Forecast', diff --git a/templates/website/src/heros/PostHero/index.tsx b/templates/website/src/heros/PostHero/index.tsx index ccb78e00627..128180e6d3e 100644 --- a/templates/website/src/heros/PostHero/index.tsx +++ b/templates/website/src/heros/PostHero/index.tsx @@ -9,7 +9,7 @@ import { formatAuthors } from '@/utilities/formatAuthors' export const PostHero: React.FC<{ post: Post }> = ({ post }) => { - const { categories, meta: { image: metaImage } = {}, populatedAuthors, publishedAt, title } = post + const { categories, heroImage, populatedAuthors, publishedAt, title } = post const hasAuthors = populatedAuthors && populatedAuthors.length > 0 && formatAuthors(populatedAuthors) !== '' @@ -63,13 +63,13 @@ export const PostHero: React.FC<{
- {metaImage && typeof metaImage !== 'string' && ( + {heroImage && typeof heroImage !== 'string' && ( )}
diff --git a/templates/website/src/payload-types.ts b/templates/website/src/payload-types.ts index 6b89ddfc76c..10cee117c1d 100644 --- a/templates/website/src/payload-types.ts +++ b/templates/website/src/payload-types.ts @@ -376,6 +376,7 @@ export interface Category { export interface Post { id: string; title: string; + heroImage?: (string | null) | Media; content: { root: { type: string; @@ -899,6 +900,7 @@ export interface PagesSelect { */ export interface PostsSelect { title?: T; + heroImage?: T; content?: T; relatedPosts?: T; categories?: T; diff --git a/templates/website/src/providers/Theme/types.ts b/templates/website/src/providers/Theme/types.ts index 4ea0a5259c9..c39b9b3e79c 100644 --- a/templates/website/src/providers/Theme/types.ts +++ b/templates/website/src/providers/Theme/types.ts @@ -1,7 +1,7 @@ export type Theme = 'dark' | 'light' export interface ThemeContextType { - setTheme: (theme: Theme | null) => void // eslint-disable-line no-unused-vars + setTheme: (theme: Theme | null) => void theme?: Theme | null }