This commit is contained in:
Your Name committed 2026-06-13 23:25:19 -04:00
1 parent 0d10c7a071
commit b867063efb
2 files changed
+26 -11

No files matched your search

@@ -1,9 +1,16 @@
"use client";
import { useState } from 'react'
import Link from 'next/link'
import { getCategoryImage, formatPrice, type Product } from '@homaroma/types'
import { getCategoryImage, formatPrice, type Product, type TranslatableString } from '@homaroma/types'
import { useCartStore } from '../store/cartStore'
/** Resolve TranslatableString → plain string */
function resolveStr(v: TranslatableString | null | undefined, lang = 'th'): string {
if (!v) return ''
if (typeof v === 'string') return v
return v[lang] ?? v['th'] ?? v['en'] ?? Object.values(v)[0] ?? ''
}
interface Props {
product: Product
}
@@ -40,8 +47,8 @@ export default function AddToCartSection({ product }: Props) {
<p className="text-slate-400 text-sm uppercase tracking-widest">Premium Collection</p>
</div>
{product.description && (
<p className="text-slate-300 leading-relaxed">{product.description}</p>
{resolveStr(product.description) && (
<p className="text-slate-300 leading-relaxed">{resolveStr(product.description)}</p>
)}
{/* Price */}