Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

/apps/studio/ @supabase/Dashboard

/apps/cms/ @supabase/marketing

/apps/www/ @supabase/marketing
/apps/www/public/images/blog @supabase/marketing
/apps/www/lib/redirects.js
Expand Down
2 changes: 0 additions & 2 deletions apps/cms/.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ S3_SECRET_ACCESS_KEY=850181e4652dd023b7a98c58ae0d2d34bd487ee0cc3254aed6eda373074
S3_REGION=local
S3_ENDPOINT=http://127.0.0.1:34321/storage/v1/s3

BLOG_APP_URL=http://localhost:3000
NEXT_PUBLIC_SERVER_URL=http://localhost:3000/blog
CRON_SECRET=secret
PREVIEW_SECRET=secret
20 changes: 15 additions & 5 deletions apps/cms/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@ const redirects = async () => {
return redirects
}

const NEXT_PUBLIC_SERVER_URL = process.env.VERCEL_PROJECT_PRODUCTION_URL
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
: undefined || process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3000'
const WWW_SITE_ORIGIN =
process.env.NEXT_PUBLIC_VERCEL_ENV === 'production'
? 'https://supabase.com'
: process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL &&
typeof process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL === 'string'
? `https://${process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL.replace('cms-git-', 'zone-www-dot-com-git-')}`
: 'http://localhost:3000'

