From 3cbd90bbd144cd848258b2bb91eea11dffbb3ab2 Mon Sep 17 00:00:00 2001 From: Brian Nelson Date: Sat, 11 Oct 2025 17:14:02 -0400 Subject: [PATCH] added settings --- src/collections/Projects.ts | 3 ++- src/collections/Settings/index.ts | 20 +++++++++++++++++--- src/payload-types.ts | 22 ++++++++++++++++++++++ src/payload.config.ts | 4 ++-- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/src/collections/Projects.ts b/src/collections/Projects.ts index ff4233b..f0fadf3 100644 --- a/src/collections/Projects.ts +++ b/src/collections/Projects.ts @@ -8,7 +8,7 @@ export const Projects: CollectionConfig = { slug: true, }, admin: { - defaultColumns: ['title', 'slug', 'updatedAt',], + defaultColumns: ['title', 'slug', 'updatedAt', 'order'], }, fields: [ { @@ -41,6 +41,7 @@ export const Projects: CollectionConfig = { }, { name: 'github', + label: 'Git Repo', type: 'text' } ] diff --git a/src/collections/Settings/index.ts b/src/collections/Settings/index.ts index 4589b41..69ab35f 100644 --- a/src/collections/Settings/index.ts +++ b/src/collections/Settings/index.ts @@ -1,8 +1,22 @@ -import type { CollectionConfig } from 'payload'; +import type { GlobalConfig } from 'payload'; -export const Settings: CollectionConfig = { +export const Settings: GlobalConfig = { slug: 'settings', fields: [ - + { + type: 'tabs', + tabs: [ + { + label: 'Contact', + fields: [ + { + name: 'email', + label: 'Contact Email', + type: 'email' + } + ] + }, + ] + }, ] } \ No newline at end of file diff --git a/src/payload-types.ts b/src/payload-types.ts index 876c68b..9e04d61 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -92,9 +92,11 @@ export interface Config { }; globals: { nav: Nav; + settings: Setting; }; globalsSelect: { nav: NavSelect | NavSelect; + settings: SettingsSelect | SettingsSelect; }; locale: null; user: User & { @@ -461,6 +463,16 @@ export interface Nav { updatedAt?: string | null; createdAt?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "settings". + */ +export interface Setting { + id: number; + email?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "nav_select". @@ -476,6 +488,16 @@ export interface NavSelect { createdAt?: T; globalType?: T; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "settings_select". + */ +export interface SettingsSelect { + email?: T; + updatedAt?: T; + createdAt?: T; + globalType?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "auth". diff --git a/src/payload.config.ts b/src/payload.config.ts index 1ac4b15..04c8147 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -13,9 +13,8 @@ import { Page } from './collections/Page' import { Projects } from './collections/Projects' import { Categories } from './collections/Categories' import { Nav } from './collections/Nav' -import { seoPlugin } from '@payloadcms/plugin-seo' -import { GenerateTitle, GenerateURL } from '@payloadcms/plugin-seo/types' import { plugins } from './plugins' +import { Settings } from './collections/Settings' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) @@ -36,6 +35,7 @@ export default buildConfig({ ], globals: [ Nav, + Settings, ], editor: lexicalEditor({ features: ({ defaultFeatures, rootFeatures }) => [