import type { AmazonData } from './types'; function StarRating({ rating, reviewCount }: { rating: number; reviewCount?: number }) { const full = Math.floor(rating); const half = rating - full >= 0.5; const stars: string[] = []; for (let i = 0; i < full; i++) stars.push('\u2605'); if (half) stars.push('\u2606'); return ( {stars.join('')} {rating.toFixed(1)} {reviewCount != null && ({reviewCount.toLocaleString()}件)} ); } export function AmazonProductsDetail({ data }: { data: AmazonData }) { const { query, products } = data; return (

🛒 Amazon 検索結果: 「{query}」

{products.map((p, i) => (
{/* Product image */}
{p.imageUrl ? ( {p.title} ) : ( 💾 )}
{/* Product info */}
#{i + 1}

{p.title}

{p.price && (
{p.price}
)} {p.rating != null && (
)}
ASIN: {p.asin}
{/* Keepa price graph */}
📈 価格推移 (Keepa)
{`${p.title}
))}
); }