kofi-stack-template-generator 2.1.26 → 2.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +343 -16
- package/package.json +8 -8
- package/src/templates.generated.ts +77 -18
- package/templates/marketing/payload/src/Footer/config.ts.hbs +178 -0
- package/templates/marketing/payload/src/Footer/hooks/revalidateFooter.ts.hbs +13 -0
- package/templates/marketing/payload/src/Footer/index.ts.hbs +1 -0
- package/templates/marketing/payload/src/Header/RowLabel.tsx.hbs +21 -0
- package/templates/marketing/payload/src/Header/config.ts.hbs +208 -0
- package/templates/marketing/payload/src/Header/hooks/revalidateHeader.ts.hbs +13 -0
- package/templates/marketing/payload/src/Header/index.ts.hbs +1 -0
- package/templates/marketing/payload/src/access/anyone.ts.hbs +3 -0
- package/templates/marketing/payload/src/access/authenticated.ts.hbs +9 -0
- package/templates/marketing/payload/src/access/authenticatedOrPublished.ts.hbs +13 -0
- package/templates/marketing/payload/src/access/index.ts.hbs +3 -0
- package/templates/marketing/payload/src/app/(frontend)/next/seed/route.ts.hbs +31 -0
- package/templates/marketing/payload/src/app/(payload)/admin/[[...segments]]/not-found.tsx.hbs +13 -6
- package/templates/marketing/payload/src/app/(payload)/admin/[[...segments]]/page.tsx.hbs +13 -6
- package/templates/marketing/payload/src/app/(payload)/api/[...slug]/route.ts.hbs +17 -7
- package/templates/marketing/payload/src/app/(payload)/api/graphql/route.ts.hbs +7 -4
- package/templates/marketing/payload/src/app/(payload)/api/graphql-playground/route.ts.hbs +5 -3
- package/templates/marketing/payload/src/app/(payload)/layout.tsx.hbs +20 -13
- package/templates/marketing/payload/src/collections/Categories/index.ts.hbs +28 -0
- package/templates/marketing/payload/src/collections/FAQs/index.ts.hbs +100 -0
- package/templates/marketing/payload/src/collections/Media.ts.hbs +148 -28
- package/templates/marketing/payload/src/collections/Pages/hooks/revalidatePage.ts.hbs +43 -0
- package/templates/marketing/payload/src/collections/Pages/index.ts.hbs +142 -0
- package/templates/marketing/payload/src/collections/Posts/hooks/populateAuthors.ts.hbs +41 -0
- package/templates/marketing/payload/src/collections/Posts/hooks/revalidatePost.ts.hbs +44 -0
- package/templates/marketing/payload/src/collections/Posts/index.ts.hbs +244 -0
- package/templates/marketing/payload/src/collections/Users/index.ts.hbs +26 -0
- package/templates/marketing/payload/src/collections/index.ts.hbs +6 -4
- package/templates/marketing/payload/src/components/BeforeDashboard/SeedButton/index.scss.hbs +12 -0
- package/templates/marketing/payload/src/components/BeforeDashboard/SeedButton/index.tsx.hbs +89 -0
- package/templates/marketing/payload/src/components/BeforeDashboard/index.scss.hbs +24 -0
- package/templates/marketing/payload/src/components/BeforeDashboard/index.tsx.hbs +69 -0
- package/templates/marketing/payload/src/components/BeforeLogin/index.tsx.hbs +14 -0
- package/templates/marketing/payload/src/components/Link/index.tsx.hbs +79 -0
- package/templates/marketing/payload/src/components/Media/index.tsx.hbs +67 -0
- package/templates/marketing/payload/src/components/RichText/index.tsx.hbs +44 -0
- package/templates/marketing/payload/src/endpoints/seed/home.ts.hbs +76 -0
- package/templates/marketing/payload/src/endpoints/seed/image-1.ts.hbs +5 -0
- package/templates/marketing/payload/src/endpoints/seed/image-2.ts.hbs +5 -0
- package/templates/marketing/payload/src/endpoints/seed/image-hero.ts.hbs +5 -0
- package/templates/marketing/payload/src/endpoints/seed/index.ts.hbs +235 -0
- package/templates/marketing/payload/src/endpoints/seed/post-1.ts.hbs +252 -0
- package/templates/marketing/payload/src/fields/defaultLexical.ts.hbs +73 -0
- package/templates/marketing/payload/src/fields/index.ts.hbs +3 -0
- package/templates/marketing/payload/src/fields/link.ts.hbs +139 -0
- package/templates/marketing/payload/src/fields/linkGroup.ts.hbs +28 -0
- package/templates/marketing/payload/src/globals/index.ts.hbs +2 -2
- package/templates/marketing/payload/src/heros/HighImpact/index.tsx.hbs +53 -0
- package/templates/marketing/payload/src/heros/LowImpact/index.tsx.hbs +48 -0
- package/templates/marketing/payload/src/heros/MediumImpact/index.tsx.hbs +46 -0
- package/templates/marketing/payload/src/heros/PostHero/index.tsx.hbs +68 -0
- package/templates/marketing/payload/src/heros/ProductShowcase/index.tsx.hbs +88 -0
- package/templates/marketing/payload/src/heros/RenderHero.tsx.hbs +27 -0
- package/templates/marketing/payload/src/heros/config.ts.hbs +112 -0
- package/templates/marketing/payload/src/heros/index.ts.hbs +7 -0
- package/templates/marketing/payload/src/hooks/index.ts.hbs +2 -0
- package/templates/marketing/payload/src/hooks/populatePublishedAt.ts.hbs +15 -0
- package/templates/marketing/payload/src/hooks/revalidateRedirects.ts.hbs +11 -0
- package/templates/marketing/payload/src/payload.config.ts.hbs +32 -8
- package/templates/marketing/payload/src/providers/HeaderTheme/index.tsx.hbs +34 -0
- package/templates/marketing/payload/src/providers/Theme/InitTheme/index.tsx.hbs +44 -0
- package/templates/marketing/payload/src/providers/Theme/index.tsx.hbs +60 -0
- package/templates/marketing/payload/src/providers/Theme/shared.ts.hbs +17 -0
- package/templates/marketing/payload/src/providers/Theme/types.ts.hbs +10 -0
- package/templates/marketing/payload/src/providers/index.tsx.hbs +18 -0
- package/templates/marketing/payload/src/utilities/canUseDOM.ts.hbs +1 -0
- package/templates/marketing/payload/src/utilities/deepMerge.ts.hbs +35 -0
- package/templates/marketing/payload/src/utilities/formatAuthors.ts.hbs +24 -0
- package/templates/marketing/payload/src/utilities/formatDateTime.ts.hbs +13 -0
- package/templates/marketing/payload/src/utilities/generateMeta.ts.hbs +87 -0
- package/templates/marketing/payload/src/utilities/generatePreviewPath.ts.hbs +33 -0
- package/templates/marketing/payload/src/utilities/getURL.ts.hbs +26 -0
- package/templates/marketing/payload/src/utilities/index.ts.hbs +8 -0
- package/templates/marketing/payload/src/utilities/mergeOpenGraph.ts.hbs +26 -0
- package/templates/marketing/payload/tsconfig.json.hbs +1 -0
- package/templates/marketing/payload/src/collections/Pages.ts.hbs +0 -66
- package/templates/marketing/payload/src/collections/Posts.ts.hbs +0 -65
- package/templates/marketing/payload/src/collections/Users.ts.hbs +0 -25
- package/templates/marketing/payload/src/globals/Navigation.ts.hbs +0 -51
- package/templates/marketing/payload/src/globals/SiteSettings.ts.hbs +0 -49
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { GlobalConfig } from "payload"
|
|
2
|
+
|
|
3
|
+
import { link } from "@/fields/link"
|
|
4
|
+
import { revalidateFooter } from "./hooks/revalidateFooter"
|
|
5
|
+
|
|
6
|
+
export const Footer: GlobalConfig = {
|
|
7
|
+
slug: "footer",
|
|
8
|
+
access: {
|
|
9
|
+
read: () => true,
|
|
10
|
+
},
|
|
11
|
+
fields: [
|
|
12
|
+
// Link Columns - organized groups of links
|
|
13
|
+
{
|
|
14
|
+
name: "columns",
|
|
15
|
+
type: "array",
|
|
16
|
+
label: "Link Columns",
|
|
17
|
+
maxRows: 5,
|
|
18
|
+
admin: {
|
|
19
|
+
initCollapsed: true,
|
|
20
|
+
description: "Add columns of links (e.g., Solutions, Resources, Company)",
|
|
21
|
+
},
|
|
22
|
+
fields: [
|
|
23
|
+
{
|
|
24
|
+
name: "title",
|
|
25
|
+
type: "text",
|
|
26
|
+
required: true,
|
|
27
|
+
label: "Column Title",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "links",
|
|
31
|
+
type: "array",
|
|
32
|
+
label: "Links",
|
|
33
|
+
maxRows: 10,
|
|
34
|
+
fields: [
|
|
35
|
+
link({
|
|
36
|
+
appearances: false,
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
39
|
+
admin: {
|
|
40
|
+
initCollapsed: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
// Social Links
|
|
46
|
+
{
|
|
47
|
+
name: "socialLinks",
|
|
48
|
+
type: "group",
|
|
49
|
+
label: "Social Links",
|
|
50
|
+
admin: {
|
|
51
|
+
description: "Add your social media profile URLs",
|
|
52
|
+
},
|
|
53
|
+
fields: [
|
|
54
|
+
{
|
|
55
|
+
name: "twitter",
|
|
56
|
+
type: "text",
|
|
57
|
+
label: "X (Twitter)",
|
|
58
|
+
admin: {
|
|
59
|
+
placeholder: "https://x.com/yourhandle",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "instagram",
|
|
64
|
+
type: "text",
|
|
65
|
+
label: "Instagram",
|
|
66
|
+
admin: {
|
|
67
|
+
placeholder: "https://instagram.com/yourhandle",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "linkedin",
|
|
72
|
+
type: "text",
|
|
73
|
+
label: "LinkedIn",
|
|
74
|
+
admin: {
|
|
75
|
+
placeholder: "https://linkedin.com/company/yourcompany",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "github",
|
|
80
|
+
type: "text",
|
|
81
|
+
label: "GitHub",
|
|
82
|
+
admin: {
|
|
83
|
+
placeholder: "https://github.com/yourorg",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "youtube",
|
|
88
|
+
type: "text",
|
|
89
|
+
label: "YouTube",
|
|
90
|
+
admin: {
|
|
91
|
+
placeholder: "https://youtube.com/@yourchannel",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
// Newsletter Section
|
|
97
|
+
{
|
|
98
|
+
name: "newsletter",
|
|
99
|
+
type: "group",
|
|
100
|
+
label: "Newsletter",
|
|
101
|
+
admin: {
|
|
102
|
+
description: "Configure the newsletter signup section",
|
|
103
|
+
},
|
|
104
|
+
fields: [
|
|
105
|
+
{
|
|
106
|
+
name: "enabled",
|
|
107
|
+
type: "checkbox",
|
|
108
|
+
label: "Enable Newsletter Signup",
|
|
109
|
+
defaultValue: true,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "title",
|
|
113
|
+
type: "text",
|
|
114
|
+
label: "Title",
|
|
115
|
+
defaultValue: "Newsletter",
|
|
116
|
+
admin: {
|
|
117
|
+
condition: (_, siblingData) => siblingData?.enabled,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "description",
|
|
122
|
+
type: "textarea",
|
|
123
|
+
label: "Description",
|
|
124
|
+
defaultValue: "Stay up to date with the latest updates and news.",
|
|
125
|
+
admin: {
|
|
126
|
+
condition: (_, siblingData) => siblingData?.enabled,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "buttonText",
|
|
131
|
+
type: "text",
|
|
132
|
+
label: "Button Text",
|
|
133
|
+
defaultValue: "Subscribe",
|
|
134
|
+
admin: {
|
|
135
|
+
condition: (_, siblingData) => siblingData?.enabled,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "placeholder",
|
|
140
|
+
type: "text",
|
|
141
|
+
label: "Email Placeholder",
|
|
142
|
+
defaultValue: "Enter your email",
|
|
143
|
+
admin: {
|
|
144
|
+
condition: (_, siblingData) => siblingData?.enabled,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
// Copyright and Bottom Bar
|
|
150
|
+
{
|
|
151
|
+
name: "copyrightText",
|
|
152
|
+
type: "text",
|
|
153
|
+
label: "Copyright Text",
|
|
154
|
+
defaultValue: "{{projectName}}",
|
|
155
|
+
admin: {
|
|
156
|
+
description: "Company name for copyright (year is added automatically)",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "bottomLinks",
|
|
161
|
+
type: "array",
|
|
162
|
+
label: "Bottom Bar Links",
|
|
163
|
+
maxRows: 4,
|
|
164
|
+
admin: {
|
|
165
|
+
description: "Links shown in the bottom bar (e.g., Contact Support, Privacy Policy)",
|
|
166
|
+
initCollapsed: true,
|
|
167
|
+
},
|
|
168
|
+
fields: [
|
|
169
|
+
link({
|
|
170
|
+
appearances: false,
|
|
171
|
+
}),
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
hooks: {
|
|
176
|
+
afterChange: [revalidateFooter],
|
|
177
|
+
},
|
|
178
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GlobalAfterChangeHook } from "payload"
|
|
2
|
+
|
|
3
|
+
import { revalidateTag } from "next/cache"
|
|
4
|
+
|
|
5
|
+
export const revalidateFooter: GlobalAfterChangeHook = ({ doc, req: { payload, context } }) => {
|
|
6
|
+
if (!context.disableRevalidate) {
|
|
7
|
+
payload.logger.info("Revalidating footer")
|
|
8
|
+
|
|
9
|
+
revalidateTag("global_footer")
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return doc
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Footer } from "./config"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import type { Header } from "@/payload-types"
|
|
3
|
+
import { type RowLabelProps, useRowLabel } from "@payloadcms/ui"
|
|
4
|
+
|
|
5
|
+
export const RowLabel: React.FC<RowLabelProps> = () => {
|
|
6
|
+
const data = useRowLabel<NonNullable<Header["navItems"]>[number]>()
|
|
7
|
+
|
|
8
|
+
const itemLabel = data?.data?.label
|
|
9
|
+
const itemType = data?.data?.type === "megaMenu" ? "Mega Menu" : "Link"
|
|
10
|
+
const isRight = (data?.data?.position || "left") === "right"
|
|
11
|
+
const itemPosition = isRight ? "Right" : "Left"
|
|
12
|
+
const itemAppearance = isRight
|
|
13
|
+
? ` · ${(data?.data?.appearance || "button") === "button" ? "Button" : "Link"}`
|
|
14
|
+
: ""
|
|
15
|
+
|
|
16
|
+
const label = itemLabel
|
|
17
|
+
? `${data.rowNumber !== undefined ? data.rowNumber + 1 : ""}. ${itemLabel} — ${itemType} (${itemPosition}${itemAppearance})`
|
|
18
|
+
: "Row"
|
|
19
|
+
|
|
20
|
+
return <div>{label}</div>
|
|
21
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type { GlobalConfig } from "payload"
|
|
2
|
+
|
|
3
|
+
import { link } from "@/fields/link"
|
|
4
|
+
import { revalidateHeader } from "./hooks/revalidateHeader"
|
|
5
|
+
|
|
6
|
+
export const Header: GlobalConfig = {
|
|
7
|
+
slug: "header",
|
|
8
|
+
access: {
|
|
9
|
+
read: () => true,
|
|
10
|
+
},
|
|
11
|
+
fields: [
|
|
12
|
+
{
|
|
13
|
+
name: "navItems",
|
|
14
|
+
type: "array",
|
|
15
|
+
maxRows: 8,
|
|
16
|
+
admin: {
|
|
17
|
+
initCollapsed: true,
|
|
18
|
+
components: {
|
|
19
|
+
RowLabel: "@/Header/RowLabel#RowLabel",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
fields: [
|
|
23
|
+
{
|
|
24
|
+
name: "type",
|
|
25
|
+
type: "select",
|
|
26
|
+
defaultValue: "link",
|
|
27
|
+
options: [
|
|
28
|
+
{ label: "Simple Link", value: "link" },
|
|
29
|
+
{ label: "Mega Menu", value: "megaMenu" },
|
|
30
|
+
],
|
|
31
|
+
admin: {
|
|
32
|
+
description: "Choose between a simple link or a mega menu dropdown",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "label",
|
|
37
|
+
type: "text",
|
|
38
|
+
required: true,
|
|
39
|
+
label: "Nav Item Label",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "position",
|
|
43
|
+
type: "select",
|
|
44
|
+
defaultValue: "left",
|
|
45
|
+
options: [
|
|
46
|
+
{ label: "Left (Near Logo)", value: "left" },
|
|
47
|
+
{ label: "Right (CTA Section)", value: "right" },
|
|
48
|
+
],
|
|
49
|
+
admin: {
|
|
50
|
+
description: "Control where this nav item appears in the header",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "appearance",
|
|
55
|
+
type: "select",
|
|
56
|
+
defaultValue: "button",
|
|
57
|
+
options: [
|
|
58
|
+
{ label: "Button", value: "button" },
|
|
59
|
+
{ label: "Link", value: "link" },
|
|
60
|
+
],
|
|
61
|
+
admin: {
|
|
62
|
+
description: "How this item should be displayed",
|
|
63
|
+
condition: (_, siblingData) => siblingData?.position === "right",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
// Simple link fields
|
|
67
|
+
link({
|
|
68
|
+
appearances: false,
|
|
69
|
+
disableLabel: true,
|
|
70
|
+
overrides: {
|
|
71
|
+
admin: {
|
|
72
|
+
condition: (_, siblingData) => siblingData?.type === "link",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
// Mega menu fields
|
|
77
|
+
{
|
|
78
|
+
name: "megaMenuColumns",
|
|
79
|
+
type: "array",
|
|
80
|
+
label: "Menu Columns",
|
|
81
|
+
maxRows: 4,
|
|
82
|
+
admin: {
|
|
83
|
+
condition: (_, siblingData) => siblingData?.type === "megaMenu",
|
|
84
|
+
},
|
|
85
|
+
fields: [
|
|
86
|
+
{
|
|
87
|
+
name: "columnLabel",
|
|
88
|
+
type: "text",
|
|
89
|
+
label: "Column Heading",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "columnDescription",
|
|
93
|
+
type: "textarea",
|
|
94
|
+
label: "Column Description",
|
|
95
|
+
admin: {
|
|
96
|
+
description: "Optional description shown below the column heading",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "items",
|
|
101
|
+
type: "array",
|
|
102
|
+
label: "Menu Items",
|
|
103
|
+
maxRows: 8,
|
|
104
|
+
fields: [
|
|
105
|
+
{
|
|
106
|
+
name: "label",
|
|
107
|
+
type: "text",
|
|
108
|
+
required: true,
|
|
109
|
+
label: "Item Label",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "description",
|
|
113
|
+
type: "text",
|
|
114
|
+
label: "Item Description",
|
|
115
|
+
admin: {
|
|
116
|
+
description: "Short description shown below the label",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "icon",
|
|
121
|
+
type: "select",
|
|
122
|
+
label: "Icon",
|
|
123
|
+
options: [
|
|
124
|
+
{ label: "None", value: "none" },
|
|
125
|
+
{ label: "Layout", value: "layout" },
|
|
126
|
+
{ label: "Dollar Sign", value: "dollarSign" },
|
|
127
|
+
{ label: "Search", value: "search" },
|
|
128
|
+
{ label: "Settings", value: "settings" },
|
|
129
|
+
{ label: "Zap", value: "zap" },
|
|
130
|
+
{ label: "Layers", value: "layers" },
|
|
131
|
+
{ label: "Users", value: "users" },
|
|
132
|
+
{ label: "Building", value: "building" },
|
|
133
|
+
{ label: "Globe", value: "globe" },
|
|
134
|
+
{ label: "Store", value: "store" },
|
|
135
|
+
{ label: "Rocket", value: "rocket" },
|
|
136
|
+
{ label: "Target", value: "target" },
|
|
137
|
+
{ label: "BarChart", value: "barChart" },
|
|
138
|
+
{ label: "Shield", value: "shield" },
|
|
139
|
+
{ label: "Database", value: "database" },
|
|
140
|
+
],
|
|
141
|
+
defaultValue: "none",
|
|
142
|
+
},
|
|
143
|
+
link({
|
|
144
|
+
appearances: false,
|
|
145
|
+
disableLabel: true,
|
|
146
|
+
}),
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
// Featured section for mega menu
|
|
152
|
+
{
|
|
153
|
+
name: "featuredItem",
|
|
154
|
+
type: "group",
|
|
155
|
+
label: "Featured Section",
|
|
156
|
+
admin: {
|
|
157
|
+
condition: (_, siblingData) => siblingData?.type === "megaMenu",
|
|
158
|
+
description: "Optional featured content shown in the mega menu",
|
|
159
|
+
},
|
|
160
|
+
fields: [
|
|
161
|
+
{
|
|
162
|
+
name: "enabled",
|
|
163
|
+
type: "checkbox",
|
|
164
|
+
label: "Show Featured Section",
|
|
165
|
+
defaultValue: false,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "heading",
|
|
169
|
+
type: "text",
|
|
170
|
+
label: "Featured Heading",
|
|
171
|
+
admin: {
|
|
172
|
+
condition: (_, siblingData) => siblingData?.enabled,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "description",
|
|
177
|
+
type: "textarea",
|
|
178
|
+
label: "Featured Description",
|
|
179
|
+
admin: {
|
|
180
|
+
condition: (_, siblingData) => siblingData?.enabled,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "image",
|
|
185
|
+
type: "upload",
|
|
186
|
+
relationTo: "media",
|
|
187
|
+
label: "Featured Image",
|
|
188
|
+
admin: {
|
|
189
|
+
condition: (_, siblingData) => siblingData?.enabled,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
link({
|
|
193
|
+
appearances: false,
|
|
194
|
+
overrides: {
|
|
195
|
+
admin: {
|
|
196
|
+
condition: (_, siblingData) => siblingData?.enabled,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
}),
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
hooks: {
|
|
206
|
+
afterChange: [revalidateHeader],
|
|
207
|
+
},
|
|
208
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GlobalAfterChangeHook } from "payload"
|
|
2
|
+
|
|
3
|
+
import { revalidateTag } from "next/cache"
|
|
4
|
+
|
|
5
|
+
export const revalidateHeader: GlobalAfterChangeHook = ({ doc, req: { payload, context } }) => {
|
|
6
|
+
if (!context.disableRevalidate) {
|
|
7
|
+
payload.logger.info("Revalidating header")
|
|
8
|
+
|
|
9
|
+
revalidateTag("global_header")
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return doc
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Header } from "./config"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { seed } from "@/endpoints/seed"
|
|
2
|
+
import config from "@payload-config"
|
|
3
|
+
import { headers } from "next/headers"
|
|
4
|
+
import { createLocalReq, getPayload } from "payload"
|
|
5
|
+
|
|
6
|
+
export const maxDuration = 60 // This function can run for a maximum of 60 seconds
|
|
7
|
+
|
|
8
|
+
export async function POST(): Promise<Response> {
|
|
9
|
+
const payload = await getPayload({ config })
|
|
10
|
+
const requestHeaders = await headers()
|
|
11
|
+
|
|
12
|
+
// Authenticate by passing request headers
|
|
13
|
+
const { user } = await payload.auth({ headers: requestHeaders })
|
|
14
|
+
|
|
15
|
+
if (!user) {
|
|
16
|
+
return new Response("Action forbidden.", { status: 403 })
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
// Create a Payload request object to pass to the Local API for transactions
|
|
21
|
+
// At this point you should pass in a user, locale, and any other context you need for the Local API
|
|
22
|
+
const payloadReq = await createLocalReq({ user }, payload)
|
|
23
|
+
|
|
24
|
+
await seed({ payload, req: payloadReq })
|
|
25
|
+
|
|
26
|
+
return Response.json({ success: true })
|
|
27
|
+
} catch (e) {
|
|
28
|
+
payload.logger.error({ err: e, message: "Error seeding data" })
|
|
29
|
+
return new Response("Error seeding data.", { status: 500 })
|
|
30
|
+
}
|
|
31
|
+
}
|
package/templates/marketing/payload/src/app/(payload)/admin/[[...segments]]/not-found.tsx.hbs
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { importMap } from '../importMap.js'
|
|
1
|
+
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
|
2
|
+
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
|
4
3
|
import type { Metadata } from 'next'
|
|
5
4
|
|
|
5
|
+
import config from '@payload-config'
|
|
6
|
+
import { NotFoundPage, generatePageMetadata } from '@payloadcms/next/views'
|
|
7
|
+
import { importMap } from '../importMap'
|
|
8
|
+
|
|
6
9
|
type Args = {
|
|
7
|
-
params: Promise<{
|
|
8
|
-
|
|
10
|
+
params: Promise<{
|
|
11
|
+
segments: string[]
|
|
12
|
+
}>
|
|
13
|
+
searchParams: Promise<{
|
|
14
|
+
[key: string]: string | string[]
|
|
15
|
+
}>
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
|
|
12
19
|
generatePageMetadata({ config, params, searchParams })
|
|
13
20
|
|
|
14
21
|
const NotFound = ({ params, searchParams }: Args) =>
|
|
15
|
-
NotFoundPage({ config,
|
|
22
|
+
NotFoundPage({ config, params, searchParams, importMap })
|
|
16
23
|
|
|
17
24
|
export default NotFound
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { importMap } from '../importMap.js'
|
|
1
|
+
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
|
2
|
+
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
|
4
3
|
import type { Metadata } from 'next'
|
|
5
4
|
|
|
5
|
+
import config from '@payload-config'
|
|
6
|
+
import { RootPage, generatePageMetadata } from '@payloadcms/next/views'
|
|
7
|
+
import { importMap } from '../importMap'
|
|
8
|
+
|
|
6
9
|
type Args = {
|
|
7
|
-
params: Promise<{
|
|
8
|
-
|
|
10
|
+
params: Promise<{
|
|
11
|
+
segments: string[]
|
|
12
|
+
}>
|
|
13
|
+
searchParams: Promise<{
|
|
14
|
+
[key: string]: string | string[]
|
|
15
|
+
}>
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
|
|
12
19
|
generatePageMetadata({ config, params, searchParams })
|
|
13
20
|
|
|
14
21
|
const Page = ({ params, searchParams }: Args) =>
|
|
15
|
-
RootPage({ config,
|
|
22
|
+
RootPage({ config, params, searchParams, importMap })
|
|
16
23
|
|
|
17
24
|
export default Page
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
1
|
+
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
|
2
|
+
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
|
3
|
+
import config from '@payload-config'
|
|
4
|
+
import '@payloadcms/next/css'
|
|
5
|
+
import {
|
|
6
|
+
REST_DELETE,
|
|
7
|
+
REST_GET,
|
|
8
|
+
REST_OPTIONS,
|
|
9
|
+
REST_PATCH,
|
|
10
|
+
REST_POST,
|
|
11
|
+
REST_PUT,
|
|
12
|
+
} from '@payloadcms/next/routes'
|
|
4
13
|
|
|
5
|
-
export const GET = REST_GET(config
|
|
6
|
-
export const POST = REST_POST(config
|
|
7
|
-
export const DELETE = REST_DELETE(config
|
|
8
|
-
export const PATCH = REST_PATCH(config
|
|
14
|
+
export const GET = REST_GET(config)
|
|
15
|
+
export const POST = REST_POST(config)
|
|
16
|
+
export const DELETE = REST_DELETE(config)
|
|
17
|
+
export const PATCH = REST_PATCH(config)
|
|
18
|
+
export const PUT = REST_PUT(config)
|
|
9
19
|
export const OPTIONS = REST_OPTIONS(config)
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
1
|
+
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
|
2
|
+
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
|
3
|
+
import config from '@payload-config'
|
|
4
|
+
import { GRAPHQL_POST, REST_OPTIONS } from '@payloadcms/next/routes'
|
|
4
5
|
|
|
5
|
-
export const POST = GRAPHQL_POST(config
|
|
6
|
+
export const POST = GRAPHQL_POST(config)
|
|
7
|
+
|
|
8
|
+
export const OPTIONS = REST_OPTIONS(config)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
|
2
|
+
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
|
3
|
+
import config from '@payload-config'
|
|
4
|
+
import '@payloadcms/next/css'
|
|
2
5
|
import { GRAPHQL_PLAYGROUND_GET } from '@payloadcms/next/routes'
|
|
3
|
-
import { importMap } from '../../importMap.js'
|
|
4
6
|
|
|
5
|
-
export const GET = GRAPHQL_PLAYGROUND_GET(config
|
|
7
|
+
export const GET = GRAPHQL_PLAYGROUND_GET(config)
|
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
|
2
|
+
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
|
3
|
+
import config from '@payload-config'
|
|
3
4
|
import '@payloadcms/next/css'
|
|
4
5
|
import { RootLayout, handleServerFunctions } from '@payloadcms/next/layouts'
|
|
5
6
|
import type { ServerFunctionClient } from 'payload'
|
|
7
|
+
import type React from 'react'
|
|
8
|
+
|
|
6
9
|
import { importMap } from './admin/importMap.js'
|
|
7
10
|
import './custom.scss'
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
type Args = {
|
|
13
|
+
children: React.ReactNode
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
const serverFunction: ServerFunctionClient = async
|
|
16
|
+
const serverFunction: ServerFunctionClient = async (args) => {
|
|
14
17
|
'use server'
|
|
15
|
-
return handleServerFunctions({
|
|
18
|
+
return handleServerFunctions({
|
|
19
|
+
...args,
|
|
20
|
+
config,
|
|
21
|
+
importMap,
|
|
22
|
+
})
|
|
16
23
|
}
|
|
17
24
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const Layout = ({ children }: Args) => (
|
|
26
|
+
<RootLayout config={config} importMap={importMap} serverFunction={serverFunction}>
|
|
27
|
+
{children}
|
|
28
|
+
</RootLayout>
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
export default Layout
|