|
|
|
|
@ -1,11 +1,18 @@ |
|
|
|
|
import { ProfileTypes } from 'config' |
|
|
|
|
import { createPortal } from 'react-dom' |
|
|
|
|
|
|
|
|
|
import { isMobileDevice, ProfileTypes } from 'config' |
|
|
|
|
|
|
|
|
|
import type { Event, Team } from 'requests' |
|
|
|
|
|
|
|
|
|
import { usePageParams } from 'hooks/usePageParams' |
|
|
|
|
import { |
|
|
|
|
useTooltip, |
|
|
|
|
usePageParams, |
|
|
|
|
useModalRoot, |
|
|
|
|
} from 'hooks' |
|
|
|
|
|
|
|
|
|
import { Name } from 'features/Name' |
|
|
|
|
import { T9n } from 'features/T9n' |
|
|
|
|
import { useLexicsStore } from 'features/LexicsStore' |
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
Avatar, |
|
|
|
|
@ -16,8 +23,8 @@ import { |
|
|
|
|
SubTitle, |
|
|
|
|
EventTime, |
|
|
|
|
EventLike, |
|
|
|
|
PlayerNum, |
|
|
|
|
} from '../TabEvents/styled' |
|
|
|
|
import { Tooltip } from '../TabStats/styled' |
|
|
|
|
|
|
|
|
|
type Props = { |
|
|
|
|
active?: boolean, |
|
|
|
|
@ -37,6 +44,16 @@ export const EventButton = ({ |
|
|
|
|
team, |
|
|
|
|
}: Props) => { |
|
|
|
|
const { sportType } = usePageParams() |
|
|
|
|
const { |
|
|
|
|
isTooltipShown, |
|
|
|
|
onMouseLeave, |
|
|
|
|
onMouseOver, |
|
|
|
|
tooltipStyle, |
|
|
|
|
tooltipText, |
|
|
|
|
} = useTooltip() |
|
|
|
|
const modalRoot = useModalRoot() |
|
|
|
|
const { suffix } = useLexicsStore() |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
c: clearTime, |
|
|
|
|
l: lexica, |
|
|
|
|
@ -82,16 +99,25 @@ export const EventButton = ({ |
|
|
|
|
<T9n t={lexica} /> |
|
|
|
|
{(score1 || score2) && ` (${score1}-${score2})`} |
|
|
|
|
</Title> |
|
|
|
|
<SubTitle> |
|
|
|
|
{nameObj && 'num' in nameObj && ( |
|
|
|
|
<PlayerNum> |
|
|
|
|
{(nameObj as Event['pl'])!.num} |
|
|
|
|
</PlayerNum> |
|
|
|
|
)}{' '} |
|
|
|
|
<SubTitle |
|
|
|
|
onMouseOver={isMobileDevice ? undefined : onMouseOver({ |
|
|
|
|
horizontalPosition: 'right', |
|
|
|
|
indent: 15, |
|
|
|
|
tooltipText: nameObj?.[`name_${suffix}`] || '', |
|
|
|
|
})} |
|
|
|
|
onMouseLeave={isMobileDevice ? undefined : onMouseLeave} |
|
|
|
|
> |
|
|
|
|
{playerName?.num}{' '} |
|
|
|
|
{(playerId || teamId) && nameObj && <Name nameObj={nameObj} />} |
|
|
|
|
</SubTitle> |
|
|
|
|
</EventDesc> |
|
|
|
|
</EventInfo> |
|
|
|
|
{isTooltipShown && modalRoot.current && createPortal( |
|
|
|
|
<Tooltip style={tooltipStyle}> |
|
|
|
|
{tooltipText} |
|
|
|
|
</Tooltip>, |
|
|
|
|
modalRoot.current, |
|
|
|
|
)} |
|
|
|
|
</Button> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|