import React from 'react'; import { useNavigate, Link } from 'react-router-dom'; import { SimProduct } from '../types'; const BuySimView: React.FC = () => { const navigate = useNavigate(); const popularSims: SimProduct[] = [ { id: 'p1', country: 'China', flag: 'cn', originalPrice: '$0.94', discountPrice: '$0.85', discountLabel: '-10%' }, { id: 'p2', country: 'Hong Kong', flag: 'hk', originalPrice: '$4.43', discountPrice: '$4.21', discountLabel: '-5%' }, { id: 'p3', country: 'Japan', flag: 'jp', originalPrice: '$1.44', discountPrice: '$1.3', discountLabel: '-10%' }, { id: 'p4', country: 'Singapore', flag: 'sg', originalPrice: '$4.43', discountPrice: '$4.21', discountLabel: '-5%' }, { id: 'p5', country: 'South Korea', flag: 'kr', originalPrice: '$0.94', discountPrice: '$0.85', discountLabel: '-10%' }, { id: 'p6', country: 'Taiwan', flag: 'tw', originalPrice: '$2.04', discountPrice: '$1.84', discountLabel: '-10%' }, { id: 'p7', country: 'Thailand', flag: 'th', originalPrice: '$1.89', discountPrice: '$1.78', discountLabel: '-6%' }, { id: 'p8', country: 'United States', flag: 'us', originalPrice: '$2.16', discountPrice: '$1.94', discountLabel: '-10%' }, ]; const handleSelect = (p: SimProduct) => { navigate(`/product/${p.country.toLowerCase()}`, { state: { country: p.country, flag: p.flag, image: p.isRegion ? 'https://images.unsplash.com/photo-1526772662000-3f88f10c053b?q=80&w=1000&auto=format&fit=crop' : (p.country === 'Thailand' ? 'https://images.unsplash.com/photo-1528181304800-2f140819898f?q=80&w=1000&auto=format&fit=crop' : `https://images.unsplash.com/photo-1526772662000-3f88f10c053b?q=80&w=1000&auto=format&fit=crop`) }}); }; const ProductCard: React.FC<{ p: SimProduct }> = ({ p }) => (
from: {p.discountPrice}