import Badge from 'react-bootstrap/Badge' 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 { AD_USER_ID, ANON_USER_ID } from '../lib/constants' export default function Hat ({ user, badge, className = 'ms-1', height = 16, width = 16 }) { if (!user || Number(user.id) === AD_USER_ID) return null if (Number(user.id) === ANON_USER_ID) { return ( {badge ? ( ) : } ) } const streak = user.optional.streak if (streak === null) { return null } return ( {badge ? ( {streak || 'new'} ) : } ) } export function HatTooltip ({ children, overlayText, placement }) { return ( {overlayText} } trigger={['hover', 'focus']} > {children} ) }