"use client";
import { Clock, Coins, Heart, Shield, Sword } from "lucide-react";
import { useTranslations } from "next-intl";
import { useState } from "react";
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { PriceDisplay } from "@/components/ui/price-display";
import type { MarketOffer } from "@/types/item";
interface OfferCardProps {
offer: MarketOffer;
}
export function OfferCard({ offer }: OfferCardProps) {
const t = useTranslations("home.stats");
const tButtons = useTranslations("home.buttons");
const [isFavorited, setIsFavorited] = useState(false);
const [_isHovered, setIsHovered] = useState(false);
const formatTimeAgo = (timestamp: Date) => {
const now = new Date();
const diff = now.getTime() - timestamp.getTime();
const minutes = Math.floor(diff / (1000 * 60));
if (minutes < 1) return "Agora";
if (minutes < 60) return `há ${minutes} ${t("minutes")}`;
const hours = Math.floor(minutes / 60);
if (hours < 24) return `há ${hours} ${t("hours")}`;
const days = Math.floor(hours / 24);
return `há ${days} dias`;
};
const getInitials = (name: string) => {
return name
.split(" ")
.map((word) => word[0])
.join("")
.toUpperCase()
.slice(0, 2);
};
const getCategoryIcon = (category: string) => {
switch (category) {
case "weapon":
return
{offer.item.stackable ? `Stack: ${offer.quantity}x` : `Qtd: ${offer.quantity}`} {offer.item.stackable && offer.quantity > 1 && ( {Math.round(offer.price / offer.quantity).toLocaleString()}{" "} gp cada )}