Adds the Prijzen section to the homepage

Shows the three live packages as cards with their price and what is
included. Each card links to the contact section with ?pakket=<id>, so
the contact form can preselect it. Invalid packages from the CMS are
skipped and the pakket value is only accepted when it names a package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 01:07:36 +02:00
co-authored by Claude Opus 5.5
parent 0b54a67dc4
commit 30dab1af42
32 changed files with 1250 additions and 6 deletions
+29
View File
@@ -0,0 +1,29 @@
import type { PricingPackage } from '../content/types.ts';
const SLUG = /^[a-z0-9-]+$/;
// Whether a package meets the invariants in domain-entities.md
export function isValidPackage(pkg: PricingPackage): boolean {
return (
SLUG.test(pkg.id) &&
pkg.name.trim() !== '' &&
Number.isInteger(pkg.price) &&
pkg.price > 0 &&
pkg.features.length > 0 &&
pkg.features.every((feature) => feature.trim() !== '')
);
}
// The packages that can be shown: invalid ones from the CMS are skipped
// rather than breaking the page, and of two packages with the same id the
// first wins. The order stays the same (BR-PRICE-02).
export function visiblePackages(
packages: readonly PricingPackage[],
): PricingPackage[] {
const seen = new Set<string>();
return packages.filter((pkg) => {
if (!isValidPackage(pkg) || seen.has(pkg.id)) return false;
seen.add(pkg.id);
return true;
});
}