/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
remotePatterns: [
...[NEXT_PUBLIC_SERVER_URL /* 'https://example.com' */].map((item) => {
...[WWW_SITE_ORIGIN /* 'https://example.com' */].map((item) => {
const url = new URL(item)

return {
hostname: url.hostname,
protocol: url.protocol.replace(':', ''),
protocol: url.protocol?.replace(':', ''),
}
}),
],
Expand All @@ -43,6 +47,12 @@ const nextConfig = {
// We are already running linting via GH action, this will skip linting during production build on Vercel
ignoreDuringBuilds: true,
},
experimental: {
// Ensure compatibility with Turbopack and Sharp
serverComponentsExternalPackages: ['sharp'],
},
// Configure Sharp as an external package for server-side rendering
serverExternalPackages: ['sharp'],
}

export default withPayload(nextConfig, { devBundleServerPackages: false })
41 changes: 21 additions & 20 deletions apps/cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,26 @@
"typecheck_IGNORED": "tsc --noEmit"
},
"dependencies": {
"@payloadcms/admin-bar": "^3.50.0",
"@payloadcms/db-postgres": "^3.50.0",
"@payloadcms/live-preview-react": "^3.50.0",
"@payloadcms/next": "3.50.0",
"@payloadcms/payload-cloud": "3.50.0",
"@payloadcms/plugin-form-builder": "3.50.0",
"@payloadcms/plugin-nested-docs": "3.50.0",
"@payloadcms/plugin-seo": "3.50.0",
"@payloadcms/richtext-lexical": "3.50.0",
"@payloadcms/storage-s3": "3.50.0",
"@payloadcms/ui": "3.50.0",
"@payloadcms/admin-bar": "^3.52.0",
"@payloadcms/db-postgres": "^3.52.0",
"@payloadcms/live-preview-react": "^3.52.0",
"@payloadcms/next": "3.52.0",
"@payloadcms/payload-cloud": "3.52.0",
"@payloadcms/plugin-form-builder": "3.52.0",
"@payloadcms/plugin-nested-docs": "3.52.0",
"@payloadcms/plugin-seo": "3.52.0",
"@payloadcms/richtext-lexical": "3.52.0",
"@payloadcms/storage-s3": "3.52.0",
"@payloadcms/ui": "3.52.0",
"@radix-ui/react-checkbox": "^1.3.2",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.2.3",
"@types/node": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"class-variance-authority": "^0.7.1",
"clsx": "^1.2.1",
"clsx": "^2.1.1",
"common": "workspace:*",
"config": "workspace:*",
"cross-env": "^7.0.3",
Expand All @@ -45,19 +48,17 @@
"image-size": "2.0.2",
"lucide-react": "^0.511.0",
"next": "catalog:",
"payload": "3.50.0",
"payload": "3.52.0",
"pg": "^8.16.3",
"prism-react-renderer": "^2.3.1",
"react": "catalog:",
"react-dom": "catalog:",
"sharp": "0.32.6",
"tailwind-merge": "^1.13.2"
},
"devDependencies": {
"@types/node": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"tailwind-merge": "^1.13.2",
"tsx": "^4.19.3",
"typescript": "5.7.3"
"typescript": "~5.5.0"
},
"externals": {
"sharp": "commonjs sharp"
}
}
34 changes: 29 additions & 5 deletions apps/cms/src/blocks/Code/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,40 @@ export const Code: Block = {
defaultValue: 'typescript',
options: [
{
label: 'Typescript',
value: 'typescript',
label: 'SQL',
value: 'sql',
},
{
label: 'JSON',
value: 'json',
},
{
label: 'bash',
value: 'bash',
},
{
label: 'Javascript',
value: 'javascript',
value: 'js',
},
{
label: 'Typescript',
value: 'ts',
},
{
label: 'tsx',
value: 'tsx',
},
{
label: 'Python',
value: 'py',
},
{
label: 'kotlin',
value: 'kotlin',
},
{
label: 'CSS',
value: 'css',
label: 'yaml',
value: 'yaml',
},
],
},
Expand Down
35 changes: 31 additions & 4 deletions apps/cms/src/collections/Authors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const Authors: CollectionConfig = {
slug: 'authors',
admin: {
useAsTitle: 'author',
defaultColumns: ['author', 'position', 'author_id'],
},
access: {
read: () => true,
Expand All @@ -13,28 +14,54 @@ export const Authors: CollectionConfig = {
name: 'author',
type: 'text',
required: true,
label: 'Author Name',
index: true,
},
{
name: 'author_id',
type: 'text',
required: true,
unique: true,
label: 'Author ID',
admin: {
description: 'Unique identifier for the author',
},
},
{
name: 'username',
type: 'text',
label: 'Username',
admin: {
description: 'GitHub/social username',
},
},
{
name: 'position',
type: 'text',
label: 'Position',
},
{
name: 'company',
type: 'text',
label: 'Company',
admin: {
description: 'Company name (for external/guest authors)',
},
},
{
name: 'author_url',
type: 'text',
label: 'Profile URL',
admin: {
description: 'Link to GitHub, Twitter, LinkedIn, etc.',
},
},
{
name: 'author_image_url',
type: 'upload',
relationTo: 'media',
required: false,
},
{
name: 'username',
type: 'text',
label: 'Profile Image',
},
],
timestamps: true,
Expand Down
5 changes: 5 additions & 0 deletions apps/cms/src/collections/Categories.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import type { CollectionConfig } from 'payload'
import { isAdmin } from '../access/isAdmin'

export const Categories: CollectionConfig = {
slug: 'categories',
admin: {
useAsTitle: 'name',
},
access: {
create: isAdmin,
read: () => true,
update: isAdmin,
delete: isAdmin,
},
fields: [
{
name: 'name',
type: 'text',
required: true,
index: true,
},
],
timestamps: true,
Expand Down
21 changes: 13 additions & 8 deletions apps/cms/src/collections/Customers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
PreviewField,
} from '@payloadcms/plugin-seo/fields'
import { slugField } from '../../fields/slug/index.ts'
import { WWW_SITE_ORIGIN } from '../../utilities/constants.ts'

const industryOptions = [
{ label: 'Healthcare', value: 'healthcare' },
Expand Down Expand Up @@ -73,16 +74,20 @@ export const Customers: CollectionConfig = {
useAsTitle: 'name',
defaultColumns: ['name', 'slug', 'updatedAt'],
preview: (data) => {
const baseUrl = process.env.BLOG_APP_URL || 'http://localhost:3000'
const baseUrl = WWW_SITE_ORIGIN || 'http://localhost:3000'
const isDraft = data?._status === 'draft'
return `${baseUrl}/customers/${data?.slug}${isDraft ? '?preview=true' : ''}`
},
},
access: {
create: isAuthenticated,
delete: isAuthenticated,
read: isAnyone,
update: isAuthenticated,
// create: isAuthenticated,
// delete: isAuthenticated,
// read: isAnyone,
// update: isAuthenticated,
create: () => false,
delete: () => false,
read: () => false,
update: () => false,
},
defaultPopulate: {
name: true,
Expand Down Expand Up @@ -303,9 +308,9 @@ export const Customers: CollectionConfig = {
},
versions: {
drafts: {
autosave: {
interval: 100,
},
// autosave: {
// interval: 100,
// },
schedulePublish: true,
},
maxPerDoc: 50,
Expand Down
25 changes: 15 additions & 10 deletions apps/cms/src/collections/Events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
} from '@payloadcms/plugin-seo/fields'
import { slugField } from '../../fields/slug/index.ts'
import { timezoneOptions } from '../../utilities/timezones.ts'
import { WWW_SITE_ORIGIN } from '../../utilities/constants.ts'

const eventTypeOptions = [
{ label: 'Conference', value: 'conference' },
Expand All @@ -47,16 +48,20 @@ export const Events: CollectionConfig = {
useAsTitle: 'title',
defaultColumns: ['title', 'slug', 'updatedAt'],
preview: (data) => {
const baseUrl = process.env.BLOG_APP_URL || 'http://localhost:3000'
const isDraft = data?._status === 'draft'
return `${baseUrl}/events/${data?.slug}${isDraft ? '?preview=true' : ''}`
const baseUrl = WWW_SITE_ORIGIN || 'http://localhost:3000'
// Always use the preview route to ensure draft mode is enabled
return `${baseUrl}/api-v2/cms/preview?slug=${data?.slug}&path=events&secret=${process.env.PREVIEW_SECRET || 'secret'}`
},
},
access: {
create: isAuthenticated,
delete: isAuthenticated,
read: isAnyone,
update: isAuthenticated,
// create: isAuthenticated,
// delete: isAuthenticated,
// read: isAnyone,
// update: isAuthenticated,
create: () => false,
delete: () => false,
read: () => false,
update: () => false,
},
defaultPopulate: {
title: true,
Expand Down Expand Up @@ -393,9 +398,9 @@ export const Events: CollectionConfig = {
},
versions: {
drafts: {
autosave: {
interval: 100,
},
// autosave: {
// interval: 100,
// },
schedulePublish: true,
},
maxPerDoc: 50,
Expand Down
Loading
Loading