Compare commits
9 Commits
785e36af08
...
v1.3.20
| Author | SHA1 | Date | |
|---|---|---|---|
| dfc7536268 | |||
| 9f26a179fa | |||
| 5043058660 | |||
| a37091ad71 | |||
| 9539aa35eb | |||
| 3ad24ef615 | |||
| 3018ae5412 | |||
| fd3f4c82c5 | |||
| 3906838dc1 |
@@ -6,61 +6,42 @@ export default function AVB() {
|
|||||||
const filePath = path.join(process.cwd(), "context/avbs.md");
|
const filePath = path.join(process.cwd(), "context/avbs.md");
|
||||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||||
|
|
||||||
// Split by double newlines to get major blocks (headers + their first paragraphs, or subsequent paragraphs)
|
// Split by double newlines to get major blocks
|
||||||
const blocks = fileContent
|
const rawBlocks = fileContent
|
||||||
.split(/\n\s*\n/)
|
.split(/\n\s*\n/)
|
||||||
.map((b) => b.trim())
|
.map((b) => b.trim())
|
||||||
.filter((b) => b !== "");
|
.filter((b) => b !== "");
|
||||||
|
|
||||||
const title = blocks[0] || "Liefer- und Zahlungsbedingungen";
|
// Extract title and stand more robustly
|
||||||
const stand = blocks[1] || "Stand Januar 2026";
|
const title = rawBlocks.find(b => b.startsWith("# "))?.replace(/^#\s+/, "") || "Allgemeine Verkaufsbedingungen";
|
||||||
|
const stand = rawBlocks.find(b => b.toLowerCase().startsWith("stand:")) || "Stand: April 2026";
|
||||||
|
|
||||||
const sections: { title: string; content: string[] }[] = [];
|
const sections: { title: string; content: string[] }[] = [];
|
||||||
let currentSection: { title: string; content: string[] } | null = null;
|
let currentSection: { title: string; content: string[] } | null = null;
|
||||||
|
|
||||||
// Skip title and stand
|
// Process sections, skipping title and stand blocks
|
||||||
blocks.slice(2).forEach((block) => {
|
rawBlocks.forEach((block) => {
|
||||||
const lines = block
|
if (block.startsWith("# ") || block.toLowerCase().startsWith("stand:")) return;
|
||||||
.split("\n")
|
|
||||||
.map((l) => l.trim())
|
|
||||||
.filter((l) => l !== "");
|
|
||||||
if (lines.length === 0) return;
|
|
||||||
|
|
||||||
const firstLine = lines[0];
|
if (block.startsWith("##")) {
|
||||||
|
// New section header: e.g. "## 1. Geltungsbereich"
|
||||||
if (/^\d+\./.test(firstLine)) {
|
|
||||||
// New section
|
|
||||||
if (currentSection) sections.push(currentSection);
|
if (currentSection) sections.push(currentSection);
|
||||||
|
currentSection = {
|
||||||
currentSection = { title: firstLine, content: [] };
|
title: block.replace(/^##\s+/, "").trim(),
|
||||||
|
content: []
|
||||||
// If there are more lines in this block, they form the first paragraph(s)
|
};
|
||||||
if (lines.length > 1) {
|
|
||||||
// Join subsequent lines as they might be part of the same paragraph
|
|
||||||
// In this MD, we'll assume lines in the same block belong together
|
|
||||||
// unless they are clearly separate paragraphs (but we already split by double newline)
|
|
||||||
const remainingText = lines.slice(1).join(" ");
|
|
||||||
if (remainingText) currentSection.content.push(remainingText);
|
|
||||||
}
|
|
||||||
} else if (currentSection) {
|
} else if (currentSection) {
|
||||||
// Continuation of current section
|
// Clean up bold markers for better display
|
||||||
const blockText = lines.join(" ");
|
const cleanedBlock = block.replace(/\*\*(.*?)\*\*/g, "$1");
|
||||||
if (blockText) currentSection.content.push(blockText);
|
currentSection.content.push(cleanedBlock);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (currentSection) sections.push(currentSection);
|
if (currentSection) sections.push(currentSection);
|
||||||
|
|
||||||
// The last block is the footer
|
// The very last block might be a footer/schlussbestimmung if it's not in a section
|
||||||
const footer = blocks[blocks.length - 1];
|
// In our MD, everything is in a section, so we just use the last block of the last section as potential footer if we want,
|
||||||
if (sections.length > 0) {
|
// but the current UI expects a separate 'footer' variable.
|
||||||
const lastSection = sections[sections.length - 1];
|
const footer = "MB Grid Solutions & Services";
|
||||||
if (lastSection.content.includes(footer) || lastSection.title === footer) {
|
|
||||||
lastSection.content = lastSection.content.filter((c) => c !== footer);
|
|
||||||
if (sections[sections.length - 1].title === footer) {
|
|
||||||
sections.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-slate-50 min-h-screen pt-40 pb-20">
|
<div className="bg-slate-50 min-h-screen pt-40 pb-20">
|
||||||
@@ -114,8 +95,9 @@ export default function AVB() {
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
<div className="pt-8 border-t border-slate-100">
|
<div className="pt-8 border-t border-slate-100 flex justify-between items-center text-slate-400 text-sm italic">
|
||||||
<p className="font-bold text-primary">{footer}</p>
|
<p>{footer}</p>
|
||||||
|
<p>{stand}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
2
next-env.d.ts
vendored
2
next-env.d.ts
vendored
@@ -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.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mb-grid-solutions.com",
|
"name": "mb-grid-solutions.com",
|
||||||
"version": "1.3.14",
|
"version": "1.3.20",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"packageManager": "pnpm@10.18.3",
|
"packageManager": "pnpm@10.18.3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
799
pnpm-lock.yaml
generated
799
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -90,7 +90,8 @@ async function main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Listen for console.error and console.warn messages (like Next.js Image warnings, hydration errors, CSP blocks)
|
// Listen for console.error and console.warn messages (like Next.js Image warnings, hydration errors, CSP blocks)
|
||||||
page.on('console', (msg) => {
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
page.on('console', (msg: any) => {
|
||||||
const type = msg.type();
|
const type = msg.type();
|
||||||
if (type === 'error' || type === 'warn') {
|
if (type === 'error' || type === 'warn') {
|
||||||
const text = msg.text();
|
const text = msg.text();
|
||||||
|
|||||||
@@ -14,5 +14,5 @@
|
|||||||
".next/types/**/*.ts",
|
".next/types/**/*.ts",
|
||||||
".next/dev/types/**/*.ts"
|
".next/dev/types/**/*.ts"
|
||||||
],
|
],
|
||||||
"exclude": ["node_modules", "tests", "tests_bak"]
|
"exclude": ["node_modules", "tests", "tests_bak", "scripts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user