Compare commits

..

3 Commits

Author SHA1 Message Date
8652dd722e perf(ci): optimize pipeline via parallelization, caching and conditional audits
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🏗️ Build (push) Successful in 6m35s
Build & Deploy / 🧪 QA (push) Successful in 15m18s
Build & Deploy / 🚀 Deploy (push) Successful in 36s
Build & Deploy / 🧪 Smoke Test (push) Failing after 10s
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
2026-02-23 12:42:05 +01:00
5e48c75a83 fix(routing): resolve 404 on German product pages via rewrites and localized links
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 18s
Build & Deploy / 🧪 QA (push) Successful in 3m7s
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🏗️ Build (push) Has started running
2026-02-23 12:36:37 +01:00
50fc8a0554 fix(analytics): remove conflicting next config rewrite and enable proxy client
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 9s
Build & Deploy / 🧪 QA (push) Successful in 1m53s
Build & Deploy / 🏗️ Build (push) Successful in 7m35s
Build & Deploy / 🚀 Deploy (push) Successful in 37s
Build & Deploy / 🧪 Smoke Test (push) Successful in 1m8s
Build & Deploy / ⚡ Lighthouse (push) Successful in 3m25s
Build & Deploy / 🔔 Notify (push) Successful in 1s
2026-02-20 15:00:18 +01:00
60 changed files with 1347 additions and 1723 deletions

View File

@@ -10,31 +10,18 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Setup pnpm - name: Setup pnpm
uses: pnpm/action-setup@v3 uses: pnpm/action-setup@v3
with: with:
version: 10 version: 10
run_install: false run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: 🔐 Configure Private Registry - name: 🔐 Configure Private Registry
run: | run: |
REGISTRY="${{ vars.REGISTRY_HOST || 'npm.infra.mintel.me' }}" REGISTRY="${{ vars.REGISTRY_HOST || 'npm.infra.mintel.me' }}"
@@ -53,7 +40,4 @@ jobs:
run: pnpm build run: pnpm build
- name: ♿ Accessibility Check - name: ♿ Accessibility Check
run: pnpm check:a11y http://klz.localhost run: pnpm check:a11y
- name: ♿ WCAG Sitemap Audit
run: pnpm run check:wcag http://klz.localhost

View File

@@ -42,7 +42,7 @@ jobs:
run: | run: |
echo "Purging old build layers and dangling images..." echo "Purging old build layers and dangling images..."
docker image prune -f docker image prune -f
docker builder prune -f --filter "until=6h" docker builder prune -f --filter "until=24h"
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -154,26 +154,15 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 10
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'pnpm'
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 10
- name: 🔐 Registry Auth - name: 🔐 Registry Auth
run: | run: |
echo "@mintel:registry=https://${{ vars.REGISTRY_HOST || 'npm.infra.mintel.me' }}" > .npmrc echo "@mintel:registry=https://${{ vars.REGISTRY_HOST || 'npm.infra.mintel.me' }}" > .npmrc
@@ -192,7 +181,7 @@ jobs:
# ────────────────────────────────────────────────────────────────────────────── # ──────────────────────────────────────────────────────────────────────────────
build: build:
name: 🏗️ Build name: 🏗️ Build
needs: [prepare, qa] needs: [prepare]
if: needs.prepare.outputs.target != 'skip' if: needs.prepare.outputs.target != 'skip'
runs-on: docker runs-on: docker
container: container:
@@ -209,7 +198,6 @@ jobs:
with: with:
context: . context: .
push: true push: true
provenance: false
platforms: linux/arm64 platforms: linux/arm64
build-args: | build-args: |
NEXT_PUBLIC_BASE_URL=${{ needs.prepare.outputs.next_public_url }} NEXT_PUBLIC_BASE_URL=${{ needs.prepare.outputs.next_public_url }}
@@ -219,8 +207,8 @@ jobs:
UMAMI_API_ENDPOINT=${{ secrets.UMAMI_API_ENDPOINT || vars.UMAMI_API_ENDPOINT || 'https://analytics.infra.mintel.me' }} UMAMI_API_ENDPOINT=${{ secrets.UMAMI_API_ENDPOINT || vars.UMAMI_API_ENDPOINT || 'https://analytics.infra.mintel.me' }}
NPM_TOKEN=${{ secrets.REGISTRY_PASS }} NPM_TOKEN=${{ secrets.REGISTRY_PASS }}
tags: registry.infra.mintel.me/mintel/klz-cables.com:${{ needs.prepare.outputs.image_tag }} tags: registry.infra.mintel.me/mintel/klz-cables.com:${{ needs.prepare.outputs.image_tag }}
cache-from: type=registry,ref=registry.infra.mintel.me/mintel/klz-cables.com:buildcache-v3 cache-from: type=registry,ref=registry.infra.mintel.me/mintel/klz-cables.com:buildcache
cache-to: type=registry,ref=registry.infra.mintel.me/mintel/klz-cables.com:buildcache-v3,mode=max cache-to: type=registry,ref=registry.infra.mintel.me/mintel/klz-cables.com:buildcache,mode=max
secrets: | secrets: |
"NPM_TOKEN=${{ secrets.REGISTRY_PASS }}" "NPM_TOKEN=${{ secrets.REGISTRY_PASS }}"
@@ -392,33 +380,22 @@ jobs:
smoke_test: smoke_test:
name: 🧪 Smoke Test name: 🧪 Smoke Test
needs: [prepare, deploy] needs: [prepare, deploy]
if: needs.deploy.result == 'success' if: needs.deploy.result == 'success' && needs.prepare.outputs.target != 'branch'
runs-on: docker runs-on: docker
container: container:
image: catthehacker/ubuntu:act-latest image: catthehacker/ubuntu:act-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 10
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'pnpm'
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 10
- name: 🔐 Registry Auth - name: 🔐 Registry Auth
run: | run: |
echo "@mintel:registry=https://${{ vars.REGISTRY_HOST || 'npm.infra.mintel.me' }}" > .npmrc echo "@mintel:registry=https://${{ vars.REGISTRY_HOST || 'npm.infra.mintel.me' }}" > .npmrc
@@ -436,33 +413,22 @@ jobs:
lighthouse: lighthouse:
name: ⚡ Lighthouse name: ⚡ Lighthouse
needs: [prepare, deploy] needs: [prepare, deploy]
if: success() && needs.prepare.outputs.target != 'skip' if: success() && needs.prepare.outputs.target != 'skip' && needs.prepare.outputs.target != 'branch'
runs-on: docker runs-on: docker
container: container:
image: catthehacker/ubuntu:act-latest image: catthehacker/ubuntu:act-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 10
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'pnpm'
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 10
- name: 🔐 Registry Auth - name: 🔐 Registry Auth
run: | run: |
echo "@mintel:registry=https://${{ vars.REGISTRY_HOST || 'npm.infra.mintel.me' }}" > .npmrc echo "@mintel:registry=https://${{ vars.REGISTRY_HOST || 'npm.infra.mintel.me' }}" > .npmrc
@@ -510,13 +476,6 @@ jobs:
PAGESPEED_LIMIT: 8 PAGESPEED_LIMIT: 8
run: pnpm run pagespeed:test run: pnpm run pagespeed:test
- name: ♿ Run WCAG Audit
env:
NEXT_PUBLIC_BASE_URL: ${{ needs.prepare.outputs.next_public_url }}
GATEKEEPER_PASSWORD: ${{ secrets.GATEKEEPER_PASSWORD || 'klz2026' }}
PAGESPEED_LIMIT: 8
run: pnpm run check:wcag
# ────────────────────────────────────────────────────────────────────────────── # ──────────────────────────────────────────────────────────────────────────────
# JOB 7: Notifications # JOB 7: Notifications
# ────────────────────────────────────────────────────────────────────────────── # ──────────────────────────────────────────────────────────────────────────────

7
.gitignore vendored
View File

@@ -11,9 +11,4 @@ lighthouserc.cjs
directus/uploads directus/uploads
!directus/extensions/ !directus/extensions/
!directus/schema/ !directus/schema/
!directus/migrations/ !directus/migrations/
.next-docker
# Pa11y CI
.pa11yci/

View File

@@ -8,6 +8,7 @@ ARG NEXT_PUBLIC_TARGET
ARG DIRECTUS_URL ARG DIRECTUS_URL
ARG UMAMI_WEBSITE_ID ARG UMAMI_WEBSITE_ID
ARG UMAMI_API_ENDPOINT ARG UMAMI_API_ENDPOINT
ARG NPM_TOKEN
# Environment variables for Next.js build # Environment variables for Next.js build
ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL
@@ -24,7 +25,7 @@ COPY pnpm-lock.yaml package.json .npmrc* ./
# Configure private registry and install dependencies # Configure private registry and install dependencies
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
--mount=type=secret,id=NPM_TOKEN \ --mount=type=secret,id=NPM_TOKEN \
export NPM_TOKEN=$(cat /run/secrets/NPM_TOKEN) && \ export NPM_TOKEN=$(cat /run/secrets/NPM_TOKEN 2>/dev/null || echo $NPM_TOKEN) && \
echo "@mintel:registry=https://npm.infra.mintel.me" > .npmrc && \ echo "@mintel:registry=https://npm.infra.mintel.me" > .npmrc && \
echo "//npm.infra.mintel.me/:_authToken=\${NPM_TOKEN}" >> .npmrc && \ echo "//npm.infra.mintel.me/:_authToken=\${NPM_TOKEN}" >> .npmrc && \
pnpm install --frozen-lockfile && \ pnpm install --frozen-lockfile && \

View File

