import { Download } from 'lucide-react'; import fs from 'fs'; import path from 'path'; export default function AGB() { const filePath = path.join(process.cwd(), 'context/agbs.md'); const fileContent = fs.readFileSync(filePath, 'utf8'); // Simple parsing of the markdown file const lines = fileContent.split('\n').map(l => l.trim()).filter(line => line !== ''); const title = lines[0] || 'Liefer- und Zahlungsbedingungen'; const stand = lines[1] || 'Stand Januar 2026'; const sections: { title: string; content: string[] }[] = []; let currentSection: { title: string; content: string[] } | null = null; // Skip title and stand lines.slice(2).forEach(line => { // Check if line starts with a number followed by a dot (e.g., "1. ", "10. ") if (/^\d+\./.test(line)) { if (currentSection) sections.push(currentSection); currentSection = { title: line, content: [] }; } else if (currentSection) { currentSection.content.push(line); } }); if (currentSection) sections.push(currentSection); // The last line is usually the location/date const footer = lines[lines.length - 1]; // Remove footer from the last section's content if it was added there if (sections.length > 0) { const lastSection = sections[sections.length - 1]; if (lastSection.content.includes(footer)) { lastSection.content = lastSection.content.filter(c => c !== footer); } } return (

{title}

{stand}

Als PDF herunterladen
{sections.map((section, index) => (

{section.title}

{section.content.map((paragraph, pIndex) => (

{paragraph}

))}
))}

{footer}

); }