Use Habbo currency PNGs for admin credits, duckets, and diamonds icons.
Local Build and Deploy / deploy (push) Successful in 56s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-17 18:16:01 +02:00
1 parent b42a313825
commit d7405238ea
7 files changed
+118 -26

No files matched your search

@@ -3,6 +3,10 @@
import { Crown, Image as ImageIcon, Package, Sparkles } from "lucide-react";
import type { CatalogItemData } from "@/app/admin/catalog/[id]/catalog-items-table/types";
import { getPointsLabel } from "@/app/admin/catalog/[id]/catalog-items-table/types";
import {
CurrencyIcon,
currencyKindFromPointsType,
} from "@/components/shared/currency-icon";
import { Badge } from "@/components/ui/badge";
import { getHabboCdnIconUrl, getLocalIconUrl } from "@/lib/furni/classname";
import { cn } from "@/lib/utils";
@@ -113,13 +117,20 @@ export function ItemsShopPreview({
</p>
<div className="mt-0.5 flex items-center gap-1.5 text-[10px] font-mono">
{item.costCredits > 0 && (
<span className="text-[var(--admin-warning)] dark:text-[var(--admin-warning)]">
{item.costCredits}c
<span className="inline-flex items-center gap-0.5 text-[var(--admin-warning)] dark:text-[var(--admin-warning)]">
<CurrencyIcon kind="credits" size={12} />
{item.costCredits}
</span>
)}
{item.costPoints > 0 && (
<span className={points.color}>
{item.costPoints} {points.label.slice(0, 3)}
<span
className={`inline-flex items-center gap-0.5 ${points.color}`}
>
<CurrencyIcon
kind={currencyKindFromPointsType(item.pointsType)}
size={12}
/>
{item.costPoints}
</span>
)}
{item.costCredits === 0 && item.costPoints === 0 && (
+55
View File
@@ -0,0 +1,55 @@
/**
* Habbo-style currency icons used across admin (and reusable on public).
* Files live at /assets/images/icons/currency/{name}.png
*/
export type CurrencyKind =
| "credits"
| "duckets"
| "diamonds"
| "pixels"
| "points";
const CURRENCY_FILES: Record<CurrencyKind, string> = {
credits: "credits",
duckets: "duckets",
diamonds: "diamonds",
// No dedicated pixels asset — activity points share the duckets icon.
pixels: "duckets",
points: "duckets",
};
/** Map emulator `points_type` (catalog / users_currency) to an icon. */
export function currencyKindFromPointsType(type: number): CurrencyKind {
if (type === 5) return "diamonds";
return "duckets";
}
export function currencyIconSrc(kind: CurrencyKind): string {
return `/assets/images/icons/currency/${CURRENCY_FILES[kind]}.png`;
}
export function CurrencyIcon({
kind,
size = 16,
className = "",
alt,
}: {
kind: CurrencyKind;
size?: number;
className?: string;
alt?: string;
}) {
return (
// biome-ignore lint/performance/noImgElement: small pixel art asset, not Next Image optimized
<img
src={currencyIconSrc(kind)}
alt={alt ?? kind}
width={size}
height={size}
className={`inline-block shrink-0 object-contain image-pixelated ${className}`.trim()}
style={{ width: size, height: size, imageRendering: "pixelated" }}
draggable={false}
/>
);
}