Compare commits

...

1 Commits

Author SHA1 Message Date
Sean Zubrickas
96304928d1 - Adds Reusable Content Block
- Updates Payload config/Pages collection to use Block References
2025-07-24 12:14:52 -04:00
8 changed files with 324 additions and 114 deletions

113
pnpm-lock.yaml generated
View File

@@ -1701,7 +1701,7 @@ importers:
version: 16.9.0
next:
specifier: 15.3.2
version: 15.3.2(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
version: 15.3.2(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.1.0-rc.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
payload:
specifier: workspace:*
version: link:../../packages/payload
@@ -1822,7 +1822,7 @@ importers:
version: 16.4.7
geist:
specifier: ^1.3.0
version: 1.4.2(next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4))
version: 1.4.2(next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4))
graphql:
specifier: ^16.8.1
version: 16.9.0
@@ -1831,13 +1831,13 @@ importers:
version: 0.378.0(react@19.1.0)
next:
specifier: 15.3.3
version: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
version: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
next-sitemap:
specifier: ^4.2.3
version: 4.2.3(next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4))
version: 4.2.3(next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4))
payload:
specifier: workspace:*
version: link:../../packages/payload
specifier: 3.48.0
version: 3.48.0(bufferutil@4.0.8)(graphql@16.9.0)(typescript@5.7.3)(utf-8-validate@6.0.5)
prism-react-renderer:
specifier: ^2.3.1
version: 2.4.1(react@19.1.0)
@@ -5046,6 +5046,9 @@ packages:
cpu: [x64]
os: [win32]
'@payloadcms/translations@3.48.0':
resolution: {integrity: sha512-YFEEyrCWK96q8uZ0OK9SU80ywSqc0S3dh+vAfI4mPzs2OPG//CHgbtz1d5X1r3e7A7CY/MzzGMVgf++fmRz2gQ==}
'@petamoriken/float16@3.9.2':
resolution: {integrity: sha512-VgffxawQde93xKxT3qap3OH+meZf7VaSB5Sqd4Rqc+FP5alWbpOyan/7tRbOAvynjpG3GpdtAuGU/NdhQpmrog==}
@@ -7401,6 +7404,10 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
croner@9.0.0:
resolution: {integrity: sha512-onMB0OkDjkXunhdW9htFjEhqrD54+M94i6ackoUkjHKbRnXdyEyKRelp4nJ1kAz32+s27jP1FsebpJCVl0BsvA==}
engines: {node: '>=18.0'}
croner@9.1.0:
resolution: {integrity: sha512-p9nwwR4qyT5W996vBZhdvBCnMhicY5ytZkR4D1Xj0wuTDEiMnjwR57Q3RXYY/s0EpX6Ay3vgIcfaR+ewGHsi+g==}
engines: {node: '>=18.0'}
@@ -10291,6 +10298,13 @@ packages:
resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==}
engines: {node: '>= 14.16'}
payload@3.48.0:
resolution: {integrity: sha512-4XG3fGI3Y7mYFz0hBShielwYsUCnI5ilmgBvRH6SZJ0sDUHsok3uTQn91QBRusRDjqk+Ml/dHpHWqSbZR/+GaQ==}
engines: {node: ^18.20.2 || >=20.9.0}
hasBin: true
peerDependencies:
graphql: ^16.8.1
peek-readable@5.3.1:
resolution: {integrity: sha512-GVlENSDW6KHaXcd9zkZltB7tCLosKB/4Hg0fqBJkAoBgYG2Tn1xtMgXtSUuMU9AK/gCm/tTdT8mgAeF4YNeeqw==}
engines: {node: '>=14.16'}
@@ -15947,6 +15961,10 @@ snapshots:
'@oxc-resolver/binding-win32-x64-msvc@5.3.0':
optional: true
'@payloadcms/translations@3.48.0':
dependencies:
date-fns: 4.1.0
'@petamoriken/float16@3.9.2':
optional: true
@@ -16489,7 +16507,7 @@ snapshots:
'@sentry/vercel-edge': 8.37.1
'@sentry/webpack-plugin': 2.22.6(webpack@5.96.1(@swc/core@1.11.29))
chalk: 3.0.0
next: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
next: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
resolve: 1.22.8
rollup: 3.29.5
stacktrace-parser: 0.1.10
@@ -18799,6 +18817,8 @@ snapshots:
- supports-color
- ts-node
croner@9.0.0: {}
croner@9.1.0: {}
cross-env@7.0.3:
@@ -20125,9 +20145,9 @@ snapshots:
- encoding
- supports-color
geist@1.4.2(next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)):
geist@1.4.2(next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)):
dependencies:
next: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
next: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
gel@2.0.1:
dependencies:
@@ -21912,13 +21932,13 @@ snapshots:
transitivePeerDependencies:
- supports-color
next-sitemap@4.2.3(next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)):
next-sitemap@4.2.3(next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)):
dependencies:
'@corex/deepmerge': 4.0.43
'@next/env': 13.5.11
fast-glob: 3.3.2
minimist: 1.2.8
next: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
next: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
next@15.2.3(@babel/core@7.27.3)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.1.0-rc.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4):
dependencies:
@@ -21977,34 +21997,6 @@ snapshots:
- '@babel/core'
- babel-plugin-macros
next@15.3.2(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4):
dependencies:
'@next/env': 15.3.2
'@swc/counter': 0.1.3
'@swc/helpers': 0.5.15
busboy: 1.6.0
caniuse-lite: 1.0.30001720
postcss: 8.4.31
react: 19.1.0
react-dom: 19.1.0(react@19.1.0)
styled-jsx: 5.1.6(@babel/core@7.27.4)(babel-plugin-macros@3.1.0)(react@19.1.0)
optionalDependencies:
'@next/swc-darwin-arm64': 15.3.2
'@next/swc-darwin-x64': 15.3.2
'@next/swc-linux-arm64-gnu': 15.3.2
'@next/swc-linux-arm64-musl': 15.3.2
'@next/swc-linux-x64-gnu': 15.3.2
'@next/swc-linux-x64-musl': 15.3.2
'@next/swc-win32-arm64-msvc': 15.3.2
'@next/swc-win32-x64-msvc': 15.3.2
'@opentelemetry/api': 1.9.0
'@playwright/test': 1.50.0
sass: 1.77.4
sharp: 0.34.2
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros
next@15.3.2(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.1.0-rc.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4):
dependencies:
'@next/env': 15.3.2
@@ -22034,7 +22026,7 @@ snapshots:
- '@babel/core'
- babel-plugin-macros
next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4):
next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4):
dependencies:
'@next/env': 15.3.3
'@swc/counter': 0.1.3
@@ -22362,6 +22354,45 @@ snapshots:
pathval@2.0.0: {}
payload@3.48.0(bufferutil@4.0.8)(graphql@16.9.0)(typescript@5.7.3)(utf-8-validate@6.0.5):
dependencies:
'@next/env': 15.3.2
'@payloadcms/translations': 3.48.0
'@types/busboy': 1.5.4
ajv: 8.17.1
bson-objectid: 2.0.4
busboy: 1.6.0
ci-info: 4.1.0
console-table-printer: 2.12.1
croner: 9.0.0
dataloader: 2.2.3
deepmerge: 4.3.1
file-type: 19.3.0
get-tsconfig: 4.8.1
graphql: 16.9.0
http-status: 2.1.0
image-size: 2.0.2
ipaddr.js: 2.2.0
jose: 5.9.6
json-schema-to-typescript: 15.0.3
minimist: 1.2.8
path-to-regexp: 6.3.0
pino: 9.5.0
pino-pretty: 13.0.0
pluralize: 8.0.0
qs-esm: 7.0.2
sanitize-filename: 1.6.3
scmp: 2.1.0
ts-essentials: 10.0.3(typescript@5.7.3)
tsx: 4.20.3
undici: 7.10.0
uuid: 10.0.0
ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@6.0.5)
transitivePeerDependencies:
- bufferutil
- typescript
- utf-8-validate
peek-readable@5.3.1: {}
pend@1.2.0: {}
@@ -24321,7 +24352,7 @@ snapshots:
'@uploadthing/shared': 7.1.1
effect: 3.10.3
optionalDependencies:
next: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
next: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
tailwindcss: 3.4.17
uri-js@4.4.1:

