diff --git a/src/components/SportIcon/SportIcon.tsx b/src/components/SportIcon/SportIcon.tsx index 86bfdb07..45a19e73 100644 --- a/src/components/SportIcon/SportIcon.tsx +++ b/src/components/SportIcon/SportIcon.tsx @@ -77,6 +77,10 @@ const sportIcons = { color: '#ffffff', icon: 'CRICKET', }, + softball: { + color: '#ffffff', + icon: 'Softball', + }, } export const SportIcon = ({ diff --git a/src/config/sportTypes.tsx b/src/config/sportTypes.tsx index b8f642f6..45e5fa0b 100644 --- a/src/config/sportTypes.tsx +++ b/src/config/sportTypes.tsx @@ -13,7 +13,8 @@ export enum SportTypes { FUTSAL = 17, FLOORBALL = 18, CRICKET = 19, - BASEBALL = 20 + BASEBALL = 20, + SOFTBALL = 21 } export const SPORT_NAMES = { @@ -32,4 +33,5 @@ export const SPORT_NAMES = { [SportTypes.FUTSAL]: 'futsal', [SportTypes.FLOORBALL]: 'floorball', [SportTypes.CRICKET]: 'cricket', + [SportTypes.SOFTBALL]: 'softball', } as const diff --git a/src/features/AuthStore/hooks/useAuth.tsx b/src/features/AuthStore/hooks/useAuth.tsx index 3014348f..54e701bf 100644 --- a/src/features/AuthStore/hooks/useAuth.tsx +++ b/src/features/AuthStore/hooks/useAuth.tsx @@ -42,7 +42,6 @@ import { } from 'requests' import { userManager } from '../config' -// eslint-disable-next-line import { needCheckNewDeviсe } from '../helpers' export const useAuth = () => { @@ -220,7 +219,6 @@ export const useAuth = () => { }) }, [logout]) - // eslint-disable-next-line const checkNewDevice = useCallback(async () => { const loadedUser = await userManager.getUser() if (!loadedUser) return @@ -230,18 +228,18 @@ export const useAuth = () => { }) }, [reChekNewDevice]) - // useEffect(() => { - // if (!needCheckNewDeviсe && !user) return undefined - // const startCheckDevice = setInterval(checkNewDevice, 20000) - // isNewDeviceLogin && clearInterval(startCheckDevice) - // return () => clearInterval(startCheckDevice) - // - // // eslint-disable-next-line react-hooks/exhaustive-deps - // }, [ - // checkNewDevice, - // isNewDeviceLogin, - // setIsNewDeviceLogin, - // ]) + useEffect(() => { + if (!needCheckNewDeviсe && !user) return undefined + const startCheckDevice = setInterval(checkNewDevice, 20000) + isNewDeviceLogin && clearInterval(startCheckDevice) + return () => clearInterval(startCheckDevice) + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [ + checkNewDevice, + isNewDeviceLogin, + setIsNewDeviceLogin, + ]) useEffect(() => { // попытаемся обновить токен используя refresh_token @@ -290,7 +288,7 @@ export const useAuth = () => { }, [changeLang]) useEffect(() => { - fetchUserInfo() + readToken() && fetchUserInfo() }, [fetchUserInfo, user]) const auth = useMemo(() => ({ diff --git a/src/features/Icon/index.tsx b/src/features/Icon/index.tsx index d6fd2300..38b32bd7 100644 --- a/src/features/Icon/index.tsx +++ b/src/features/Icon/index.tsx @@ -36,7 +36,7 @@ export const Icon: React.FC = ({ > { // @ts-ignore - React.createElement(icons[refIcon], {}) + icons[refIcon] && React.createElement(icons[refIcon], {}) } ) diff --git a/src/features/MatchPage/index.tsx b/src/features/MatchPage/index.tsx index 61904796..72066bb6 100644 --- a/src/features/MatchPage/index.tsx +++ b/src/features/MatchPage/index.tsx @@ -107,7 +107,9 @@ const MatchPageComponent = () => { { - user && (profile?.tournament.id === 131 || profile?.tournament.id === 2032) + user + && profile?.sub + && (profile?.tournament.id === 131 || profile?.tournament.id === 2032) && } diff --git a/src/features/MatchSidePlaylists/components/PlayersTable/hooks/usePlayers.tsx b/src/features/MatchSidePlaylists/components/PlayersTable/hooks/usePlayers.tsx index 0c3de6d3..08643dff 100644 --- a/src/features/MatchSidePlaylists/components/PlayersTable/hooks/usePlayers.tsx +++ b/src/features/MatchSidePlaylists/components/PlayersTable/hooks/usePlayers.tsx @@ -33,7 +33,7 @@ export const usePlayers = ({ sortCondition, teamId }: UsePlayersArgs) => { ) const getPlayerName = useCallback((player: Player) => ( - trim(player[`lastname_${suffix}`] || '') + trim(player[`lastname_${suffix}`]) || player[`firstname_${suffix}`] ), [suffix]) const getParamValue = useCallback((playerId: number, paramId: number) => { diff --git a/src/features/MatchSidePlaylists/components/PlayersTable/index.tsx b/src/features/MatchSidePlaylists/components/PlayersTable/index.tsx index 3a8f9b9c..1061daeb 100644 --- a/src/features/MatchSidePlaylists/components/PlayersTable/index.tsx +++ b/src/features/MatchSidePlaylists/components/PlayersTable/index.tsx @@ -144,9 +144,9 @@ export const PlayersTable = (props: PlayersTableProps) => { {map(players, (player) => { const playerName = getPlayerName(player) + const playerNum = player.num ?? player.club_shirt_num const playerProfileUrl = `/${sportName}/players/${player.id}` - return ( diff --git a/src/features/MatchSidePlaylists/components/TabEvents/styled.tsx b/src/features/MatchSidePlaylists/components/TabEvents/styled.tsx index f5e082d8..552961b3 100644 --- a/src/features/MatchSidePlaylists/components/TabEvents/styled.tsx +++ b/src/features/MatchSidePlaylists/components/TabEvents/styled.tsx @@ -31,6 +31,7 @@ export const Event = styled.li` width: 100%; height: 48px; margin-bottom: 12px; + position: relative; :first-child { margin-top: 12px; @@ -119,6 +120,8 @@ export const SubTitle = styled(Title)` font-weight: normal; color: rgba(255, 255, 255, 0.7); margin-top: 2px; + width: 100%; + position: relative; ${NameStyled} { font-weight: 700; diff --git a/src/hooks/useTooltip.tsx b/src/hooks/useTooltip.tsx index e2c236e6..6b6eaa43 100644 --- a/src/hooks/useTooltip.tsx +++ b/src/hooks/useTooltip.tsx @@ -54,7 +54,7 @@ export const useTooltip = () => { const tooltipStyle: CSSProperties = { left: !isUndefined(coords.left) ? `${coords.left}px` : 'auto', position: 'fixed', - right: !isUndefined(coords.right) ? `${window.screen.width - coords.right}px` : 'auto', + right: !isUndefined(coords.right) ? `${window.innerWidth - coords.right}px` : 'auto', top: `${coords.top}px`, zIndex: 999, diff --git a/src/libs/index.ts b/src/libs/index.ts index a39144fa..f3795343 100644 --- a/src/libs/index.ts +++ b/src/libs/index.ts @@ -22,3 +22,4 @@ export { PoweredByInsports } from './objects/PoweredByInsports' export { Info } from './objects/Info' export { Streetball } from './objects/Streetball' export { Baseball } from './objects/Baseball' +export { Softball } from './objects/Softball' diff --git a/src/libs/objects/Softball.tsx b/src/libs/objects/Softball.tsx new file mode 100644 index 00000000..6f44de7f --- /dev/null +++ b/src/libs/objects/Softball.tsx @@ -0,0 +1,20 @@ +export const Softball = () => ( + + + + + + + + + + + + +)