feat: payload cms

This commit is contained in:
2026-02-26 01:32:22 +01:00
parent 1963a93123
commit 7d65237ee9
67 changed files with 3179 additions and 760 deletions

View File

@@ -22,6 +22,8 @@ import { StrikethroughFeatureClient as StrikethroughFeatureClient_e70f5e05f09f93
import { UnderlineFeatureClient as UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { BoldFeatureClient as BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { ItalicFeatureClient as ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { default as default_9ed509b5e5f7d08a16335393f27586cc } from '../../../src/payload/components/Icon'
import { default as default_5470ea90f7a8fd882c2fe59ff2b1c5b9 } from '../../../src/payload/components/Logo'
import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@payloadcms/next/rsc'
export const importMap = {
@@ -49,5 +51,7 @@ export const importMap = {
"@payloadcms/richtext-lexical/client#UnderlineFeatureClient": UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#BoldFeatureClient": BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#ItalicFeatureClient": ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"/src/payload/components/Icon#default": default_9ed509b5e5f7d08a16335393f27586cc,
"/src/payload/components/Logo#default": default_5470ea90f7a8fd882c2fe59ff2b1c5b9,
"@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1
}

View File

@@ -1 +1,151 @@
/* Custom Payload CMS admin styles can go here. Do not import payloadcms/ui/scss/app.scss as it is handled by @payloadcms/next/css */
/* =================================================================
KLZ Cables Payload Admin Theme
Strictly follows docs/STYLEGUIDE.md & tailwind.config.cjs
IMPORTANT: We use `html` selector (not `:root`) because Payload's
own CSS defines variables on `:root` and loads AFTER this file.
`html` has higher specificity than `:root`, so our values win.
================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
/* =================================================================
COLOR OVERRIDES
Payload internally maps:
--theme-elevation-* → --color-base-*
--theme-success-* → --color-success-*
We override the SOURCE variables on `html` to beat Payload's `:root`.
================================================================= */
html {
/* ---------------------------------------------------------------
KLZ Primary Blue (#011dff) → Buttons, links, active states
--------------------------------------------------------------- */
--color-success-50: #eef0ff !important;
--color-success-100: #dfe2ff !important;
--color-success-150: #cdd2ff !important;
--color-success-200: #b8bfff !important;
--color-success-250: #a0a9ff !important;
--color-success-300: #8892ff !important;
--color-success-350: #707bff !important;
--color-success-400: #5564ff !important;
--color-success-450: #3a4dff !important;
--color-success-500: #011dff !important;
/* KLZ Primary */
--color-success-550: #0119e6 !important;
--color-success-600: #0116cc !important;
--color-success-650: #0112b3 !important;
--color-success-700: #000e99 !important;
--color-success-750: #000b80 !important;
--color-success-800: #000866 !important;
--color-success-850: #00054d !important;
--color-success-900: #000333 !important;
--color-success-950: #00011a !important;
/* ---------------------------------------------------------------
KLZ "Foundation Neutrals" → Backgrounds, cards, borders, text
Based on tailwind.config.cjs: neutral.light=#fff,
neutral.DEFAULT=#f8f9fa, neutral.dark=#263336, neutral.black=#0a0a0a
text.primary=#1a1a1a, text.secondary=#6c757d, text.light=#adb5bd
--------------------------------------------------------------- */
--color-base-0: #ffffff !important;
--color-base-50: #f8f9fa !important;
--color-base-100: #f1f3f5 !important;
--color-base-150: #e9ecef !important;
--color-base-200: #dee2e6 !important;
--color-base-250: #ced4da !important;
--color-base-300: #adb5bd !important;
--color-base-350: #9ba3ab !important;
--color-base-400: #868e96 !important;
--color-base-450: #6c757d !important;
--color-base-500: #5c636a !important;
--color-base-550: #4d5358 !important;
--color-base-600: #3d4246 !important;
--color-base-650: #343a40 !important;
--color-base-700: #2b3035 !important;
--color-base-750: #263336 !important;
--color-base-800: #212529 !important;
--color-base-850: #1a1a1a !important;
--color-base-900: #121212 !important;
--color-base-950: #0a0a0a !important;
--color-base-1000: #000000 !important;
/* Typography */
--font-body: 'Inter', system-ui, -apple-system, sans-serif !important;
--font-headings: 'Inter', system-ui, -apple-system, sans-serif !important;
}
/* Base Body Application */
body {
font-family: var(--font-body) !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* =================================================================
Login / Setup Page
================================================================= */
.template-default.template-default--has-bg {
background: radial-gradient(circle at top right, #e6ebf5 0%, #f8f9fa 60%, #f3f4f6 100%) !important;
}
.login__wrap,
.create-first-user__wrap {
border-top: none !important;
padding: 3rem !important;
background: rgba(255, 255, 255, 0.85) !important;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid var(--theme-elevation-150) !important;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
border-radius: 1.5rem !important;
}
/* =================================================================
Buttons override Payload's dark buttons with KLZ Blue
Payload uses .btn--style-primary { --bg-color: var(--theme-elevation-800) }
which makes all primary buttons near-black. We override to KLZ Blue.
================================================================= */
.btn--style-primary,
.btn--style-pill {
--bg-color: #011dff !important;
--color: #ffffff !important;
--hover-bg: #0116cc !important;
--hover-color: #ffffff !important;
}
.btn--style-primary.btn--disabled,
.btn--style-pill.btn--disabled {
--bg-color: #b8bfff !important;
--color: #ffffff !important;
--hover-bg: #b8bfff !important;
}
/* Sidebar Active Items */
[class*="nav-group__link--active"],
[class*="nav__link--active"] {
--theme-elevation-800: #011dff !important;
color: #011dff !important;
border-left-color: #011dff !important;
}
.btn--style-secondary {
--box-shadow: inset 0 0 0 1px #011dff !important;
--color: #011dff !important;
--hover-color: #0116cc !important;
--hover-box-shadow: inset 0 0 0 1px #0116cc !important;
}
/* =================================================================
Logo & Icon
================================================================= */
.klz-admin-logo,
.klz-admin-icon {
display: block !important;
visibility: visible !important;
opacity: 1 !important;
height: 32px !important;
width: auto !important;
max-width: 100% !important;
object-fit: contain !important;
}

View File

@@ -3,6 +3,7 @@ import { Container, Badge, Heading } from '@/components/ui';
import { getTranslations, setRequestLocale } from 'next-intl/server';
import { Metadata } from 'next';
import { getPageBySlug, getAllPages } from '@/lib/pages';
import { mapSlugToFileSlug, mapFileSlugToTranslated } from '@/lib/slugs';
import PayloadRichText from '@/components/PayloadRichText';
import { SITE_URL } from '@/lib/schema';
import TrackedLink from '@/components/analytics/TrackedLink';
@@ -20,15 +21,19 @@ export async function generateMetadata({ params }: PageProps): Promise<Metadata>
if (!pageData) return {};
const fileSlug = await mapSlugToFileSlug(slug, locale);
const deSlug = await mapFileSlugToTranslated(fileSlug, 'de');
const enSlug = await mapFileSlugToTranslated(fileSlug, 'en');
return {
title: pageData.frontmatter.title,
description: pageData.frontmatter.excerpt || '',
alternates: {
canonical: `${SITE_URL}/${locale}/${slug}`,
languages: {
de: `${SITE_URL}/de/${slug}`,
en: `${SITE_URL}/en/${slug}`,
'x-default': `${SITE_URL}/en/${slug}`,
de: `${SITE_URL}/de/${deSlug}`,
en: `${SITE_URL}/en/${enSlug}`,
'x-default': `${SITE_URL}/en/${enSlug}`,
},
},
openGraph: {
@@ -54,6 +59,16 @@ export default async function StandardPage({ params }: PageProps) {
notFound();
}
// Full-bleed pages render blocks edge-to-edge without the generic article wrapper
if (pageData.frontmatter.layout === 'fullBleed') {
return (
<div className="flex flex-col min-h-screen">
<PayloadRichText data={pageData.content} className="" />
</div>
);
}
// Default article layout with hero, content, and support CTA
return (
<div className="flex flex-col min-h-screen bg-white">
{/* Hero Section */}

View File

@@ -1,5 +1,5 @@
import { ImageResponse } from 'next/og';
import { getProductBySlug } from '@/lib/mdx';
import { getProductBySlug } from '@/lib/products';
import { getTranslations } from 'next-intl/server';
import { OGImageTemplate } from '@/components/OGImageTemplate';
import { NextRequest } from 'next/server';

View File

@@ -67,6 +67,9 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
alt={featuredPost.frontmatter.title}
fill
className="absolute inset-0 w-full h-full object-cover opacity-40 md:opacity-60"
style={{
objectPosition: `${featuredPost.frontmatter.focalX ?? 50}% ${featuredPost.frontmatter.focalY ?? 50}%`,
}}
sizes="100vw"
priority
/>
@@ -168,6 +171,9 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
alt={post.frontmatter.title}
fill
className="w-full h-full object-cover transition-transform duration-1000 group-hover:scale-110"
style={{
objectPosition: `${post.frontmatter.focalX ?? 50}% ${post.frontmatter.focalY ?? 50}%`,
}}
sizes="(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw"
/>
<div className="absolute inset-0 image-overlay-gradient opacity-0 group-hover:opacity-100 transition-opacity duration-500" />
@@ -192,10 +198,10 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
</span>
{(new Date(post.frontmatter.date) > new Date() ||
post.frontmatter.public === false) && (
<span className="px-1.5 py-0.5 border border-current rounded-sm text-[9px] md:text-xs">
Draft
</span>
)}
<span className="px-1.5 py-0.5 border border-current rounded-sm text-[9px] md:text-xs">
Draft
</span>
)}
</div>
<h3 className="text-lg md:text-2xl font-bold text-primary mb-3 md:mb-6 group-hover:text-accent-dark transition-colors line-clamp-3 md:line-clamp-4 leading-tight">
{post.frontmatter.title}

View File

@@ -7,7 +7,7 @@ import RelatedProducts from '@/components/RelatedProducts';
import DatasheetDownload from '@/components/DatasheetDownload';
import { Badge, Card, Container, Heading, Section } from '@/components/ui';
import { getDatasheetPath } from '@/lib/datasheets';
import { getAllProducts, getProductBySlug } from '@/lib/mdx';
import { getAllProducts, getProductBySlug } from '@/lib/products';
import { mapFileSlugToTranslated, mapSlugToFileSlug } from '@/lib/slugs';
import { Metadata } from 'next';
import { getTranslations, setRequestLocale } from 'next-intl/server';

View File

@@ -94,6 +94,16 @@ export async function sendContactFormAction(formData: FormData) {
logger.info('Notification email sent successfully', {
messageId: notificationResult.messageId,
});
} else {
logger.error('Notification email FAILED', {
error: notificationResult.error,
subject: notificationSubject,
email,
});
services.errors.captureException(
new Error(`Notification email failed: ${notificationResult.error}`),
{ action: 'sendContactFormAction_notification', email },
);
}
// 2b. Send confirmation to Customer (branded as KLZ Cables)
@@ -115,6 +125,16 @@ export async function sendContactFormAction(formData: FormData) {
logger.info('Confirmation email sent successfully', {
messageId: confirmationResult.messageId,
});
} else {
logger.error('Confirmation email FAILED', {
error: confirmationResult.error,
subject: confirmationSubject,
to: email,
});
services.errors.captureException(
new Error(`Confirmation email failed: ${confirmationResult.error}`),
{ action: 'sendContactFormAction_confirmation', email },
);
}
// Notify via Gotify (Internal)

View File

@@ -1,6 +1,6 @@
import { config } from '@/lib/config';
import { MetadataRoute } from 'next';
import { getAllProductsMetadata } from '@/lib/mdx';
import { getAllProductsMetadata } from '@/lib/products';
import { getAllPostsMetadata } from '@/lib/blog';
import { getAllPagesMetadata } from '@/lib/pages';
import { mapFileSlugToTranslated } from '@/lib/slugs';