@@ -77,7 +77,7 @@ export default async function StandardPage({ params }: PageProps) {
<div className="absolute top-0 left-0 w-full h-full bg-[radial-gradient(circle_at_center,_var(--tw-gradient-stops))] from-accent via-transparent to-transparent" /> <div className="absolute top-0 left-0 w-full h-full bg-[radial-gradient(circle_at_center,_var(--tw-gradient-stops))] from-accent via-transparent to-transparent" />
</div> </div>
<Container className="relative z-10"> <Container className="relative z-10">
<div className="max-w-4xl"> <div className="max-w-4xl animate-slide-up">
<Badge variant="accent" className="mb-4 md:mb-6"> <Badge variant="accent" className="mb-4 md:mb-6">
{t('badge')} {t('badge')}
</Badge> </Badge>
@@ -93,7 +93,7 @@ export default async function StandardPage({ params }: PageProps) {
<div className="max-w-4xl mx-auto"> <div className="max-w-4xl mx-auto">
{/* Excerpt/Lead paragraph if available */} {/* Excerpt/Lead paragraph if available */}
{pageData.frontmatter.excerpt && ( {pageData.frontmatter.excerpt && (
<div className="mb-16"> <div className="mb-16 animate-slight-fade-in-from-bottom">
<p className="text-xl md:text-2xl text-text-primary leading-relaxed font-medium border-l-4 border-primary pl-8 py-2 italic"> <p className="text-xl md:text-2xl text-text-primary leading-relaxed font-medium border-l-4 border-primary pl-8 py-2 italic">
{pageData.frontmatter.excerpt} {pageData.frontmatter.excerpt}
</p> </p>
@@ -101,7 +101,7 @@ export default async function StandardPage({ params }: PageProps) {
)} )}
{/* Main content with shared blog components */} {/* Main content with shared blog components */}
<div className="prose prose-lg md:prose-xl max-w-none prose-headings:font-bold prose-headings:text-text-primary prose-p:text-text-secondary prose-p:leading-relaxed prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-img:rounded-2xl prose-img:shadow-2xl prose-blockquote:border-primary prose-blockquote:bg-primary/5 prose-blockquote:rounded-r-2xl prose-strong:text-primary"> <div className="prose prose-lg md:prose-xl max-w-none prose-headings:font-bold prose-headings:text-text-primary prose-p:text-text-secondary prose-p:leading-relaxed prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-img:rounded-2xl prose-img:shadow-2xl prose-blockquote:border-primary prose-blockquote:bg-primary/5 prose-blockquote:rounded-r-2xl prose-strong:text-primary animate-slight-fade-in-from-bottom">
<MDXRemote source={pageData.content} components={mdxComponents} /> <MDXRemote source={pageData.content} components={mdxComponents} />
</div> </div>

View File

@@ -5,7 +5,6 @@ import { MDXRemote } from 'next-mdx-remote/rsc';
import { getPostBySlug, getAdjacentPosts, getReadingTime, getHeadings } from '@/lib/blog'; import { getPostBySlug, getAdjacentPosts, getReadingTime, getHeadings } from '@/lib/blog';
import { Metadata } from 'next'; import { Metadata } from 'next';
import Link from 'next/link'; import Link from 'next/link';
import Image from 'next/image';
import PostNavigation from '@/components/blog/PostNavigation'; import PostNavigation from '@/components/blog/PostNavigation';
import PowerCTA from '@/components/blog/PowerCTA'; import PowerCTA from '@/components/blog/PowerCTA';
import TableOfContents from '@/components/blog/TableOfContents'; import TableOfContents from '@/components/blog/TableOfContents';
@@ -54,7 +53,7 @@ export default async function BlogPost({ params }: BlogPostProps) {
const { locale, slug } = await params; const { locale, slug } = await params;
setRequestLocale(locale); setRequestLocale(locale);
const post = await getPostBySlug(slug, locale); const post = await getPostBySlug(slug, locale);
const { prev, next, isPrevRandom, isNextRandom } = await getAdjacentPosts(slug, locale); const { prev, next } = await getAdjacentPosts(slug, locale);
if (!post) { if (!post) {
notFound(); notFound();
@@ -70,20 +69,13 @@ export default async function BlogPost({ params }: BlogPostProps) {
category={post.frontmatter.category} category={post.frontmatter.category}
readingTime={getReadingTime(post.content)} readingTime={getReadingTime(post.content)}
/> />
{/* Featured Image Header */} {/* Featured Image Header */}
{post.frontmatter.featuredImage ? ( {post.frontmatter.featuredImage ? (
<div className="relative w-full h-[70vh] min-h-[500px] overflow-hidden group"> <div className="relative w-full h-[70vh] min-h-[500px] overflow-hidden group">
<div className="absolute inset-0 transition-transform duration-[3s] ease-out scale-110 group-hover:scale-100"> <div
<Image className="absolute inset-0 bg-cover bg-center transition-transform duration-[3s] ease-out scale-110 group-hover:scale-100"
src={`${post.frontmatter.featuredImage}?gravity=obj:face`} style={{ backgroundImage: `url(${post.frontmatter.featuredImage})` }}
alt={post.frontmatter.title} />
fill
priority
className="object-cover"
sizes="100vw"
/>
</div>
<div className="absolute inset-0 bg-gradient-to-t from-neutral-dark via-neutral-dark/40 to-transparent" /> <div className="absolute inset-0 bg-gradient-to-t from-neutral-dark via-neutral-dark/40 to-transparent" />
{/* Title overlay on image */} {/* Title overlay on image */}
@@ -92,15 +84,18 @@ export default async function BlogPost({ params }: BlogPostProps) {
<div className="max-w-4xl"> <div className="max-w-4xl">
{post.frontmatter.category && ( {post.frontmatter.category && (
<div className="overflow-hidden mb-6"> <div className="overflow-hidden mb-6">
<span className="inline-block px-4 py-1.5 bg-accent text-neutral-dark text-xs font-bold uppercase tracking-[0.2em] rounded-sm"> <span className="inline-block px-4 py-1.5 bg-accent text-neutral-dark text-xs font-bold uppercase tracking-[0.2em] rounded-sm animate-slight-fade-in-from-bottom">
{post.frontmatter.category} {post.frontmatter.category}
</span> </span>
</div> </div>
)} )}
<Heading level={1} className="text-white mb-8 drop-shadow-2xl"> <Heading
level={1}
className="text-white mb-8 drop-shadow-2xl animate-slight-fade-in-from-bottom [animation-delay:200ms]"
>
{post.frontmatter.title} {post.frontmatter.title}
</Heading> </Heading>
<div className="flex flex-wrap items-center gap-6 text-white/80 text-sm md:text-base font-medium"> <div className="flex flex-wrap items-center gap-6 text-white/80 text-sm md:text-base font-medium animate-slight-fade-in-from-bottom [animation-delay:400ms]">
<time dateTime={post.frontmatter.date}> <time dateTime={post.frontmatter.date}>
{new Date(post.frontmatter.date).toLocaleDateString(locale, { {new Date(post.frontmatter.date).toLocaleDateString(locale, {
year: 'numeric', year: 'numeric',
@@ -110,15 +105,6 @@ export default async function BlogPost({ params }: BlogPostProps) {
</time> </time>
<span className="w-1 h-1 bg-white/30 rounded-full" /> <span className="w-1 h-1 bg-white/30 rounded-full" />
<span>{getReadingTime(post.content)} min read</span> <span>{getReadingTime(post.content)} min read</span>
{(new Date(post.frontmatter.date) > new Date() ||
post.frontmatter.public === false) && (
<>
<span className="w-1 h-1 bg-white/30 rounded-full" />
<span className="px-2 py-0.5 border border-white/40 text-white/80 rounded uppercase tracking-widest text-[10px] md:text-xs font-bold">
Draft Preview
</span>
</>
)}
</div> </div>
</div> </div>
</div> </div>
@@ -137,7 +123,7 @@ export default async function BlogPost({ params }: BlogPostProps) {
<Heading level={1} className="mb-8"> <Heading level={1} className="mb-8">
{post.frontmatter.title} {post.frontmatter.title}
</Heading> </Heading>
<div className="flex items-center gap-6 text-text-primary/80 font-medium"> <div className="flex items-center gap-6 text-text-secondary font-medium">
<time dateTime={post.frontmatter.date}> <time dateTime={post.frontmatter.date}>
{new Date(post.frontmatter.date).toLocaleDateString(locale, { {new Date(post.frontmatter.date).toLocaleDateString(locale, {
year: 'numeric', year: 'numeric',
@@ -145,17 +131,8 @@ export default async function BlogPost({ params }: BlogPostProps) {
day: 'numeric', day: 'numeric',
})} })}
</time> </time>
<span className="w-1 h-1 bg-neutral-400 rounded-full" /> <span className="w-1 h-1 bg-neutral-300 rounded-full" />
<span>{getReadingTime(post.content)} min read</span> <span>{getReadingTime(post.content)} min read</span>
{(new Date(post.frontmatter.date) > new Date() ||
post.frontmatter.public === false) && (
<>
<span className="w-1 h-1 bg-neutral-300 rounded-full" />
<span className="px-2 py-0.5 border border-orange-500/50 text-orange-600 rounded uppercase tracking-widest text-[10px] md:text-xs font-bold">
Draft Preview
</span>
</>
)}
</div> </div>
</div> </div>
</header> </header>
@@ -168,7 +145,7 @@ export default async function BlogPost({ params }: BlogPostProps) {
<div className="sticky-narrative-content"> <div className="sticky-narrative-content">
{/* Excerpt/Lead paragraph if available */} {/* Excerpt/Lead paragraph if available */}
{post.frontmatter.excerpt && ( {post.frontmatter.excerpt && (
<div className="mb-16"> <div className="mb-16 animate-slight-fade-in-from-bottom [animation-delay:600ms]">
<p className="text-xl md:text-2xl text-text-primary leading-relaxed font-medium border-l-4 border-primary pl-8 py-2 italic"> <p className="text-xl md:text-2xl text-text-primary leading-relaxed font-medium border-l-4 border-primary pl-8 py-2 italic">
{post.frontmatter.excerpt} {post.frontmatter.excerpt}
</p> </p>
@@ -176,7 +153,7 @@ export default async function BlogPost({ params }: BlogPostProps) {
)} )}
{/* Main content with enhanced styling */} {/* Main content with enhanced styling */}
<div className="prose prose-lg md:prose-xl max-w-none prose-headings:font-bold prose-headings:text-text-primary prose-p:text-text-secondary prose-p:leading-relaxed prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-img:rounded-2xl prose-img:shadow-2xl prose-blockquote:border-primary prose-blockquote:bg-primary/5 prose-blockquote:rounded-r-2xl prose-strong:text-primary"> <div className="prose prose-lg md:prose-xl max-w-none prose-headings:font-bold prose-headings:text-text-primary prose-p:text-text-secondary prose-p:leading-relaxed prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-img:rounded-2xl prose-img:shadow-2xl prose-blockquote:border-primary prose-blockquote:bg-primary/5 prose-blockquote:rounded-r-2xl prose-strong:text-primary animate-slight-fade-in-from-bottom [animation-delay:800ms]">
<MDXRemote source={post.content} components={mdxComponents} /> <MDXRemote source={post.content} components={mdxComponents} />
</div> </div>
@@ -187,13 +164,7 @@ export default async function BlogPost({ params }: BlogPostProps) {
{/* Post Navigation */} {/* Post Navigation */}
<div className="mt-16"> <div className="mt-16">
<PostNavigation <PostNavigation prev={prev} next={next} locale={locale} />
prev={prev}
next={next}
isPrevRandom={isPrevRandom}
isNextRandom={isNextRandom}
locale={locale}
/>
</div> </div>
{/* Back to blog link */} {/* Back to blog link */}

View File

@@ -6,7 +6,6 @@ import Reveal from '@/components/Reveal';
import { Metadata } from 'next'; import { Metadata } from 'next';
import { getTranslations, setRequestLocale } from 'next-intl/server'; import { getTranslations, setRequestLocale } from 'next-intl/server';
import { SITE_URL } from '@/lib/schema'; import { SITE_URL } from '@/lib/schema';
import { BlogPaginationKeyboardObserver } from '@/components/blog/BlogPaginationKeyboardObserver';
interface BlogIndexProps { interface BlogIndexProps {
params: Promise<{ params: Promise<{
@@ -63,10 +62,10 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
{featuredPost && featuredPost.frontmatter.featuredImage && ( {featuredPost && featuredPost.frontmatter.featuredImage && (
<> <>
<Image <Image
src={`${featuredPost.frontmatter.featuredImage}?gravity=obj:face`} src={featuredPost.frontmatter.featuredImage}
alt={featuredPost.frontmatter.title} alt={featuredPost.frontmatter.title}
fill fill
className="absolute inset-0 w-full h-full object-cover opacity-40 md:opacity-60" className="absolute inset-0 w-full h-full object-cover scale-105 animate-slow-zoom opacity-40 md:opacity-60"
sizes="100vw" sizes="100vw"
priority priority
/> />
@@ -75,20 +74,10 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
)} )}
<Container className="relative z-10"> <Container className="relative z-10">
<div className="max-w-4xl"> <div className="max-w-4xl animate-slide-up">
<div className="flex flex-wrap items-center gap-3 mb-4 md:mb-6"> <Badge variant="saturated" className="mb-4 md:mb-6">
<Badge variant="saturated">{t('featuredPost')}</Badge> {t('featuredPost')}
{featuredPost && </Badge>
(new Date(featuredPost.frontmatter.date) > new Date() ||
featuredPost.frontmatter.public === false) && (
<Badge
variant="neutral"
className="border border-white/30 bg-transparent text-white/80 shadow-none"
>
Draft Preview
</Badge>
)}
</div>
{featuredPost && ( {featuredPost && (
<> <>
<Heading level={1} className="text-white mb-4 md:mb-8"> <Heading level={1} className="text-white mb-4 md:mb-8">
@@ -164,7 +153,7 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
{post.frontmatter.featuredImage && ( {post.frontmatter.featuredImage && (
<div className="relative h-48 md:h-72 overflow-hidden"> <div className="relative h-48 md:h-72 overflow-hidden">
<Image <Image
src={`${post.frontmatter.featuredImage}?gravity=obj:face`} src={post.frontmatter.featuredImage}
alt={post.frontmatter.title} alt={post.frontmatter.title}
fill fill
className="w-full h-full object-cover transition-transform duration-1000 group-hover:scale-110" className="w-full h-full object-cover transition-transform duration-1000 group-hover:scale-110"
@@ -182,20 +171,12 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
</div> </div>
)} )}
<div className="p-5 md:p-10 flex flex-col flex-1"> <div className="p-5 md:p-10 flex flex-col flex-1">
<div className="flex items-center gap-3 text-[10px] md:text-sm font-bold text-primary/70 mb-2 md:mb-4 tracking-widest uppercase"> <div className="text-[10px] md:text-sm font-bold text-accent-dark mb-2 md:mb-4 tracking-widest uppercase">
<span> {new Date(post.frontmatter.date).toLocaleDateString(locale, {
{new Date(post.frontmatter.date).toLocaleDateString(locale, { year: 'numeric',
year: 'numeric', month: 'long',
month: 'long', day: 'numeric',
day: 'numeric', })}
})}
</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>
)}
</div> </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-2 leading-tight"> <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-2 leading-tight">
{post.frontmatter.title} {post.frontmatter.title}
@@ -230,47 +211,21 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
))} ))}
</div> </div>
{/* Pagination */} {/* Pagination Placeholder */}
<div className="mt-12 md:mt-24 flex justify-center gap-2 md:gap-4"> <div className="mt-12 md:mt-24 flex justify-center gap-2 md:gap-4">
<Button <Button variant="outline" size="sm" className="md:h-11 md:px-6 md:text-base" disabled>
href="#"
variant="outline"
size="sm"
className="md:h-11 md:px-6 md:text-base pointer-events-none opacity-50"
aria-disabled="true"
aria-keyshortcuts="ArrowLeft"
tabIndex={-1}
>
{t('prev')} {t('prev')}
</Button> </Button>
<Button <Button variant="primary" size="sm" className="md:h-11 md:px-6 md:text-base">
href={`/${locale}/blog?page=1`}
variant="primary"
size="sm"
className="md:h-11 md:px-6 md:text-base"
aria-current="page"
>
1 1
</Button> </Button>
<Button <Button variant="outline" size="sm" className="md:h-11 md:px-6 md:text-base">
href={`/${locale}/blog?page=2`}
variant="outline"
size="sm"
className="md:h-11 md:px-6 md:text-base"
>
2 2
</Button> </Button>
<Button <Button variant="outline" size="sm" className="md:h-11 md:px-6 md:text-base">
href={`/${locale}/blog?page=2`}
variant="outline"
size="sm"
className="md:h-11 md:px-6 md:text-base"
aria-keyshortcuts="ArrowRight"
>
{t('next')} {t('next')}
</Button> </Button>
</div> </div>
<BlogPaginationKeyboardObserver currentPage={1} totalPages={2} locale={locale} />
</Container> </Container>
</Section> </Section>
</div> </div>

View File

@@ -30,15 +30,14 @@ export async function generateMetadata(props: {
const params = await props.params; const params = await props.params;
const { locale } = params; const { locale } = params;
const baseUrl = process.env.CI ? 'http://klz.localhost' : SITE_URL;
return { return {
metadataBase: new URL(baseUrl), metadataBase: new URL(SITE_URL),
manifest: '/manifest.webmanifest', manifest: '/manifest.webmanifest',
alternates: { alternates: {
canonical: `${baseUrl}/${locale}`, canonical: locale === 'en' ? '/' : `/${locale}`,
languages: { languages: {
de: `${baseUrl}/de`, de: '/de',
en: `${baseUrl}/en`, en: '/en',
}, },
}, },
icons: { icons: {
@@ -73,31 +72,14 @@ export default async function Layout(props: {
setRequestLocale(safeLocale); setRequestLocale(safeLocale);
let messages: Record<string, any> = {}; let messages = {};
try { try {
messages = await getMessages(); messages = await getMessages();
} catch (error) { } catch (error) {
console.error(`Failed to load messages for locale '${safeLocale}':`, error);
messages = {}; messages = {};
} }
// Pick only the namespaces required by client components to reduce the hydration payload size
const clientKeys = [
'Footer',
'Navigation',
'Contact',
'Products',
'Team',
'Home',
'Error',
'StandardPage',
];
const clientMessages: Record<string, any> = {};
for (const key of clientKeys) {
if (messages[key]) {
clientMessages[key] = messages[key];
}
}
const { getServerAppServices } = await import('@/lib/services/create-services.server'); const { getServerAppServices } = await import('@/lib/services/create-services.server');
const serverServices = getServerAppServices(); const serverServices = getServerAppServices();
@@ -105,10 +87,7 @@ export default async function Layout(props: {
const { headers } = await import('next/headers'); const { headers } = await import('next/headers');
const requestHeaders = await headers(); const requestHeaders = await headers();
// Disable analytics in CI to prevent console noise/score penalties if ('setServerContext' in serverServices.analytics) {
if (process.env.NEXT_PUBLIC_CI === 'true') {
// Skip setting server context for analytics in CI
} else if ('setServerContext' in serverServices.analytics) {
(serverServices.analytics as any).setServerContext({ (serverServices.analytics as any).setServerContext({
userAgent: requestHeaders.get('user-agent') || undefined, userAgent: requestHeaders.get('user-agent') || undefined,
language: requestHeaders.get('accept-language')?.split(',')[0] || undefined, language: requestHeaders.get('accept-language')?.split(',')[0] || undefined,
@@ -139,7 +118,7 @@ export default async function Layout(props: {
<link rel="preconnect" href="https://img.infra.mintel.me" /> <link rel="preconnect" href="https://img.infra.mintel.me" />
</head> </head>
<body className="flex flex-col min-h-screen font-sans selection:bg-accent selection:text-primary-dark antialiased overflow-x-hidden"> <body className="flex flex-col min-h-screen font-sans selection:bg-accent selection:text-primary-dark antialiased overflow-x-hidden">
<NextIntlClientProvider messages={clientMessages} locale={safeLocale}> <NextIntlClientProvider messages={messages} locale={safeLocale}>
<RecordModeProvider isEnabled={recordModeEnabled}> <RecordModeProvider isEnabled={recordModeEnabled}>
<RecordModeVisuals> <RecordModeVisuals>
<SkipLink /> <SkipLink />

View File

@@ -1,12 +1,11 @@
import Hero from '@/components/home/Hero'; import Hero from '@/components/home/Hero';
import JsonLd from '@/components/JsonLd'; import JsonLd from '@/components/JsonLd';
import { getBreadcrumbSchema, SITE_URL } from '@/lib/schema'; import { getBreadcrumbSchema, SITE_URL } from '@/lib/schema';
import ProductCategories from '@/components/home/ProductCategories';
import WhatWeDo from '@/components/home/WhatWeDo';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import Reveal from '@/components/Reveal'; import Reveal from '@/components/Reveal';
const ProductCategories = dynamic(() => import('@/components/home/ProductCategories'));
const WhatWeDo = dynamic(() => import('@/components/home/WhatWeDo'));
const RecentPosts = dynamic(() => import('@/components/home/RecentPosts')); const RecentPosts = dynamic(() => import('@/components/home/RecentPosts'));
const Experience = dynamic(() => import('@/components/home/Experience')); const Experience = dynamic(() => import('@/components/home/Experience'));
const WhyChooseUs = dynamic(() => import('@/components/home/WhyChooseUs')); const WhyChooseUs = dynamic(() => import('@/components/home/WhyChooseUs'));
@@ -27,13 +26,6 @@ export default async function HomePage({ params }: { params: Promise<{ locale: s
id="breadcrumb-home" id="breadcrumb-home"
data={getBreadcrumbSchema([{ name: 'Home', item: `/${locale}` }])} data={getBreadcrumbSchema([{ name: 'Home', item: `/${locale}` }])}
/> />
{/*
The instruction refers to changing a class within the Hero component's paragraph.
Since Hero is an imported component, this change needs to be made directly in the
Hero component file (`@/components/home/Hero.tsx`) itself, not in this page file.
This file (`app/[locale]/page.tsx`) only renders the Hero component.
Therefore, no change is applied here.
*/}
<Hero /> <Hero />
<Reveal> <Reveal>
<ProductCategories /> <ProductCategories />

View File

@@ -53,17 +53,17 @@ export async function generateMetadata({ params }: ProductPageProps): Promise<Me
title: categoryTitle, title: categoryTitle,
description: categoryDesc, description: categoryDesc,
alternates: { alternates: {
canonical: `${SITE_URL}/${locale}/products/${productSlug}`, canonical: `${SITE_URL}/${locale}/${await mapFileSlugToTranslated('products', locale)}/${productSlug}`,
languages: { languages: {
de: `${SITE_URL}/de/products/${await mapFileSlugToTranslated(productSlug, 'de')}`, de: `${SITE_URL}/de/${await mapFileSlugToTranslated('products', 'de')}/${await mapFileSlugToTranslated(productSlug, 'de')}`,
en: `${SITE_URL}/en/products/${await mapFileSlugToTranslated(productSlug, 'en')}`, en: `${SITE_URL}/en/${await mapFileSlugToTranslated('products', 'en')}/${await mapFileSlugToTranslated(productSlug, 'en')}`,
'x-default': `${SITE_URL}/en/products/${await mapFileSlugToTranslated(productSlug, 'en')}`, 'x-default': `${SITE_URL}/en/${await mapFileSlugToTranslated('products', 'en')}/${await mapFileSlugToTranslated(productSlug, 'en')}`,
}, },
}, },
openGraph: { openGraph: {
title: `${categoryTitle} | KLZ Cables`, title: `${categoryTitle} | KLZ Cables`,
description: categoryDesc, description: categoryDesc,
url: `${SITE_URL}/${locale}/products/${productSlug}`, url: `${SITE_URL}/${locale}/${await mapFileSlugToTranslated('products', locale)}/${productSlug}`,
images: getProductOGImageMetadata(fileSlug, categoryTitle, locale), images: getProductOGImageMetadata(fileSlug, categoryTitle, locale),
}, },
twitter: { twitter: {
@@ -81,18 +81,18 @@ export async function generateMetadata({ params }: ProductPageProps): Promise<Me
title: product.frontmatter.title, title: product.frontmatter.title,
description: product.frontmatter.description, description: product.frontmatter.description,
alternates: { alternates: {
canonical: `${SITE_URL}/${locale}/products/${slug.join('/')}`, canonical: `${SITE_URL}/${locale}/${await mapFileSlugToTranslated('products', locale)}/${slug.join('/')}`,
languages: { languages: {
de: `${SITE_URL}/de/products/${await mapFileSlugToTranslated(slug[0], 'de')}/${await mapFileSlugToTranslated(productSlug, 'de')}`, de: `${SITE_URL}/de/${await mapFileSlugToTranslated('products', 'de')}/${await mapFileSlugToTranslated(slug[0], 'de')}/${await mapFileSlugToTranslated(productSlug, 'de')}`,
en: `${SITE_URL}/en/products/${await mapFileSlugToTranslated(slug[0], 'en')}/${await mapFileSlugToTranslated(productSlug, 'en')}`, en: `${SITE_URL}/en/${await mapFileSlugToTranslated('products', 'en')}/${await mapFileSlugToTranslated(slug[0], 'en')}/${await mapFileSlugToTranslated(productSlug, 'en')}`,
'x-default': `${SITE_URL}/en/products/${await mapFileSlugToTranslated(slug[0], 'en')}/${await mapFileSlugToTranslated(productSlug, 'en')}`, 'x-default': `${SITE_URL}/en/${await mapFileSlugToTranslated('products', 'en')}/${await mapFileSlugToTranslated(slug[0], 'en')}/${await mapFileSlugToTranslated(productSlug, 'en')}`,
}, },
}, },
openGraph: { openGraph: {
title: `${product.frontmatter.title} | KLZ Cables`, title: `${product.frontmatter.title} | KLZ Cables`,
description: product.frontmatter.description, description: product.frontmatter.description,
type: 'website', type: 'website',
url: `${SITE_URL}/${locale}/products/${slug.join('/')}`, url: `${SITE_URL}/${locale}/${await mapFileSlugToTranslated('products', locale)}/${slug.join('/')}`,
images: getProductOGImageMetadata(productSlug, product.frontmatter.title, locale), images: getProductOGImageMetadata(productSlug, product.frontmatter.title, locale),
}, },
twitter: { twitter: {
@@ -236,7 +236,7 @@ export default async function ProductPage({ params }: ProductPageProps) {
{productsWithTranslatedSlugs.map((product) => ( {productsWithTranslatedSlugs.map((product) => (
<Link <Link
key={product.slug} key={product.slug}
href={`/${locale}/products/${productSlug}/${product.translatedSlug}`} href={`/${locale}/${productSlug}/${product.translatedSlug}`}
className="group block bg-white rounded-[32px] overflow-hidden shadow-sm hover:shadow-2xl transition-all duration-500 border border-neutral-dark/5" className="group block bg-white rounded-[32px] overflow-hidden shadow-sm hover:shadow-2xl transition-all duration-500 border border-neutral-dark/5"
> >
<Card tag="article" className="premium-card-reset"> <Card tag="article" className="premium-card-reset">
@@ -381,7 +381,7 @@ export default async function ProductPage({ params }: ProductPageProps) {
</Link> </Link>
<span className="mx-4 opacity-20">/</span> <span className="mx-4 opacity-20">/</span>
<Link <Link
href={`/${locale}/products/${categorySlug}`} href={`/${locale}/${productSlug}`}
className="hover:text-accent transition-colors" className="hover:text-accent transition-colors"
> >
{categoryTitle} {categoryTitle}
@@ -504,7 +504,7 @@ export default async function ProductPage({ params }: ProductPageProps) {
'@type': 'Offer', '@type': 'Offer',
availability: 'https://schema.org/InStock', availability: 'https://schema.org/InStock',
priceCurrency: 'EUR', priceCurrency: 'EUR',
url: `${SITE_URL}/${locale}/products/${slug.join('/')}`, url: `${SITE_URL}/${locale}/${await mapFileSlugToTranslated('products', locale)}/${slug.join('/')}`,
itemCondition: 'https://schema.org/NewCondition', itemCondition: 'https://schema.org/NewCondition',
}, },
additionalProperty: technicalItems.map((item: any) => ({ additionalProperty: technicalItems.map((item: any) => ({
@@ -515,7 +515,7 @@ export default async function ProductPage({ params }: ProductPageProps) {
category: product.frontmatter.categories.join(', '), category: product.frontmatter.categories.join(', '),
mainEntityOfPage: { mainEntityOfPage: {
'@type': 'WebPage', '@type': 'WebPage',
'@id': `${SITE_URL}/${locale}/products/${slug.join('/')}`, '@id': `${SITE_URL}/${locale}/${await mapFileSlugToTranslated('products', locale)}/${slug.join('/')}`,
}, },
} as any } as any
} }

View File

@@ -52,22 +52,18 @@ export async function POST(request: NextRequest) {
if (!response.ok) { if (!response.ok) {
const errorText = await response.text(); const errorText = await response.text();
if (!process.env.CI) { logger.error('Sentry/GlitchTip API responded with error', {
logger.error('Sentry/GlitchTip API responded with error', { status: response.status,
status: response.status, error: errorText.slice(0, 100),
error: errorText.slice(0, 100), });
});
}
return new NextResponse(errorText, { status: response.status }); return new NextResponse(errorText, { status: response.status });
} }
return NextResponse.json({ status: 'ok' }); return NextResponse.json({ status: 'ok' });
} catch (error) { } catch (error) {
if (!process.env.CI) { logger.error('Failed to relay Sentry request', {
logger.error('Failed to relay Sentry request', { error: (error as Error).message,
error: (error as Error).message, });
});
}
return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 }); return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 });
} }
} }

View File

@@ -7,9 +7,7 @@ import { getAllPagesMetadata } from '@/lib/pages';
export const revalidate = 3600; // Revalidate every hour export const revalidate = 3600; // Revalidate every hour
export default async function sitemap(): Promise<MetadataRoute.Sitemap> { export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = process.env.CI const baseUrl = config.baseUrl || 'https://klz-cables.com';
? 'http://klz.localhost'
: config.baseUrl || 'https://klz-cables.com';
const locales = ['de', 'en']; const locales = ['de', 'en'];
const routes = [ const routes = [

View File

@@ -56,12 +56,10 @@ export async function POST(request: NextRequest) {
if (!response.ok) { if (!response.ok) {
const errorText = await response.text(); const errorText = await response.text();
if (!process.env.CI) { logger.error('Umami API responded with error', {
logger.error('Umami API responded with error', { status: response.status,
status: response.status, error: errorText.slice(0, 100),
error: errorText.slice(0, 100), });
});
}
return new NextResponse(errorText, { status: response.status }); return new NextResponse(errorText, { status: response.status });
} }
@@ -71,18 +69,16 @@ export async function POST(request: NextRequest) {
const errorStack = error instanceof Error ? error.stack : undefined; const errorStack = error instanceof Error ? error.stack : undefined;
// Console error to ensure it appears in logs even if logger fails // Console error to ensure it appears in logs even if logger fails
if (!process.env.CI) { console.error('CRITICAL PROXY ERROR:', {
console.error('CRITICAL PROXY ERROR:', { message: errorMessage,
message: errorMessage, stack: errorStack,
stack: errorStack, endpoint: config.analytics.umami.apiEndpoint,
endpoint: config.analytics.umami.apiEndpoint, });
});
logger.error('Failed to proxy analytics request', { logger.error('Failed to proxy analytics request', {
error: errorMessage, error: errorMessage,
stack: errorStack, stack: errorStack,
}); });
}
return NextResponse.json( return NextResponse.json(
{ {

View File

@@ -2,6 +2,7 @@
import Link from 'next/link'; import Link from 'next/link';
import Image from 'next/image'; import Image from 'next/image';
import { motion } from 'framer-motion';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { usePathname } from 'next/navigation'; import { usePathname } from 'next/navigation';
import { Button } from './ui'; import { Button } from './ui';
@@ -17,6 +18,7 @@ export default function Header() {
const [isScrolled, setIsScrolled] = useState(false); const [isScrolled, setIsScrolled] = useState(false);
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const mobileMenuRef = useRef<HTMLDivElement>(null); const mobileMenuRef = useRef<HTMLDivElement>(null);
const closeButtonRef = useRef<HTMLButtonElement>(null);
// Extract locale from pathname // Extract locale from pathname
const currentLocale = pathname.split('/')[1] || 'en'; const currentLocale = pathname.split('/')[1] || 'en';
@@ -33,6 +35,7 @@ export default function Header() {
return () => window.removeEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll);
}, []); }, []);
// Prevent scroll when mobile menu is open
// Prevent scroll when mobile menu is open and handle focus trap // Prevent scroll when mobile menu is open and handle focus trap
useEffect(() => { useEffect(() => {
if (isMobileMenuOpen) { if (isMobileMenuOpen) {
@@ -99,10 +102,9 @@ export default function Header() {
]; ];
const headerClass = cn( const headerClass = cn(
'fixed top-0 left-0 right-0 z-50 transition-all duration-500 safe-area-p transform-gpu animate-in fade-in slide-in-from-top-12 fill-mode-both', 'fixed top-0 left-0 right-0 z-50 transition-all duration-500 safe-area-p transform-gpu',
{ {
'bg-primary/95 backdrop-blur-md md:bg-transparent py-3 md:py-8 shadow-2xl md:shadow-none': 'bg-transparent py-4 md:py-8': isHomePage && !isScrolled && !isMobileMenuOpen,
isHomePage && !isScrolled && !isMobileMenuOpen,
'bg-primary py-3 md:py-4 shadow-2xl': !isHomePage || isScrolled || isMobileMenuOpen, 'bg-primary py-3 md:py-4 shadow-2xl': !isHomePage || isScrolled || isMobileMenuOpen,
}, },
); );
@@ -112,11 +114,18 @@ export default function Header() {
return ( return (
<> <>
<header className={headerClass} style={{ animationDuration: '800ms' }}> <motion.header
className={headerClass}
initial={{ y: -100, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{ duration: 0.8, ease: 'easeOut' }}
>
<div className="container mx-auto px-4 md:px-12 lg:px-16 max-w-7xl flex items-center justify-between"> <div className="container mx-auto px-4 md:px-12 lg:px-16 max-w-7xl flex items-center justify-between">
<div <motion.div
className="flex-shrink-0 group touch-target animate-in fade-in zoom-in-90 fill-mode-both" className="flex-shrink-0 group touch-target"
style={{ animationDuration: '600ms', animationDelay: '100ms' }} initial={{ scale: 0.8, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
transition={{ duration: 0.6, ease: 'easeOut', delay: 0.1 }}
> >
<Link <Link
href={`/${currentLocale}`} href={`/${currentLocale}`}
@@ -136,16 +145,24 @@ export default function Header() {
priority priority
/> />
</Link> </Link>
</div> </motion.div>
<div className="flex items-center gap-4 md:gap-12"> <motion.div
<nav className="hidden lg:flex items-center space-x-10"> className="flex items-center gap-4 md:gap-12"
{menuItems.map((item, idx) => ( initial="hidden"
<div animate="visible"
key={item.href} variants={{
className="animate-in fade-in slide-in-from-bottom-4 fill-mode-both" visible: {
style={{ animationDuration: '500ms', animationDelay: `${150 + idx * 80}ms` }} transition: {
> staggerChildren: 0.08,
delayChildren: 0.3,
},
},
}}
>
<motion.nav className="hidden lg:flex items-center space-x-10" variants={navVariants}>
{menuItems.map((item, _idx) => (
<motion.div key={item.href} variants={navLinkVariants}>
<Link <Link
href={`/${currentLocale}${item.href === '/' ? '' : item.href}`} href={`/${currentLocale}${item.href === '/' ? '' : item.href}`}
onClick={() => { onClick={() => {
@@ -164,22 +181,25 @@ export default function Header() {
{item.label} {item.label}
<span className="absolute -bottom-2 left-0 w-0 h-1 bg-accent transition-all duration-500 group-hover:w-full rounded-full shadow-[0_0_12px_rgba(130,237,32,0.6)]" /> <span className="absolute -bottom-2 left-0 w-0 h-1 bg-accent transition-all duration-500 group-hover:w-full rounded-full shadow-[0_0_12px_rgba(130,237,32,0.6)]" />
</Link> </Link>
</div> </motion.div>
))} ))}
</nav> </motion.nav>
<div <motion.div
className={cn( className={cn('hidden lg:flex items-center space-x-8', textColorClass)}
'hidden lg:flex items-center space-x-8 animate-in fade-in slide-in-from-right-8 fill-mode-both', variants={headerRightVariants}
textColorClass,
)}
style={{ animationDuration: '600ms', animationDelay: '300ms' }}
> >
<div <motion.div
className="flex items-center space-x-4 text-xs md:text-sm font-extrabold tracking-widest uppercase animate-in fade-in slide-in-from-left-4 fill-mode-both" className="flex items-center space-x-4 text-xs md:text-sm font-extrabold tracking-widest uppercase"
style={{ animationDuration: '500ms', animationDelay: '600ms' }} initial={{ opacity: 0, x: 20 }}
animate={{ opacity: 1, x: 0 }}
transition={{ duration: 0.5, delay: 0.6 }}
> >
<div> <motion.div
initial={{ opacity: 0, scale: 0.8 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ duration: 0.4, delay: 0.65 }}
>
<Link <Link
href={getPathForLocale('en')} href={getPathForLocale('en')}
onClick={() => onClick={() =>
@@ -190,13 +210,22 @@ export default function Header() {
location: 'header', location: 'header',
}) })
} }
className={`hover:text-accent transition-colors flex items-center gap-2 touch-target ${currentLocale === 'en' ? 'text-accent' : 'opacity-80'}`} className={`hover:text-accent transition-colors flex items-center gap-2 touch-target ${currentLocale === 'en' ? 'text-accent' : 'opacity-60'}`}
> >
EN EN
</Link> </Link>
</div> </motion.div>
<div className="w-px h-4 bg-current opacity-30" /> <motion.div
<div> className="w-px h-4 bg-current opacity-20"
initial={{ scaleY: 0 }}
animate={{ scaleY: 1 }}
transition={{ duration: 0.4, delay: 0.7 }}
/>
<motion.div
initial={{ opacity: 0, scale: 0.8 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ duration: 0.4, delay: 0.75 }}
>
<Link <Link
href={getPathForLocale('de')} href={getPathForLocale('de')}
onClick={() => onClick={() =>
@@ -207,22 +236,23 @@ export default function Header() {
location: 'header', location: 'header',
}) })
} }
className={`hover:text-accent transition-colors flex items-center gap-2 touch-target ${currentLocale === 'de' ? 'text-accent' : 'opacity-80'}`} className={`hover:text-accent transition-colors flex items-center gap-2 touch-target ${currentLocale === 'de' ? 'text-accent' : 'opacity-60'}`}
> >
DE DE
</Link> </Link>
</div> </motion.div>
</div> </motion.div>
<div <motion.div
className="animate-in fade-in zoom-in-95 fill-mode-both" initial={{ scale: 0.9, opacity: 0 }}
style={{ animationDuration: '600ms', animationDelay: '700ms' }} animate={{ scale: 1, opacity: 1 }}
transition={{ duration: 0.6, type: 'spring', stiffness: 400, delay: 0.7 }}
> >
<Button <Button
href={`/${currentLocale}/contact`} href={`/${currentLocale}/contact`}
variant="white" variant="white"
size="md" size="md"
className="px-8 shadow-xl hover:scale-105 transition-transform" className="px-8 shadow-xl"
onClick={() => onClick={() =>
trackEvent(AnalyticsEvents.BUTTON_CLICK, { trackEvent(AnalyticsEvents.BUTTON_CLICK, {
label: t('contact'), label: t('contact'),
@@ -232,19 +262,27 @@ export default function Header() {
> >
{t('contact')} {t('contact')}
</Button> </Button>
</div> </motion.div>
</div> </motion.div>
{/* Mobile Menu Button */} {/* Mobile Menu Button */}
<button <motion.button
className={cn( className={cn(
'lg:hidden touch-target p-2 rounded-xl bg-white/10 border border-white/20 z-50 transition-all duration-300', 'lg:hidden touch-target p-2 rounded-xl bg-white/10 border border-white/20 z-50',
textColorClass, textColorClass,
isMobileMenuOpen ? 'rotate-90 scale-110' : 'rotate-0 scale-100',
)} )}
aria-label={t('toggleMenu')} aria-label={t('toggleMenu')}
aria-expanded={isMobileMenuOpen} aria-expanded={isMobileMenuOpen}
aria-controls="mobile-menu" aria-controls="mobile-menu"
initial={{ scale: 0.8, opacity: 0, rotate: -180 }}
animate={{ scale: 1, opacity: 1, rotate: 0 }}
transition={{
duration: 0.6,
type: 'spring',
stiffness: 300,
damping: 20,
delay: 0.5,
}}
onClick={() => { onClick={() => {
const newState = !isMobileMenuOpen; const newState = !isMobileMenuOpen;
setIsMobileMenuOpen(newState); setIsMobileMenuOpen(newState);
@@ -254,30 +292,39 @@ export default function Header() {
}); });
}} }}
> >
<svg <motion.svg
className="w-7 h-7 transition-transform duration-300" className="w-7 h-7"
fill="none" fill="none"
stroke="currentColor" stroke="currentColor"
viewBox="0 0 24 24" viewBox="0 0 24 24"
initial={{ scale: 0 }}
animate={{ scale: 1 }}
transition={{ duration: 0.3, delay: 0.6 }}
> >
{isMobileMenuOpen ? ( {isMobileMenuOpen ? (
<path <motion.path
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={2} strokeWidth={2}
d="M6 18L18 6M6 6l12 12" d="M6 18L18 6M6 6l12 12"
initial={{ pathLength: 0 }}
animate={{ pathLength: 1 }}
transition={{ duration: 0.4, delay: 0.7 }}
/> />
) : ( ) : (
<path <motion.path
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={2} strokeWidth={2}
d="M4 6h16M4 12h16M4 18h16" d="M4 6h16M4 12h16M4 18h16"
initial={{ pathLength: 0 }}
animate={{ pathLength: 1 }}
transition={{ duration: 0.4, delay: 0.7 }}
/> />
)} )}
</svg> </motion.svg>
</button> </motion.button>
</div> </motion.div>
</div> </div>
{/* Mobile Menu Overlay */} {/* Mobile Menu Overlay */}
@@ -294,15 +341,35 @@ export default function Header() {
aria-label={t('menu')} aria-label={t('menu')}
ref={mobileMenuRef} ref={mobileMenuRef}
> >
<nav className="flex-grow flex flex-col justify-center items-center p-8 space-y-8"> <motion.nav
className="flex-grow flex flex-col justify-center items-center p-8 space-y-8"
initial="closed"
animate={isMobileMenuOpen ? 'open' : 'closed'}
variants={{
open: {
transition: {
staggerChildren: 0.1,
delayChildren: 0.2,
},
},
}}
>
{menuItems.map((item, idx) => ( {menuItems.map((item, idx) => (
<div <motion.div
key={item.href} key={item.href}
className={cn( variants={{
'transition-all duration-500 transform', closed: { opacity: 0, y: 50, scale: 0.9 },
isMobileMenuOpen ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8', open: {
)} opacity: 1,
style={{ transitionDelay: `${isMobileMenuOpen ? 200 + idx * 80 : 0}ms` }} y: 0,
scale: 1,
transition: {
duration: 0.6,
ease: 'easeOut',
delay: idx * 0.08,
},
},
}}
> >
<Link <Link
href={`/${currentLocale}${item.href === '/' ? '' : item.href}`} href={`/${currentLocale}${item.href === '/' ? '' : item.href}`}
@@ -318,61 +385,120 @@ export default function Header() {
> >
{item.label} {item.label}
</Link> </Link>
</div> </motion.div>
))} ))}
<div <motion.div
className={cn( className="pt-8 border-t border-white/10 w-full flex flex-col items-center space-y-8"
'pt-8 border-t border-white/10 w-full flex flex-col items-center space-y-8 transition-all duration-500', initial={{ opacity: 0, y: 30 }}
isMobileMenuOpen ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8', animate={isMobileMenuOpen ? { opacity: 1, y: 0 } : { opacity: 0, y: 30 }}
)} transition={{ duration: 0.5, delay: 0.8 }}
style={{ transitionDelay: isMobileMenuOpen ? '600ms' : '0ms' }}
> >
<div className="flex items-center space-x-8 text-lg md:text-xl font-extrabold tracking-widest uppercase text-white"> <motion.div
<div> className="flex items-center space-x-8 text-lg md:text-xl font-extrabold tracking-widest uppercase text-white"
initial={{ opacity: 0, scale: 0.8 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ duration: 0.4, delay: 0.9 }}
>
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3, delay: 1.0 }}
>
<Link <Link
href={getPathForLocale('en')} href={getPathForLocale('en')}
className={`hover:text-accent transition-colors ${currentLocale === 'en' ? 'text-accent' : 'opacity-80'}`} className={`hover:text-accent transition-colors ${currentLocale === 'en' ? 'text-accent' : 'opacity-60'}`}
> >
EN EN
</Link> </Link>
</div> </motion.div>
<div className="w-px h-6 bg-white/30" /> <motion.div
<div> className="w-px h-6 bg-white/20"
initial={{ scaleX: 0 }}
animate={{ scaleX: 1 }}
transition={{ duration: 0.4, delay: 1.05 }}
/>
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3, delay: 1.1 }}
>
<Link <Link
href={getPathForLocale('de')} href={getPathForLocale('de')}
className={`hover:text-accent transition-colors ${currentLocale === 'de' ? 'text-accent' : 'opacity-80'}`} className={`hover:text-accent transition-colors ${currentLocale === 'de' ? 'text-accent' : 'opacity-60'}`}
> >
DE DE
</Link> </Link>
</div> </motion.div>
</div> </motion.div>
<div className="w-full max-w-xs"> <motion.div
initial={{ scale: 0.9, opacity: 0, y: 20 }}
animate={{ scale: 1, opacity: 1, y: 0 }}
transition={{ type: 'spring', stiffness: 400, damping: 20, delay: 1.2 }}
>
<Button <Button
href={`/${currentLocale}/contact`} href={`/${currentLocale}/contact`}
variant="accent" variant="accent"
size="lg" size="lg"
className="w-full py-6 text-lg md:text-xl shadow-2xl hover:scale-105 transition-transform" className="w-full max-w-xs py-6 text-lg md:text-xl shadow-2xl"
> >
{t('contact')} {t('contact')}
</Button> </Button>
</div> </motion.div>
</div> </motion.div>
{/* Bottom Branding */} {/* Bottom Branding */}
<div <motion.div
className={cn( className="p-12 flex justify-center opacity-20"
'p-12 flex justify-center transition-all duration-700', initial={{ opacity: 0, scale: 0.8 }}
isMobileMenuOpen ? 'opacity-20 scale-100' : 'opacity-0 scale-75', animate={isMobileMenuOpen ? { opacity: 0.2, scale: 1 } : { opacity: 0, scale: 0.8 }}
)} transition={{ duration: 0.5, delay: 1.4 }}
style={{ transitionDelay: isMobileMenuOpen ? '800ms' : '0ms' }}
> >
<Image src="/logo-white.svg" alt={t('home')} width={80} height={80} unoptimized /> <motion.div
</div> initial={{ scale: 0.5 }}
</nav> animate={{ scale: 1 }}
transition={{ type: 'spring', stiffness: 300, delay: 1.5 }}
>
<Image src="/logo-white.svg" alt={t('home')} width={80} height={80} unoptimized />
</motion.div>
</motion.div>
</motion.nav>
</div> </div>
</header> </motion.header>
</> </>
); );
} }
const navVariants = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.06,
delayChildren: 0.1,
},
},
} as const;
const navLinkVariants = {
hidden: { opacity: 0, y: 20, scale: 0.9 },
visible: {
opacity: 1,
y: 0,
scale: 1,
transition: {
duration: 0.5,
ease: 'easeOut',
},
},
} as const;
const headerRightVariants = {
hidden: { opacity: 0, x: 30 },
visible: {
opacity: 1,
x: 0,
transition: { duration: 0.6, ease: 'easeOut' },
},
} as const;

View File

@@ -3,7 +3,7 @@
import React, { useEffect, useState, useCallback, useRef } from 'react'; import React, { useEffect, useState, useCallback, useRef } from 'react';
import Image from 'next/image'; import Image from 'next/image';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
import { m, LazyMotion, AnimatePresence } from 'framer-motion'; import { motion, AnimatePresence } from 'framer-motion';
import { useRouter, useSearchParams, usePathname } from 'next/navigation'; import { useRouter, useSearchParams, usePathname } from 'next/navigation';
interface LightboxProps { interface LightboxProps {
@@ -139,120 +139,118 @@ export default function Lightbox({ isOpen, images, initialIndex, onClose }: Ligh
if (!mounted) return null; if (!mounted) return null;
return createPortal( return createPortal(
<LazyMotion strict features={() => import('@/lib/framer-features').then(res => res.default)}> <AnimatePresence>
<AnimatePresence> {isOpen && (
{isOpen && ( <div
<div className="fixed inset-0 z-[99999] flex items-center justify-center"
className="fixed inset-0 z-[99999] flex items-center justify-center" role="dialog"
role="dialog" aria-modal="true"
aria-modal="true" >
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.5 }}
className="absolute inset-0 bg-primary/95 backdrop-blur-xl"
onClick={handleClose}
/>
<motion.button
initial={{ opacity: 0, scale: 0.5 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.5 }}
transition={{ delay: 0.1, duration: 0.4 }}
ref={closeButtonRef}
onClick={handleClose}
className="absolute top-6 right-6 text-white/60 hover:text-white transition-all duration-500 z-[10000] rounded-full w-14 h-14 flex items-center justify-center hover:bg-white/5 group border border-white/10"
aria-label="Close lightbox"
> >
<m.div <div className="relative w-full h-full flex items-center justify-center group-hover:rotate-90 transition-transform duration-500">
initial={{ opacity: 0 }} <span className="text-3xl font-extralight leading-none mb-1">×</span>
animate={{ opacity: 1 }} </div>
exit={{ opacity: 0 }} </motion.button>
transition={{ duration: 0.5 }}
className="absolute inset-0 bg-primary/95 backdrop-blur-xl"
onClick={handleClose}
/>
<m.button <motion.button
initial={{ opacity: 0, scale: 0.5 }} initial={{ opacity: 0, x: -20 }}
animate={{ opacity: 1, scale: 1 }} animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, scale: 0.5 }} exit={{ opacity: 0, x: -20 }}
transition={{ delay: 0.1, duration: 0.4 }} transition={{ delay: 0.2, duration: 0.4 }}
ref={closeButtonRef} onClick={prevImage}
onClick={handleClose} className="absolute left-6 top-1/2 -translate-y-1/2 text-white/60 hover:text-white transition-all duration-500 w-14 h-14 flex items-center justify-center hover:bg-white/5 rounded-full z-[10000] group border border-white/10"
className="absolute top-6 right-6 text-white/60 hover:text-white transition-all duration-500 z-[10000] rounded-full w-14 h-14 flex items-center justify-center hover:bg-white/5 group border border-white/10" aria-label="Previous image"
aria-label="Close lightbox" >
> <span className="text-4xl font-extralight group-hover:-translate-x-1 transition-transform duration-500">
<div className="relative w-full h-full flex items-center justify-center group-hover:rotate-90 transition-transform duration-500">
<span className="text-3xl font-extralight leading-none mb-1">×</span> </span>
</motion.button>
<motion.button
initial={{ opacity: 0, x: 20 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: 20 }}
transition={{ delay: 0.2, duration: 0.4 }}
onClick={nextImage}
className="absolute right-6 top-1/2 -translate-y-1/2 text-white/60 hover:text-white transition-all duration-500 w-14 h-14 flex items-center justify-center hover:bg-white/5 rounded-full z-[10000] group border border-white/10"
aria-label="Next image"
>
<span className="text-4xl font-extralight group-hover:translate-x-1 transition-transform duration-500">
</span>
</motion.button>
<motion.div
initial={{ opacity: 0, y: 40, scale: 0.95 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: 20, scale: 0.98 }}
transition={{ duration: 0.6, ease: [0.25, 0.46, 0.45, 0.94] }}
className="relative w-full h-full max-w-6xl max-h-[85vh] flex flex-col items-center justify-center p-4 md:p-12 z-20 pointer-events-none"
>
<div className="pointer-events-auto w-full h-full flex flex-col items-center justify-center">
<div className="relative w-full h-full shadow-[0_40px_100px_-20px_rgba(0,0,0,0.6)] ring-1 ring-white/20 overflow-hidden bg-primary-dark/50 rounded-2xl flex items-center justify-center">
<AnimatePresence mode="wait" initial={false}>
<motion.div
key={currentIndex}
initial={{ opacity: 0, scale: 1.1, filter: 'blur(10px)' }}
animate={{ opacity: 1, scale: 1, filter: 'blur(0px)' }}
exit={{ opacity: 0, scale: 0.9, filter: 'blur(10px)' }}
transition={{ duration: 0.7, ease: [0.25, 0.46, 0.45, 0.94] }}
className="relative w-full h-full"
>
<Image
src={images[currentIndex]}
alt={`Gallery image ${currentIndex + 1}`}
fill
className="object-cover transition-transform duration-1000 hover:scale-[1.03]"
unoptimized
/>
</motion.div>
</AnimatePresence>
{/* Technical Detail: Subtle grid overlay to reinforce industrial precision */}
<div className="absolute inset-0 pointer-events-none opacity-[0.03] bg-[url('/grid.svg')] bg-repeat z-10" />
{/* Premium Reflection: Subtle gradient to give material feel */}
<div className="absolute inset-0 pointer-events-none bg-gradient-to-tr from-white/10 via-transparent to-transparent opacity-40 z-10" />
</div> </div>
</m.button>
<m.button <motion.div
initial={{ opacity: 0, x: -20 }} initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, x: 0 }} animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, x: -20 }} exit={{ opacity: 0, y: 10 }}
transition={{ delay: 0.2, duration: 0.4 }} transition={{ delay: 0.3, duration: 0.4 }}
onClick={prevImage} className="mt-8 flex items-center gap-4"
className="absolute left-6 top-1/2 -translate-y-1/2 text-white/60 hover:text-white transition-all duration-500 w-14 h-14 flex items-center justify-center hover:bg-white/5 rounded-full z-[10000] group border border-white/10" >
aria-label="Previous image" <div className="h-px w-12 bg-white/20" />
> <div className="bg-white/5 backdrop-blur-2xl text-white px-6 py-2 rounded-full border border-white/10 text-[11px] font-bold tracking-[0.2em] uppercase">
<span className="text-4xl font-extralight group-hover:-translate-x-1 transition-transform duration-500"> {currentIndex + 1} <span className="text-accent mx-3">/</span> {images.length}
</span>
</m.button>
<m.button
initial={{ opacity: 0, x: 20 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: 20 }}
transition={{ delay: 0.2, duration: 0.4 }}
onClick={nextImage}
className="absolute right-6 top-1/2 -translate-y-1/2 text-white/60 hover:text-white transition-all duration-500 w-14 h-14 flex items-center justify-center hover:bg-white/5 rounded-full z-[10000] group border border-white/10"
aria-label="Next image"
>
<span className="text-4xl font-extralight group-hover:translate-x-1 transition-transform duration-500">
</span>
</m.button>
<m.div
initial={{ opacity: 0, y: 40, scale: 0.95 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: 20, scale: 0.98 }}
transition={{ duration: 0.6, ease: [0.25, 0.46, 0.45, 0.94] }}
className="relative w-full h-full max-w-6xl max-h-[85vh] flex flex-col items-center justify-center p-4 md:p-12 z-20 pointer-events-none"
>
<div className="pointer-events-auto w-full h-full flex flex-col items-center justify-center">
<div className="relative w-full h-full shadow-[0_40px_100px_-20px_rgba(0,0,0,0.6)] ring-1 ring-white/20 overflow-hidden bg-primary-dark/50 rounded-2xl flex items-center justify-center">
<AnimatePresence mode="wait" initial={false}>
<m.div
key={currentIndex}
initial={{ opacity: 0, scale: 1.1, filter: 'blur(10px)' }}
animate={{ opacity: 1, scale: 1, filter: 'blur(0px)' }}
exit={{ opacity: 0, scale: 0.9, filter: 'blur(10px)' }}
transition={{ duration: 0.7, ease: [0.25, 0.46, 0.45, 0.94] }}
className="relative w-full h-full"
>
<Image
src={images[currentIndex]}
alt={`Gallery image ${currentIndex + 1}`}
fill
className="object-cover transition-transform duration-1000 hover:scale-[1.03]"
unoptimized
/>
</m.div>
</AnimatePresence>
{/* Technical Detail: Subtle grid overlay to reinforce industrial precision */}
<div className="absolute inset-0 pointer-events-none opacity-[0.03] bg-[url('/grid.svg')] bg-repeat z-10" />
{/* Premium Reflection: Subtle gradient to give material feel */}
<div className="absolute inset-0 pointer-events-none bg-gradient-to-tr from-white/10 via-transparent to-transparent opacity-40 z-10" />
</div> </div>
<div className="h-px w-12 bg-white/20" />
<m.div </motion.div>
initial={{ opacity: 0, y: 10 }} </div>
animate={{ opacity: 1, y: 0 }} </motion.div>
exit={{ opacity: 0, y: 10 }} </div>
transition={{ delay: 0.3, duration: 0.4 }} )}
className="mt-8 flex items-center gap-4" </AnimatePresence>,
>
<div className="h-px w-12 bg-white/20" />
<div className="bg-white/5 backdrop-blur-2xl text-white px-6 py-2 rounded-full border border-white/10 text-[11px] font-bold tracking-[0.2em] uppercase">
{currentIndex + 1} <span className="text-accent mx-3">/</span> {images.length}
</div>
<div className="h-px w-12 bg-white/20" />
</m.div>
</div>
</m.div>
</div>
)}
</AnimatePresence>
</LazyMotion>,
document.body, document.body,
); );
} }

View File

@@ -2,6 +2,7 @@ import { getAllProducts } from '@/lib/mdx';
import { getTranslations } from 'next-intl/server'; import { getTranslations } from 'next-intl/server';
import Image from 'next/image'; import Image from 'next/image';
import { RelatedProductLink } from './RelatedProductLink'; import { RelatedProductLink } from './RelatedProductLink';
import { mapFileSlugToTranslated } from '@/lib/slugs';
interface RelatedProductsProps { interface RelatedProductsProps {
currentSlug: string; currentSlug: string;
@@ -16,6 +17,7 @@ export default async function RelatedProducts({
}: RelatedProductsProps) { }: RelatedProductsProps) {
const products = await getAllProducts(locale); const products = await getAllProducts(locale);
const t = await getTranslations('Products'); const t = await getTranslations('Products');
const productsSlug = await mapFileSlugToTranslated('products', locale);
// Filter products: same category, not current product // Filter products: same category, not current product
const related = products const related = products
@@ -61,7 +63,7 @@ export default async function RelatedProducts({
return ( return (
<RelatedProductLink <RelatedProductLink
key={product.slug} key={product.slug}
href={`/${locale}/products/${catSlug}/${product.slug}`} href={`/${locale}/${productsSlug}/${catSlug}/${product.slug}`}
productSlug={product.slug} productSlug={product.slug}
productTitle={product.frontmatter.title} productTitle={product.frontmatter.title}
className="group block bg-white rounded-[32px] overflow-hidden shadow-sm hover:shadow-2xl transition-all duration-500 border border-neutral-dark/5" className="group block bg-white rounded-[32px] overflow-hidden shadow-sm hover:shadow-2xl transition-all duration-500 border border-neutral-dark/5"

View File

@@ -1,6 +1,7 @@
'use client'; 'use client';
import React from 'react'; import React from 'react';
import { motion, Variants } from 'framer-motion';
import { cn } from '@/components/ui'; import { cn } from '@/components/ui';
interface ScribbleProps { interface ScribbleProps {
@@ -10,6 +11,18 @@ interface ScribbleProps {
} }
export default function Scribble({ variant, className, color = '#82ed20' }: ScribbleProps) { export default function Scribble({ variant, className, color = '#82ed20' }: ScribbleProps) {
const pathVariants: Variants = {
hidden: { pathLength: 0, opacity: 0 },
visible: {
pathLength: 1,
opacity: 1,
transition: {
duration: 1.8,
ease: 'easeInOut',
},
},
};
if (variant === 'circle') { if (variant === 'circle') {
return ( return (
<svg <svg
@@ -18,10 +31,11 @@ export default function Scribble({ variant, className, color = '#82ed20' }: Scri
viewBox="0 0 800 350" viewBox="0 0 800 350"
preserveAspectRatio="none" preserveAspectRatio="none"
> >
<path <motion.path
className="animate-draw-stroke" variants={pathVariants}
pathLength="1" initial="hidden"
style={{ strokeDasharray: 1, strokeDashoffset: 1, animation: 'draw-stroke 1.8s ease-in-out 0.5s forwards' }} whileInView="visible"
viewport={{ once: true }}
transform="matrix(0.9791300296783447,0,0,0.9791300296783447,400,179)" transform="matrix(0.9791300296783447,0,0,0.9791300296783447,400,179)"
strokeLinejoin="miter" strokeLinejoin="miter"
fillOpacity="0" fillOpacity="0"
@@ -43,10 +57,11 @@ export default function Scribble({ variant, className, color = '#82ed20' }: Scri
viewBox="-400 -55 730 60" viewBox="-400 -55 730 60"
preserveAspectRatio="none" preserveAspectRatio="none"
> >
<path <motion.path
className="animate-draw-stroke" variants={pathVariants}
pathLength="1" initial="hidden"
style={{ strokeDasharray: 1, strokeDashoffset: 1, animation: 'draw-stroke 1.8s ease-in-out 0.5s forwards' }} whileInView="visible"
viewport={{ once: true }}
d="m -383.25 -6 c 55.25 -22 130.75 -33.5 293.25 -38 c 54.5 -0.5 195 -2.5 401 15" d="m -383.25 -6 c 55.25 -22 130.75 -33.5 293.25 -38 c 54.5 -0.5 195 -2.5 401 15"
stroke={color} stroke={color}
strokeWidth="20" strokeWidth="20"

View File

@@ -1,7 +1,7 @@
'use client'; 'use client';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { Suspense, useEffect, useState } from 'react'; import { Suspense } from 'react';
const DynamicAnalyticsProvider = dynamic(() => import('./AnalyticsProvider'), { const DynamicAnalyticsProvider = dynamic(() => import('./AnalyticsProvider'), {
ssr: false, ssr: false,
@@ -11,25 +11,6 @@ const DynamicScrollDepthTracker = dynamic(() => import('./ScrollDepthTracker'),
}); });
export default function AnalyticsShell() { export default function AnalyticsShell() {
const [shouldLoad, setShouldLoad] = useState(false);
useEffect(() => {
// Disable analytics in CI to prevent console noise/score penalties
if (process.env.NEXT_PUBLIC_CI === 'true') {
return;
}
// Wait until browser is completely idle before loading heavy analytics/logger/sentry SDKs
if (typeof window !== 'undefined' && 'requestIdleCallback' in window) {
window.requestIdleCallback(() => setShouldLoad(true), { timeout: 3000 });
} else {
const timer = setTimeout(() => setShouldLoad(true), 2500);
return () => clearTimeout(timer);
}
}, []);
if (!shouldLoad) return null;
return ( return (
<Suspense fallback={null}> <Suspense fallback={null}>
<DynamicAnalyticsProvider /> <DynamicAnalyticsProvider />

View File

@@ -136,14 +136,18 @@ function AddToCartButton({ product, quantity = 1 }) {
product_category: product.category, product_category: product.category,
price: product.price, price: product.price,
quantity: quantity, quantity: quantity,
cart_total: 150.0, // Current cart total cart_total: 150.00, // Current cart total
}); });
// Actual add to cart logic // Actual add to cart logic
// addToCart(product, quantity); // addToCart(product, quantity);
}; };
return <button onClick={handleAddToCart}>Add to Cart</button>; return (
<button onClick={handleAddToCart}>
Add to Cart
</button>
);
} }
``` ```
@@ -167,7 +171,7 @@ function CheckoutComplete({ order }) {
transaction_tax: order.tax, transaction_tax: order.tax,
transaction_shipping: order.shipping, transaction_shipping: order.shipping,
product_count: order.items.length, product_count: order.items.length,
products: order.items.map((item) => ({ products: order.items.map(item => ({
product_id: item.product.id, product_id: item.product.id,
product_name: item.product.name, product_name: item.product.name,
quantity: item.quantity, quantity: item.quantity,
@@ -194,21 +198,27 @@ function WishlistButton({ product }) {
const toggleWishlist = () => { const toggleWishlist = () => {
const newState = !isInWishlist; const newState = !isInWishlist;
trackEvent( trackEvent(
newState ? AnalyticsEvents.PRODUCT_WISHLIST_ADD : AnalyticsEvents.PRODUCT_WISHLIST_REMOVE, newState
? AnalyticsEvents.PRODUCT_WISHLIST_ADD
: AnalyticsEvents.PRODUCT_WISHLIST_REMOVE,
{ {
product_id: product.id, product_id: product.id,
product_name: product.name, product_name: product.name,
product_category: product.category, product_category: product.category,
}, }
); );
setIsInWishlist(newState); setIsInWishlist(newState);
// Update wishlist in backend // Update wishlist in backend
}; };
return <button onClick={toggleWishlist}>{isInWishlist ? '❤️' : '🤍'}</button>; return (
<button onClick={toggleWishlist}>
{isInWishlist ? '❤️' : '🤍'}
</button>
);
} }
``` ```
@@ -258,7 +268,7 @@ function ContactForm() {
}; };
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => { const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
setFormData((prev) => ({ setFormData(prev => ({
...prev, ...prev,
[e.target.name]: e.target.value, [e.target.name]: e.target.value,
})); }));
@@ -300,7 +310,9 @@ function NewsletterSignup() {
return ( return (
<div> <div>
<input placeholder="Enter email" /> <input placeholder="Enter email" />
<button onClick={() => handleSubscribe('user@example.com')}>Subscribe</button> <button onClick={() => handleSubscribe('user@example.com')}>
Subscribe
</button>
</div> </div>
); );
} }
@@ -384,12 +396,10 @@ function LoginForm() {
}; };
return ( return (
<form <form onSubmit={(e) => {
onSubmit={(e) => { e.preventDefault();
e.preventDefault(); handleLogin('user@example.com', 'password');
handleLogin('user@example.com', 'password'); }}>
}}
>
{/* Form fields */} {/* Form fields */}
<button type="submit">Login</button> <button type="submit">Login</button>
</form> </form>
@@ -408,7 +418,11 @@ import { AnalyticsEvents } from '@/components/analytics/analytics-events';
function SignupForm() { function SignupForm() {
const { trackEvent } = useAnalytics(); const { trackEvent } = useAnalytics();
const handleSignup = (userData: { email: string; name: string; company?: string }) => { const handleSignup = (userData: {
email: string;
name: string;
company?: string;
}) => {
trackEvent(AnalyticsEvents.USER_SIGNUP, { trackEvent(AnalyticsEvents.USER_SIGNUP, {
user_email: userData.email, user_email: userData.email,
user_name: userData.name, user_name: userData.name,
@@ -422,16 +436,14 @@ function SignupForm() {
}; };
return ( return (
<form <form onSubmit={(e) => {
onSubmit={(e) => { e.preventDefault();
e.preventDefault(); handleSignup({
handleSignup({ email: 'user@example.com',
email: 'user@example.com', name: 'John Doe',
name: 'John Doe', company: 'ACME Corp',
company: 'ACME Corp', });
}); }}>
}}
>
{/* Form fields */} {/* Form fields */}
<button type="submit">Sign Up</button> <button type="submit">Sign Up</button>
</form> </form>
@@ -471,7 +483,7 @@ function SearchBar() {
return ( return (
<div> <div>
<input <input
value={query} value={query}
onChange={(e) => setQuery(e.target.value)} onChange={(e) => setQuery(e.target.value)}
placeholder="Search products..." placeholder="Search products..."
@@ -537,7 +549,7 @@ function ProductFilters() {
<option value="cables">Cables</option> <option value="cables">Cables</option>
<option value="connectors">Connectors</option> <option value="connectors">Connectors</option>
</select> </select>
<button onClick={handleClearFilters}>Clear Filters</button> <button onClick={handleClearFilters}>Clear Filters</button>
</div> </div>
); );
@@ -619,7 +631,11 @@ function VideoPlayer({ videoId, videoTitle }) {
}; };
return ( return (
<video onPlay={handlePlay} onPause={handlePause} onEnded={handleComplete}> <video
onPlay={handlePlay}
onPause={handlePause}
onEnded={handleComplete}
>
<source src="/video.mp4" type="video/mp4" /> <source src="/video.mp4" type="video/mp4" />
</video> </video>
); );
@@ -649,7 +665,11 @@ function DownloadButton({ fileName, fileType, fileSize }) {
// window.location.href = `/downloads/${fileName}`; // window.location.href = `/downloads/${fileName}`;
}; };
return <button onClick={handleDownload}>Download {fileName}</button>; return (
<button onClick={handleDownload}>
Download {fileName}
</button>
);
} }
``` ```
@@ -680,7 +700,7 @@ class ErrorBoundary extends Component<ErrorBoundaryProps> {
componentDidCatch(error: Error, errorInfo: ErrorInfo) { componentDidCatch(error: Error, errorInfo: ErrorInfo) {
const { trackEvent } = useAnalytics(); const { trackEvent } = useAnalytics();
trackEvent(AnalyticsEvents.ERROR, { trackEvent(AnalyticsEvents.ERROR, {
error_message: error.message, error_message: error.message,
error_stack: error.stack, error_stack: error.stack,
@@ -722,14 +742,14 @@ function ApiClient() {
const fetchData = async (endpoint: string) => { const fetchData = async (endpoint: string) => {
try { try {
const response = await fetch(endpoint); const response = await fetch(endpoint);
if (!response.ok) { if (!response.ok) {
trackEvent(AnalyticsEvents.API_ERROR, { trackEvent(AnalyticsEvents.API_ERROR, {
endpoint: endpoint, endpoint: endpoint,
status_code: response.status, status_code: response.status,
error_message: response.statusText, error_message: response.statusText,
}); });
throw new Error(`HTTP ${response.status}`); throw new Error(`HTTP ${response.status}`);
} }
@@ -745,7 +765,7 @@ function ApiClient() {
error_message: error.message, error_message: error.message,
error_type: error.name, error_type: error.name,
}); });
throw error; throw error;
} }
}; };
@@ -943,9 +963,15 @@ function CableProductPage({ cable }) {
return ( return (
<div> <div>
<h1>{cable.name}</h1> <h1>{cable.name}</h1>
<button onClick={handleTechnicalSpecDownload}>Download Technical Specs</button> <button onClick={handleTechnicalSpecDownload}>
<button onClick={handleRequestQuote}>Request Quote</button> Download Technical Specs
<button onClick={handleBrochureDownload}>Download Brochure</button> </button>
<button onClick={handleRequestQuote}>
Request Quote
</button>
<button onClick={handleBrochureDownload}>
Download Brochure
</button>
</div> </div>
); );
} }
@@ -984,8 +1010,12 @@ function WindFarmProjectPage({ project }) {
return ( return (
<div> <div>
<h1>{project.name}</h1> <h1>{project.name}</h1>
<button onClick={handleProjectInquiry}>Request Project Consultation</button> <button onClick={handleProjectInquiry}>
<button onClick={handleCableCalculation}>Calculate Cable Requirements</button> Request Project Consultation
</button>
<button onClick={handleCableCalculation}>
Calculate Cable Requirements
</button>
</div> </div>
); );
} }
@@ -1036,7 +1066,7 @@ test('tracks button click', () => {
// [Umami] Tracked pageview: /products/123 // [Umami] Tracked pageview: /products/123
// To test without sending data to Umami: // To test without sending data to Umami:
// 1. Remove UMAMI_WEBSITE_ID from .env // 1. Remove NEXT_PUBLIC_UMAMI_WEBSITE_ID from .env
// 2. Or set it to an empty string // 2. Or set it to an empty string
// 3. Check console logs to verify events are being tracked // 3. Check console logs to verify events are being tracked
``` ```
@@ -1139,9 +1169,7 @@ function WebVitalsTracker() {
} }
}); });
observer.observe({ observer.observe({ entryTypes: ['largest-contentful-paint', 'first-input-delay', 'layout-shift'] });
entryTypes: ['largest-contentful-paint', 'first-input-delay', 'layout-shift'],
});
} }
}, []); }, []);
@@ -1166,7 +1194,6 @@ This examples file demonstrates how to implement comprehensive analytics trackin
-**Business-specific events** (KLZ Cables, wind farms) -**Business-specific events** (KLZ Cables, wind farms)
Remember to: Remember to:
1. Use the `useAnalytics` hook for client-side tracking 1. Use the `useAnalytics` hook for client-side tracking
2. Import events from `AnalyticsEvents` for consistency 2. Import events from `AnalyticsEvents` for consistency
3. Include relevant context in your events 3. Include relevant context in your events

View File

@@ -2,7 +2,7 @@
## Setup Checklist ## Setup Checklist
- [ ] Add `UMAMI_WEBSITE_ID` to `.env` file - [ ] Add `NEXT_PUBLIC_UMAMI_WEBSITE_ID` to `.env` file
- [ ] Verify `UmamiScript` is in your layout - [ ] Verify `UmamiScript` is in your layout
- [ ] Verify `AnalyticsProvider` is in your layout - [ ] Verify `AnalyticsProvider` is in your layout
- [ ] Test in development mode - [ ] Test in development mode
@@ -12,7 +12,7 @@
```bash ```bash
# Required # Required
UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3 NEXT_PUBLIC_UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3
# Optional (defaults to https://analytics.infra.mintel.me/script.js) # Optional (defaults to https://analytics.infra.mintel.me/script.js)
NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.infra.mintel.me/script.js NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.infra.mintel.me/script.js
@@ -86,16 +86,16 @@ function ProductCard({ product }) {
## Common Events ## Common Events
| Event | When to Use | Example Properties | | Event | When to Use | Example Properties |
| --------------------- | ------------------- | ------------------------------------------------- | |-------|-------------|-------------------|
| `pageview` | Page loads | `{ url: '/products/123' }` | | `pageview` | Page loads | `{ url: '/products/123' }` |
| `button_click` | Button clicked | `{ button_id: 'cta', page: 'homepage' }` | | `button_click` | Button clicked | `{ button_id: 'cta', page: 'homepage' }` |
| `form_submit` | Form submitted | `{ form_id: 'contact', form_name: 'Contact Us' }` | | `form_submit` | Form submitted | `{ form_id: 'contact', form_name: 'Contact Us' }` |
| `product_view` | Product page viewed | `{ product_id: '123', price: 99.99 }` | | `product_view` | Product page viewed | `{ product_id: '123', price: 99.99 }` |
| `product_add_to_cart` | Add to cart | `{ product_id: '123', quantity: 1 }` | | `product_add_to_cart` | Add to cart | `{ product_id: '123', quantity: 1 }` |
| `search` | Search performed | `{ search_query: 'cable', results: 42 }` | | `search` | Search performed | `{ search_query: 'cable', results: 42 }` |
| `user_login` | User logged in | `{ user_email: 'user@example.com' }` | | `user_login` | User logged in | `{ user_email: 'user@example.com' }` |
| `error` | Error occurred | `{ error_message: 'Something went wrong' }` | | `error` | Error occurred | `{ error_message: 'Something went wrong' }` |
## Testing ## Testing
@@ -112,7 +112,7 @@ In development, you'll see console logs:
```bash ```bash
# .env.local # .env.local
# UMAMI_WEBSITE_ID= # NEXT_PUBLIC_UMAMI_WEBSITE_ID=
``` ```
## Troubleshooting ## Troubleshooting
@@ -120,9 +120,8 @@ In development, you'll see console logs:
### Analytics Not Working? ### Analytics Not Working?
1. **Check environment variables:** 1. **Check environment variables:**
```bash ```bash
echo $UMAMI_WEBSITE_ID echo $NEXT_PUBLIC_UMAMI_WEBSITE_ID
``` ```
2. **Verify script is loading:** 2. **Verify script is loading:**
@@ -137,12 +136,12 @@ In development, you'll see console logs:
### Common Issues ### Common Issues
| Issue | Solution | | Issue | Solution |
| ------------------- | ----------------------------------- | |-------|----------|
| No data in Umami | Check website ID and script URL | | No data in Umami | Check website ID and script URL |
| Events not tracking | Verify `useAnalytics` hook is used | | Events not tracking | Verify `useAnalytics` hook is used |
| Script not loading | Check network connection, CORS | | Script not loading | Check network connection, CORS |
| Wrong data | Verify event properties are correct | | Wrong data | Verify event properties are correct |
## Performance Tips ## Performance Tips

View File

@@ -20,7 +20,7 @@ Add these to your `.env` file:
```bash ```bash
# Required: Your Umami website ID # Required: Your Umami website ID
UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3 NEXT_PUBLIC_UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3
# Optional: Custom Umami script URL (defaults to https://analytics.infra.mintel.me/script.js) # Optional: Custom Umami script URL (defaults to https://analytics.infra.mintel.me/script.js)
NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.infra.mintel.me/script.js NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.infra.mintel.me/script.js
@@ -32,7 +32,7 @@ The `docker-compose.yml` already includes the environment variables:
```yaml ```yaml
environment: environment:
- UMAMI_WEBSITE_ID=${UMAMI_WEBSITE_ID} - NEXT_PUBLIC_UMAMI_WEBSITE_ID=${NEXT_PUBLIC_UMAMI_WEBSITE_ID}
- NEXT_PUBLIC_UMAMI_SCRIPT_URL=${NEXT_PUBLIC_UMAMI_SCRIPT_URL:-https://analytics.infra.mintel.me/script.js} - NEXT_PUBLIC_UMAMI_SCRIPT_URL=${NEXT_PUBLIC_UMAMI_SCRIPT_URL:-https://analytics.infra.mintel.me/script.js}
``` ```
@@ -75,7 +75,11 @@ function ProductCard({ product }) {
}); });
}; };
return <button onClick={handleAddToCart}>Add to Cart</button>; return (
<button onClick={handleAddToCart}>
Add to Cart
</button>
);
} }
``` ```
@@ -92,7 +96,7 @@ function CustomNavigation() {
const navigateToCustomPage = () => { const navigateToCustomPage = () => {
// Track a custom pageview // Track a custom pageview
trackPageview('/custom-path?param=value'); trackPageview('/custom-path?param=value');
// Then perform navigation // Then perform navigation
window.location.href = '/custom-path?param=value'; window.location.href = '/custom-path?param=value';
}; };
@@ -273,7 +277,11 @@ function ErrorBoundary({ children }) {
}); });
}; };
return <ErrorBoundary onError={handleError}>{children}</ErrorBoundary>; return (
<ErrorBoundary onError={handleError}>
{children}
</ErrorBoundary>
);
} }
``` ```
@@ -281,20 +289,20 @@ function ErrorBoundary({ children }) {
### Common Events ### Common Events
| Event Name | Description | Example Properties | | Event Name | Description | Example Properties |
| --------------------- | --------------------- | ------------------------------------------------------------ | |------------|-------------|-------------------|
| `pageview` | Page view | `{ url: '/products/123' }` | | `pageview` | Page view | `{ url: '/products/123' }` |
| `button_click` | Button clicked | `{ button_id: 'cta-primary', page: 'homepage' }` | | `button_click` | Button clicked | `{ button_id: 'cta-primary', page: 'homepage' }` |
| `link_click` | Link clicked | `{ link_url: '/products', link_text: 'View Products' }` | | `link_click` | Link clicked | `{ link_url: '/products', link_text: 'View Products' }` |
| `form_submit` | Form submitted | `{ form_id: 'contact-form', form_name: 'Contact Us' }` | | `form_submit` | Form submitted | `{ form_id: 'contact-form', form_name: 'Contact Us' }` |
| `product_view` | Product page viewed | `{ product_id: '123', product_name: 'Cable', price: 99.99 }` | | `product_view` | Product page viewed | `{ product_id: '123', product_name: 'Cable', price: 99.99 }` |
| `product_add_to_cart` | Product added to cart | `{ product_id: '123', quantity: 1 }` | | `product_add_to_cart` | Product added to cart | `{ product_id: '123', quantity: 1 }` |
| `product_purchase` | Product purchased | `{ product_id: '123', transaction_id: 'TXN-123' }` | | `product_purchase` | Product purchased | `{ product_id: '123', transaction_id: 'TXN-123' }` |
| `search` | Search performed | `{ search_query: 'cable', search_results_count: 42 }` | | `search` | Search performed | `{ search_query: 'cable', search_results_count: 42 }` |
| `filter_apply` | Filter applied | `{ filter_type: 'category', filter_value: 'high-voltage' }` | | `filter_apply` | Filter applied | `{ filter_type: 'category', filter_value: 'high-voltage' }` |
| `user_login` | User logged in | `{ user_email: 'user@example.com' }` | | `user_login` | User logged in | `{ user_email: 'user@example.com' }` |
| `user_signup` | User signed up | `{ user_email: 'user@example.com' }` | | `user_signup` | User signed up | `{ user_email: 'user@example.com' }` |
| `error` | Error occurred | `{ error_message: 'Something went wrong' }` | | `error` | Error occurred | `{ error_message: 'Something went wrong' }` |
### Custom Events ### Custom Events
@@ -377,9 +385,8 @@ The analytics system includes development mode logging:
### Analytics Not Working ### Analytics Not Working
1. **Check environment variables:** 1. **Check environment variables:**
```bash ```bash
echo $UMAMI_WEBSITE_ID echo $NEXT_PUBLIC_UMAMI_WEBSITE_ID
``` ```
2. **Verify the script is loading:** 2. **Verify the script is loading:**
@@ -398,11 +405,11 @@ In development mode, you'll see console logs for all tracked events. This helps
### Disabling Analytics ### Disabling Analytics
To disable analytics (e.g., for local development), simply remove the `UMAMI_WEBSITE_ID` environment variable: To disable analytics (e.g., for local development), simply remove the `NEXT_PUBLIC_UMAMI_WEBSITE_ID` environment variable:
```bash ```bash
# .env.local (not committed to git) # .env.local (not committed to git)
# UMAMI_WEBSITE_ID= # NEXT_PUBLIC_UMAMI_WEBSITE_ID=
``` ```
## Performance ## Performance
@@ -431,7 +438,6 @@ The analytics implementation is optimized for performance:
## Support ## Support
For issues or questions about the analytics implementation, check: For issues or questions about the analytics implementation, check:
1. This README for usage examples 1. This README for usage examples
2. The component source code for implementation details 2. The component source code for implementation details
3. The Umami documentation for platform-specific questions 3. The Umami documentation for platform-specific questions

View File

@@ -16,7 +16,6 @@ The project already had a solid foundation:
## What Was Enhanced ## What Was Enhanced
### 1. **Enhanced UmamiScript** (`components/analytics/UmamiScript.tsx`) ### 1. **Enhanced UmamiScript** (`components/analytics/UmamiScript.tsx`)
- ✅ Added TypeScript props interface for customization - ✅ Added TypeScript props interface for customization
- ✅ Added JSDoc documentation with usage examples - ✅ Added JSDoc documentation with usage examples
- ✅ Added error handling for script loading failures - ✅ Added error handling for script loading failures
@@ -24,13 +23,11 @@ The project already had a solid foundation:
- ✅ Improved type safety and comments - ✅ Improved type safety and comments
### 2. **Enhanced AnalyticsProvider** (`components/analytics/AnalyticsProvider.tsx`) ### 2. **Enhanced AnalyticsProvider** (`components/analytics/AnalyticsProvider.tsx`)
- ✅ Added comprehensive JSDoc documentation - ✅ Added comprehensive JSDoc documentation
- ✅ Added development mode logging - ✅ Added development mode logging
- ✅ Improved code comments - ✅ Improved code comments
### 3. **New Custom Hook** (`components/analytics/useAnalytics.ts`) ### 3. **New Custom Hook** (`components/analytics/useAnalytics.ts`)
- ✅ Type-safe `useAnalytics` hook for easy event tracking - ✅ Type-safe `useAnalytics` hook for easy event tracking
-`trackEvent()` method for custom events -`trackEvent()` method for custom events
-`trackPageview()` method for manual pageview tracking -`trackPageview()` method for manual pageview tracking
@@ -38,14 +35,12 @@ The project already had a solid foundation:
- ✅ Development mode logging - ✅ Development mode logging
### 4. **Event Definitions** (`components/analytics/analytics-events.ts`) ### 4. **Event Definitions** (`components/analytics/analytics-events.ts`)
- ✅ Centralized event constants for consistency - ✅ Centralized event constants for consistency
- ✅ Type-safe event names - ✅ Type-safe event names
- ✅ Helper functions for common event properties - ✅ Helper functions for common event properties
- ✅ 30+ predefined events for various use cases - ✅ 30+ predefined events for various use cases
### 5. **Comprehensive Documentation** ### 5. **Comprehensive Documentation**
-**README.md** - Full documentation with setup, usage, and best practices -**README.md** - Full documentation with setup, usage, and best practices
-**EXAMPLES.md** - 20+ practical examples for different scenarios -**EXAMPLES.md** - 20+ practical examples for different scenarios
-**QUICK_REFERENCE.md** - Quick start guide and troubleshooting -**QUICK_REFERENCE.md** - Quick start guide and troubleshooting
@@ -68,14 +63,12 @@ components/analytics/
## Key Features ## Key Features
### 🚀 Modern Implementation ### 🚀 Modern Implementation
- Uses Next.js `Script` component (not old-school `<script>` tags) - Uses Next.js `Script` component (not old-school `<script>` tags)
- TypeScript for type safety - TypeScript for type safety
- React hooks for clean API - React hooks for clean API
- Environment variable configuration - Environment variable configuration
### 📊 Comprehensive Tracking ### 📊 Comprehensive Tracking
- Automatic pageview tracking on route changes - Automatic pageview tracking on route changes
- Custom event tracking with properties - Custom event tracking with properties
- E-commerce events (products, cart, purchases) - E-commerce events (products, cart, purchases)
@@ -84,7 +77,6 @@ components/analytics/
- Error and performance tracking - Error and performance tracking
### 🎯 Developer Experience ### 🎯 Developer Experience
- Type-safe event tracking - Type-safe event tracking
- Centralized event definitions - Centralized event definitions
- Development mode logging - Development mode logging
@@ -92,7 +84,6 @@ components/analytics/
- 20+ practical examples - 20+ practical examples
### 🔒 Privacy & Performance ### 🔒 Privacy & Performance
- No PII tracking by default - No PII tracking by default
- Script loads after page is interactive - Script loads after page is interactive
- Minimal performance impact - Minimal performance impact
@@ -104,7 +95,7 @@ The project is already configured in `docker-compose.yml`:
```yaml ```yaml
environment: environment:
- UMAMI_WEBSITE_ID=${UMAMI_WEBSITE_ID} - NEXT_PUBLIC_UMAMI_WEBSITE_ID=${NEXT_PUBLIC_UMAMI_WEBSITE_ID}
- NEXT_PUBLIC_UMAMI_SCRIPT_URL=${NEXT_PUBLIC_UMAMI_SCRIPT_URL:-https://analytics.infra.mintel.me/script.js} - NEXT_PUBLIC_UMAMI_SCRIPT_URL=${NEXT_PUBLIC_UMAMI_SCRIPT_URL:-https://analytics.infra.mintel.me/script.js}
``` ```
@@ -113,7 +104,7 @@ environment:
Add to your `.env` file: Add to your `.env` file:
```bash ```bash
UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3 NEXT_PUBLIC_UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3
``` ```
## Usage Examples ## Usage Examples
@@ -197,7 +188,7 @@ In development, you'll see console logs:
```bash ```bash
# .env.local # .env.local
# UMAMI_WEBSITE_ID= # NEXT_PUBLIC_UMAMI_WEBSITE_ID=
``` ```
## Troubleshooting ## Troubleshooting
@@ -205,9 +196,8 @@ In development, you'll see console logs:
### Analytics Not Working? ### Analytics Not Working?
1. **Check environment variables:** 1. **Check environment variables:**
```bash ```bash
echo $UMAMI_WEBSITE_ID echo $NEXT_PUBLIC_UMAMI_WEBSITE_ID
``` ```
2. **Verify script is loading:** 2. **Verify script is loading:**
@@ -222,12 +212,12 @@ In development, you'll see console logs:
### Common Issues ### Common Issues
| Issue | Solution | | Issue | Solution |
| ------------------- | ----------------------------------- | |-------|----------|
| No data in Umami | Check website ID and script URL | | No data in Umami | Check website ID and script URL |
| Events not tracking | Verify `useAnalytics` hook is used | | Events not tracking | Verify `useAnalytics` hook is used |
| Script not loading | Check network connection, CORS | | Script not loading | Check network connection, CORS |
| Wrong data | Verify event properties are correct | | Wrong data | Verify event properties are correct |
## Performance Tips ## Performance Tips
@@ -249,13 +239,13 @@ In development, you'll see console logs:
1. ✅ **Setup complete** - All files are in place 1. ✅ **Setup complete** - All files are in place
2. ✅ **Documentation complete** - README, EXAMPLES, QUICK_REFERENCE 2. ✅ **Documentation complete** - README, EXAMPLES, QUICK_REFERENCE
3. ✅ **Code enhanced** - Better TypeScript, error handling, docs 3. ✅ **Code enhanced** - Better TypeScript, error handling, docs
4. 📝 **Add to .env** - Set `UMAMI_WEBSITE_ID` 4. 📝 **Add to .env** - Set `NEXT_PUBLIC_UMAMI_WEBSITE_ID`
5. 🧪 **Test in development** - Verify events are tracked 5. 🧪 **Test in development** - Verify events are tracked
6. 🚀 **Deploy** - Analytics will work in production 6. 🚀 **Deploy** - Analytics will work in production
## Quick Start Checklist ## Quick Start Checklist
- [ ] Add `UMAMI_WEBSITE_ID` to `.env` file - [ ] Add `NEXT_PUBLIC_UMAMI_WEBSITE_ID` to `.env` file
- [ ] Verify `UmamiScript` is in `app/[locale]/layout.tsx` - [ ] Verify `UmamiScript` is in `app/[locale]/layout.tsx`
- [ ] Verify `AnalyticsProvider` is in `app/[locale]/layout.tsx` - [ ] Verify `AnalyticsProvider` is in `app/[locale]/layout.tsx`
- [ ] Test in development mode (check console logs) - [ ] Test in development mode (check console logs)

View File

@@ -1,42 +0,0 @@
'use client';
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
interface BlogPaginationProps {
currentPage: number;
totalPages: number;
locale: string;
}
export function BlogPaginationKeyboardObserver({
currentPage,
totalPages,
locale,
}: BlogPaginationProps) {
const router = useRouter();
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
// Don't trigger if user is typing in an input
if (
document.activeElement?.tagName === 'INPUT' ||
document.activeElement?.tagName === 'TEXTAREA' ||
document.activeElement?.tagName === 'SELECT'
) {
return;
}
if (e.key === 'ArrowLeft' && currentPage > 1) {
router.push(`/${locale}/blog?page=${currentPage - 1}`);
} else if (e.key === 'ArrowRight' && currentPage < totalPages) {
router.push(`/${locale}/blog?page=${currentPage + 1}`);
}
};
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
}, [currentPage, totalPages, locale, router]);
return null;
}

View File

@@ -5,66 +5,47 @@ import { PostMdx } from '@/lib/blog';
interface PostNavigationProps { interface PostNavigationProps {
prev: PostMdx | null; prev: PostMdx | null;
next: PostMdx | null; next: PostMdx | null;
isPrevRandom?: boolean;
isNextRandom?: boolean;
locale: string; locale: string;
} }
export default function PostNavigation({ export default function PostNavigation({ prev, next, locale }: PostNavigationProps) {
prev,
next,
isPrevRandom,
isNextRandom,
locale,
}: PostNavigationProps) {
if (!prev && !next) return null; if (!prev && !next) return null;
return ( return (
<div className="grid grid-cols-1 md:grid-cols-2 w-full mt-16"> <div className="grid grid-cols-1 md:grid-cols-2 w-full mt-16">
{/* Previous Post (Older) */} {/* Previous Post (Older) */}
{prev ? ( {prev ? (
<Link <Link
href={`/${locale}/blog/${prev.slug}`} href={`/${locale}/blog/${prev.slug}`}
className="group relative h-64 md:h-80 overflow-hidden block" className="group relative h-64 md:h-80 overflow-hidden block"
> >
{/* Background Image */} {/* Background Image */}
{prev.frontmatter.featuredImage ? ( {prev.frontmatter.featuredImage ? (
<div <div
className="absolute inset-0 bg-cover bg-center transition-transform duration-700 group-hover:scale-110" className="absolute inset-0 bg-cover bg-center transition-transform duration-700 group-hover:scale-110"
style={{ backgroundImage: `url(${prev.frontmatter.featuredImage})` }} style={{ backgroundImage: `url(${prev.frontmatter.featuredImage})` }}
/> />
) : ( ) : (
<div className="absolute inset-0 bg-neutral-100" /> <div className="absolute inset-0 bg-neutral-100" />
)} )}
{/* Overlay */} {/* Overlay */}
<div className="absolute inset-0 bg-black/60 group-hover:bg-black/50 transition-colors duration-300" /> <div className="absolute inset-0 bg-black/60 group-hover:bg-black/50 transition-colors duration-300" />
{/* Content */} {/* Content */}
<div className="absolute inset-0 flex flex-col justify-center p-8 md:p-12 text-white z-10"> <div className="absolute inset-0 flex flex-col justify-center p-8 md:p-12 text-white z-10">
<span className="text-sm font-bold uppercase tracking-wider mb-2 text-white/90"> <span className="text-sm font-bold uppercase tracking-wider mb-2 opacity-70">
{isPrevRandom {locale === 'de' ? 'Vorheriger Beitrag' : 'Previous Post'}
? locale === 'de'
? 'Weiterer Artikel'
: 'More Article'
: locale === 'de'
? 'Vorheriger Beitrag'
: 'Previous Post'}
</span> </span>
<h3 className="text-xl md:text-2xl font-bold leading-tight group-hover:underline decoration-2 underline-offset-4"> <h3 className="text-xl md:text-2xl font-bold leading-tight group-hover:underline decoration-2 underline-offset-4">
{prev.frontmatter.title} {prev.frontmatter.title}
</h3> </h3>
</div> </div>
{/* Arrow Icon */} {/* Arrow Icon */}
<div className="absolute left-4 top-1/2 -translate-y-1/2 text-white/70 group-hover:text-white group-hover:-translate-x-2 transition-all duration-300"> <div className="absolute left-4 top-1/2 -translate-y-1/2 text-white/30 group-hover:text-white group-hover:-translate-x-2 transition-all duration-300">
<svg className="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <svg className="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M15 19l-7-7 7-7"
/>
</svg> </svg>
</div> </div>
</Link> </Link>
@@ -74,39 +55,33 @@ export default function PostNavigation({
{/* Next Post (Newer) */} {/* Next Post (Newer) */}
{next ? ( {next ? (
<Link <Link
href={`/${locale}/blog/${next.slug}`} href={`/${locale}/blog/${next.slug}`}
className="group relative h-64 md:h-80 overflow-hidden block" className="group relative h-64 md:h-80 overflow-hidden block"
> >
{/* Background Image */} {/* Background Image */}
{next.frontmatter.featuredImage ? ( {next.frontmatter.featuredImage ? (
<div <div
className="absolute inset-0 bg-cover bg-center transition-transform duration-700 group-hover:scale-110" className="absolute inset-0 bg-cover bg-center transition-transform duration-700 group-hover:scale-110"
style={{ backgroundImage: `url(${next.frontmatter.featuredImage})` }} style={{ backgroundImage: `url(${next.frontmatter.featuredImage})` }}
/> />
) : ( ) : (
<div className="absolute inset-0 bg-neutral-100" /> <div className="absolute inset-0 bg-neutral-100" />
)} )}
{/* Overlay */} {/* Overlay */}
<div className="absolute inset-0 bg-black/60 group-hover:bg-black/50 transition-colors duration-300" /> <div className="absolute inset-0 bg-black/60 group-hover:bg-black/50 transition-colors duration-300" />
{/* Content */} {/* Content */}
<div className="absolute inset-0 flex flex-col justify-center items-end text-right p-8 md:p-12 text-white z-10"> <div className="absolute inset-0 flex flex-col justify-center items-end text-right p-8 md:p-12 text-white z-10">
<span className="text-sm font-bold uppercase tracking-wider mb-2 text-white/90"> <span className="text-sm font-bold uppercase tracking-wider mb-2 opacity-70">
{isNextRandom {locale === 'de' ? 'Nächster Beitrag' : 'Next Post'}
? locale === 'de'
? 'Weiterer Artikel'
: 'More Article'
: locale === 'de'
? 'Nächster Beitrag'
: 'Next Post'}
</span> </span>
<h3 className="text-xl md:text-2xl font-bold leading-tight group-hover:underline decoration-2 underline-offset-4"> <h3 className="text-xl md:text-2xl font-bold leading-tight group-hover:underline decoration-2 underline-offset-4">
{next.frontmatter.title} {next.frontmatter.title}
</h3> </h3>
</div> </div>
{/* Arrow Icon */} {/* Arrow Icon */}
<div className="absolute right-4 top-1/2 -translate-y-1/2 text-white/30 group-hover:text-white group-hover:translate-x-2 transition-all duration-300"> <div className="absolute right-4 top-1/2 -translate-y-1/2 text-white/30 group-hover:text-white group-hover:translate-x-2 transition-all duration-300">
<svg className="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <svg className="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">

View File

@@ -28,7 +28,7 @@ export default function PowerCTA({ locale }: PowerCTAProps) {
<span className="text-accent block">{isDe ? 'Energiewende?' : 'Energy Transition?'}</span> <span className="text-accent block">{isDe ? 'Energiewende?' : 'Energy Transition?'}</span>
</h3> </h3>
<p className="text-xl text-white/90 mb-10 leading-relaxed max-w-2xl"> <p className="text-xl text-white/70 mb-10 leading-relaxed max-w-2xl">
{isDe {isDe
? 'Von der Planung von Wind- und Solarparks bis zur Lieferung hochwertiger Energiekabel erwecken wir Ihre Projekte zum Leben.' ? 'Von der Planung von Wind- und Solarparks bis zur Lieferung hochwertiger Energiekabel erwecken wir Ihre Projekte zum Leben.'
: 'From wind and solar park planning to delivering high-quality energy cables, we bring your projects to life.'} : 'From wind and solar park planning to delivering high-quality energy cables, we bring your projects to life.'}
@@ -45,7 +45,7 @@ export default function PowerCTA({ locale }: PowerCTAProps) {
? 'Zertifizierte Qualität nach EU-Standards' ? 'Zertifizierte Qualität nach EU-Standards'
: 'Certified quality according to EU standards', : 'Certified quality according to EU standards',
].map((item, i) => ( ].map((item, i) => (
<div key={i} className="flex items-center gap-4 text-white/90"> <div key={i} className="flex items-center gap-4 text-white/80">
<div className="w-6 h-6 rounded-full bg-accent/20 flex items-center justify-center flex-shrink-0"> <div className="w-6 h-6 rounded-full bg-accent/20 flex items-center justify-center flex-shrink-0">
<svg <svg
className="w-3 h-3 text-accent" className="w-3 h-3 text-accent"
@@ -88,7 +88,7 @@ export default function PowerCTA({ locale }: PowerCTAProps) {
/> />
</svg> </svg>
</Link> </Link>
<p className="text-white/80 text-sm font-medium"> <p className="text-white/50 text-sm font-medium">
{isDe {isDe
? 'Kostenlose Erstberatung für Ihr Vorhaben.' ? 'Kostenlose Erstberatung für Ihr Vorhaben.'
: 'Free initial consultation for your project.'} : 'Free initial consultation for your project.'}

View File

@@ -53,7 +53,7 @@ export default function TableOfContents({ headings, locale }: TableOfContentsPro
return ( return (
<nav className="hidden lg:block w-full ml-12"> <nav className="hidden lg:block w-full ml-12">
<div className="relative pl-6 border-l border-neutral-200"> <div className="relative pl-6 border-l border-neutral-200">
<h4 className="text-xs md:text-sm font-bold uppercase tracking-[0.2em] text-text-primary/70 mb-6"> <h4 className="text-xs md:text-sm font-bold uppercase tracking-[0.2em] text-text-primary/50 mb-6">
{locale === 'de' ? 'Inhalt' : 'Table of Contents'} {locale === 'de' ? 'Inhalt' : 'Table of Contents'}
</h4> </h4>
<ul className="space-y-4"> <ul className="space-y-4">

View File

@@ -19,78 +19,53 @@ export default function VisualLinkPreview({ url, title, summary, image }: Visual
})(); })();
return ( return (
<Link <Link href={url} target="_blank" rel="noopener noreferrer" className="block my-12 no-underline group">
href={url}
target="_blank"
rel="noopener noreferrer"
className="block my-12 no-underline group"
>
<div className="flex flex-col md:flex-row border border-neutral-200 rounded-2xl overflow-hidden bg-white transition-all duration-500 hover:shadow-2xl hover:border-primary/20 hover:-translate-y-1 group"> <div className="flex flex-col md:flex-row border border-neutral-200 rounded-2xl overflow-hidden bg-white transition-all duration-500 hover:shadow-2xl hover:border-primary/20 hover:-translate-y-1 group">
<div className="relative w-full md:w-64 h-48 md:h-auto flex-shrink-0 bg-neutral-50 overflow-hidden"> <div className="relative w-full md:w-64 h-48 md:h-auto flex-shrink-0 bg-neutral-50 overflow-hidden">
{image ? ( {image ? (
<Image <Image
src={image} src={image}
alt={title} alt={title}
fill fill
unoptimized unoptimized
className="object-cover transition-transform duration-700 group-hover:scale-110" className="object-cover transition-transform duration-700 group-hover:scale-110"
/> />
) : ( ) : (
<div className="w-full h-full flex items-center justify-center bg-primary/5"> <div className="w-full h-full flex items-center justify-center bg-primary/5">
<svg <svg className="w-12 h-12 text-primary/20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
className="w-12 h-12 text-primary/20" <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" />
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"
/>
</svg> </svg>
</div> </div>
)} )}
{/* Industrial overlay */} {/* Industrial overlay */}
<div className="absolute inset-0 bg-primary/10 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none" /> <div className="absolute inset-0 bg-primary/10 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none" />
</div> </div>
<div className="p-8 flex flex-col justify-center relative"> <div className="p-8 flex flex-col justify-center relative">
{/* Industrial accent corner */} {/* Industrial accent corner */}
<div className="absolute top-0 right-0 w-12 h-12 bg-primary/5 -mr-6 -mt-6 rotate-45 transition-transform group-hover:scale-110" /> <div className="absolute top-0 right-0 w-12 h-12 bg-primary/5 -mr-6 -mt-6 rotate-45 transition-transform group-hover:scale-110" />
<div className="flex items-center gap-2 mb-3"> <div className="flex items-center gap-2 mb-3">
<span className="text-[10px] font-bold uppercase tracking-[0.2em] text-primary/80 bg-primary/10 px-2 py-0.5 rounded"> <span className="text-[10px] font-bold uppercase tracking-[0.2em] text-primary/60 bg-primary/5 px-2 py-0.5 rounded">
External Link External Link
</span> </span>
<span className="text-[10px] font-bold uppercase tracking-[0.2em] text-text-secondary/80"> <span className="text-[10px] font-bold uppercase tracking-[0.2em] text-text-secondary/40">
{hostname} {hostname}
</span> </span>
</div> </div>
<h3 className="text-xl font-bold text-text-primary mb-3 group-hover:text-primary transition-colors line-clamp-2 leading-tight"> <h3 className="text-xl font-bold text-text-primary mb-3 group-hover:text-primary transition-colors line-clamp-2 leading-tight">
{title} {title}
</h3> </h3>
<p className="text-text-secondary text-base line-clamp-2 leading-relaxed mb-4"> <p className="text-text-secondary text-base line-clamp-2 leading-relaxed mb-4">
{summary} {summary}
</p> </p>
<div className="flex items-center gap-2 text-primary font-bold text-xs uppercase tracking-widest"> <div className="flex items-center gap-2 text-primary font-bold text-xs uppercase tracking-widest">
<span>Read more</span> <span>Read more</span>
<svg <svg className="w-4 h-4 transition-transform group-hover:translate-x-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
className="w-4 h-4 transition-transform group-hover:translate-x-1" <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17 8l4 4m0 0l-4 4m4-4H3" />
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M17 8l4 4m0 0l-4 4m4-4H3"
/>
</svg> </svg>
</div> </div>
</div> </div>

View File

@@ -3,8 +3,7 @@ import React from 'react';
import Image from 'next/image'; import Image from 'next/image';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { Section, Container, Heading } from '../../components/ui'; import { Section, Container, Heading } from '../../components/ui';
import dynamic from 'next/dynamic'; import Lightbox from '../Lightbox';
const Lightbox = dynamic(() => import('../Lightbox'), { ssr: false });
import { useSearchParams } from 'next/navigation'; import { useSearchParams } from 'next/navigation';
export default function GallerySection() { export default function GallerySection() {

View File

@@ -2,6 +2,7 @@
import Scribble from '@/components/Scribble'; import Scribble from '@/components/Scribble';
import { Button, Container, Heading, Section } from '@/components/ui'; import { Button, Container, Heading, Section } from '@/components/ui';
import { motion } from 'framer-motion';
import { useTranslations, useLocale } from 'next-intl'; import { useTranslations, useLocale } from 'next-intl';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { useAnalytics } from '../analytics/useAnalytics'; import { useAnalytics } from '../analytics/useAnalytics';
@@ -16,8 +17,13 @@ export default function Hero() {
return ( return (
<Section className="relative min-h-[85vh] md:h-[90vh] flex flex-col items-center justify-center overflow-hidden bg-primary py-12 md:py-0 lg:py-0"> <Section className="relative min-h-[85vh] md:h-[90vh] flex flex-col items-center justify-center overflow-hidden bg-primary py-12 md:py-0 lg:py-0">
<Container className="relative z-10 text-center md:text-left text-white w-full order-2 md:order-none"> <Container className="relative z-10 text-center md:text-left text-white w-full order-2 md:order-none">
<div className="max-w-5xl mx-auto md:mx-0"> <motion.div
<div> className="max-w-5xl mx-auto md:mx-0"
initial="hidden"
animate="visible"
variants={containerVariants}
>
<motion.div variants={headingVariants}>
<Heading <Heading
level={1} level={1}
className="text-center md:text-left mb-6 md:mb-8 md:max-w-none text-white text-4xl sm:text-5xl md:text-7xl font-extrabold [text-shadow:_-2px_-2px_0_#002b49,_2px_-2px_0_#002b49,_-2px_2px_0_#002b49,_2px_2px_0_#002b49,_-2px_0_0_#002b49,_2px_0_0_#002b49,_0_-2px_0_#002b49,_0_2px_0_#002b49]" className="text-center md:text-left mb-6 md:mb-8 md:max-w-none text-white text-4xl sm:text-5xl md:text-7xl font-extrabold [text-shadow:_-2px_-2px_0_#002b49,_2px_-2px_0_#002b49,_-2px_2px_0_#002b49,_2px_2px_0_#002b49,_-2px_0_0_#002b49,_2px_0_0_#002b49,_0_-2px_0_#002b49,_0_2px_0_#002b49]"
@@ -25,30 +31,38 @@ export default function Hero() {
{t.rich('title', { {t.rich('title', {
green: (chunks) => ( green: (chunks) => (
<span className="relative inline-block"> <span className="relative inline-block">
<span className="relative z-10 text-accent italic inline-block">{chunks}</span> <motion.span
<div className="relative z-10 text-accent italic"
className="w-[140%] h-[140%] -top-[20%] -left-[20%] text-accent/30 hidden md:block absolute -z-10 animate-in fade-in zoom-in-0 duration-1000 ease-out fill-mode-both" variants={accentVariants}
style={{ animationDelay: '500ms' }} >
{chunks}
</motion.span>
<motion.div
variants={scribbleVariants}
className="w-[140%] h-[140%] -top-[20%] -left-[20%] text-accent/30 hidden md:block absolute -z-10"
> >
<Scribble variant="circle" /> <Scribble variant="circle" />
</div> </motion.div>
</span> </span>
), ),
})} })}
</Heading> </Heading>
</div> </motion.div>
<div> <motion.div variants={subtitleVariants}>
<p className="text-lg md:text-xl text-white leading-relaxed max-w-2xl mb-10 md:mb-12"> <p className="text-lg md:text-xl text-white/90 leading-relaxed max-w-2xl mb-10 md:mb-12">
{t('subtitle')} {t('subtitle')}
</p> </p>
</div> </motion.div>
<div className="flex flex-col sm:flex-row justify-center md:justify-start gap-4 md:gap-6"> <motion.div
<div> className="flex flex-col sm:flex-row justify-center md:justify-start gap-4 md:gap-6"
variants={buttonContainerVariants}
>
<motion.div variants={buttonVariants}>
<Button <Button
href="/contact" href="/contact"
variant="accent" variant="accent"
size="lg" size="lg"
className="group w-full sm:w-auto h-14 md:h-16 px-8 md:px-10 text-base md:text-lg hover:scale-105 transition-transform" className="group w-full sm:w-auto h-14 md:h-16 px-8 md:px-10 text-base md:text-lg"
onClick={() => onClick={() =>
trackEvent(AnalyticsEvents.BUTTON_CLICK, { trackEvent(AnalyticsEvents.BUTTON_CLICK, {
label: t('cta'), label: t('cta'),
@@ -57,17 +71,15 @@ export default function Hero() {
} }
> >
{t('cta')} {t('cta')}
<span className="transition-transform group-hover/btn:translate-x-1 ml-2"> <span className="transition-transform group-hover/btn:translate-x-1">&rarr;</span>
&rarr;
</span>
</Button> </Button>
</div> </motion.div>
<div> <motion.div variants={buttonVariants}>
<Button <Button
href={`/${locale}/${locale === 'de' ? 'produkte' : 'products'}`} href={`/${locale}/${locale === 'de' ? 'produkte' : 'products'}`}
variant="white" variant="white"
size="lg" size="lg"
className="group w-full sm:w-auto h-14 md:h-16 px-8 md:px-10 text-base md:text-lg md:bg-white md:text-primary md:hover:bg-neutral-light md:border-none hover:scale-105 transition-transform" className="group w-full sm:w-auto h-14 md:h-16 px-8 md:px-10 text-base md:text-lg md:bg-white md:text-primary md:hover:bg-neutral-light md:border-none"
onClick={() => onClick={() =>
trackEvent(AnalyticsEvents.BUTTON_CLICK, { trackEvent(AnalyticsEvents.BUTTON_CLICK, {
label: t('exploreProducts'), label: t('exploreProducts'),
@@ -77,23 +89,110 @@ export default function Hero() {
> >
{t('exploreProducts')} {t('exploreProducts')}
</Button> </Button>
</div> </motion.div>
</div> </motion.div>
</div> </motion.div>
</Container> </Container>
<div className="relative md:absolute inset-0 z-0 w-full h-[40vh] md:h-full order-1 md:order-none mb-[-80px] md:mb-0 mt-[80px] md:mt-0 overflow-visible pointer-events-none animate-in fade-in zoom-in-95 duration-1000 ease-out fill-mode-both"> <motion.div
className="relative md:absolute inset-0 z-0 w-full h-[40vh] md:h-full order-1 md:order-none mb-[-80px] md:mb-0 mt-[80px] md:mt-0 overflow-visible pointer-events-none"
initial={{ opacity: 0, scale: 0.95, filter: 'blur(20px)' }}
animate={{ opacity: 1, scale: 1, filter: 'blur(0px)' }}
transition={{ duration: 2.2, ease: 'easeOut', delay: 0.05 }}
>
<HeroIllustration /> <HeroIllustration />
</div> </motion.div>
<div <motion.div
className="absolute bottom-6 md:bottom-10 left-1/2 -translate-x-1/2 hidden sm:block animate-in fade-in slide-in-from-bottom-4 duration-1000 ease-out fill-mode-both" className="absolute bottom-6 md:bottom-10 left-1/2 -translate-x-1/2 hidden sm:block"
style={{ animationDelay: '2000ms' }} initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 1, ease: 'easeOut', delay: 3 }}
> >
<div className="w-6 h-10 border-2 border-white/30 rounded-full flex justify-center p-1"> <div className="w-6 h-10 border-2 border-white/30 rounded-full flex justify-center p-1">
<div className="w-1 h-2 bg-white rounded-full animate-bounce" /> <motion.div
className="w-1 h-2 bg-white rounded-full"
animate={{ y: [0, -10, 0] }}
transition={{
duration: 1.5,
repeat: Infinity,
ease: 'easeInOut',
}}
/>
</div> </div>
</div> </motion.div>
</Section> </Section>
); );
} }
const containerVariants = {
hidden: { opacity: 1 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.1,
delayChildren: 0.1,
},
},
} as const;
const headingVariants = {
hidden: { opacity: 1, y: 10, scale: 0.98 },
visible: {
opacity: 1,
y: 0,
scale: 1,
transition: { duration: 0.4, ease: [0.25, 0.46, 0.45, 0.94] },
},
} as const;
const accentVariants = {
hidden: { opacity: 0, scale: 0.9, rotate: -5 },
visible: {
opacity: 1,
scale: 1,
rotate: 0,
transition: { duration: 0.8, ease: [0.25, 0.46, 0.45, 0.94] },
},
} as const;
const scribbleVariants = {
hidden: { opacity: 0, scale: 0, rotate: 180 },
visible: {
opacity: 1,
scale: 1,
rotate: 0,
transition: { duration: 1, type: 'spring', stiffness: 300, damping: 20 },
},
} as const;
const subtitleVariants = {
hidden: { opacity: 1, y: 20, scale: 0.98 },
visible: {
opacity: 1,
y: 0,
scale: 1,
transition: { duration: 0.6, ease: [0.25, 0.46, 0.45, 0.94], delay: 0.1 },
},
} as const;
const buttonContainerVariants = {
hidden: { opacity: 1 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.15,
delayChildren: 0.4,
},
},
} as const;
const buttonVariants = {
hidden: { opacity: 1, y: 30, scale: 0.9 },
visible: {
opacity: 1,
y: 0,
scale: 1,
transition: { type: 'spring', stiffness: 400, damping: 20 },
},
} as const;

View File

@@ -125,9 +125,8 @@ export default function HeroIllustration() {
}, []); }, []);
const viewBox = isMobile ? '400 0 1000 1100' : '-400 -200 1800 1100'; const viewBox = isMobile ? '400 0 1000 1100' : '-400 -200 1800 1100';
// Increase scale slightly and opacity significantly on mobile to fix the "thin" appearance const scale = isMobile ? 1.44 : 1;
const scale = isMobile ? 1.6 : 1; const opacity = isMobile ? 0.6 : 0.85;
const opacity = isMobile ? 0.9 : 0.85;
return ( return (
<div className="absolute inset-0 z-0 overflow-visible bg-primary w-full h-full"> <div className="absolute inset-0 z-0 overflow-visible bg-primary w-full h-full">
@@ -155,15 +154,15 @@ export default function HeroIllustration() {
<stop offset="70%" stopColor="white" stopOpacity="0.4" /> <stop offset="70%" stopColor="white" stopOpacity="0.4" />
<stop offset="100%" stopColor="white" stopOpacity="0" /> <stop offset="100%" stopColor="white" stopOpacity="0" />
</linearGradient> </linearGradient>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%"> <filter id="glow" x="-20%" y="-20%" width="140%" height="140%">
<feGaussianBlur stdDeviation="3" result="blur" /> <feGaussianBlur stdDeviation="1.5" result="blur" />
<feMerge> <feMerge>
<feMergeNode in="blur" /> <feMergeNode in="blur" />
<feMergeNode in="SourceGraphic" /> <feMergeNode in="SourceGraphic" />
</feMerge> </feMerge>
</filter> </filter>
<filter id="soft-glow" x="-100%" y="-100%" width="300%" height="300%"> <filter id="soft-glow" x="-50%" y="-50%" width="200%" height="200%">
<feGaussianBlur stdDeviation="2" result="blur" /> <feGaussianBlur stdDeviation="1" result="blur" />
<feMerge> <feMerge>
<feMergeNode in="blur" /> <feMergeNode in="blur" />
<feMergeNode in="SourceGraphic" /> <feMergeNode in="SourceGraphic" />
@@ -216,10 +215,10 @@ export default function HeroIllustration() {
</g> </g>
{/* ANIMATED ENERGY FLOW */} {/* ANIMATED ENERGY FLOW */}
<g filter="url(#glow)"> <g>
{POWER_LINES.map((line, i) => { {POWER_LINES.map((line, i) => {
// Only animate a subset of lines to reduce main-thread work // Only animate a small subset of lines to reduce main-thread work significantly
if (i % 2 !== 0) return null; if (i % 5 !== 0) return null;
const from = gridToScreen(line.from.col, line.from.row); const from = gridToScreen(line.from.col, line.from.row);
const to = gridToScreen(line.to.col, line.to.row); const to = gridToScreen(line.to.col, line.to.row);
const length = Math.sqrt(Math.pow(to.x - from.x, 2) + Math.pow(to.y - from.y, 2)); const length = Math.sqrt(Math.pow(to.x - from.x, 2) + Math.pow(to.y - from.y, 2));

View File

@@ -1,7 +1,7 @@
'use client'; 'use client';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { m, LazyMotion, AnimatePresence } from 'framer-motion'; import { motion, AnimatePresence } from 'framer-motion';
import { useRecordMode } from './RecordModeContext'; import { useRecordMode } from './RecordModeContext';
export function PlaybackCursor() { export function PlaybackCursor() {
@@ -24,69 +24,67 @@ export function PlaybackCursor() {
if (!isPlaying) return null; if (!isPlaying) return null;
return ( return (
<LazyMotion strict features={() => import('@/lib/framer-features').then(res => res.default)}> <motion.div
<m.div className="fixed z-[10000] pointer-events-none"
className="fixed z-[10000] pointer-events-none" animate={{
animate={{ x: cursorPosition.x,
x: cursorPosition.x, y: cursorPosition.y,
y: cursorPosition.y, scale: isClicking ? 0.8 : 1,
scale: isClicking ? 0.8 : 1, rotateX: isClicking ? 15 : 0,
rotateX: isClicking ? 15 : 0, rotateY: isClicking ? -15 : 0,
rotateY: isClicking ? -15 : 0, }}
}} transition={{
transition={{ x: { type: 'spring', damping: 30, stiffness: 250, mass: 0.5 },
x: { type: 'spring', damping: 30, stiffness: 250, mass: 0.5 }, y: { type: 'spring', damping: 30, stiffness: 250, mass: 0.5 },
y: { type: 'spring', damping: 30, stiffness: 250, mass: 0.5 }, scale: { type: 'spring', damping: 15, stiffness: 400 },
scale: { type: 'spring', damping: 15, stiffness: 400 }, rotateX: { type: 'spring', damping: 15, stiffness: 400 },
rotateX: { type: 'spring', damping: 15, stiffness: 400 }, rotateY: { type: 'spring', damping: 15, stiffness: 400 },
rotateY: { type: 'spring', damping: 15, stiffness: 400 }, }}
}} style={{ perspective: '1000px' }}
style={{ perspective: '1000px' }} >
> <AnimatePresence>
<AnimatePresence> {isClicking && (
{isClicking && ( <motion.div
<m.div initial={{ scale: 0.5, opacity: 0 }}
initial={{ scale: 0.5, opacity: 0 }} animate={{ scale: 2.5, opacity: 0 }}
animate={{ scale: 2.5, opacity: 0 }} exit={{ opacity: 0 }}
exit={{ opacity: 0 }} transition={{ duration: 0.4, ease: 'easeOut' }}
transition={{ duration: 0.4, ease: 'easeOut' }} className="absolute inset-0 rounded-full border-2 border-[#82ed20] blur-[1px]"
className="absolute inset-0 rounded-full border-2 border-[#82ed20] blur-[1px]" />
/> )}
)} </AnimatePresence>
</AnimatePresence>
{/* Outer Pulse Ring */} {/* Outer Pulse Ring */}
<div
className={`absolute -inset-3 rounded-full bg-[#82ed20]/10 ${isClicking ? 'scale-150 opacity-0' : 'animate-ping'} transition-all duration-300`}
/>
{/* Visual Cursor */}
<div className="relative">
{/* Soft Glow */}
<div <div
className={`absolute -inset-3 rounded-full bg-[#82ed20]/10 ${isClicking ? 'scale-150 opacity-0' : 'animate-ping'} transition-all duration-300`} className={`absolute -inset-2 bg-[#82ed20]/20 rounded-full blur-md transition-all ${isClicking ? 'bg-[#82ed20]/50 blur-xl' : ''}`}
/> />
{/* Visual Cursor */} {/* Pointer Arrow */}
<div className="relative"> <svg
{/* Soft Glow */} width="24"
<div height="24"
className={`absolute -inset-2 bg-[#82ed20]/20 rounded-full blur-md transition-all ${isClicking ? 'bg-[#82ed20]/50 blur-xl' : ''}`} viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className={`drop-shadow-[0_2px_8px_rgba(130,237,32,0.5)] transition-transform ${isClicking ? 'translate-y-0.5' : ''}`}
>
<path
d="M3 3L10.07 19.97L12.58 12.58L19.97 10.07L3 3Z"
fill={isClicking ? '#82ed20' : 'white'}
stroke="black"
strokeWidth="1.5"
strokeLinejoin="round"
className="transition-colors duration-150"
/> />
</svg>
{/* Pointer Arrow */} </div>
<svg </motion.div>
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className={`drop-shadow-[0_2px_8px_rgba(130,237,32,0.5)] transition-transform ${isClicking ? 'translate-y-0.5' : ''}`}
>
<path
d="M3 3L10.07 19.97L12.58 12.58L19.97 10.07L3 3Z"
fill={isClicking ? '#82ed20' : 'white'}
stroke="black"
strokeWidth="1.5"
strokeLinejoin="round"
className="transition-colors duration-150"
/>
</svg>
</div>
</m.div>
</LazyMotion>
); );
} }

View File

@@ -2,7 +2,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { useRecordMode } from './RecordModeContext'; import { useRecordMode } from './RecordModeContext';
import { Reorder, AnimatePresence, LazyMotion } from 'framer-motion'; import { Reorder, AnimatePresence } from 'framer-motion';
import { import {
Play, Play,
Square, Square,
@@ -146,460 +146,438 @@ export function RecordModeOverlay() {
} }
return ( return (
<LazyMotion strict features={() => import('@/lib/framer-features').then(res => res.default)}> <div className="fixed inset-0 z-[9998] pointer-events-none font-sans">
<div className="fixed inset-0 z-[9998] pointer-events-none font-sans"> {/* 1. Global Toolbar - Slim Industrial Bar */}
{/* 1. Global Toolbar - Slim Industrial Bar */} <div className="fixed bottom-6 left-1/2 -translate-x-1/2 z-[10000] pointer-events-auto">
<div className="fixed bottom-6 left-1/2 -translate-x-1/2 z-[10000] pointer-events-auto"> <div className="bg-black/80 backdrop-blur-2xl border border-white/10 p-2 rounded-[24px] shadow-[0_32px_80px_rgba(0,0,0,0.8)] flex items-center gap-2">
<div className="bg-black/80 backdrop-blur-2xl border border-white/10 p-2 rounded-[24px] shadow-[0_32px_80px_rgba(0,0,0,0.8)] flex items-center gap-2"> {/* Identity Tag */}
{/* Identity Tag */} <div className="flex items-center gap-3 px-4 py-2 bg-white/5 rounded-[16px] border border-white/5 mx-1">
<div className="flex items-center gap-3 px-4 py-2 bg-white/5 rounded-[16px] border border-white/5 mx-1"> <div className="w-2 h-2 rounded-full bg-accent animate-pulse" />
<div className="w-2 h-2 rounded-full bg-accent animate-pulse" /> <div className="flex flex-col">
<div className="flex flex-col"> <span className="text-[10px] font-bold text-white uppercase tracking-wider leading-none">
<span className="text-[10px] font-bold text-white uppercase tracking-wider leading-none"> Event Builder
Event Builder </span>
</span> <span className="text-[8px] text-white/30 uppercase tracking-widest mt-1">
<span className="text-[8px] text-white/30 uppercase tracking-widest mt-1"> Manual Mode
Manual Mode </span>
</span>
</div>
</div> </div>
</div>
<div className="w-px h-6 bg-white/10 mx-1" /> <div className="w-px h-6 bg-white/10 mx-1" />
{/* Action Tools */} {/* Action Tools */}
<div className="flex items-center gap-1"> <div className="flex items-center gap-1">
<button <button
onClick={() => { onClick={() => {
setPickingMode('mouse'); setPickingMode('mouse');
setLastInteractionType('click'); setLastInteractionType('click');
}} }}
className={`flex items-center gap-2 px-4 py-2.5 rounded-[16px] transition-all text-xs font-bold uppercase tracking-wide ${pickingMode === 'mouse' ? 'bg-accent text-primary-dark shadow-lg shadow-accent/20' : 'text-white/40 hover:text-white hover:bg-white/5'}`} className={`flex items-center gap-2 px-4 py-2.5 rounded-[16px] transition-all text-xs font-bold uppercase tracking-wide ${pickingMode === 'mouse' ? 'bg-accent text-primary-dark shadow-lg shadow-accent/20' : 'text-white/40 hover:text-white hover:bg-white/5'}`}
> >
<MousePointer2 size={16} /> <MousePointer2 size={16} />
<span>Mouse</span> <span>Mouse</span>
</button> </button>
<button
onClick={() => setPickingMode('scroll')}
className={`flex items-center gap-2 px-4 py-2.5 rounded-[16px] transition-all text-xs font-bold uppercase tracking-wide ${pickingMode === 'scroll' ? 'bg-accent text-primary-dark shadow-lg shadow-accent/20' : 'text-white/40 hover:text-white hover:bg-white/5'}`}
>
<Scroll size={16} />
<span>Scroll</span>
</button>
<button
onClick={() =>
addEvent({
type: 'wait',
duration: 2000,
zoom: 1,
description: 'Wait for 2s',
motionBlur: false,
})
}
className="flex items-center gap-2 px-4 py-2.5 rounded-[16px] text-white/40 hover:text-white hover:bg-white/5 transition-all text-xs font-bold uppercase tracking-wide"
>
<Plus size={16} />
<span>Wait</span>
</button>
</div>
<div className="w-px h-6 bg-white/10 mx-1" />
{/* Sequence Controls */}
<div className="flex items-center gap-1 p-0.5">
<button
onClick={playEvents}
disabled={isPlaying || events.length === 0}
className="p-2.5 text-accent hover:bg-accent/10 rounded-[14px] disabled:opacity-20 transition-all"
title="Preview Sequence"
>
<Play size={18} fill="currentColor" />
</button>
<button
onClick={() => setShowEvents(!showEvents)}
className={`p-2.5 rounded-[14px] transition-all relative ${showEvents ? 'bg-white/10 text-white' : 'text-white/40 hover:text-white hover:bg-white/5'}`}
>
<Edit2 size={18} />
{events.length > 0 && (
<span className="absolute -top-1 -right-1 w-4 h-4 bg-accent text-primary-dark text-[10px] flex items-center justify-center rounded-full font-bold border-2 border-black">
{events.length}
</span>
)}
</button>
<button
onClick={async () => {
const session = {
events,
name: 'Recording',
createdAt: new Date().toISOString(),
};
try {
const res = await fetch('/api/save-session', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(session),
});
if (res.ok) {
// Visual feedback could be improved, but alert is fine for dev tool
alert('Session saved to remotion/session.json');
} else {
const err = await res.json();
alert(`Failed to save: ${err.error}`);
}
} catch (e) {
console.error(e);
alert('Error saving session');
}
}}
disabled={events.length === 0}
className="p-3 bg-white/5 hover:bg-green-500/20 rounded-2xl disabled:opacity-30 transition-all text-green-400"
title="Save to Project (Dev)"
>
<Save size={20} />
</button>
<button
onClick={() => {
const data = JSON.stringify(
{ events, name: 'Recording', createdAt: new Date().toISOString() },
null,
2,
);
const blob = new Blob([data], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'remotion-session.json';
a.click();
URL.revokeObjectURL(url);
}}
disabled={events.length === 0}
className="p-3 bg-white/5 hover:bg-blue-500/20 rounded-2xl disabled:opacity-30 transition-all text-blue-400"
title="Download JSON"
>
<Download size={20} />
</button>
</div>
<div className="w-px h-6 bg-white/10 mx-1" />
<button <button
onClick={() => setIsActive(false)} onClick={() => setPickingMode('scroll')}
className="p-2.5 text-red-500 hover:bg-red-500/10 rounded-[14px] transition-all mx-1" className={`flex items-center gap-2 px-4 py-2.5 rounded-[16px] transition-all text-xs font-bold uppercase tracking-wide ${pickingMode === 'scroll' ? 'bg-accent text-primary-dark shadow-lg shadow-accent/20' : 'text-white/40 hover:text-white hover:bg-white/5'}`}
title="Exit Studio"
> >
<X size={20} /> <Scroll size={16} />
<span>Scroll</span>
</button>
<button
onClick={() =>
addEvent({
type: 'wait',
duration: 2000,
zoom: 1,
description: 'Wait for 2s',
motionBlur: false,
})
}
className="flex items-center gap-2 px-4 py-2.5 rounded-[16px] text-white/40 hover:text-white hover:bg-white/5 transition-all text-xs font-bold uppercase tracking-wide"
>
<Plus size={16} />
<span>Wait</span>
</button>
</div>
<div className="w-px h-6 bg-white/10 mx-1" />
{/* Sequence Controls */}
<div className="flex items-center gap-1 p-0.5">
<button
onClick={playEvents}
disabled={isPlaying || events.length === 0}
className="p-2.5 text-accent hover:bg-accent/10 rounded-[14px] disabled:opacity-20 transition-all"
title="Preview Sequence"
>
<Play size={18} fill="currentColor" />
</button>
<button
onClick={() => setShowEvents(!showEvents)}
className={`p-2.5 rounded-[14px] transition-all relative ${showEvents ? 'bg-white/10 text-white' : 'text-white/40 hover:text-white hover:bg-white/5'}`}
>
<Edit2 size={18} />
{events.length > 0 && (
<span className="absolute -top-1 -right-1 w-4 h-4 bg-accent text-primary-dark text-[10px] flex items-center justify-center rounded-full font-bold border-2 border-black">
{events.length}
</span>
)}
</button>
<button
onClick={async () => {
const session = { events, name: 'Recording', createdAt: new Date().toISOString() };
try {
const res = await fetch('/api/save-session', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(session),
});
if (res.ok) {
// Visual feedback could be improved, but alert is fine for dev tool
alert('Session saved to remotion/session.json');
} else {
const err = await res.json();
alert(`Failed to save: ${err.error}`);
}
} catch (e) {
console.error(e);
alert('Error saving session');
}
}}
disabled={events.length === 0}
className="p-3 bg-white/5 hover:bg-green-500/20 rounded-2xl disabled:opacity-30 transition-all text-green-400"
title="Save to Project (Dev)"
>
<Save size={20} />
</button>
<button
onClick={() => {
const data = JSON.stringify(
{ events, name: 'Recording', createdAt: new Date().toISOString() },
null,
2,
);
const blob = new Blob([data], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'remotion-session.json';
a.click();
URL.revokeObjectURL(url);
}}
disabled={events.length === 0}
className="p-3 bg-white/5 hover:bg-blue-500/20 rounded-2xl disabled:opacity-30 transition-all text-blue-400"
title="Download JSON"
>
<Download size={20} />
</button>
</div>
<div className="w-px h-6 bg-white/10 mx-1" />
<button
onClick={() => setIsActive(false)}
className="p-2.5 text-red-500 hover:bg-red-500/10 rounded-[14px] transition-all mx-1"
title="Exit Studio"
>
<X size={20} />
</button>
</div>
</div>
{/* 2. Event Timeline Popover */}
{showEvents && (
<div className="fixed bottom-[100px] left-1/2 -translate-x-1/2 w-[400px] pointer-events-auto z-[9999]">
<div className="bg-black/90 backdrop-blur-3xl border border-white/10 rounded-[32px] p-6 shadow-[0_40px_100px_rgba(0,0,0,0.9)] max-h-[500px] overflow-hidden flex flex-col scale-in">
<div className="flex items-center justify-between mb-6">
<div>
<h4 className="text-white font-bold text-lg leading-none">Recording Track</h4>
<p className="text-[10px] text-white/30 uppercase tracking-widest mt-2">
{events.length} Actions Recorded
</p>
</div>
<button
onClick={clearEvents}
disabled={events.length === 0}
className="text-red-400/40 hover:text-red-400 transition-colors p-2 hover:bg-red-500/10 rounded-xl disabled:opacity-10"
>
<Trash2 size={18} />
</button>
</div>
<Reorder.Group
axis="y"
values={events}
onReorder={setEvents}
className="flex-1 overflow-y-auto space-y-2 pr-2 scrollbar-hide"
>
{events.length === 0 ? (
<div className="py-12 flex flex-col items-center justify-center text-white/10">
<Plus size={40} strokeWidth={1} />
<p className="text-xs mt-4">Timeline is empty</p>
</div>
) : (
events.map((event, index) => (
<Reorder.Item
key={event.id}
value={event}
className="group flex items-center gap-3 bg-white/[0.03] border border-white/5 p-3 rounded-[20px] transition-all hover:bg-white/[0.06] hover:border-white/10"
onMouseEnter={() => setHoveredEventId(event.id)}
onMouseLeave={() => setHoveredEventId(null)}
>
<div className="cursor-grab active:cursor-grabbing text-white/10 hover:text-white/30 transition-colors">
<GripVertical size={16} />
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
<span className="text-white text-[10px] font-black uppercase tracking-widest">
{event.type === 'mouse' ? `Mouse (${event.interactionType})` : event.type}
</span>
{event.clickOrigin &&
event.clickOrigin !== 'center' &&
event.interactionType === 'click' && (
<span className="text-[8px] bg-accent/20 text-accent px-1.5 py-0.5 rounded uppercase font-bold">
{event.clickOrigin}
</span>
)}
<span className="text-[8px] bg-white/10 px-1.5 py-0.5 rounded text-white/40 font-mono italic">
{event.duration}ms
</span>
</div>
<p className="text-[9px] text-white/30 truncate font-mono mt-1 opacity-60">
{event.selector || 'system:wait'}
</p>
</div>
<div className="flex items-center gap-1">
<button
onClick={() => {
setEditingEventId(event.id);
setEditForm(event);
}}
className="p-2 text-white/0 group-hover:text-white/40 hover:text-white hover:bg-white/10 rounded-xl transition-all"
>
<Settings2 size={14} />
</button>
<button
onClick={() => removeEvent(event.id)}
className="p-2 text-white/0 group-hover:text-red-400/60 hover:text-red-400 hover:bg-red-500/10 rounded-xl transition-all"
>
<Trash2 size={14} />
</button>
</div>
</Reorder.Item>
))
)}
</Reorder.Group>
</div>
</div>
)}
{/* Industrial Selector Highlighter - handled inside iframe via PickingHelper */}
{/* Picking Tooltip */}
{pickingMode && (
<div className="fixed top-8 left-1/2 -translate-x-1/2 z-[10000] pointer-events-auto">
<div className="bg-accent text-primary-dark px-6 py-3 rounded-full flex items-center gap-4 shadow-[0_20px_40px_rgba(130,237,32,0.4)] animate-reveal border border-primary-dark/10">
<div className="flex items-center gap-2">
<div className="w-2 h-2 rounded-full bg-primary-dark animate-pulse" />
<span className="font-black uppercase tracking-widest text-xs">
Assigning {pickingMode}
</span>
</div>
<div className="w-px h-6 bg-primary-dark/20" />
<button
onClick={() => {
setPickingMode(null);
setHoveredElement(null);
}}
className="text-[10px] font-bold uppercase tracking-widest opacity-60 hover:opacity-100 transition-opacity bg-primary-dark/10 px-3 py-1.5 rounded-full"
>
ESC to Cancel
</button> </button>
</div> </div>
</div> </div>
)}
{/* 2. Event Timeline Popover */} <PlaybackCursor />
{showEvents && (
<div className="fixed bottom-[100px] left-1/2 -translate-x-1/2 w-[400px] pointer-events-auto z-[9999]">
<div className="bg-black/90 backdrop-blur-3xl border border-white/10 rounded-[32px] p-6 shadow-[0_40px_100px_rgba(0,0,0,0.9)] max-h-[500px] overflow-hidden flex flex-col scale-in">
<div className="flex items-center justify-between mb-6">
<div>
<h4 className="text-white font-bold text-lg leading-none">Recording Track</h4>
<p className="text-[10px] text-white/30 uppercase tracking-widest mt-2">
{events.length} Actions Recorded
</p>
</div>
<button
onClick={clearEvents}
disabled={events.length === 0}
className="text-red-400/40 hover:text-red-400 transition-colors p-2 hover:bg-red-500/10 rounded-xl disabled:opacity-10"
>
<Trash2 size={18} />
</button>
</div>
<Reorder.Group {/* 3. Event Options Panel (Sidebar-like) */}
axis="y" <AnimatePresence>
values={events} {editingEventId && (
onReorder={setEvents} <div className="fixed inset-y-0 right-0 w-[350px] bg-black/95 backdrop-blur-3xl border-l border-white/10 z-[11000] pointer-events-auto p-8 shadow-[-40px_0_100px_rgba(0,0,0,0.9)] flex flex-col">
className="flex-1 overflow-y-auto space-y-2 pr-2 scrollbar-hide" <div className="flex items-center justify-between mb-8">
> <h3 className="text-white font-black uppercase tracking-tighter text-xl">
{events.length === 0 ? ( Event Options
<div className="py-12 flex flex-col items-center justify-center text-white/10"> </h3>
<Plus size={40} strokeWidth={1} />
<p className="text-xs mt-4">Timeline is empty</p>
</div>
) : (
events.map((event, index) => (
<Reorder.Item
key={event.id}
value={event}
className="group flex items-center gap-3 bg-white/[0.03] border border-white/5 p-3 rounded-[20px] transition-all hover:bg-white/[0.06] hover:border-white/10"
onMouseEnter={() => setHoveredEventId(event.id)}
onMouseLeave={() => setHoveredEventId(null)}
>
<div className="cursor-grab active:cursor-grabbing text-white/10 hover:text-white/30 transition-colors">
<GripVertical size={16} />
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
<span className="text-white text-[10px] font-black uppercase tracking-widest">
{event.type === 'mouse'
? `Mouse (${event.interactionType})`
: event.type}
</span>
{event.clickOrigin &&
event.clickOrigin !== 'center' &&
event.interactionType === 'click' && (
<span className="text-[8px] bg-accent/20 text-accent px-1.5 py-0.5 rounded uppercase font-bold">
{event.clickOrigin}
</span>
)}
<span className="text-[8px] bg-white/10 px-1.5 py-0.5 rounded text-white/40 font-mono italic">
{event.duration}ms
</span>
</div>
<p className="text-[9px] text-white/30 truncate font-mono mt-1 opacity-60">
{event.selector || 'system:wait'}
</p>
</div>
<div className="flex items-center gap-1">
<button
onClick={() => {
setEditingEventId(event.id);
setEditForm(event);
}}
className="p-2 text-white/0 group-hover:text-white/40 hover:text-white hover:bg-white/10 rounded-xl transition-all"
>
<Settings2 size={14} />
</button>
<button
onClick={() => removeEvent(event.id)}
className="p-2 text-white/0 group-hover:text-red-400/60 hover:text-red-400 hover:bg-red-500/10 rounded-xl transition-all"
>
<Trash2 size={14} />
</button>
</div>
</Reorder.Item>
))
)}
</Reorder.Group>
</div>
</div>
)}
{/* Industrial Selector Highlighter - handled inside iframe via PickingHelper */}
{/* Picking Tooltip */}
{pickingMode && (
<div className="fixed top-8 left-1/2 -translate-x-1/2 z-[10000] pointer-events-auto">
<div className="bg-accent text-primary-dark px-6 py-3 rounded-full flex items-center gap-4 shadow-[0_20px_40px_rgba(130,237,32,0.4)] animate-reveal border border-primary-dark/10">
<div className="flex items-center gap-2">
<div className="w-2 h-2 rounded-full bg-primary-dark animate-pulse" />
<span className="font-black uppercase tracking-widest text-xs">
Assigning {pickingMode}
</span>
</div>
<div className="w-px h-6 bg-primary-dark/20" />
<button <button
onClick={() => { onClick={() => setEditingEventId(null)}
setPickingMode(null); className="p-2 text-white/40 hover:text-white transition-colors"
setHoveredElement(null);
}}
className="text-[10px] font-bold uppercase tracking-widest opacity-60 hover:opacity-100 transition-opacity bg-primary-dark/10 px-3 py-1.5 rounded-full"
> >
ESC to Cancel <X size={20} />
</button> </button>
</div> </div>
</div>
)}
<PlaybackCursor /> <div className="flex-1 space-y-8 overflow-y-auto pr-2 scrollbar-hide">
{/* Type Display */}
{/* 3. Event Options Panel (Sidebar-like) */} <div className="space-y-3">
<AnimatePresence> <label className="text-[10px] uppercase tracking-[0.2em] font-bold text-white/30 leading-none">
{editingEventId && ( Interaction Type
<div className="fixed inset-y-0 right-0 w-[350px] bg-black/95 backdrop-blur-3xl border-l border-white/10 z-[11000] pointer-events-auto p-8 shadow-[-40px_0_100px_rgba(0,0,0,0.9)] flex flex-col"> </label>
<div className="flex items-center justify-between mb-8"> <div className="flex gap-2 p-1 bg-white/5 rounded-2xl border border-white/5">
<h3 className="text-white font-black uppercase tracking-tighter text-xl"> <button
Event Options onClick={() =>
</h3> setEditForm((prev) => ({ ...prev, type: 'mouse', interactionType: 'click' }))
<button }
onClick={() => setEditingEventId(null)} className={`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl transition-all border ${editForm.type === 'mouse' && editForm.interactionType === 'click' ? 'bg-accent text-primary-dark border-accent' : 'text-white/40 border-transparent hover:border-white/10'}`}
className="p-2 text-white/40 hover:text-white transition-colors" >
> <MousePointer2 size={14} />
<X size={20} /> <span className="text-[10px] font-black uppercase">Click</span>
</button> </button>
<button
onClick={() =>
setEditForm((prev) => ({ ...prev, type: 'mouse', interactionType: 'hover' }))
}
className={`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl transition-all border ${editForm.type === 'mouse' && editForm.interactionType === 'hover' ? 'bg-accent text-primary-dark border-accent' : 'text-white/40 border-transparent hover:border-white/10'}`}
>
<Eye size={14} />
<span className="text-[10px] font-black uppercase">Hover</span>
</button>
<button
onClick={() => setEditForm((prev) => ({ ...prev, type: 'scroll' }))}
className={`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl transition-all border ${editForm.type === 'scroll' ? 'bg-accent text-primary-dark border-accent' : 'text-white/40 border-transparent hover:border-white/10'}`}
>
<Scroll size={14} />
<span className="text-[10px] font-black uppercase">Scroll</span>
</button>
<button
onClick={() => setEditForm((prev) => ({ ...prev, type: 'wait' }))}
className={`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl transition-all border ${editForm.type === 'wait' ? 'bg-accent text-primary-dark border-accent' : 'text-white/40 border-transparent hover:border-white/10'}`}
>
<Clock size={14} />
<span className="text-[10px] font-black uppercase">Wait</span>
</button>
</div>
</div> </div>
<div className="flex-1 space-y-8 overflow-y-auto pr-2 scrollbar-hide"> {/* Precise Click Origin */}
{/* Type Display */} {editForm.type === 'mouse' && editForm.interactionType === 'click' && (
<div className="space-y-3"> <div className="space-y-4">
<label className="text-[10px] uppercase tracking-[0.2em] font-bold text-white/30 leading-none"> <label className="text-[10px] uppercase tracking-[0.2em] font-bold text-white/30 leading-none">
Interaction Type Click Origin
</label> </label>
<div className="flex gap-2 p-1 bg-white/5 rounded-2xl border border-white/5"> <div className="grid grid-cols-3 gap-2 p-2 bg-white/5 rounded-2xl border border-white/5">
<button {[
onClick={() => { id: 'top-left', label: 'TL' },
setEditForm((prev) => ({ { id: 'top-right', label: 'TR' },
...prev, { id: 'center', label: 'CTR' },
type: 'mouse', { id: 'bottom-left', label: 'BL' },
interactionType: 'click', { id: 'bottom-right', label: 'BR' },
})) ].map((origin) => (
} <button
className={`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl transition-all border ${editForm.type === 'mouse' && editForm.interactionType === 'click' ? 'bg-accent text-primary-dark border-accent' : 'text-white/40 border-transparent hover:border-white/10'}`} key={origin.id}
> onClick={() =>
<MousePointer2 size={14} /> setEditForm((prev) => ({ ...prev, clickOrigin: origin.id as any }))
<span className="text-[10px] font-black uppercase">Click</span> }
</button> className={`py-3 rounded-xl text-[10px] font-black uppercase tracking-tighter transition-all border ${editForm.clickOrigin === origin.id ? 'bg-accent text-primary-dark border-accent' : 'bg-transparent text-white/40 border-white/5 hover:border-white/20'}`}
<button >
onClick={() => {origin.label}
setEditForm((prev) => ({ </button>
...prev, ))}
type: 'mouse',
interactionType: 'hover',
}))
}
className={`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl transition-all border ${editForm.type === 'mouse' && editForm.interactionType === 'hover' ? 'bg-accent text-primary-dark border-accent' : 'text-white/40 border-transparent hover:border-white/10'}`}
>
<Eye size={14} />
<span className="text-[10px] font-black uppercase">Hover</span>
</button>
<button
onClick={() => setEditForm((prev) => ({ ...prev, type: 'scroll' }))}
className={`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl transition-all border ${editForm.type === 'scroll' ? 'bg-accent text-primary-dark border-accent' : 'text-white/40 border-transparent hover:border-white/10'}`}
>
<Scroll size={14} />
<span className="text-[10px] font-black uppercase">Scroll</span>
</button>
<button
onClick={() => setEditForm((prev) => ({ ...prev, type: 'wait' }))}
className={`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl transition-all border ${editForm.type === 'wait' ? 'bg-accent text-primary-dark border-accent' : 'text-white/40 border-transparent hover:border-white/10'}`}
>
<Clock size={14} />
<span className="text-[10px] font-black uppercase">Wait</span>
</button>
</div> </div>
</div> </div>
)}
{/* Precise Click Origin */} {/* Timing */}
{editForm.type === 'mouse' && editForm.interactionType === 'click' && ( <div className="space-y-4">
<div className="space-y-4"> <label className="text-[10px] uppercase tracking-[0.2em] font-bold text-white/30 leading-none flex items-center justify-between">
<label className="text-[10px] uppercase tracking-[0.2em] font-bold text-white/30 leading-none"> <span>Timeline Allocation</span>
Click Origin <span className="text-accent">{editForm.duration}ms</span>
</label> </label>
<div className="grid grid-cols-3 gap-2 p-2 bg-white/5 rounded-2xl border border-white/5"> <input
{[ type="range"
{ id: 'top-left', label: 'TL' }, min="0"
{ id: 'top-right', label: 'TR' }, max="5000"
{ id: 'center', label: 'CTR' }, step="100"
{ id: 'bottom-left', label: 'BL' }, value={editForm.duration || 1000}
{ id: 'bottom-right', label: 'BR' }, onChange={(e) =>
].map((origin) => ( setEditForm((prev) => ({ ...prev, duration: parseInt(e.target.value) }))
<button }
key={origin.id} className="w-full h-1 bg-white/10 rounded-lg appearance-none cursor-pointer accent-accent"
onClick={() => />
setEditForm((prev) => ({ ...prev, clickOrigin: origin.id as any })) </div>
}
className={`py-3 rounded-xl text-[10px] font-black uppercase tracking-tighter transition-all border ${editForm.clickOrigin === origin.id ? 'bg-accent text-primary-dark border-accent' : 'bg-transparent text-white/40 border-white/5 hover:border-white/20'}`} {/* Zoom & Effects */}
> <div className="space-y-6">
{origin.label} <div className="flex items-center justify-between p-4 bg-white/5 rounded-2xl border border-white/5 group hover:border-white/20 transition-all">
</button> <div className="flex items-center gap-3">
))} <Maximize2 size={18} className="text-white/40" />
</div> <span className="text-xs font-bold text-white uppercase tracking-wider">
Zoom Shift
</span>
</div> </div>
)}
{/* Timing */}
<div className="space-y-4">
<label className="text-[10px] uppercase tracking-[0.2em] font-bold text-white/30 leading-none flex items-center justify-between">
<span>Timeline Allocation</span>
<span className="text-accent">{editForm.duration}ms</span>
</label>
<input <input
type="range" type="number"
min="0" step="0.1"
max="5000" min="1"
step="100" max="3"
value={editForm.duration || 1000} value={editForm.zoom || 1}
onChange={(e) => onChange={(e) =>
setEditForm((prev) => ({ ...prev, duration: parseInt(e.target.value) })) setEditForm((prev) => ({ ...prev, zoom: parseFloat(e.target.value) }))
} }
className="w-full h-1 bg-white/10 rounded-lg appearance-none cursor-pointer accent-accent" className="w-16 bg-white/10 border border-white/10 rounded-lg px-2 py-1 text-xs text-white text-center font-mono"
/> />
</div> </div>
{/* Zoom & Effects */} <button
<div className="space-y-6"> onClick={() => setEditForm((prev) => ({ ...prev, motionBlur: !prev.motionBlur }))}
<div className="flex items-center justify-between p-4 bg-white/5 rounded-2xl border border-white/5 group hover:border-white/20 transition-all"> className={`flex items-center justify-between w-full p-4 rounded-2xl border transition-all ${editForm.motionBlur ? 'bg-accent/10 border-accent/30 text-accent' : 'bg-white/5 border-white/5 text-white/40'}`}
<div className="flex items-center gap-3"> >
<Maximize2 size={18} className="text-white/40" /> <div className="flex items-center gap-3">
<span className="text-xs font-bold text-white uppercase tracking-wider"> <Box size={18} />
Zoom Shift <span className="text-xs font-bold uppercase tracking-wider">Motion Blur</span>
</span>
</div>
<input
type="number"
step="0.1"
min="1"
max="3"
value={editForm.zoom || 1}
onChange={(e) =>
setEditForm((prev) => ({ ...prev, zoom: parseFloat(e.target.value) }))
}
className="w-16 bg-white/10 border border-white/10 rounded-lg px-2 py-1 text-xs text-white text-center font-mono"
/>
</div> </div>
{editForm.motionBlur ? <Check size={18} /> : <div className="w-[18px]" />}
</button>
{editForm.type === 'mouse' && editForm.interactionType === 'click' && (
<button <button
onClick={() => onClick={() => setEditForm((prev) => ({ ...prev, realClick: !prev.realClick }))}
setEditForm((prev) => ({ ...prev, motionBlur: !prev.motionBlur })) className={`flex items-center justify-between w-full p-4 rounded-2xl border transition-all ${editForm.realClick ? 'bg-orange-500/10 border-orange-500/30 text-orange-400' : 'bg-white/5 border-white/5 text-white/40'}`}
}
className={`flex items-center justify-between w-full p-4 rounded-2xl border transition-all ${editForm.motionBlur ? 'bg-accent/10 border-accent/30 text-accent' : 'bg-white/5 border-white/5 text-white/40'}`}
> >
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<Box size={18} /> <ExternalLink size={18} />
<span className="text-xs font-bold uppercase tracking-wider"> <div className="flex flex-col items-start">
Motion Blur <span className="text-xs font-bold uppercase tracking-wider">
</span> Trigger Navigation
</div> </span>
{editForm.motionBlur ? <Check size={18} /> : <div className="w-[18px]" />} <span className="text-[8px] opacity-60">
</button> Allows URL transitions in Studio
</span>
{editForm.type === 'mouse' && editForm.interactionType === 'click' && (
<button
onClick={() =>
setEditForm((prev) => ({ ...prev, realClick: !prev.realClick }))
}
className={`flex items-center justify-between w-full p-4 rounded-2xl border transition-all ${editForm.realClick ? 'bg-orange-500/10 border-orange-500/30 text-orange-400' : 'bg-white/5 border-white/5 text-white/40'}`}
>
<div className="flex items-center gap-3">
<ExternalLink size={18} />
<div className="flex flex-col items-start">
<span className="text-xs font-bold uppercase tracking-wider">
Trigger Navigation
</span>
<span className="text-[8px] opacity-60">
Allows URL transitions in Studio
</span>
</div>
</div> </div>
{editForm.realClick ? <Check size={18} /> : <div className="w-[18px]" />} </div>
</button> {editForm.realClick ? <Check size={18} /> : <div className="w-[18px]" />}
)} </button>
</div> )}
</div> </div>
<button
onClick={saveEdit}
className="mt-8 py-5 bg-accent text-primary-dark text-xs font-black uppercase tracking-[0.2em] rounded-2xl shadow-2xl shadow-accent/20 hover:scale-[1.02] transition-all"
>
Commit Changes
</button>
</div> </div>
)}
</AnimatePresence> <button
</div> onClick={saveEdit}
</LazyMotion> className="mt-8 py-5 bg-accent text-primary-dark text-xs font-black uppercase tracking-[0.2em] rounded-2xl shadow-2xl shadow-accent/20 hover:scale-[1.02] transition-all"
>
Commit Changes
</button>
</div>
)}
</AnimatePresence>
</div>
); );
} }

View File

@@ -10,6 +10,7 @@ export function RecordModeVisuals({ children }: { children: React.ReactNode }) {
const [iframeUrl, setIframeUrl] = React.useState<string | null>(null); const [iframeUrl, setIframeUrl] = React.useState<string | null>(null);
React.useEffect(() => { React.useEffect(() => {
setMounted(true);
// Explicit non-magical detection // Explicit non-magical detection
const embedded = const embedded =
window.location.search.includes('embedded=true') || window.name === 'record-mode-iframe'; window.location.search.includes('embedded=true') || window.name === 'record-mode-iframe';
@@ -20,12 +21,13 @@ export function RecordModeVisuals({ children }: { children: React.ReactNode }) {
url.searchParams.set('embedded', 'true'); url.searchParams.set('embedded', 'true');
setIframeUrl(url.toString()); setIframeUrl(url.toString());
} }
}, []); }, [isEmbedded]);
// Hydration Guard: Match server on first render
if (!mounted) return <>{children}</>;
// Recursion Guard: If we are already in an embedded iframe, // Recursion Guard: If we are already in an embedded iframe,
// strictly return just the children to prevent Inception. // strictly return just the children to prevent Inception.
// Note: This causes a hydration mismatch remount ONLY when actually embedded (e.g. inside Directus).
// Standard users and Lighthouse bots will NOT suffer a remount.
if (isEmbedded) { if (isEmbedded) {
return ( return (
<> <>

View File

@@ -3,8 +3,7 @@
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { useState } from 'react'; import { useState } from 'react';
import Image from 'next/image'; import Image from 'next/image';
import dynamic from 'next/dynamic'; import Lightbox from '@/components/Lightbox';
const Lightbox = dynamic(() => import('@/components/Lightbox'), { ssr: false });
import { Section, Container, Heading } from '@/components/ui'; import { Section, Container, Heading } from '@/components/ui';
export default function Gallery() { export default function Gallery() {

View File

@@ -1,15 +1,10 @@
{ {
"ci": { "ci": {
"collect": { "collect": {
"numberOfRuns": 3, "numberOfRuns": 1,
"settings": { "settings": {
"preset": "desktop", "preset": "desktop",
"onlyCategories": [ "onlyCategories": ["performance", "accessibility", "best-practices", "seo"],
"performance",
"accessibility",
"best-practices",
"seo"
],
"chromeFlags": "--no-sandbox --disable-setuid-sandbox" "chromeFlags": "--no-sandbox --disable-setuid-sandbox"
} }
}, },
@@ -18,7 +13,7 @@
"categories:performance": [ "categories:performance": [
"error", "error",
{ {
"minScore": 0.9 "minScore": 0.8
} }
], ],
"categories:accessibility": [ "categories:accessibility": [
@@ -54,4 +49,4 @@
} }
} }
} }
} }

View File

@@ -1,66 +0,0 @@
---
title: 'Herzlich willkommen bei KLZ: Johannes Gleich startet als Senior Key Account Manager durch'
date: '2026-02-20T14:50:00'
featuredImage: /uploads/2026/01/1767353529807.jpg
locale: de
category: Kabel Technologie
excerpt: 'KLZ Cables startet mit einer starken Verstärkung ins neue Jahr: Johannes Gleich übernimmt die Rolle des Senior Key Account Managers. Erfahren Sie mehr über unseren neuen Experten für Infrastruktur und Energieversorger.'
public: false
---
# Herzlich willkommen bei KLZ: Johannes Gleich startet als Senior Key Account Manager durch
KLZ Cables startet mit einer starken Verstärkung ins neue Jahr: Seit Januar 2026 übernimmt Johannes Gleich die Rolle des Senior Key Account Managers. Mit ihm gewinnen wir nicht nur zusätzliche Vertriebskraft, sondern auch jahrzehntelange Erfahrung und ein wertvolles Branchennetzwerk.
### **1. Ein bekanntes Gesicht für eine effektive Zusammenarbeit**
Johannes ist für KLZ kein Neuling: Bereits während seiner über zehnjährigen Tätigkeit bei der LAPP Gruppe hat unser Team die Zusammenarbeit mit ihm kennengelernt und sehr geschätzt. Diese bestehende Vertrautheit und das gegenseitige Vertrauen erleichtern den Einstieg enorm und versprechen eine produktive Kooperation von Tag eins an.
### **2. Beruflicher Hintergrund: Erfahrung trifft technische Tiefe**
Mit rund 50 Jahren verbindet Johannes fundierte Berufserfahrung mit frischer Motivation. Seine Basis ist eine technische Ausbildung im Bereich Elektrotechnik. Dieses Fundament ermöglicht es ihm, unsere Produkte nicht nur zu vertreiben, sondern sie in ihrer gesamten technischen Tiefe zu erklären und einzuordnen.
**Sein Werdegang im Überblick:**
<TechnicalGrid
title="Karrierestationen"
items={[
{ label: "Seit Jan. 2026", value: "Senior Key Account Manager bei KLZ Vertriebs GmbH (Remote)" },
{ label: "2015 2026", value: "Projektmanager Infrastrukturbereich Stadtwerke & Energieversorger bei der LAPP Gruppe (Stuttgart)" }
]}
/>
In den vergangenen elf Jahren hat er sich als Experte für die Anforderungen großer Infrastrukturanbieter etabliert. Er kennt die Herausforderungen der Branche technisch, wirtschaftlich und strategisch aus erster Hand.
### **3. Expertise: Ausschreibungen, Normen und Markttrends**
Was Johannes besonders wertvoll für unser Team macht, ist sein spezialisiertes Fachwissen:
<TechnicalGrid
title="Kernkompetenzen"
items={[
{ label: "Tender-Management", value: "Seine umfassende Erfahrung macht ihn zu einem sicheren Partner bei komplexen Ausschreibungen." },
{ label: "Normen & Fertigung", value: "Er verfügt über tiefgehende Kenntnisse im Bereich Kabelnormen und der Kabelfertigung." },
{ label: "Marktkenntnis", value: "Trends, Preisentwicklungen und Beschaffungsstrategien im deutschen Kabelmarkt sind ihm bestens vertraut." },
{ label: "Logistik", value: "Fundierte Kenntnisse in der Lieferkette runden sein Profil ab." }
]}
/>
### **4. Ein verlässlicher Partner auf Augenhöhe**
Johannes genießt bei Kunden eine hohe Wertschätzung als echter „Kümmerer“. Er übernimmt Verantwortung und zeichnet sich durch eine ausgleichende, aber in der Sache klare Verhandlungsführung aus. Seine Fähigkeit, komplexe Anforderungen strukturiert umzusetzen, hat sich bereits in früheren gemeinsamen Projekten mit KLZ bewährt.
### **5. Neue Rolle und Ziele bei KLZ Cables**
In seiner neuen Position wird Johannes den Vertrieb strategisch verstärken und die Geschäftsführung operativ entlasten.
**Seine Kernaufgaben umfassen:**
- **Gezielte Betreuung:** Fokus auf Stadtwerke, Netzbetreiber und Energieversorger.
- **Markterschließung:** Aufbau von Kontakten in den Bereichen Renewables und Tiefbau.
- **Strategische Planung:** Umsetzung von Vertriebsaktivitäten ohne administrative Grenzen, um maximale Dynamik zu entfalten.
### **6. Ausblick**
Wir freuen uns besonders, dass Johannes bei KLZ den Raum findet, sein gesamtes Wissen optimal für unsere Kunden einzusetzen. Mit seiner Kombination aus technischem Know-how, Markterfahrung und menschlicher Integrität ist er genau am richtigen Ort, um das Wachstum von KLZ Cables nachhaltig zu fördern.
Herzlich willkommen im Team, Johannes! Wir freuen uns auf die gemeinsamen Projekte.

View File

@@ -1,66 +0,0 @@
---
title: 'Welcome to KLZ: Johannes Gleich starts as Senior Key Account Manager'
date: '2026-02-20T14:50:00'
featuredImage: /uploads/2026/01/1767353529807.jpg
locale: en
category: Cable Technology
excerpt: 'KLZ Cables kicks off the new year with a strong addition: Johannes Gleich takes on the role of Senior Key Account Manager. Learn more about our new expert for infrastructure and energy suppliers.'
public: false
---
# Welcome to KLZ: Johannes Gleich starts as Senior Key Account Manager
KLZ Cables kicks off the new year with a strong addition to the team: Since January 2026, Johannes Gleich has taken on the role of Senior Key Account Manager. With him, we gain not only additional sales power, but also decades of experience and a valuable industry network.
### **1. A familiar face for effective collaboration**
Johannes is no stranger to KLZ: During his more than ten years at the LAPP Group, our team had the pleasure of working with him and greatly appreciated the collaboration. This existing familiarity and mutual trust make his start enormously easier and promise productive cooperation from day one.
### **2. Professional background: Experience meets technical depth**
At around 50 years of age, Johannes combines solid professional experience with fresh motivation. His foundation is a technical education in electrical engineering. This basis enables him not only to sell our products, but also to explain and classify them in their full technical depth.
**His career at a glance:**
<TechnicalGrid
title="Career Stations"
items={[
{ label: "Since Jan. 2026", value: "Senior Key Account Manager at KLZ Vertriebs GmbH (Remote)" },
{ label: "2015 2026", value: "Project Manager Infrastructure Municipal Utilities & Energy Suppliers at the LAPP Group (Stuttgart)" }
]}
/>
Over the past eleven years, he has established himself as an expert in the requirements of large infrastructure providers. He knows the industry's challenges—technical, economic, and strategic—firsthand.
### **3. Expertise: Tenders, standards, and market trends**
What makes Johannes particularly valuable to our team is his specialized expertise:
<TechnicalGrid
title="Core Competencies"
items={[
{ label: "Tender Management", value: "His extensive experience makes him a reliable partner for complex tenders." },
{ label: "Standards & Production", value: "He has deeply rooted knowledge in cable standards and cable manufacturing." },
{ label: "Market Knowledge", value: "He is highly familiar with trends, price developments, and procurement strategies in the German cable market." },
{ label: "Logistics", value: "Solid knowledge of the supply chain rounds out his profile." }
]}
/>
### **4. A reliable partner at eye level**
Johannes is highly valued by customers as a true "caretaker". He takes responsibility and stands out for his balanced yet clear negotiation skills. His ability to implement complex requirements in a structured manner has already proven itself in past joint projects with KLZ.
### **5. New role and goals at KLZ Cables**
In his new position, Johannes will strategically strengthen sales and operatively relieve the management.
**His core responsibilities include:**
- **Targeted Support:** Focus on municipal utilities, grid operators, and energy suppliers.
- **Market Penetration:** Building contacts in the renewables and civil engineering sectors.
- **Strategic Planning:** Implementing sales activities without administrative boundaries to unfold maximum dynamism.
### **6. Outlook**
We are especially pleased that Johannes has found the space at KLZ to optimally use all his knowledge for our customers. With his combination of technical know-how, market experience, and personal integrity, he is exactly in the right place to sustainably promote the growth of KLZ Cables.
Welcome to the team, Johannes! We look forward to our future projects together.

View File

@@ -183,9 +183,9 @@ services:
# This fixes the Next.js URL-decoding bug on dynamic image proxy paths # This fixes the Next.js URL-decoding bug on dynamic image proxy paths
- "traefik.http.routers.${PROJECT_NAME:-klz}-img.rule=(Host(`${TRAEFIK_HOST:-klz.localhost}`) || Host(`staging.klz-cables.com`) || Host(`testing.klz-cables.com`)) && PathPrefix(`/_img`)" - "traefik.http.routers.${PROJECT_NAME:-klz}-img.rule=(Host(`${TRAEFIK_HOST:-klz.localhost}`) || Host(`staging.klz-cables.com`) || Host(`testing.klz-cables.com`)) && PathPrefix(`/_img`)"
- "traefik.http.routers.${PROJECT_NAME:-klz}-img.priority=99999" - "traefik.http.routers.${PROJECT_NAME:-klz}-img.priority=99999"
- "traefik.http.routers.${PROJECT_NAME:-klz}-img.entrypoints=${TRAEFIK_ENTRYPOINT:-web}" - "traefik.http.routers.${PROJECT_NAME:-klz}-img.entrypoints=websecure"
- "traefik.http.routers.${PROJECT_NAME:-klz}-img.tls=${TRAEFIK_TLS:-false}" - "traefik.http.routers.${PROJECT_NAME:-klz}-img.tls=true"
- "traefik.http.routers.${PROJECT_NAME:-klz}-img.tls.certresolver=${TRAEFIK_CERT_RESOLVER:-}" - "traefik.http.routers.${PROJECT_NAME:-klz}-img.tls.certresolver=${TRAEFIK_CERT_RESOLVER:-le}"
- "traefik.http.routers.${PROJECT_NAME:-klz}-img.service=${PROJECT_NAME:-klz}-imgproxy-svc" - "traefik.http.routers.${PROJECT_NAME:-klz}-img.service=${PROJECT_NAME:-klz}-imgproxy-svc"
- "traefik.http.services.${PROJECT_NAME:-klz}-imgproxy-svc.loadbalancer.server.port=8080" - "traefik.http.services.${PROJECT_NAME:-klz}-imgproxy-svc.loadbalancer.server.port=8080"
- "traefik.http.routers.${PROJECT_NAME:-klz}-img.middlewares=${PROJECT_NAME:-klz}-img-strip" - "traefik.http.routers.${PROJECT_NAME:-klz}-img.middlewares=${PROJECT_NAME:-klz}-img-strip"

View File

@@ -39,7 +39,7 @@ NODE_ENV=production
NEXT_PUBLIC_BASE_URL=https://klz-cables.com NEXT_PUBLIC_BASE_URL=https://klz-cables.com
# Analytics (Umami) # Analytics (Umami)
UMAMI_WEBSITE_ID=your-umami-website-id NEXT_PUBLIC_UMAMI_WEBSITE_ID=your-umami-website-id
NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.infra.mintel.me/script.js NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.infra.mintel.me/script.js
# Error Tracking (GlitchTip/Sentry) # Error Tracking (GlitchTip/Sentry)

View File

@@ -2,7 +2,6 @@ import fs from 'fs';
import path from 'path'; import path from 'path';
import matter from 'gray-matter'; import matter from 'gray-matter';
import { mapSlugToFileSlug } from './slugs'; import { mapSlugToFileSlug } from './slugs';
import { config } from '@/lib/config';
export interface PostFrontmatter { export interface PostFrontmatter {
title: string; title: string;
@@ -11,7 +10,6 @@ export interface PostFrontmatter {
featuredImage?: string | null; featuredImage?: string | null;
category?: string; category?: string;
locale: string; locale: string;
public?: boolean;
} }
export interface PostMdx { export interface PostMdx {
@@ -20,17 +18,6 @@ export interface PostMdx {
content: string; content: string;
} }
export function isPostVisible(post: { frontmatter: { date: string; public?: boolean } }) {
// If explicitly marked as not public, hide in production
if (post.frontmatter.public === false && config.isProduction) {
return false;
}
const postDate = new Date(post.frontmatter.date);
const now = new Date();
return !(postDate > now && config.isProduction);
}
export async function getPostBySlug(slug: string, locale: string): Promise<PostMdx | null> { export async function getPostBySlug(slug: string, locale: string): Promise<PostMdx | null> {
// Map translated slug to file slug // Map translated slug to file slug
const fileSlug = await mapSlugToFileSlug(slug, locale); const fileSlug = await mapSlugToFileSlug(slug, locale);
@@ -44,17 +31,11 @@ export async function getPostBySlug(slug: string, locale: string): Promise<PostM
const fileContent = fs.readFileSync(filePath, 'utf8'); const fileContent = fs.readFileSync(filePath, 'utf8');
const { data, content } = matter(fileContent); const { data, content } = matter(fileContent);
const postInfo = { return {
slug: fileSlug, slug: fileSlug,
frontmatter: data as PostFrontmatter, frontmatter: data as PostFrontmatter,
content, content,
}; };
if (!isPostVisible(postInfo)) {
return null;
}
return postInfo;
} }
export async function getAllPosts(locale: string): Promise<PostMdx[]> { export async function getAllPosts(locale: string): Promise<PostMdx[]> {
@@ -74,7 +55,6 @@ export async function getAllPosts(locale: string): Promise<PostMdx[]> {
content, content,
}; };
}) })
.filter(isPostVisible)
.sort( .sort(
(a, b) => new Date(b.frontmatter.date).getTime() - new Date(a.frontmatter.date).getTime(), (a, b) => new Date(b.frontmatter.date).getTime() - new Date(a.frontmatter.date).getTime(),
); );
@@ -98,7 +78,6 @@ export async function getAllPostsMetadata(locale: string): Promise<Partial<PostM
frontmatter: data as PostFrontmatter, frontmatter: data as PostFrontmatter,
}; };
}) })
.filter(isPostVisible)
.sort( .sort(
(a, b) => (a, b) =>
new Date(b.frontmatter.date as string).getTime() - new Date(b.frontmatter.date as string).getTime() -
@@ -109,7 +88,7 @@ export async function getAllPostsMetadata(locale: string): Promise<Partial<PostM
export async function getAdjacentPosts( export async function getAdjacentPosts(
slug: string, slug: string,
locale: string, locale: string,
): Promise<{ prev: PostMdx | null; next: PostMdx | null; isPrevRandom?: boolean; isNextRandom?: boolean }> { ): Promise<{ prev: PostMdx | null; next: PostMdx | null }> {
const posts = await getAllPosts(locale); const posts = await getAllPosts(locale);
const currentIndex = posts.findIndex((post) => post.slug === slug); const currentIndex = posts.findIndex((post) => post.slug === slug);
@@ -120,31 +99,10 @@ export async function getAdjacentPosts(
// Posts are sorted by date descending (newest first) // Posts are sorted by date descending (newest first)
// So "next" post (newer) is at index - 1 // So "next" post (newer) is at index - 1
// And "previous" post (older) is at index + 1 // And "previous" post (older) is at index + 1
let next = currentIndex > 0 ? posts[currentIndex - 1] : null; const next = currentIndex > 0 ? posts[currentIndex - 1] : null;
let prev = currentIndex < posts.length - 1 ? posts[currentIndex + 1] : null; const prev = currentIndex < posts.length - 1 ? posts[currentIndex + 1] : null;
let isNextRandom = false; return { prev, next };
let isPrevRandom = false;
const getRandomPost = (excludeSlugs: string[]) => {
const available = posts.filter(p => !excludeSlugs.includes(p.slug));
if (available.length === 0) return null;
return available[Math.floor(Math.random() * available.length)];
};
// If there's no next post (we are at the newest post), show a random post instead
if (!next && posts.length > 2) {
next = getRandomPost([slug, prev?.slug].filter(Boolean) as string[]);
isNextRandom = true;
}
// If there's no previous post (we are at the oldest post), show a random post instead
if (!prev && posts.length > 2) {
prev = getRandomPost([slug, next?.slug].filter(Boolean) as string[]);
isPrevRandom = true;
}
return { prev, next, isPrevRandom, isNextRandom };
} }
export function getReadingTime(content: string): number { export function getReadingTime(content: string): number {

View File

@@ -20,8 +20,6 @@ const booleanSchema = z.preprocess((val) => {
const envExtension = { const envExtension = {
// Project specific overrides or additions // Project specific overrides or additions
AUTH_COOKIE_NAME: z.string().default('klz_gatekeeper_session'), AUTH_COOKIE_NAME: z.string().default('klz_gatekeeper_session'),
TARGET: z.string().optional(),
NEXT_PUBLIC_TARGET: z.string().optional(),
// Gatekeeper specifics not in base // Gatekeeper specifics not in base
GATEKEEPER_URL: z.string().url().default('http://gatekeeper:3000'), GATEKEEPER_URL: z.string().url().default('http://gatekeeper:3000'),

View File

@@ -1,2 +0,0 @@
import { domAnimation } from 'framer-motion';
export default domAnimation;

View File

@@ -23,28 +23,11 @@ export default function imgproxyLoader({
return src; return src;
} }
// Check if src contains custom gravity query parameter
let gravity = 'sm'; // Use smart gravity (content-aware) by default
let cleanSrc = src;
try {
// Dummy base needed for relative URLs
const url = new URL(src, 'http://localhost');
const customGravity = url.searchParams.get('gravity');
if (customGravity) {
gravity = customGravity;
url.searchParams.delete('gravity');
cleanSrc = src.startsWith('http') ? url.href : url.pathname + url.search;
}
} catch (e) {
// Fallback if parsing fails
}
// We use the width provided by Next.js for responsive images // We use the width provided by Next.js for responsive images
// Height is set to 0 to maintain aspect ratio // Height is set to 0 to maintain aspect ratio
return getImgproxyUrl(cleanSrc, { return getImgproxyUrl(src, {
width, width,
resizing_type: 'fit', resizing_type: 'fit',
gravity, gravity: 'sm', // Use smart gravity (content-aware) instead of face detection (requires ML)
}); });
} }

View File

@@ -1,11 +1,6 @@
import { config } from './config'; import { config } from './config';
const getSiteUrl = () => { export const SITE_URL = (config.baseUrl as string) || 'https://klz-cables.com';
if (process.env.CI) return 'http://klz.localhost';
return (config.baseUrl as string) || 'https://klz-cables.com';
};
export const SITE_URL = getSiteUrl();
export const LOGO_URL = `${SITE_URL}/logo.png`; export const LOGO_URL = `${SITE_URL}/logo.png`;
export const getOrganizationSchema = () => ({ export const getOrganizationSchema = () => ({

View File

@@ -30,7 +30,6 @@ export interface AnalyticsService {
``` ```
**Key Features:** **Key Features:**
- Type-safe event properties - Type-safe event properties
- Consistent API across implementations - Consistent API across implementations
- Well-documented with JSDoc comments - Well-documented with JSDoc comments
@@ -40,7 +39,6 @@ export interface AnalyticsService {
Implements the `AnalyticsService` interface for Umami analytics. Implements the `AnalyticsService` interface for Umami analytics.
**Features:** **Features:**
- Type-safe event tracking - Type-safe event tracking
- Automatic pageview tracking - Automatic pageview tracking
- Browser environment detection - Browser environment detection
@@ -48,7 +46,6 @@ Implements the `AnalyticsService` interface for Umami analytics.
- Comprehensive JSDoc documentation - Comprehensive JSDoc documentation
**Usage:** **Usage:**
```typescript ```typescript
import { UmamiAnalyticsService } from '@/lib/services/analytics/umami-analytics-service'; import { UmamiAnalyticsService } from '@/lib/services/analytics/umami-analytics-service';
@@ -62,14 +59,12 @@ service.trackPageview('/products/123');
A no-op implementation used as a fallback when analytics are disabled. A no-op implementation used as a fallback when analytics are disabled.
**Features:** **Features:**
- Maintains the same API as other services - Maintains the same API as other services
- Safe to call even when analytics are disabled - Safe to call even when analytics are disabled
- No performance impact - No performance impact
- Comprehensive JSDoc documentation - Comprehensive JSDoc documentation
**Usage:** **Usage:**
```typescript ```typescript
import { NoopAnalyticsService } from '@/lib/services/analytics/noop-analytics-service'; import { NoopAnalyticsService } from '@/lib/services/analytics/noop-analytics-service';
@@ -84,7 +79,7 @@ The service layer automatically selects the appropriate implementation based on
```typescript ```typescript
// In lib/services/create-services.ts // In lib/services/create-services.ts
const umamiEnabled = Boolean(process.env.UMAMI_WEBSITE_ID); const umamiEnabled = Boolean(process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID);
const analytics = umamiEnabled const analytics = umamiEnabled
? new UmamiAnalyticsService({ enabled: true }) ? new UmamiAnalyticsService({ enabled: true })
@@ -96,7 +91,7 @@ const analytics = umamiEnabled
### Required for Umami ### Required for Umami
```bash ```bash
UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3 NEXT_PUBLIC_UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3
``` ```
### Optional (defaults provided) ### Optional (defaults provided)
@@ -114,12 +109,10 @@ NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.infra.mintel.me/script.js
Track a custom event with optional properties. Track a custom event with optional properties.
**Parameters:** **Parameters:**
- `eventName` - The name of the event to track - `eventName` - The name of the event to track
- `props` - Optional event properties (metadata) - `props` - Optional event properties (metadata)
**Example:** **Example:**
```typescript ```typescript
service.track('product_add_to_cart', { service.track('product_add_to_cart', {
product_id: '123', product_id: '123',
@@ -134,11 +127,9 @@ service.track('product_add_to_cart', {
Track a pageview. Track a pageview.
**Parameters:** **Parameters:**
- `url` - The URL to track (defaults to current location) - `url` - The URL to track (defaults to current location)
**Example:** **Example:**
```typescript ```typescript
// Track current page // Track current page
service.trackPageview(); service.trackPageview();
@@ -156,11 +147,9 @@ new UmamiAnalyticsService(options: UmamiAnalyticsServiceOptions)
``` ```
**Options:** **Options:**
- `enabled: boolean` - Whether analytics are enabled - `enabled: boolean` - Whether analytics are enabled
**Example:** **Example:**
```typescript ```typescript
const service = new UmamiAnalyticsService({ enabled: true }); const service = new UmamiAnalyticsService({ enabled: true });
``` ```
@@ -170,11 +159,10 @@ const service = new UmamiAnalyticsService({ enabled: true });
#### Constructor #### Constructor
```typescript ```typescript
new NoopAnalyticsService(); new NoopAnalyticsService()
``` ```
**Example:** **Example:**
```typescript ```typescript
const service = new NoopAnalyticsService(); const service = new NoopAnalyticsService();
``` ```
@@ -184,11 +172,13 @@ const service = new NoopAnalyticsService();
### AnalyticsEventProperties ### AnalyticsEventProperties
```typescript ```typescript
type AnalyticsEventProperties = Record<string, string | number | boolean | null | undefined>; type AnalyticsEventProperties = Record<
string,
string | number | boolean | null | undefined
>;
``` ```
**Example:** **Example:**
```typescript ```typescript
const properties: AnalyticsEventProperties = { const properties: AnalyticsEventProperties = {
product_id: '123', product_id: '123',
@@ -263,7 +253,7 @@ services.analytics.track('button_click', {
The service layer gracefully handles disabled analytics: The service layer gracefully handles disabled analytics:
```typescript ```typescript
// When UMAMI_WEBSITE_ID is not set: // When NEXT_PUBLIC_UMAMI_WEBSITE_ID is not set:
// - NoopAnalyticsService is used // - NoopAnalyticsService is used
// - All calls are safe (no-op) // - All calls are safe (no-op)
// - No errors are thrown // - No errors are thrown
@@ -376,13 +366,13 @@ import { getAppServices } from '@/lib/services/create-services';
async function MyServerComponent() { async function MyServerComponent() {
const services = getAppServices(); const services = getAppServices();
// Note: Analytics won't work in server components // Note: Analytics won't work in server components
// Use client components for analytics tracking // Use client components for analytics tracking
// But you can still access other services like cache // But you can still access other services like cache
const data = await services.cache.get('key'); const data = await services.cache.get('key');
return <div>{data}</div>; return <div>{data}</div>;
} }
``` ```
@@ -392,16 +382,14 @@ async function MyServerComponent() {
### Analytics Not Working ### Analytics Not Working
1. **Check environment variables:** 1. **Check environment variables:**
```bash ```bash
echo $UMAMI_WEBSITE_ID echo $NEXT_PUBLIC_UMAMI_WEBSITE_ID
``` ```
2. **Verify service selection:** 2. **Verify service selection:**
```typescript ```typescript
import { getAppServices } from '@/lib/services/create-services'; import { getAppServices } from '@/lib/services/create-services';
const services = getAppServices(); const services = getAppServices();
console.log(services.analytics); // Should be UmamiAnalyticsService console.log(services.analytics); // Should be UmamiAnalyticsService
``` ```
@@ -413,12 +401,12 @@ async function MyServerComponent() {
### Common Issues ### Common Issues
| Issue | Solution | | Issue | Solution |
| ------------------- | ----------------------------------- | |-------|----------|
| No data in Umami | Check website ID and script URL | | No data in Umami | Check website ID and script URL |
| Events not tracking | Verify service is being used | | Events not tracking | Verify service is being used |
| Script not loading | Check network connection, CORS | | Script not loading | Check network connection, CORS |
| Wrong data | Verify event properties are correct | | Wrong data | Verify event properties are correct |
## Related Files ## Related Files

View File

@@ -19,7 +19,7 @@ import type { AnalyticsEventProperties, AnalyticsService } from './analytics-ser
* @example * @example
* ```typescript * ```typescript
* // Automatic fallback in create-services.ts * // Automatic fallback in create-services.ts
* const umamiEnabled = Boolean(process.env.UMAMI_WEBSITE_ID); * const umamiEnabled = Boolean(process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID);
* const analytics = umamiEnabled * const analytics = umamiEnabled
* ? new UmamiAnalyticsService({ enabled: true }) * ? new UmamiAnalyticsService({ enabled: true })
* : new NoopAnalyticsService(); // Fallback when no website ID * : new NoopAnalyticsService(); // Fallback when no website ID

View File

@@ -84,7 +84,6 @@ export class UmamiAnalyticsService implements AnalyticsService {
screen: isClient ? `${window.screen.width}x${window.screen.height}` : undefined, screen: isClient ? `${window.screen.width}x${window.screen.height}` : undefined,
language: isClient ? navigator.language : this.serverContext?.language, language: isClient ? navigator.language : this.serverContext?.language,
referrer: isClient ? document.referrer : this.serverContext?.referrer, referrer: isClient ? document.referrer : this.serverContext?.referrer,
title: isClient ? document.title : undefined,
...data, ...data,
}; };

View File

@@ -55,7 +55,7 @@ let singleton: AppServices | undefined;
* @example * @example
* ```typescript * ```typescript
* // Automatic service selection based on environment * // Automatic service selection based on environment
* // If UMAMI_WEBSITE_ID is set: * // If NEXT_PUBLIC_UMAMI_WEBSITE_ID is set:
* // services.analytics = UmamiAnalyticsService * // services.analytics = UmamiAnalyticsService
* // If not set: * // If not set:
* // services.analytics = NoopAnalyticsService (safe no-op) * // services.analytics = NoopAnalyticsService (safe no-op)

View File

@@ -1,3 +1,4 @@
import * as Sentry from '@sentry/nextjs';
import type { import type {
ErrorReportingLevel, ErrorReportingLevel,
ErrorReportingService, ErrorReportingService,
@@ -6,66 +7,32 @@ import type {
import type { NotificationService } from '../notifications/notification-service'; import type { NotificationService } from '../notifications/notification-service';
import type { LoggerService } from '../logging/logger-service'; import type { LoggerService } from '../logging/logger-service';
type SentryLike = typeof Sentry;
export type GlitchtipErrorReportingServiceOptions = { export type GlitchtipErrorReportingServiceOptions = {
enabled: boolean; enabled: boolean;
}; };
// GlitchTip speaks the Sentry protocol; @sentry/nextjs can send to GlitchTip via DSN. // GlitchTip speaks the Sentry protocol; @sentry/nextjs can send to GlitchTip via DSN.
// Sentry is dynamically imported to avoid a ~100KB main-thread execution penalty on initial load.
export class GlitchtipErrorReportingService implements ErrorReportingService { export class GlitchtipErrorReportingService implements ErrorReportingService {
private logger: LoggerService; private logger: LoggerService;
private sentryPromise: Promise<typeof import('@sentry/nextjs')> | null = null;
constructor( constructor(
private readonly options: GlitchtipErrorReportingServiceOptions, private readonly options: GlitchtipErrorReportingServiceOptions,
logger: LoggerService, logger: LoggerService,
private readonly notifications?: NotificationService, private readonly notifications?: NotificationService,
private readonly sentry: SentryLike = Sentry,
) { ) {
this.logger = logger.child({ component: 'error-reporting-glitchtip' }); this.logger = logger.child({ component: 'error-reporting-glitchtip' });
if (this.options.enabled) {
if (typeof window !== 'undefined') {
// On client-side, wait until idle before fetching Sentry
if ('requestIdleCallback' in window) {
window.requestIdleCallback(() => {
this.getSentry();
});
} else {
setTimeout(() => {
this.getSentry();
}, 3000);
}
} else {
// Pre-fetch on server-side
this.getSentry();
}
}
}
private getSentry(): Promise<typeof import('@sentry/nextjs')> {
if (!this.sentryPromise) {
this.sentryPromise = import('@sentry/nextjs').then((Sentry) => {
// Client-side initialization must happen here since sentry.client.config.ts is empty
if (typeof window !== 'undefined') {
Sentry.init({
dsn: 'https://public@errors.infra.mintel.me/1',
tunnel: '/errors/api/relay',
enabled: true,
tracesSampleRate: 0,
replaysOnErrorSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
});
}
return Sentry;
});
}
return this.sentryPromise;
} }
async captureException(error: unknown, context?: Record<string, unknown>) { async captureException(error: unknown, context?: Record<string, unknown>) {
if (!this.options.enabled) return undefined; if (!this.options.enabled) return undefined;
const result = this.sentry.captureException(error, context as any) as any;
// Send to Gotify if it's considered critical or if we just want all exceptions there // Send to Gotify if it's considered critical or if we just want all exceptions there
// For now, let's send all exceptions to Gotify as requested "notify me via gotify about critical error messages"
// We'll treat all captureException calls as potentially critical or at least noteworthy
if (this.notifications) { if (this.notifications) {
const errorMessage = error instanceof Error ? error.message : String(error); const errorMessage = error instanceof Error ? error.message : String(error);
const contextStr = context ? `\nContext: ${JSON.stringify(context, null, 2)}` : ''; const contextStr = context ? `\nContext: ${JSON.stringify(context, null, 2)}` : '';
@@ -77,33 +44,34 @@ export class GlitchtipErrorReportingService implements ErrorReportingService {
}); });
} }
const Sentry = await this.getSentry(); return result;
return Sentry.captureException(error, context as any) as any;
} }
async captureMessage(message: string, level: ErrorReportingLevel = 'error') { captureMessage(message: string, level: ErrorReportingLevel = 'error') {
if (!this.options.enabled) return undefined; if (!this.options.enabled) return undefined;
const Sentry = await this.getSentry(); return this.sentry.captureMessage(message, level as any) as any;
return Sentry.captureMessage(message, level as any) as any;
} }
setUser(user: ErrorReportingUser | null) { setUser(user: ErrorReportingUser | null) {
if (!this.options.enabled) return; if (!this.options.enabled) return;
this.getSentry().then((Sentry) => Sentry.setUser(user as any)); this.sentry.setUser(user as any);
} }
setTag(key: string, value: string) { setTag(key: string, value: string) {
if (!this.options.enabled) return; if (!this.options.enabled) return;
this.getSentry().then((Sentry) => Sentry.setTag(key, value)); this.sentry.setTag(key, value);
} }
withScope<T>(fn: () => T, context?: Record<string, unknown>): T { withScope<T>(fn: () => T, context?: Record<string, unknown>) {
if (!this.options.enabled) return fn(); if (!this.options.enabled) return fn();
// Since withScope mandates executing fn() synchronously to return T, return this.sentry.withScope((scope) => {
// and Sentry load is async, if context mapping is absolutely required if (context) {
// for this feature we would need an async API. for (const [key, value] of Object.entries(context)) {
// For now we degrade gracefully by just executing the function. scope.setExtra(key, value);
return fn(); }
}
return fn();
});
} }
} }

View File

@@ -53,11 +53,9 @@ export default function middleware(request: NextRequest) {
body: request.body, body: request.body,
}); });
if (process.env.NODE_ENV !== 'production' || !process.env.CI) { console.log(
console.log( `🛡️ Proxy: Fixed internal URL leak: ${url} -> ${urlObj.toString()} | Proto: ${proto} | Host: ${hostHeader}`,
`🛡️ Proxy: Fixed internal URL leak: ${url} -> ${urlObj.toString()} | Proto: ${proto} | Host: ${hostHeader}`, );
);
}
} }
try { try {

View File

@@ -10,10 +10,6 @@ const nextConfig = {
// Make sure entries are not disposed too quickly // Make sure entries are not disposed too quickly
maxInactiveAge: 60 * 1000, maxInactiveAge: 60 * 1000,
}, },
experimental: {
optimizeCss: true,
optimizePackageImports: ['lucide-react', 'framer-motion', '@/components/ui'],
},
productionBrowserSourceMaps: false, productionBrowserSourceMaps: false,
logging: { logging: {
fetches: { fetches: {
@@ -348,6 +344,14 @@ const nextConfig = {
} }
return [ return [
{
source: '/de/produkte',
destination: '/de/products',
},
{
source: '/de/produkte/:path*',
destination: '/de/products/:path*',
},
{ {
source: '/cms/:path*', source: '/cms/:path*',
destination: `${directusUrl}/:path*`, destination: `${directusUrl}/:path*`,

View File

@@ -67,7 +67,6 @@
"@vitest/ui": "^4.0.16", "@vitest/ui": "^4.0.16",
"autoprefixer": "^10.4.23", "autoprefixer": "^10.4.23",
"cheerio": "^1.2.0", "cheerio": "^1.2.0",
"critters": "^0.0.25",
"eslint": "^9.18.0", "eslint": "^9.18.0",
"happy-dom": "^20.6.1", "happy-dom": "^20.6.1",
"husky": "^9.1.7", "husky": "^9.1.7",
@@ -97,7 +96,7 @@
"test:og": "vitest run tests/og-image.test.ts", "test:og": "vitest run tests/og-image.test.ts",
"check:og": "tsx scripts/check-og-images.ts", "check:og": "tsx scripts/check-og-images.ts",
"check:mdx": "node scripts/validate-mdx.mjs", "check:mdx": "node scripts/validate-mdx.mjs",
"check:a11y": "pa11y-ci", "check:a11y": "start-server-and-test start http://localhost:3000 'pa11y-ci'",
"check:wcag": "tsx ./scripts/wcag-sitemap.ts", "check:wcag": "tsx ./scripts/wcag-sitemap.ts",
"cms:branding:local": "DIRECTUS_URL=${DIRECTUS_URL:-http://cms.klz.localhost} npx tsx --env-file=.env scripts/setup-directus-branding.ts", "cms:branding:local": "DIRECTUS_URL=${DIRECTUS_URL:-http://cms.klz.localhost} npx tsx --env-file=.env scripts/setup-directus-branding.ts",
"cms:branding:testing": "DIRECTUS_URL=https://cms.testing.klz-cables.com npx tsx --env-file=.env scripts/setup-directus-branding.ts", "cms:branding:testing": "DIRECTUS_URL=https://cms.testing.klz-cables.com npx tsx --env-file=.env scripts/setup-directus-branding.ts",

22
pnpm-lock.yaml generated
View File

@@ -198,9 +198,6 @@ importers:
cheerio: cheerio:
specifier: ^1.2.0 specifier: ^1.2.0
version: 1.2.0 version: 1.2.0
critters:
specifier: ^0.0.25
version: 0.0.25
eslint: eslint:
specifier: ^9.18.0 specifier: ^9.18.0
version: 9.39.2(jiti@2.6.1) version: 9.39.2(jiti@2.6.1)
@@ -3697,10 +3694,6 @@ packages:
engines: {node: '>=0.8'} engines: {node: '>=0.8'}
hasBin: true hasBin: true
critters@0.0.25:
resolution: {integrity: sha512-ROF/tjJyyRdM8/6W0VqoN5Ql05xAGnkf5b7f3sTEl1bI5jTQQf8O918RD/V9tEb9pRY/TKcvJekDbJtniHyPtQ==}
deprecated: Ownership of Critters has moved to the Nuxt team, who will be maintaining the project going forward. If you'd like to keep using Critters, please switch to the actively-maintained fork at https://github.com/danielroe/beasties
cross-spawn@7.0.6: cross-spawn@7.0.6:
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
@@ -6122,9 +6115,6 @@ packages:
resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==} resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
postcss-media-query-parser@0.2.3:
resolution: {integrity: sha512-3sOlxmbKcSHMjlUXQZKQ06jOswE7oVkXPxmZdoB1r5l0q6gTFTQSHxNxOrCccElbW7dxNytifNEo8qidX2Vsig==}
postcss-modules-extract-imports@3.1.0: postcss-modules-extract-imports@3.1.0:
resolution: {integrity: sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==} resolution: {integrity: sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==}
engines: {node: ^10 || ^12 || >= 14} engines: {node: ^10 || ^12 || >= 14}
@@ -11246,16 +11236,6 @@ snapshots:
crc-32@1.2.2: {} crc-32@1.2.2: {}
critters@0.0.25:
dependencies:
chalk: 4.1.2
css-select: 5.2.2
dom-serializer: 2.0.0
domhandler: 5.0.3
htmlparser2: 8.0.2
postcss: 8.5.6
postcss-media-query-parser: 0.2.3
cross-spawn@7.0.6: cross-spawn@7.0.6:
dependencies: dependencies:
path-key: 3.1.1 path-key: 3.1.1
@@ -14236,8 +14216,6 @@ snapshots:
possible-typed-array-names@1.1.0: {} possible-typed-array-names@1.1.0: {}
postcss-media-query-parser@0.2.3: {}
postcss-modules-extract-imports@3.1.0(postcss@8.5.6): postcss-modules-extract-imports@3.1.0(postcss@8.5.6):
dependencies: dependencies:
postcss: 8.5.6 postcss: 8.5.6

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 KiB

View File

@@ -9,10 +9,8 @@ echo "🚀 Starting High-Fidelity Local Audit..."
# 1. Environment and Infrastructure # 1. Environment and Infrastructure
export DOCKER_HOST="unix:///Users/marcmintel/.docker/run/docker.sock" export DOCKER_HOST="unix:///Users/marcmintel/.docker/run/docker.sock"
export IMGPROXY_URL="http://klz-imgproxy:8080" export IMGPROXY_URL="http://img.klz.localhost"
export NEXT_URL="http://klz.localhost" export NEXT_URL="http://klz.localhost"
export NEXT_PUBLIC_CI=true
export CI=true
docker network create infra 2>/dev/null || true docker network create infra 2>/dev/null || true
docker volume create klz-cablescom_directus-db-data 2>/dev/null || true docker volume create klz-cablescom_directus-db-data 2>/dev/null || true
@@ -26,7 +24,6 @@ docker-compose up -d --remove-orphans klz-db klz-cms klz-gatekeeper
echo "🏗️ Building and starting klz-app (Production)..." echo "🏗️ Building and starting klz-app (Production)..."
# We bypass the dev override by explicitly using the base compose file # We bypass the dev override by explicitly using the base compose file
NEXT_PUBLIC_BASE_URL=$NEXT_URL \ NEXT_PUBLIC_BASE_URL=$NEXT_URL \
NEXT_PUBLIC_CI=true \
docker-compose -f docker-compose.yml up -d --build klz-app klz-imgproxy docker-compose -f docker-compose.yml up -d --build klz-app klz-imgproxy
# 4. Wait for application to be ready # 4. Wait for application to be ready
@@ -50,8 +47,5 @@ echo "✅ App is healthy at $NEXT_URL"
echo "⚡ Executing Lighthouse CI..." echo "⚡ Executing Lighthouse CI..."
NEXT_PUBLIC_BASE_URL=$NEXT_URL PAGESPEED_LIMIT=5 pnpm run pagespeed:test "$NEXT_URL" NEXT_PUBLIC_BASE_URL=$NEXT_URL PAGESPEED_LIMIT=5 pnpm run pagespeed:test "$NEXT_URL"
echo "♿ Executing WCAG Audit..."
NEXT_PUBLIC_BASE_URL=$NEXT_URL PAGESPEED_LIMIT=10 pnpm run check:wcag "$NEXT_URL"
echo "✨ Audit completed! Summary above." echo "✨ Audit completed! Summary above."
echo "💡 You can stop the production app with: docker-compose stop klz-app" echo "💡 You can stop the production app with: docker-compose stop klz-app"

View File

@@ -12,7 +12,8 @@ import * as path from 'path';
* 3. Runs Lighthouse CI on those URLs * 3. Runs Lighthouse CI on those URLs
*/ */
const targetUrl = process.argv[2] || process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000'; const targetUrl =
process.argv[2] || process.env.NEXT_PUBLIC_BASE_URL || 'https://testing.klz-cables.com';
const limit = process.env.PAGESPEED_LIMIT ? parseInt(process.env.PAGESPEED_LIMIT) : 20; // Default limit to avoid infinite runs const limit = process.env.PAGESPEED_LIMIT ? parseInt(process.env.PAGESPEED_LIMIT) : 20; // Default limit to avoid infinite runs
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026'; const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026';
@@ -57,10 +58,9 @@ async function main() {
`⚠️ Too many pages (${urls.length}). Limiting to ${limit} representative pages.`, `⚠️ Too many pages (${urls.length}). Limiting to ${limit} representative pages.`,
); );
// Try to pick a variety: home, some products, some blog posts // Try to pick a variety: home, some products, some blog posts
const homeEN = urls.filter((u) => u.endsWith('/en') || u === targetUrl); const home = urls.filter((u) => u.endsWith('/de') || u.endsWith('/en') || u === targetUrl);
const homeDE = urls.filter((u) => u.endsWith('/de')); const others = urls.filter((u) => !home.includes(u));
const others = urls.filter((u) => !homeEN.includes(u) && !homeDE.includes(u)); urls = [...home, ...others.slice(0, limit - home.length)];
urls = [...homeEN, ...homeDE, ...others.slice(0, limit - (homeEN.length + homeDE.length))];
} }
console.log(`🧪 Pages to be tested:`); console.log(`🧪 Pages to be tested:`);

View File

@@ -1,21 +0,0 @@
const fs = require('fs');
const files = [
'/Users/marcmintel/Projects/klz-2026/components/Header.tsx',
'/Users/marcmintel/Projects/klz-2026/components/Scribble.tsx',
'/Users/marcmintel/Projects/klz-2026/components/Lightbox.tsx',
'/Users/marcmintel/Projects/klz-2026/components/record-mode/RecordModeOverlay.tsx',
'/Users/marcmintel/Projects/klz-2026/components/record-mode/PlaybackCursor.tsx'
];
for (const file of files) {
let content = fs.readFileSync(file, 'utf8');
content = content.replace(/import { motion } from 'framer-motion';/g, "import { m, LazyMotion, domAnimation } from 'framer-motion';");
content = content.replace(/import { motion, Variants } from 'framer-motion';/g, "import { m, LazyMotion, domAnimation, Variants } from 'framer-motion';");
content = content.replace(/import { motion, AnimatePresence } from 'framer-motion';/g, "import { m, LazyMotion, domAnimation, AnimatePresence } from 'framer-motion';");
content = content.replace(/<motion\./g, '<m.');
content = content.replace(/<\/motion\./g, '</m.');
fs.writeFileSync(file, content);
}
console.log('Replaced motion with m in ' + files.length + ' files');

View File

@@ -12,7 +12,8 @@ import * as path from 'path';
* 3. Runs pa11y-ci on those URLs * 3. Runs pa11y-ci on those URLs
*/ */
const targetUrl = process.argv[2] || process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000'; const targetUrl =
process.argv[2] || process.env.NEXT_PUBLIC_BASE_URL || 'https://testing.klz-cables.com';
const limit = process.env.PAGESPEED_LIMIT ? parseInt(process.env.PAGESPEED_LIMIT) : 20; const limit = process.env.PAGESPEED_LIMIT ? parseInt(process.env.PAGESPEED_LIMIT) : 20;
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026'; const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026';
@@ -79,38 +80,22 @@ async function main() {
...baseConfig, ...baseConfig,
defaults: { defaults: {
...baseConfig.defaults, ...baseConfig.defaults,
threshold: 0, // Force threshold to 0 so all errors are shown in JSON actions: [
runners: ['axe'], `set cookie klz_gatekeeper_session=${gatekeeperPassword} domain=${domain} path=/`,
ignore: [...(baseConfig.defaults?.ignore || []), 'color-contrast'], ...(baseConfig.defaults?.actions || []),
chromeLaunchConfig: { ],
...baseConfig.defaults?.chromeLaunchConfig,
args: [
...(baseConfig.defaults?.chromeLaunchConfig?.args || []),
'--no-sandbox',
'--disable-setuid-sandbox',
],
},
headers: {
Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`,
},
timeout: 60000, // Increase timeout for slower pages timeout: 60000, // Increase timeout for slower pages
}, },
urls: urls, urls: urls,
}; };
// Create output directory const tempConfigPath = path.join(process.cwd(), '.pa11yci.temp.json');
const outputDir = path.join(process.cwd(), '.pa11yci'); const reportPath = path.join(process.cwd(), '.pa11yci-report.json');
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}
const tempConfigPath = path.join(outputDir, 'config.temp.json');
const reportPath = path.join(outputDir, 'report.json');
fs.writeFileSync(tempConfigPath, JSON.stringify(tempConfig, null, 2)); fs.writeFileSync(tempConfigPath, JSON.stringify(tempConfig, null, 2));
// 3. Execute pa11y-ci // 3. Execute pa11y-ci
console.log(`\n💻 Executing pa11y-ci...`); console.log(`\n💻 Executing pa11y-ci...`);
const pa11yCommand = `npx pa11y-ci --config .pa11yci/config.temp.json --reporter json > .pa11yci/report.json`; const pa11yCommand = `npx pa11y-ci --config .pa11yci.temp.json --reporter json > .pa11yci-report.json`;
try { try {
execSync(pa11yCommand, { execSync(pa11yCommand, {
@@ -128,18 +113,9 @@ async function main() {
const summaryTable = Object.keys(reportData.results).map((url) => { const summaryTable = Object.keys(reportData.results).map((url) => {
const results = reportData.results[url]; const results = reportData.results[url];
// Results might have errors or just a top level message if it crashed const errors = results.filter((r: any) => r.type === 'error').length;
let errors = 0; const warnings = results.filter((r: any) => r.type === 'warning').length;
let warnings = 0; const notices = results.filter((r: any) => r.type === 'notice').length;
let notices = 0;
if (Array.isArray(results)) {
// pa11y action execution errors come as objects with a message but no type
const actionErrors = results.filter((r: any) => !r.type && r.message).length;
errors = results.filter((r: any) => r.type === 'error').length + actionErrors;
warnings = results.filter((r: any) => r.type === 'warning').length;
notices = results.filter((r: any) => r.type === 'notice').length;
}
// Clean URL for display // Clean URL for display
const displayUrl = url.replace(targetUrl, '') || '/'; const displayUrl = url.replace(targetUrl, '') || '/';
@@ -162,7 +138,6 @@ async function main() {
console.log(`\n📈 Result: ${cleanPages}/${totalPages} pages are error-free.`); console.log(`\n📈 Result: ${cleanPages}/${totalPages} pages are error-free.`);
if (totalErrors > 0) { if (totalErrors > 0) {
console.log(` Total Errors discovered: ${totalErrors}`); console.log(` Total Errors discovered: ${totalErrors}`);
process.exitCode = 1;
} }
} }
@@ -177,9 +152,11 @@ async function main() {
} }
process.exit(1); process.exit(1);
} finally { } finally {
// Clean up temp config file, keep report // Clean up temp files
const tempConfigPath = path.join(process.cwd(), '.pa11yci/config.temp.json'); ['.pa11yci.temp.json', '.pa11yci-report.json'].forEach((f) => {
if (fs.existsSync(tempConfigPath)) fs.unlinkSync(tempConfigPath); const p = path.join(process.cwd(), f);
if (fs.existsSync(p)) fs.unlinkSync(p);
});
} }
} }

View File

@@ -1,4 +1,19 @@
// Sentry initialization move to GlitchtipErrorReportingService to allow lazy-loading import * as Sentry from '@sentry/nextjs';
// for PageSpeed 100 optimizations. This file is now empty to prevent the SDK
// from being included in the initial JS bundle. // We use a placeholder DSN on the client because the real DSN is injected
export {}; // by our server-side relay at /errors/api/relay.
// This keeps our environment clean of NEXT_PUBLIC_ variables.
const CLIENT_DSN = 'https://public@errors.infra.mintel.me/1';
Sentry.init({
dsn: CLIENT_DSN,
// Relay events through our own server to hide the real DSN and bypass ad-blockers
tunnel: '/errors/api/relay',
// Enable even if no DSN is provided, because we have the tunnel
enabled: true,
tracesSampleRate: 0,
replaysOnErrorSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
});

View File

@@ -20,7 +20,7 @@
--color-accent: #82ed20; --color-accent: #82ed20;
/* Sustainability Green */ /* Sustainability Green */
--color-accent-dark: #14532d; --color-accent-dark: #6bc41a;
--color-accent-light: #f0f9e6; --color-accent-light: #f0f9e6;
--color-neutral: #f8f9fa; --color-neutral: #f8f9fa;
@@ -43,11 +43,11 @@
--animate-slide-up: slide-up 0.6s ease-out; --animate-slide-up: slide-up 0.6s ease-out;
--animate-slow-zoom: slow-zoom 20s linear infinite; --animate-slow-zoom: slow-zoom 20s linear infinite;
--animate-reveal: reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; --animate-reveal: reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
--animate-slight-fade-in-from-bottom: slight-fade-in-from-bottom 0.8s --animate-slight-fade-in-from-bottom: slight-fade-in-from-bottom 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
cubic-bezier(0.16, 1, 0.3, 1) forwards;
--animate-gradient-x: gradient-x 15s ease infinite; --animate-gradient-x: gradient-x 15s ease infinite;
@keyframes gradient-x { @keyframes gradient-x {
0%, 0%,
100% { 100% {
background-position: 0% 50%; background-position: 0% 50%;
@@ -135,32 +135,10 @@
transform: translate(0, 0) scale(1); transform: translate(0, 0) scale(1);
} }
} }
@keyframes spin-slow {
to {
transform: rotate(360deg);
}
}
@keyframes flow {
to {
stroke-dashoffset: 0;
}
}
@keyframes solar-pulse {
0%,
100% {
fill-opacity: 0.2;
}
50% {
fill-opacity: 0.5;
}
}
} }
@layer base { @layer base {
.bg-primary a, .bg-primary a,
.bg-primary-dark a { .bg-primary-dark a {
@apply text-white/90 hover:text-white transition-colors; @apply text-white/90 hover:text-white transition-colors;
@@ -343,4 +321,4 @@
@utility content-visibility-auto { @utility content-visibility-auto {
content-visibility: auto; content-visibility: auto;
contain-intrinsic-size: 1px 1000px; contain-intrinsic-size: 1px 1000px;
} }