View File

@@ -7,6 +7,7 @@ import { CallToActionBlock } from '@/blocks/CallToAction/Component'
import { ContentBlock } from '@/blocks/Content/Component'
import { FormBlock } from '@/blocks/Form/Component'
import { MediaBlock } from '@/blocks/MediaBlock/Component'
import { ReusableContentBlock } from '@/blocks/ReusableContent/Component'
const blockComponents = {
archive: ArchiveBlock,
@@ -14,6 +15,7 @@ const blockComponents = {
cta: CallToActionBlock,
formBlock: FormBlock,
mediaBlock: MediaBlock,
reusableContentBlock: ReusableContentBlock,
}
export const RenderBlocks: React.FC<{

View File

@@ -0,0 +1,28 @@
import type { Page } from '@/payload-types'
import { RenderBlocks } from '@/blocks/RenderBlocks'
import React from 'react'
export type Props = Extract<Page['layout'][0], { blockType: 'reusableContentBlock' }>
export const ReusableContentBlock: React.FC<Props> = ({ reusableContentBlockFields }) => {
const { customId, reusableContent } = reusableContentBlockFields
if (
typeof reusableContent === 'object' &&
reusableContent !== null &&
'layout' in reusableContent &&
Array.isArray((reusableContent as { layout: unknown }).layout)
) {
const layout = (reusableContent as { layout: Page['layout'] }).layout
console.log('Resolved reusable layout:', layout)
return (
<section id={customId ?? undefined}>
<RenderBlocks blocks={layout} />
</section>
)
}
return null
}

View File

@@ -0,0 +1,26 @@
import type { Block } from 'payload'
export const ReusableContent: Block = {
slug: 'reusableContentBlock',
fields: [
{
name: 'reusableContentBlockFields',
type: 'group',
fields: [
{
name: 'reusableContent',
type: 'relationship',
relationTo: 'reusable-content',
required: true,
},
{
name: 'customId',
type: 'text',
admin: {
description: 'Custom ID for targeting with CSS/JS',
},
},
],
},
],
}

View File

@@ -7,6 +7,7 @@ import { CallToAction } from '../../blocks/CallToAction/config'
import { Content } from '../../blocks/Content/config'
import { FormBlock } from '../../blocks/Form/config'
import { MediaBlock } from '../../blocks/MediaBlock/config'
import { ReusableContent } from '@/blocks/ReusableContent/config'
import { hero } from '@/heros/config'
import { slugField } from '@/fields/slug'
import { populatePublishedAt } from '../../hooks/populatePublishedAt'
@@ -75,7 +76,15 @@ export const Pages: CollectionConfig<'pages'> = {
{
name: 'layout',
type: 'blocks',
blocks: [CallToAction, Content, MediaBlock, Archive, FormBlock],
blockReferences: [
CallToAction,
Content,
Archive,
MediaBlock,
FormBlock,
ReusableContent,
],
blocks: [],
required: true,
admin: {
initCollapsed: true,

View File

@@ -0,0 +1,37 @@
import type { CollectionConfig } from 'payload'
import { Archive } from '@/blocks/ArchiveBlock/config'
import { CallToAction } from '@/blocks/CallToAction/config'
import { Content } from '@/blocks/Content/config'
import { MediaBlock } from '@/blocks/MediaBlock/config'
import { FormBlock } from '@/blocks/Form/config'
import { anyone } from '../access/anyone'
import { authenticated } from '../access/authenticated'
export const ReusableContent: CollectionConfig = {
slug: 'reusable-content',
access: {
create: authenticated,
delete: authenticated,
read: anyone,
update: authenticated,
},
admin: {
useAsTitle: 'title',
},
fields: [
{
name: 'title',
type: 'text',
required: true,
},
{
name: 'layout',
type: 'blocks',
blockReferences: [CallToAction, Content, Archive, MediaBlock, FormBlock],
blocks: [],
required: true,
},
],
}

View File

@@ -65,12 +65,19 @@ export interface Config {
auth: {
users: UserAuthOperations;
};
blocks: {};
blocks: {
cta: CallToActionBlock;
content: ContentBlock;
archive: ArchiveBlock;
mediaBlock: MediaBlock;
formBlock: FormBlock;
};
collections: {
pages: Page;
posts: Post;
media: Media;
categories: Category;
'reusable-content': ReusableContent;
users: User;
redirects: Redirect;
forms: Form;
@@ -87,6 +94,7 @@ export interface Config {
posts: PostsSelect<false> | PostsSelect<true>;
media: MediaSelect<false> | MediaSelect<true>;
categories: CategoriesSelect<false> | CategoriesSelect<true>;
'reusable-content': ReusableContentSelect<false> | ReusableContentSelect<true>;
users: UsersSelect<false> | UsersSelect<true>;
redirects: RedirectsSelect<false> | RedirectsSelect<true>;
forms: FormsSelect<false> | FormsSelect<true>;
@@ -141,6 +149,54 @@ export interface UserAuthOperations {
password: string;
};
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "CallToActionBlock".
*/
export interface CallToActionBlock {
richText?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
links?:
| {
link: {
type?: ('reference' | 'custom') | null;
newTab?: boolean | null;
reference?:
| ({
relationTo: 'pages';
value: string | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
} | null);
url?: string | null;
label: string;
/**
* Choose how the link should be rendered.
*/
appearance?: ('default' | 'outline') | null;
};
id?: string | null;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'cta';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "pages".
@@ -191,7 +247,25 @@ export interface Page {
| null;
media?: (string | null) | Media;
};
layout: (CallToActionBlock | ContentBlock | MediaBlock | ArchiveBlock | FormBlock)[];
layout: (
| CallToActionBlock
| ContentBlock
| ArchiveBlock
| MediaBlock
| FormBlock
| {
reusableContentBlockFields: {
reusableContent: string | ReusableContent;
/**
* Custom ID for targeting with CSS/JS
*/
customId?: string | null;
};
id?: string | null;
blockName?: string | null;
blockType: 'reusableContentBlock';
}
)[];
meta?: {
title?: string | null;
/**
@@ -392,54 +466,6 @@ export interface User {
| null;
password?: string | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "CallToActionBlock".
*/
export interface CallToActionBlock {
richText?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
links?:
| {
link: {
type?: ('reference' | 'custom') | null;
newTab?: boolean | null;
reference?:
| ({
relationTo: 'pages';
value: string | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
} | null);
url?: string | null;
label: string;
/**
* Choose how the link should be rendered.
*/
appearance?: ('default' | 'outline') | null;
};
id?: string | null;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'cta';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "ContentBlock".
@@ -490,16 +516,6 @@ export interface ContentBlock {
blockName?: string | null;
blockType: 'content';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "MediaBlock".
*/
export interface MediaBlock {
media: string | Media;
id?: string | null;
blockName?: string | null;
blockType: 'mediaBlock';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "ArchiveBlock".
@@ -534,6 +550,16 @@ export interface ArchiveBlock {
blockName?: string | null;
blockType: 'archive';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "MediaBlock".
*/
export interface MediaBlock {
media: string | Media;
id?: string | null;
blockName?: string | null;
blockType: 'mediaBlock';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "FormBlock".
@@ -734,6 +760,17 @@ export interface Form {
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "reusable-content".
*/
export interface ReusableContent {
id: string;
title: string;
layout: (CallToActionBlock | ContentBlock | ArchiveBlock | MediaBlock | FormBlock)[];
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "redirects".
@@ -923,6 +960,10 @@ export interface PayloadLockedDocument {
relationTo: 'categories';
value: string | Category;
} | null)
| ({
relationTo: 'reusable-content';
value: string | ReusableContent;
} | null)
| ({
relationTo: 'users';
value: string | User;
@@ -1022,9 +1063,21 @@ export interface PagesSelect<T extends boolean = true> {
| {
cta?: T | CallToActionBlockSelect<T>;
content?: T | ContentBlockSelect<T>;
mediaBlock?: T | MediaBlockSelect<T>;
archive?: T | ArchiveBlockSelect<T>;
mediaBlock?: T | MediaBlockSelect<T>;
formBlock?: T | FormBlockSelect<T>;
reusableContentBlock?:
| T
| {
reusableContentBlockFields?:
| T
| {
reusableContent?: T;
customId?: T;
};
id?: T;
blockName?: T;
};
};
meta?:
| T
@@ -1090,15 +1143,6 @@ export interface ContentBlockSelect<T extends boolean = true> {
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "MediaBlock_select".
*/
export interface MediaBlockSelect<T extends boolean = true> {
media?: T;
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "ArchiveBlock_select".
@@ -1113,6 +1157,15 @@ export interface ArchiveBlockSelect<T extends boolean = true> {
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "MediaBlock_select".
*/
export interface MediaBlockSelect<T extends boolean = true> {
media?: T;
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "FormBlock_select".
@@ -1268,6 +1321,24 @@ export interface CategoriesSelect<T extends boolean = true> {
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "reusable-content_select".
*/
export interface ReusableContentSelect<T extends boolean = true> {
title?: T;
layout?:
| T
| {
cta?: T | CallToActionBlockSelect<T>;
content?: T | ContentBlockSelect<T>;
archive?: T | ArchiveBlockSelect<T>;
mediaBlock?: T | MediaBlockSelect<T>;
formBlock?: T | FormBlockSelect<T>;
};
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users_select".

View File

@@ -11,11 +11,17 @@ import { Media } from './collections/Media'
import { Pages } from './collections/Pages'
import { Posts } from './collections/Posts'
import { Users } from './collections/Users'
import { ReusableContent } from './collections/ReusableContents'
import { Footer } from './Footer/config'
import { Header } from './Header/config'
import { plugins } from './plugins'
import { defaultLexical } from '@/fields/defaultLexical'
import { getServerSideURL } from './utilities/getURL'
import { CallToAction } from '@/blocks/CallToAction/config'
import { Content } from '@/blocks/Content/config'
import { Archive } from '@/blocks/ArchiveBlock/config'
import { MediaBlock } from '@/blocks/MediaBlock/config'
import { FormBlock } from '@/blocks/Form/config'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
@@ -57,6 +63,7 @@ export default buildConfig({
],
},
},
blocks: [CallToAction, Content, Archive, MediaBlock, FormBlock],
// This config helps us configure global or default features that the other editors can inherit
editor: defaultLexical,
// database-adapter-config-start
@@ -64,7 +71,7 @@ export default buildConfig({
url: process.env.DATABASE_URI,
}),
// database-adapter-config-end
collections: [Pages, Posts, Media, Categories, Users],
collections: [Pages, Posts, Media, Categories, ReusableContent, Users],
cors: [getServerSideURL()].filter(Boolean),
globals: [Header, Footer],
plugins: [
@@ -72,7 +79,6 @@ export default buildConfig({
// storage-adapter-placeholder
],
secret: process.env.PAYLOAD_SECRET,
sharp,
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
},