Files
mintel.me/apps/web/src/payload/collections/Posts.ts
Marc Mintel 11f735bbdf
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 16s
Build & Deploy / 🏗️ Build (push) Failing after 6m58s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 QA (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 1s
fix: resolve admin white screen via static ChatWindowProvider import
- Statically declare ChatWindowProvider in payload.config.ts admin.components.providers
- Regenerate importMap.js with correct component mappings
- Update Dockerfile to support _at-mintel monorepo sync for local builds
- Add .gitignore entries for manual build artifacts
- Update blocks and collections (payload-ai integration updates)
- Sync pnpm-lock.yaml
2026-03-07 11:47:52 +01:00

122 lines
2.8 KiB
TypeScript

import type { CollectionConfig } from "payload";
import { lexicalEditor, BlocksFeature } from "@payloadcms/richtext-lexical";
import { payloadBlocks } from "../blocks/allBlocks";
export const Posts: CollectionConfig = {
slug: "posts",
admin: {
useAsTitle: "title",
defaultColumns: ["featuredImage", "title", "date", "updatedAt", "_status"],
},
versions: {
drafts: true,
},
access: {
read: () => true, // Publicly readable API
},
fields: [
{
name: "aiOptimizer",
type: "ui",
admin: {
position: "sidebar",
components: {
Field: "@mintel/payload-ai/components/OptimizeButton#OptimizeButton",
},
},
},
{
name: "title",
type: "text",
required: true,
},
{
name: "slug",
type: "text",
required: true,
unique: true,
admin: {
position: "sidebar",
components: {
afterInput: [
"@mintel/payload-ai/components/FieldGenerators/GenerateSlugButton#GenerateSlugButton",
],
},
},
hooks: {
beforeValidate: [
({ value, data }) => {
if (value) return value;
if (data?.title) {
return data.title
.toLowerCase()
.replace(/ /g, "-")
.replace(/[^\w-]+/g, "");
}
return value;
},
],
},
},
{
name: "description",
type: "text",
required: true,
},
{
name: "date",
type: "date",
required: true,
admin: {
position: "sidebar",
description:
"Set a future date and save as 'Published' to schedule this post. It will not appear on the frontend until this date is reached.",
},
},
{
name: "tags",
type: "array",
required: true,
admin: {
position: "sidebar",
},
fields: [
{
name: "tag",
type: "text",
admin: {
description: "Kategorisiere diesen Post mit einem eindeutigen Tag",
components: { Field: "@/src/payload/components/TagSelector" },
},
},
],
},
{
name: "featuredImage",
type: "upload",
relationTo: "media",
admin: {
description: "The main hero image for the blog post.",
position: "sidebar",
components: {
afterInput: [
"@mintel/payload-ai/components/FieldGenerators/GenerateThumbnailButton#GenerateThumbnailButton",
],
},
},
},
{
name: "content",
type: "richText",
editor: lexicalEditor({
features: ({ defaultFeatures }) => [
...defaultFeatures,
BlocksFeature({
blocks: payloadBlocks,
}),
],
}),
},
],
};