"use client"; import { TibiaItem } from "@/types/item"; import { MagicCard } from "@/components/ui/magic-card"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { PriceDisplay } from "@/components/ui/price-display"; import { useTranslations } from "next-intl"; import { TrendingUp, TrendingDown, Sword, Shield, Weight, Heart, Star, Clock, Coins, ArrowUp, ArrowDown, Minus, Zap, Flame, Snowflake, Zap as Energy, Skull, Cross, Badge as BadgeIcon, Boxes, } from "lucide-react"; import { useState } from "react"; import { getRarityColor, getRarityBgColor, getRarityGlow, } from "@/lib/currency-utils"; interface ItemCardProps { item: TibiaItem; mode?: "market" | "catalog"; } export function ItemCard({ item, mode = "market" }: ItemCardProps) { const t = useTranslations("home.item"); const [isFavorited, setIsFavorited] = useState(false); const [isHovered, setIsHovered] = useState(false); const rarityColors = { common: "bg-gray-500", uncommon: "bg-green-500", rare: "bg-blue-500", epic: "bg-purple-500", legendary: "bg-orange-500", }; const categoryIcons = { weapon: Sword, armor: Shield, helmet: Shield, legs: Shield, boots: Shield, shield: Shield, amulet: "💎", ring: "💍", potion: "🧪", rune: "📜", tool: "🔧", ammunition: "🏹", other: "📦", }; const CategoryIcon = categoryIcons[item.category]; // Calcular diferença percentual entre compra e venda (somente quando houver preço) const hasPrice = item && (item as any).price && typeof (item as any).price.buy === "number" && typeof (item as any).price.sell === "number" && (item as any).price.sell !== 0; const priceDifference = hasPrice ? (((item as any).price.buy - (item as any).price.sell) / (item as any).price.sell) * 100 : 0; const isHotDeal = hasPrice && priceDifference > 20; // Hot deal se diferença > 20% // Determinar tendência de preço const getPriceTrend = () => { const ph = (item as any).priceHistory; if (!ph || typeof ph.highest !== "number" || typeof ph.lowest !== "number" || typeof ph.average !== "number") { return "stable"; } if (ph.highest > ph.average * 1.1) return "up"; if (ph.lowest < ph.average * 0.9) return "down"; return "stable"; }; const trend = getPriceTrend(); const TrendIcon = trend === "up" ? ArrowUp : trend === "down" ? ArrowDown : Minus; const trendColor = trend === "up" ? "text-green-500" : trend === "down" ? "text-red-500" : "text-gray-500"; return (