import Link from "next/link"; import { Minus, Plus, Heart, ShoppingCart, Store } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; interface ProductPurchaseCardProps { price: string; oldPrice?: string; isInCart: boolean; localQuantity: number; availableStock: number; isSyncing: boolean; syncError: boolean; isFavorite: boolean; productStock: number; channelName?: string; onAddToCart: () => void; onQuantityIncrease: () => void; onQuantityDecrease: () => void; onToggleFavorite: () => void; t: (key: string) => string; } export function ProductPurchaseCard({ price, oldPrice, isInCart, localQuantity, availableStock, isSyncing, syncError, isFavorite, productStock, channelName, onAddToCart, onQuantityIncrease, onQuantityDecrease, onToggleFavorite, t, }: ProductPurchaseCardProps) { const isOutOfStock = productStock === 0; return (
{/* Price Section */}
{t("price")}:
{price}{" "} TMT {oldPrice && parseFloat(oldPrice) > 0 && ( {oldPrice} TMT )}
{/* Action Buttons Section */}
{isInCart ? ( <> {/* Go to Cart Button */} {/* Quantity Controls */}
{isSyncing ? (
) : null} {localQuantity} {syncError && ( )}
{/* Favorite Button - In Cart */}
) : (
{/* Add to Cart Button */} {/* Favorite Button - Not in Cart */}
)}
); }