import React from 'react'; import type { AvatarDecoration } from '@backspace/shared/src/profile'; interface DecoratedAvatarProps { decoration: AvatarDecoration; /** Avatar element to decorate; the overlay sizes itself to this box. */ children: React.ReactNode; className?: string; } /** * Wraps an avatar with a decorative layer. Every decoration is inline SVG on a * 100×100 box around the picture — no image assets, so a new one is a few * lines of markup and scales to any avatar size. */ export function DecoratedAvatar({ decoration, children, className = '' }: DecoratedAvatarProps) { return (
{children} {decoration !== 'none' && ( )}
); } function Decoration({ id }: { id: AvatarDecoration }) { switch (id) { case 'ring': return ( ); case 'neon': return ( ); case 'flames': return ( ); case 'stars': return ( {[0, 72, 144, 216, 288].map((a) => ( ))} ); case 'halo': return ( ); case 'vines': return ( {[20, 70, 130, 200, 260, 320].map((a) => ( ))} ); case 'pixel': return ( {Array.from({ length: 28 }).map((_, i) => { const a = (i / 28) * Math.PI * 2; const x = 50 + Math.cos(a) * 45; const y = 50 + Math.sin(a) * 45; return ; })} ); case 'hearts': return ( {[[8, 20, 1], [88, 14, 0.8], [6, 74, 0.7], [90, 78, 0.9]].map(([x, y, s], i) => ( ))} ); case 'frost': return ( {[0, 60, 120, 180, 240, 300].map((a) => ( ))} ); case 'crown': return ( ); default: return null; } }