fix: refactor MDXContent to use getLocale and add missing blog blocks
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Successful in 1m16s
Build & Deploy / 🏗️ Build (push) Successful in 2m46s
Build & Deploy / 🚀 Deploy (push) Successful in 14s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 1m3s
Build & Deploy / 🔔 Notify (push) Successful in 2s

This commit is contained in:
2026-05-07 11:30:59 +02:00
parent 5a61ebf269
commit ac437e19f3
4 changed files with 34 additions and 8 deletions

View File

@@ -1,12 +1,15 @@
import React from 'react'; import React from 'react';
import { MDXRemote } from 'next-mdx-remote/rsc'; import { MDXRemote } from 'next-mdx-remote/rsc';
import { useLocale } from 'next-intl'; import { getLocale } from 'next-intl/server';
// Blog components // Blog components
import TechnicalGrid from './blog/TechnicalGrid'; import TechnicalGrid from './blog/TechnicalGrid';
import Stats from './blog/Stats'; import Stats from './blog/Stats';
import VisualLinkPreview from './blog/VisualLinkPreview'; import VisualLinkPreview from './blog/VisualLinkPreview';
import StickyNarrative from './blog/StickyNarrative'; import StickyNarrative from './blog/StickyNarrative';
import ComparisonGrid from './blog/ComparisonGrid';
import HighlightBox from './blog/HighlightBox';
import ChatBubble from './blog/ChatBubble';
// Home components // Home components
import Hero from './home/Hero'; import Hero from './home/Hero';
@@ -36,10 +39,14 @@ function HeroSection(props: any) {
); );
} }
function Block(props: any) { async function Block(props: any) {
const { type, data } = props; const { type, data, children } = props;
const locale = useLocale(); const locale = await getLocale();
switch (type) {
// Normalize type (Payload sometimes uses blockType in data)
const blockType = type || data?.blockType;
switch (blockType) {
// Blog Components // Blog Components
case 'technicalGrid': case 'technicalGrid':
return <TechnicalGrid {...data} />; return <TechnicalGrid {...data} />;
@@ -49,6 +56,12 @@ function Block(props: any) {
return <VisualLinkPreview {...data} />; return <VisualLinkPreview {...data} />;
case 'stickyNarrative': case 'stickyNarrative':
return <StickyNarrative {...data} />; return <StickyNarrative {...data} />;
case 'comparisonGrid':
return <ComparisonGrid {...data} />;
case 'highlightBox':
return <HighlightBox {...data}>{children}</HighlightBox>;
case 'chatBubble':
return <ChatBubble {...data}>{children}</ChatBubble>;
// Home Components // Home Components
case 'homeHero': case 'homeHero':
@@ -74,7 +87,12 @@ function Block(props: any) {
default: default:
return ( return (
<div className="p-4 border-2 border-dashed border-gray-300">Unknown Block: {type}</div> <div className="p-8 border-2 border-dashed border-red-200 rounded-2xl my-8 bg-red-50 text-red-600">
<p className="font-bold mb-2">Unknown Block Type: {blockType}</p>
<pre className="text-xs overflow-auto p-4 bg-white/50 rounded">
{JSON.stringify({ type, data: !!data, hasChildren: !!children }, null, 2)}
</pre>
</div>
); );
} }
} }

2
next-env.d.ts vendored
View File

@@ -1,6 +1,6 @@
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/image-types/global" /> /// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts"; import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited // NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -113,7 +113,7 @@
"prepare": "husky", "prepare": "husky",
"preinstall": "npx only-allow pnpm" "preinstall": "npx only-allow pnpm"
}, },
"version": "2.3.22-rc.20", "version": "2.3.22-rc.21",
"pnpm": { "pnpm": {
"onlyBuiltDependencies": [ "onlyBuiltDependencies": [
"@parcel/watcher", "@parcel/watcher",

8
push_error.log Normal file
View File

@@ -0,0 +1,8 @@
remote:
remote: Create a new pull request for 'feature/mdx-migration':
remote: https://git.infra.mintel.me/mmintel/klz-cables.com/pulls/new/feature/mdx-migration
remote:
remote: . Processing 1 references
remote: Processed 1 references in total
To https://git.infra.mintel.me/mmintel/klz-cables.com.git
58092917..f17a8c8c feature/mdx-migration -> feature/mdx-migration