import OverlayTrigger from 'react-bootstrap/OverlayTrigger' import Tooltip from 'react-bootstrap/Tooltip' import CowboyHatIcon from '@/svgs/cowboy.svg' import AnonIcon from '@/svgs/spy-fill.svg' import { numWithUnits } from '@/lib/format' import { USER_ID } from '@/lib/constants' import GunIcon from '@/svgs/revolver.svg' import HorseIcon from '@/svgs/horse.svg' import classNames from 'classnames' const BADGES = [ { icon: CowboyHatIcon, streakName: 'streak' }, { icon: HorseIcon, streakName: 'horseStreak' }, { icon: GunIcon, streakName: 'gunStreak', sizeDelta: 2 } ] export default function Badges ({ user, badge, className = 'ms-1', badgeClassName, spacingClassName = 'ms-1', height = 16, width = 16 }) { if (!user || Number(user.id) === USER_ID.ad) return null if (Number(user.id) === USER_ID.anon) { return ( ) } return ( {BADGES.map(({ icon, streakName, sizeDelta }, i) => ( 0 && spacingClassName)} IconForBadge={icon} height={height} width={width} sizeDelta={sizeDelta} /> ))} ) } function SNBadge ({ user, badge, streakName, badgeClassName, IconForBadge, height = 16, width = 16, sizeDelta = 0 }) { const streak = user.optional[streakName] if (streak === null) { return null } return ( ) } export function BadgeTooltip ({ children, overlayText, placement }) { return ( {overlayText} } trigger={['hover', 'focus']} > {children} ) }