style: clean up code formatting and remove trailing whitespace
refactor: reorganize imports and fix type imports
This commit is contained in:
1 parent
d3704602fd
commit
47c04de6fe
232 files changed
+7140
-4798
No files matched your search
@@ -1,9 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Package, MapPin, DollarSign, Coins, User } from "lucide-react";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Coins, DollarSign, MapPin, Package, User } from "lucide-react";
|
||||
import Image from "next/image";
|
||||
import { useState } from "react";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import type { Chat } from "@/lib/hooks/use-chat";
|
||||
|
||||
interface ChatHeaderProps {
|
||||
@@ -17,20 +17,23 @@ export function ChatHeader({ chat, currentUserId }: ChatHeaderProps) {
|
||||
chat.buyer_id === currentUserId ? chat.seller_cache : chat.buyer_cache;
|
||||
const [imageError, setImageError] = useState(false);
|
||||
|
||||
const formatPrice = (price: number | null | undefined, type: "pix" | "tc" | "gp"): string => {
|
||||
const formatPrice = (
|
||||
price: number | null | undefined,
|
||||
type: "pix" | "tc" | "gp",
|
||||
): string => {
|
||||
if (price === null || price === undefined) return "N/A";
|
||||
|
||||
|
||||
if (type === "pix") {
|
||||
return new Intl.NumberFormat("pt-BR", {
|
||||
style: "currency",
|
||||
currency: "BRL",
|
||||
}).format(price);
|
||||
}
|
||||
|
||||
|
||||
if (type === "tc") {
|
||||
return `${price.toLocaleString("pt-BR")} TC`;
|
||||
}
|
||||
|
||||
|
||||
if (type === "gp") {
|
||||
const gold = price / 1000000;
|
||||
if (gold >= 1) {
|
||||
@@ -38,7 +41,7 @@ export function ChatHeader({ chat, currentUserId }: ChatHeaderProps) {
|
||||
}
|
||||
return `${price.toLocaleString("pt-BR")} gp`;
|
||||
}
|
||||
|
||||
|
||||
return price.toLocaleString("pt-BR");
|
||||
};
|
||||
|
||||
@@ -63,7 +66,9 @@ export function ChatHeader({ chat, currentUserId }: ChatHeaderProps) {
|
||||
|
||||
{/* Detalhes do anúncio */}
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="font-semibold text-lg truncate">{listing.item_name}</h3>
|
||||
<h3 className="font-semibold text-lg truncate">
|
||||
{listing.item_name}
|
||||
</h3>
|
||||
<div className="flex items-center gap-3 text-sm text-muted-foreground mt-1">
|
||||
<div className="flex items-center gap-1">
|
||||
<MapPin className="h-3 w-3" />
|
||||
@@ -102,9 +107,7 @@ export function ChatHeader({ chat, currentUserId }: ChatHeaderProps) {
|
||||
{/* Informações do outro usuário */}
|
||||
<div className="flex items-center gap-2 pt-2 border-t">
|
||||
<User className="h-4 w-4 text-muted-foreground" />
|
||||
<span className="text-sm text-muted-foreground">
|
||||
Conversando com:{" "}
|
||||
</span>
|
||||
<span className="text-sm text-muted-foreground">Conversando com: </span>
|
||||
<span className="text-sm font-medium">
|
||||
{otherUser.character_name || otherUser.username}
|
||||
</span>
|
||||
@@ -112,4 +115,3 @@ export function ChatHeader({ chat, currentUserId }: ChatHeaderProps) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user