update admin dashboard & landing page editor

This commit is contained in:
2026-03-27 04:17:11 -05:00
parent 8c6891f80d
commit 482d2d6c97
10 changed files with 2646 additions and 589 deletions

View File

@@ -0,0 +1,186 @@
import type { Block } from 'payload';
import {
defaultLandingCtaContent,
defaultLandingFeaturesContent,
defaultLandingHeroContent,
defaultLandingTechStackContent,
} from '../../components/landing/content';
export const landingPageBlocks: Block[] = [
{
slug: 'hero',
labels: {
singular: 'Hero Section',
plural: 'Hero Sections',
},
fields: [
{
name: 'badgeEmoji',
type: 'text',
defaultValue: defaultLandingHeroContent.badgeEmoji,
},
{
name: 'badgeText',
type: 'text',
defaultValue: defaultLandingHeroContent.badgeText,
},
{
name: 'headingPrefix',
type: 'text',
defaultValue: defaultLandingHeroContent.headingPrefix,
},
{
name: 'headingHighlight',
type: 'text',
defaultValue: defaultLandingHeroContent.headingHighlight,
},
{
name: 'description',
type: 'textarea',
defaultValue: defaultLandingHeroContent.description,
},
{
name: 'primaryCta',
label: 'Primary CTA',
type: 'group',
fields: [
{
name: 'label',
type: 'text',
defaultValue: defaultLandingHeroContent.primaryCta.label,
},
{
name: 'url',
type: 'text',
defaultValue: defaultLandingHeroContent.primaryCta.url,
},
],
},
{
name: 'highlights',
type: 'array',
defaultValue: defaultLandingHeroContent.highlights.map((label) => ({
label,
})),
fields: [
{
name: 'label',
type: 'text',
},
],
},
],
},
{
slug: 'features',
labels: {
singular: 'Features Section',
plural: 'Features Sections',
},
fields: [
{
name: 'heading',
type: 'text',
defaultValue: defaultLandingFeaturesContent.heading,
},
{
name: 'description',
type: 'textarea',
defaultValue: defaultLandingFeaturesContent.description,
},
{
name: 'items',
type: 'array',
defaultValue: defaultLandingFeaturesContent.items,
fields: [
{
name: 'icon',
type: 'text',
},
{
name: 'title',
type: 'text',
},
{
name: 'description',
type: 'textarea',
},
],
},
],
},
{
slug: 'techStack',
labels: {
singular: 'Tech Stack Section',
plural: 'Tech Stack Sections',
},
fields: [
{
name: 'heading',
type: 'text',
defaultValue: defaultLandingTechStackContent.heading,
},
{
name: 'description',
type: 'textarea',
defaultValue: defaultLandingTechStackContent.description,
},
{
name: 'categories',
type: 'array',
defaultValue: defaultLandingTechStackContent.categories,
fields: [
{
name: 'category',
type: 'text',
},
{
name: 'technologies',
type: 'array',
fields: [
{
name: 'name',
type: 'text',
},
{
name: 'description',
type: 'text',
},
],
},
],
},
],
},
{
slug: 'cta',
labels: {
singular: 'CTA Section',
plural: 'CTA Sections',
},
fields: [
{
name: 'heading',
type: 'text',
defaultValue: defaultLandingCtaContent.heading,
},
{
name: 'description',
type: 'textarea',
defaultValue: defaultLandingCtaContent.description,
},
{
name: 'commandLabel',
type: 'text',
defaultValue: defaultLandingCtaContent.commandLabel,
},
{
name: 'command',
type: 'textarea',
defaultValue: defaultLandingCtaContent.command,
},
],
},
];

View File

@@ -1,6 +1,7 @@
import type { GlobalConfig } from 'payload';
import { defaultLandingPageContent } from '../../components/landing/content';
import { createDefaultLandingPageLayoutForPayload } from '../../components/landing/content';
import { landingPageBlocks } from './landing-page-blocks';
export const LandingPage: GlobalConfig = {
slug: 'landing-page',
@@ -42,194 +43,17 @@ export const LandingPage: GlobalConfig = {
},
fields: [
{
type: 'tabs',
tabs: [
{
label: 'Hero',
fields: [
{
name: 'hero',
type: 'group',
fields: [
{
name: 'badgeEmoji',
type: 'text',
defaultValue: defaultLandingPageContent.hero.badgeEmoji,
},
{
name: 'badgeText',
type: 'text',
defaultValue: defaultLandingPageContent.hero.badgeText,
},
{
name: 'headingPrefix',
type: 'text',
defaultValue: defaultLandingPageContent.hero.headingPrefix,
},
{
name: 'headingHighlight',
type: 'text',
defaultValue: defaultLandingPageContent.hero.headingHighlight,
},
{
name: 'description',
type: 'textarea',
defaultValue: defaultLandingPageContent.hero.description,
},
{
name: 'primaryCta',
label: 'Primary CTA',
type: 'group',
fields: [
{
name: 'label',
type: 'text',
defaultValue:
defaultLandingPageContent.hero.primaryCta.label,
},
{
name: 'url',
type: 'text',
defaultValue:
defaultLandingPageContent.hero.primaryCta.url,
},
],
},
{
name: 'highlights',
type: 'array',
defaultValue: defaultLandingPageContent.hero.highlights.map(
(label) => ({ label }),
),
fields: [
{
name: 'label',
type: 'text',
},
],
},
],
},
],
},
{
label: 'Features',
fields: [
{
name: 'features',
type: 'group',
fields: [
{
name: 'heading',
type: 'text',
defaultValue: defaultLandingPageContent.features.heading,
},
{
name: 'description',
type: 'textarea',
defaultValue: defaultLandingPageContent.features.description,
},
{
name: 'items',
type: 'array',
defaultValue: defaultLandingPageContent.features.items,
fields: [
{
name: 'icon',
type: 'text',
},
{
name: 'title',
type: 'text',
},
{
name: 'description',
type: 'textarea',
},
],
},
],
},
],
},
{
label: 'Tech Stack',
fields: [
{
name: 'techStack',
type: 'group',
fields: [
{
name: 'heading',
type: 'text',
defaultValue: defaultLandingPageContent.techStack.heading,
},
{
name: 'description',
type: 'textarea',
defaultValue: defaultLandingPageContent.techStack.description,
},
{
name: 'categories',
type: 'array',
defaultValue: defaultLandingPageContent.techStack.categories,
fields: [
{
name: 'category',
type: 'text',
},
{
name: 'technologies',
type: 'array',
fields: [
{
name: 'name',
type: 'text',
},
{
name: 'description',
type: 'text',
},
],
},
],
},
],
},
],
},
{
label: 'CTA',
fields: [
{
name: 'cta',
type: 'group',
fields: [
{
name: 'heading',
type: 'text',
defaultValue: defaultLandingPageContent.cta.heading,
},
{
name: 'description',
type: 'textarea',
defaultValue: defaultLandingPageContent.cta.description,
},
{
name: 'commandLabel',
type: 'text',
defaultValue: defaultLandingPageContent.cta.commandLabel,
},
{
name: 'command',
type: 'textarea',
defaultValue: defaultLandingPageContent.cta.command,
},
],
},
],
},
],
name: 'layout',
label: 'Layout Builder',
type: 'blocks',
minRows: 1,
defaultValue: () => createDefaultLandingPageLayoutForPayload(),
blocks: landingPageBlocks,
admin: {
description:
'Add, remove, and reorder landing page sections while keeping live preview and autosave.',
initCollapsed: true,
},
},
],
};