Use Habbo currency PNGs for admin credits, duckets, and diamonds icons.
Local Build and Deploy / deploy (push) Successful in 56s
Local Build and Deploy / deploy (push) Successful in 56s
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
b42a313825
commit
d7405238ea
7 files changed
+118
-26
No files matched your search
@@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user