'use client'; import Link from 'next/link'; import { useParams } from 'next/navigation'; import PageLayout from '../../components/PageLayout'; import { useActiveCoffees } from '../hooks/getActiveCoffees'; import CoffeeDetailGallery from '../components/CoffeeDetailGallery'; import { useCoffeePictures } from '../hooks/useCoffeePictures'; import { useTranslation } from '../../i18n/useTranslation'; import SubscribeGuard from '../components/SubscribeGuard'; export default function CoffeeAbonnementDetailPage() { return ( ); } function CoffeeAbonnementDetailPageContent() { const { t } = useTranslation(); const params = useParams(); const { coffees, loading, error } = useActiveCoffees(); const rawId = params?.id; const coffeeId = Array.isArray(rawId) ? rawId[0] : rawId; const { pictureUrls: endpointPictureUrls, loading: picturesLoading } = useCoffeePictures(coffeeId ? String(coffeeId) : undefined); const coffee = coffees.find((item) => item.id === String(coffeeId)); const fallbackGallery = coffee ? (coffee.gallery.length ? coffee.gallery : (coffee.image ? [coffee.image] : [])) : []; const gallery = endpointPictureUrls.length ? endpointPictureUrls : fallbackGallery; return ( {t('autofix.kbdc4e405')} {t('autofix.k50bb594b')} {t('autofix.ka157a704')} {t('autofix.k96839795')} {loading && ( )} {!loading && error && ( {error} )} {!loading && !error && !coffee && ( {t('autofix.kbcb6ceea')} {t('autofix.k8e0e178e')} )} {!loading && !error && coffee && ( {coffee.name} {coffee.description || t('autofix.kec078e54')} Price per pack EUR {coffee.pricePer10.toFixed(2)} Capsules per pack 10 capsules {t('autofix.k5bd8edf9')} {picturesLoading ? 'Loading...' : gallery.length} Ready to add this coffee to your plan? Go back to the selection page and choose how many packs you want. {t('autofix.k47e6f301')} )} ); }
{t('autofix.ka157a704')}
{t('autofix.k8e0e178e')}
{coffee.description || t('autofix.kec078e54')}
Ready to add this coffee to your plan? Go back to the selection page and choose how many packs you want.