import { useMemo } from 'react' import { Link } from 'react-router-dom' import type { ObjectWithName } from 'features/Name' import { PAGES, ProfileTypes, URL_AWS, } from 'config' import { client } from 'config/clients' import { ClientNames } from 'config/clients/types' import { checkPage } from 'helpers/checkPage' import { T9n } from 'features/T9n' import { useName } from 'features/Name' import { StarIcon } from './components/StarIcon' import { Wrapper, Details, FavoriteButton, Logo, InfoName, InfoItems, ProfileName, InfoFlag, StyledLink, SсBtnWrapper, SсGetHighlightBtn, DetailsWrapper, } from './styled' import { useProfileCard } from './hooks' export type ProfileType = { profile: ObjectWithName & { additionalInfo: ObjectWithName & { id: number, tournamentId?: number, }, }, } export const ProfileCard = ({ profile }: ProfileType) => { const name = useName(profile || {}) const { isFavorite, profileId, profileType, setPlayerHighlight, sportType, toggleFavorites, } = useProfileCard() const tournamentId = profile.additionalInfo?.tournamentId const isPlayerPage = checkPage(PAGES.player) const isGetHighLightShown = useMemo(() => { switch (client.name) { case ClientNames.Facr: return false default: return true } }, []) return (
{name} {tournamentId ? ( ) : }
{!client.disabledHighlights && isPlayerPage && isGetHighLightShown && ( setPlayerHighlight({ profile: { ...profile, id: profileId, }, sportType, })} > )}
) }