From d3232b947d0129b45c47d00ce380a23d323584c1 Mon Sep 17 00:00:00 2001 From: Elliot DeNolf Date: Thu, 5 Dec 2024 16:33:33 -0500 Subject: [PATCH] templates: bump for v3.4.0 (#9780) Automated bump of templates for v3.4.0 Co-authored-by: github-actions[bot] --- ...tial.json => 20241205_211431_initial.json} | 2 +- ..._initial.ts => 20241205_211431_initial.ts} | 0 .../with-postgres/src/migrations/index.ts | 8 +- ...tial.json => 20241205_211405_initial.json} | 2 +- ..._initial.ts => 20241205_211405_initial.ts} | 0 .../src/migrations/index.ts | 8 +- .../src/Footer/RowLabel.tsx | 13 +++ .../with-vercel-website/src/Footer/config.ts | 6 + .../src/Header/RowLabel.tsx | 13 +++ .../with-vercel-website/src/Header/config.ts | 6 + .../src/app/(payload)/admin/importMap.js | 4 + .../src/blocks/Content/config.ts | 3 + .../src/blocks/RelatedPosts/Component.tsx | 2 +- .../src/collections/Pages/index.ts | 3 + .../src/components/RichText/index.tsx | 2 +- .../src/endpoints/seed/index.ts | 104 +++++++++--------- .../src/fields/linkGroup.ts | 3 + .../src/heros/HighImpact/index.tsx | 4 +- ...tial.json => 20241205_211421_initial.json} | 2 +- ..._initial.ts => 20241205_211421_initial.ts} | 0 .../src/migrations/index.ts | 8 +- .../with-vercel-website/tailwind.config.mjs | 42 +++++-- 22 files changed, 156 insertions(+), 79 deletions(-) rename templates/with-postgres/src/migrations/{20241205_040211_initial.json => 20241205_211431_initial.json} (99%) rename templates/with-postgres/src/migrations/{20241205_040211_initial.ts => 20241205_211431_initial.ts} (100%) rename templates/with-vercel-postgres/src/migrations/{20241205_040146_initial.json => 20241205_211405_initial.json} (99%) rename templates/with-vercel-postgres/src/migrations/{20241205_040146_initial.ts => 20241205_211405_initial.ts} (100%) create mode 100644 templates/with-vercel-website/src/Footer/RowLabel.tsx create mode 100644 templates/with-vercel-website/src/Header/RowLabel.tsx rename templates/with-vercel-website/src/migrations/{20241205_040201_initial.json => 20241205_211421_initial.json} (99%) rename templates/with-vercel-website/src/migrations/{20241205_040201_initial.ts => 20241205_211421_initial.ts} (100%) diff --git a/templates/with-postgres/src/migrations/20241205_040211_initial.json b/templates/with-postgres/src/migrations/20241205_211431_initial.json similarity index 99% rename from templates/with-postgres/src/migrations/20241205_040211_initial.json rename to templates/with-postgres/src/migrations/20241205_211431_initial.json index f0977ba495..49da78233c 100644 --- a/templates/with-postgres/src/migrations/20241205_040211_initial.json +++ b/templates/with-postgres/src/migrations/20241205_211431_initial.json @@ -1,5 +1,5 @@ { - "id": "6ff63df3-bd96-4bc0-8d4b-1b0e6cc63711", + "id": "99a9cc07-6ed3-4eeb-bc7d-a20cc21ec135", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", diff --git a/templates/with-postgres/src/migrations/20241205_040211_initial.ts b/templates/with-postgres/src/migrations/20241205_211431_initial.ts similarity index 100% rename from templates/with-postgres/src/migrations/20241205_040211_initial.ts rename to templates/with-postgres/src/migrations/20241205_211431_initial.ts diff --git a/templates/with-postgres/src/migrations/index.ts b/templates/with-postgres/src/migrations/index.ts index 61d8050a5c..316fb5d6d9 100644 --- a/templates/with-postgres/src/migrations/index.ts +++ b/templates/with-postgres/src/migrations/index.ts @@ -1,9 +1,9 @@ -import * as migration_20241205_040211_initial from './20241205_040211_initial' +import * as migration_20241205_211431_initial from './20241205_211431_initial' export const migrations = [ { - up: migration_20241205_040211_initial.up, - down: migration_20241205_040211_initial.down, - name: '20241205_040211_initial', + up: migration_20241205_211431_initial.up, + down: migration_20241205_211431_initial.down, + name: '20241205_211431_initial', }, ] diff --git a/templates/with-vercel-postgres/src/migrations/20241205_040146_initial.json b/templates/with-vercel-postgres/src/migrations/20241205_211405_initial.json similarity index 99% rename from templates/with-vercel-postgres/src/migrations/20241205_040146_initial.json rename to templates/with-vercel-postgres/src/migrations/20241205_211405_initial.json index f8cc85663a..754f0d786a 100644 --- a/templates/with-vercel-postgres/src/migrations/20241205_040146_initial.json +++ b/templates/with-vercel-postgres/src/migrations/20241205_211405_initial.json @@ -1,5 +1,5 @@ { - "id": "3b1d2937-d942-42f0-9738-5e8c48c205de", + "id": "caad9ebf-d475-40cd-930e-059daf04fde8", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", diff --git a/templates/with-vercel-postgres/src/migrations/20241205_040146_initial.ts b/templates/with-vercel-postgres/src/migrations/20241205_211405_initial.ts similarity index 100% rename from templates/with-vercel-postgres/src/migrations/20241205_040146_initial.ts rename to templates/with-vercel-postgres/src/migrations/20241205_211405_initial.ts diff --git a/templates/with-vercel-postgres/src/migrations/index.ts b/templates/with-vercel-postgres/src/migrations/index.ts index d4b11a79f0..168d09796d 100644 --- a/templates/with-vercel-postgres/src/migrations/index.ts +++ b/templates/with-vercel-postgres/src/migrations/index.ts @@ -1,9 +1,9 @@ -import * as migration_20241205_040146_initial from './20241205_040146_initial' +import * as migration_20241205_211405_initial from './20241205_211405_initial' export const migrations = [ { - up: migration_20241205_040146_initial.up, - down: migration_20241205_040146_initial.down, - name: '20241205_040146_initial', + up: migration_20241205_211405_initial.up, + down: migration_20241205_211405_initial.down, + name: '20241205_211405_initial', }, ] diff --git a/templates/with-vercel-website/src/Footer/RowLabel.tsx b/templates/with-vercel-website/src/Footer/RowLabel.tsx new file mode 100644 index 0000000000..57e747495b --- /dev/null +++ b/templates/with-vercel-website/src/Footer/RowLabel.tsx @@ -0,0 +1,13 @@ +'use client' +import { Header } from '@/payload-types' +import { RowLabelProps, useRowLabel } from '@payloadcms/ui' + +export const RowLabel: React.FC = (props) => { + const data = useRowLabel[number]>() + + const label = data?.data?.link?.label + ? `Nav item ${data.rowNumber !== undefined ? data.rowNumber + 1 : ''}: ${data?.data?.link?.label}` + : 'Row' + + return
{label}
+} diff --git a/templates/with-vercel-website/src/Footer/config.ts b/templates/with-vercel-website/src/Footer/config.ts index 692bc3b7ab..ca9b54bc46 100644 --- a/templates/with-vercel-website/src/Footer/config.ts +++ b/templates/with-vercel-website/src/Footer/config.ts @@ -18,6 +18,12 @@ export const Footer: GlobalConfig = { }), ], maxRows: 6, + admin: { + initCollapsed: true, + components: { + RowLabel: '@/Footer/RowLabel#RowLabel', + }, + }, }, ], hooks: { diff --git a/templates/with-vercel-website/src/Header/RowLabel.tsx b/templates/with-vercel-website/src/Header/RowLabel.tsx new file mode 100644 index 0000000000..57e747495b --- /dev/null +++ b/templates/with-vercel-website/src/Header/RowLabel.tsx @@ -0,0 +1,13 @@ +'use client' +import { Header } from '@/payload-types' +import { RowLabelProps, useRowLabel } from '@payloadcms/ui' + +export const RowLabel: React.FC = (props) => { + const data = useRowLabel[number]>() + + const label = data?.data?.link?.label + ? `Nav item ${data.rowNumber !== undefined ? data.rowNumber + 1 : ''}: ${data?.data?.link?.label}` + : 'Row' + + return
{label}
+} diff --git a/templates/with-vercel-website/src/Header/config.ts b/templates/with-vercel-website/src/Header/config.ts index 30f833c8e2..58fe89c809 100644 --- a/templates/with-vercel-website/src/Header/config.ts +++ b/templates/with-vercel-website/src/Header/config.ts @@ -18,6 +18,12 @@ export const Header: GlobalConfig = { }), ], maxRows: 6, + admin: { + initCollapsed: true, + components: { + RowLabel: '@/Header/RowLabel#RowLabel', + }, + }, }, ], hooks: { diff --git a/templates/with-vercel-website/src/app/(payload)/admin/importMap.js b/templates/with-vercel-website/src/app/(payload)/admin/importMap.js index 8eb653c10c..896ea84aba 100644 --- a/templates/with-vercel-website/src/app/(payload)/admin/importMap.js +++ b/templates/with-vercel-website/src/app/(payload)/admin/importMap.js @@ -18,6 +18,8 @@ import { HorizontalRuleFeatureClient as HorizontalRuleFeatureClient_e70f5e05f09f import { BlocksFeatureClient as BlocksFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client' import { LinkToDoc as LinkToDoc_aead06e4cbf6b2620c5c51c9ab283634 } from '@payloadcms/plugin-search/client' import { ReindexButton as ReindexButton_aead06e4cbf6b2620c5c51c9ab283634 } from '@payloadcms/plugin-search/client' +import { RowLabel as RowLabel_ec255a65fa6fa8d1faeb09cf35284224 } from '@/Header/RowLabel' +import { RowLabel as RowLabel_1f6ff6ff633e3695d348f4f3c58f1466 } from '@/Footer/RowLabel' import { default as default_1a7510af427896d367a49dbf838d2de6 } from '@/components/BeforeDashboard' import { default as default_8a7ab0eb7ab5c511aba12e68480bfe5e } from '@/components/BeforeLogin' @@ -59,6 +61,8 @@ export const importMap = { BlocksFeatureClient_e70f5e05f09f93e00b997edb1ef0c864, '@payloadcms/plugin-search/client#LinkToDoc': LinkToDoc_aead06e4cbf6b2620c5c51c9ab283634, '@payloadcms/plugin-search/client#ReindexButton': ReindexButton_aead06e4cbf6b2620c5c51c9ab283634, + '@/Header/RowLabel#RowLabel': RowLabel_ec255a65fa6fa8d1faeb09cf35284224, + '@/Footer/RowLabel#RowLabel': RowLabel_1f6ff6ff633e3695d348f4f3c58f1466, '@/components/BeforeDashboard#default': default_1a7510af427896d367a49dbf838d2de6, '@/components/BeforeLogin#default': default_8a7ab0eb7ab5c511aba12e68480bfe5e, } diff --git a/templates/with-vercel-website/src/blocks/Content/config.ts b/templates/with-vercel-website/src/blocks/Content/config.ts index 01c22edc34..16a01e218c 100644 --- a/templates/with-vercel-website/src/blocks/Content/config.ts +++ b/templates/with-vercel-website/src/blocks/Content/config.ts @@ -68,6 +68,9 @@ export const Content: Block = { { name: 'columns', type: 'array', + admin: { + initCollapsed: true, + }, fields: columnFields, }, ], diff --git a/templates/with-vercel-website/src/blocks/RelatedPosts/Component.tsx b/templates/with-vercel-website/src/blocks/RelatedPosts/Component.tsx index d81f53641a..214657f5df 100644 --- a/templates/with-vercel-website/src/blocks/RelatedPosts/Component.tsx +++ b/templates/with-vercel-website/src/blocks/RelatedPosts/Component.tsx @@ -16,7 +16,7 @@ export const RelatedPosts: React.FC = (props) => { const { className, docs, introContent } = props return ( -
+
{introContent && }
diff --git a/templates/with-vercel-website/src/collections/Pages/index.ts b/templates/with-vercel-website/src/collections/Pages/index.ts index 7ee4e92dca..03517ab506 100644 --- a/templates/with-vercel-website/src/collections/Pages/index.ts +++ b/templates/with-vercel-website/src/collections/Pages/index.ts @@ -79,6 +79,9 @@ export const Pages: CollectionConfig<'pages'> = { type: 'blocks', blocks: [CallToAction, Content, MediaBlock, Archive, FormBlock], required: true, + admin: { + initCollapsed: true, + }, }, ], label: 'Content', diff --git a/templates/with-vercel-website/src/components/RichText/index.tsx b/templates/with-vercel-website/src/components/RichText/index.tsx index b2d046b648..beb5a871f4 100644 --- a/templates/with-vercel-website/src/components/RichText/index.tsx +++ b/templates/with-vercel-website/src/components/RichText/index.tsx @@ -55,7 +55,7 @@ export default function RichText(props: Props) { { 'container ': enableGutter, 'max-w-none': !enableGutter, - 'mx-auto prose dark:prose-invert ': enableProse, + 'mx-auto prose md:prose-md dark:prose-invert ': enableProse, }, className, )} diff --git a/templates/with-vercel-website/src/endpoints/seed/index.ts b/templates/with-vercel-website/src/endpoints/seed/index.ts index 6d50a8fc19..733adfebd6 100644 --- a/templates/with-vercel-website/src/endpoints/seed/index.ts +++ b/templates/with-vercel-website/src/endpoints/seed/index.ts @@ -38,6 +38,7 @@ export const seed = async ({ // this is because while `yarn seed` drops the database // the custom `/api/seed` endpoint does not payload.logger.info(`— Clearing collections and globals...`) + // clear the database await Promise.all( globals.map((global) => @@ -54,16 +55,9 @@ export const seed = async ({ ), ) - for (const collection of collections) { - await payload.delete({ - collection: collection, - where: {}, - depth: 0, - context: { - disableRevalidate: true, - }, - }) - } + await Promise.all( + collections.map((collection) => payload.db.deleteMany({ collection, req, where: {} })), + ) payload.logger.info(`— Seeding demo author and user...`) @@ -78,6 +72,7 @@ export const seed = async ({ }) payload.logger.info(`— Seeding media...`) + const [image1Buffer, image2Buffer, image3Buffer, hero1Buffer] = await Promise.all([ fetchFileByURL( 'https://raw.githubusercontent.com/payloadcms/payload/refs/heads/main/templates/website/src/endpoints/seed/image-post1.webp', @@ -102,6 +97,9 @@ export const seed = async ({ technologyCategory, newsCategory, financeCategory, + designCategory, + softwareCategory, + engineeringCategory, ] = await Promise.all([ payload.create({ collection: 'users', @@ -152,30 +150,30 @@ export const seed = async ({ title: 'Finance', }, }), + payload.create({ + collection: 'categories', + data: { + title: 'Design', + }, + }), + + payload.create({ + collection: 'categories', + data: { + title: 'Software', + }, + }), + + payload.create({ + collection: 'categories', + data: { + title: 'Engineering', + }, + }), ]) + let demoAuthorID: number | string = demoAuthor.id - await payload.create({ - collection: 'categories', - data: { - title: 'Design', - }, - }) - - await payload.create({ - collection: 'categories', - data: { - title: 'Software', - }, - }) - - await payload.create({ - collection: 'categories', - data: { - title: 'Engineering', - }, - }) - let image1ID: number | string = image1Doc.id let image2ID: number | string = image2Doc.id let image3ID: number | string = image3Doc.id @@ -236,27 +234,29 @@ export const seed = async ({ }) // update each post with related posts - await payload.update({ - id: post1Doc.id, - collection: 'posts', - data: { - relatedPosts: [post2Doc.id, post3Doc.id], - }, - }) - await payload.update({ - id: post2Doc.id, - collection: 'posts', - data: { - relatedPosts: [post1Doc.id, post3Doc.id], - }, - }) - await payload.update({ - id: post3Doc.id, - collection: 'posts', - data: { - relatedPosts: [post1Doc.id, post2Doc.id], - }, - }) + await Promise.all([ + payload.update({ + id: post1Doc.id, + collection: 'posts', + data: { + relatedPosts: [post2Doc.id, post3Doc.id], + }, + }), + payload.update({ + id: post2Doc.id, + collection: 'posts', + data: { + relatedPosts: [post1Doc.id, post3Doc.id], + }, + }), + payload.update({ + id: post3Doc.id, + collection: 'posts', + data: { + relatedPosts: [post1Doc.id, post2Doc.id], + }, + }), + ]) payload.logger.info(`— Seeding contact form...`) diff --git a/templates/with-vercel-website/src/fields/linkGroup.ts b/templates/with-vercel-website/src/fields/linkGroup.ts index c59fb3cdba..c86fa33cf5 100644 --- a/templates/with-vercel-website/src/fields/linkGroup.ts +++ b/templates/with-vercel-website/src/fields/linkGroup.ts @@ -19,6 +19,9 @@ export const linkGroup: LinkGroupType = ({ appearances, overrides = {} } = {}) = appearances, }), ], + admin: { + initCollapsed: true, + }, } return deepMerge(generatedLinkGroup, overrides) diff --git a/templates/with-vercel-website/src/heros/HighImpact/index.tsx b/templates/with-vercel-website/src/heros/HighImpact/index.tsx index 115bd523bb..968e1a408d 100644 --- a/templates/with-vercel-website/src/heros/HighImpact/index.tsx +++ b/templates/with-vercel-website/src/heros/HighImpact/index.tsx @@ -21,10 +21,10 @@ export const HighImpactHero: React.FC = ({ links, media, richText data-theme="dark" >
-
+
{richText && } {Array.isArray(links) && links.length > 0 && ( -
    +
      {links.map(({ link }, i) => { return (
    • diff --git a/templates/with-vercel-website/src/migrations/20241205_040201_initial.json b/templates/with-vercel-website/src/migrations/20241205_211421_initial.json similarity index 99% rename from templates/with-vercel-website/src/migrations/20241205_040201_initial.json rename to templates/with-vercel-website/src/migrations/20241205_211421_initial.json index a52ce32867..2d1563e1b8 100644 --- a/templates/with-vercel-website/src/migrations/20241205_040201_initial.json +++ b/templates/with-vercel-website/src/migrations/20241205_211421_initial.json @@ -1,5 +1,5 @@ { - "id": "391f6437-f7f5-4001-88f4-714288dfa4c9", + "id": "1f73d42b-5afd-4044-aabd-9363f0e03800", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", diff --git a/templates/with-vercel-website/src/migrations/20241205_040201_initial.ts b/templates/with-vercel-website/src/migrations/20241205_211421_initial.ts similarity index 100% rename from templates/with-vercel-website/src/migrations/20241205_040201_initial.ts rename to templates/with-vercel-website/src/migrations/20241205_211421_initial.ts diff --git a/templates/with-vercel-website/src/migrations/index.ts b/templates/with-vercel-website/src/migrations/index.ts index 3f92da85df..7252045146 100644 --- a/templates/with-vercel-website/src/migrations/index.ts +++ b/templates/with-vercel-website/src/migrations/index.ts @@ -1,9 +1,9 @@ -import * as migration_20241205_040201_initial from './20241205_040201_initial' +import * as migration_20241205_211421_initial from './20241205_211421_initial' export const migrations = [ { - up: migration_20241205_040201_initial.up, - down: migration_20241205_040201_initial.down, - name: '20241205_040201_initial', + up: migration_20241205_211421_initial.up, + down: migration_20241205_211421_initial.down, + name: '20241205_211421_initial', }, ] diff --git a/templates/with-vercel-website/tailwind.config.mjs b/templates/with-vercel-website/tailwind.config.mjs index 5d63910cee..52f1043c69 100644 --- a/templates/with-vercel-website/tailwind.config.mjs +++ b/templates/with-vercel-website/tailwind.config.mjs @@ -106,15 +106,41 @@ export default { }, typography: ({ theme }) => ({ DEFAULT: { - css: { - '--tw-prose-body': 'var(--text)', - '--tw-prose-headings': 'var(--text)', - h1: { - fontSize: '3.5rem', - fontWeight: 'normal', - marginBottom: '0.25em', + css: [ + { + '--tw-prose-body': 'var(--text)', + '--tw-prose-headings': 'var(--text)', + h1: { + fontWeight: 'normal', + marginBottom: '0.25em', + }, }, - }, + ], + }, + base: { + css: [ + { + h1: { + fontSize: '2.5rem', + }, + h2: { + fontSize: '1.25rem', + fontWeight: 600, + }, + }, + ], + }, + md: { + css: [ + { + h1: { + fontSize: '3.5rem', + }, + h2: { + fontSize: '1.5rem', + }, + }, + ], }, }), },