import { Box, Button, Divider, Flex, Heading, IconButton, } from "@chakra-ui/react"; import { t, Trans } from "@lingui/macro"; import { LeagueType, RankedMode } from "@prisma/client"; import ModeImage from "components/common/ModeImage"; import MyLink from "components/common/MyLink"; import SubText from "components/common/SubText"; import UserAvatar from "components/common/UserAvatar"; import WeaponImage from "components/common/WeaponImage"; import { getEmojiFlag } from "countries-list"; import { getFullUsername } from "lib/strings"; import { useMyTheme } from "lib/useMyTheme"; import useUser from "lib/useUser"; import { GetUserByIdentifierData } from "prisma/queries/getUserByIdentifier"; import { FaGamepad, FaTwitch, FaTwitter, FaYoutube } from "react-icons/fa"; import { FiInfo } from "react-icons/fi"; import { RiTrophyLine } from "react-icons/ri"; interface AvatarWithInfoProps { user: NonNullable; peakXPowers: Partial>; peakLeaguePowers: Partial>; } const AvatarWithInfo: React.FC = ({ user, peakXPowers, peakLeaguePowers, }) => { const [loggedInUser] = useUser(); const { gray, themeColorShade } = useMyTheme(); function getSensString( motion: number | null | undefined, stick: number ): string { const stickSensString = `${stick > 0 ? "+" : ""}${stick} ${t`Stick`}`; const motionSensString = typeof motion === "number" ? ` ${motion > 0 ? "+" : ""}${motion} ${t`Motion`}` : ""; return `${stickSensString} ${motionSensString}`; } return ( <> {getFullUsername(user)} {user.profile?.country && ( {getEmojiFlag(user.profile.country)} )} {user.profile?.twitterName && ( } color="#1DA1F2" isRound variant="ghost" /> )} {user.profile?.twitchName && ( } color="#6441A4" isRound variant="ghost" /> )} {user.profile?.youtubeId && ( } color="#FF0000" isRound variant="ghost" /> )} {user.profile?.weaponPool && user.profile?.weaponPool.length > 0 && ( {user.profile.weaponPool.map((wpn) => ( ))} )} {typeof user.profile?.sensStick === "number" && ( {getSensString( user.profile.sensMotion, user.profile.sensStick )} )} {Object.keys(peakXPowers).length > 0 && ( {(["SZ", "TC", "RM", "CB"] as RankedMode[]) .filter((mode) => peakXPowers[mode]) .map((mode, i) => ( {i !== 0 && } {" "} {peakXPowers[mode]} ))} )} {Object.keys(peakLeaguePowers).length > 0 && ( <> {(["TWIN", "QUAD"] as LeagueType[]) .filter((type) => peakLeaguePowers[type]) .map((type) => ( {type} {peakLeaguePowers[type]} ))} )} {!!user.player?.switchAccountId && ( )} ); function Top500HelpText() { if (Object.keys(peakXPowers).length > 0 || user.id !== loggedInUser?.id) return null; return ( If you have finished a month in the Top 500 you can get your peak ranks showing here. Simply DM Sendou#4059 on Discord with the month, mode and your in-game name. ); } }; export default AvatarWithInfo;