Added Tailwind CSS and tw-animate-css imports to globals.css. Introduced a custom dark variant and an extensive @theme inline block with CSS variables for colors, radii, and animations. Included keyframes for shimmer-slide, spin-around, gradient, shine, and background-position-spin to enable consistent theming and dynamic UI effects across the application.
91 lines
2.1 KiB
TypeScript
91 lines
2.1 KiB
TypeScript
import { Currency } from "@/types/currency";
|
|
|
|
export function formatPrice(value: number, currency: Currency = "gp"): string {
|
|
if (value >= 1000000) {
|
|
const millions = value / 1000000;
|
|
return `${millions.toFixed(1)}kk ${currency}`;
|
|
}
|
|
|
|
if (value >= 1000) {
|
|
const thousands = value / 1000;
|
|
return `${thousands.toFixed(0)}k ${currency}`;
|
|
}
|
|
|
|
return `${value.toLocaleString("pt-BR")} ${currency}`;
|
|
}
|
|
|
|
export function convertGpToTc(gp: number): number {
|
|
return Math.round(gp / 35000); // 1 TC ≈ 35.000 gp
|
|
}
|
|
|
|
export function formatLargeNumber(value: number): string {
|
|
if (value >= 1000000) {
|
|
const millions = value / 1000000;
|
|
return `${millions.toFixed(1)}kk`;
|
|
}
|
|
|
|
if (value >= 1000) {
|
|
const thousands = value / 1000;
|
|
return `${thousands.toFixed(0)}k`;
|
|
}
|
|
|
|
return value.toLocaleString("pt-BR");
|
|
}
|
|
|
|
export function formatPriceWithTc(gp: number): string {
|
|
const tc = convertGpToTc(gp);
|
|
if (tc >= 1) {
|
|
return `${formatPrice(gp)} (${tc} TC)`;
|
|
}
|
|
return formatPrice(gp);
|
|
}
|
|
|
|
export function getRarityColor(rarity: string): string {
|
|
switch (rarity) {
|
|
case "legendary":
|
|
return "text-orange-500";
|
|
case "epic":
|
|
return "text-purple-500";
|
|
case "rare":
|
|
return "text-blue-500";
|
|
case "uncommon":
|
|
return "text-green-500";
|
|
case "common":
|
|
return "text-gray-500";
|
|
default:
|
|
return "text-gray-500";
|
|
}
|
|
}
|
|
|
|
export function getRarityBgColor(rarity: string): string {
|
|
switch (rarity) {
|
|
case "legendary":
|
|
return "bg-orange-500/10";
|
|
case "epic":
|
|
return "bg-purple-500/10";
|
|
case "rare":
|
|
return "bg-blue-500/10";
|
|
case "uncommon":
|
|
return "bg-green-500/10";
|
|
case "common":
|
|
return "bg-gray-500/10";
|
|
default:
|
|
return "bg-gray-500/10";
|
|
}
|
|
}
|
|
|
|
export function getRarityGlow(rarity: string): string {
|
|
switch (rarity) {
|
|
case "legendary":
|
|
return "shadow-[0_0_15px_rgba(255,140,0,0.5)]";
|
|
case "epic":
|
|
return "shadow-[0_0_15px_rgba(155,89,182,0.5)]";
|
|
case "rare":
|
|
return "shadow-[0_0_15px_rgba(52,152,219,0.5)]";
|
|
case "uncommon":
|
|
return "shadow-[0_0_15px_rgba(46,204,113,0.5)]";
|
|
default:
|
|
return "";
|
|
}
|
|
}
|