diff --git a/hifi-src/src/pages/public/ModelPage.jsx b/hifi-src/src/pages/public/ModelPage.jsx index eb8a72e..2dbdf96 100644 --- a/hifi-src/src/pages/public/ModelPage.jsx +++ b/hifi-src/src/pages/public/ModelPage.jsx @@ -45,6 +45,21 @@ export default function ModelPage() { const { model, packages } = data; + // Preis-Rang innerhalb dieses Modells bestimmt die optische Wucht der Kachel: + // die guenstigste Option bleibt schlicht/hell, dazwischen liegende Pakete + // bekommen einen Akzent-Rahmen, das teuerste Paket eine dunkle "Premium"-Karte. + // Das braucht keine zusaetzliche Admin-Einstellung und passt sich automatisch an. + const rankById = new Map( + [...packages].sort((a, b) => a.total_price - b.total_price).map((p, i) => [p.id, i]) + ); + const tierOf = (pkg) => { + if (packages.length <= 1) return 'plain'; + const rank = rankById.get(pkg.id); + if (rank === 0) return 'plain'; + if (rank === packages.length - 1) return 'premium'; + return 'accent'; + }; + const contactUrl = (pkg) => { const params = new URLSearchParams({ brand: model.brand_name, @@ -72,58 +87,89 @@ export default function ModelPage() { )}
{pkg.tagline}
} - -{t('modelPage.totalPrice')}
-{formatPrice(pkg.total_price)}
-+ {pkg.tagline} +
+ )} + ++ {t('modelPage.totalPrice')} +
++ {formatPrice(pkg.total_price)} +
+