develop #134

Merged
andrey.dekterev merged 5 commits from develop into master 3 years ago
  1. 4
      src/components/SportIcon/SportIcon.tsx
  2. 4
      src/config/sportTypes.tsx
  3. 28
      src/features/AuthStore/hooks/useAuth.tsx
  4. 2
      src/features/Icon/index.tsx
  5. 4
      src/features/MatchPage/index.tsx
  6. 2
      src/features/MatchSidePlaylists/components/PlayersTable/hooks/usePlayers.tsx
  7. 2
      src/features/MatchSidePlaylists/components/PlayersTable/index.tsx
  8. 3
      src/features/MatchSidePlaylists/components/TabEvents/styled.tsx
  9. 2
      src/hooks/useTooltip.tsx
  10. 1
      src/libs/index.ts
  11. 20
      src/libs/objects/Softball.tsx

@ -77,6 +77,10 @@ const sportIcons = {
color: '#ffffff',
icon: 'CRICKET',
},
softball: {
color: '#ffffff',
icon: 'Softball',
},
}
export const SportIcon = ({

@ -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

@ -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(() => ({

@ -36,7 +36,7 @@ export const Icon: React.FC<IconProps> = ({
>
{
// @ts-ignore
React.createElement(icons[refIcon], {})
icons[refIcon] && React.createElement(icons[refIcon], {})
}
</div>
)

@ -107,7 +107,9 @@ const MatchPageComponent = () => {
</SubscriptionGuard>
</Main>
{
user && (profile?.tournament.id === 131 || profile?.tournament.id === 2032)
user
&& profile?.sub
&& (profile?.tournament.id === 131 || profile?.tournament.id === 2032)
&& <FavouriteTeamPopup />
}
</PageWrapper>

@ -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) => {

@ -144,9 +144,9 @@ export const PlayersTable = (props: PlayersTableProps) => {
<tbody>
{map(players, (player) => {
const playerName = getPlayerName(player)
const playerNum = player.num ?? player.club_shirt_num
const playerProfileUrl = `/${sportName}/players/${player.id}`
return (
<Row key={player.id}>
<Cell columnWidth={firstColumnWidth}>

@ -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;

@ -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,

@ -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'

@ -0,0 +1,20 @@
export const Softball = () => (
<svg
xmlns='http://www.w3.org/2000/svg'
width='24'
height='24'
fill='none'
viewBox='0 0 24 24'
>
<g fill='#fff' clipPath='url(#clip0_44293_325999)'>
<path d='M14.516 5.617c-.375.023-.75.047-1.125.067-.579.032-.584.026-.598-.633 1.019-.144 2.049-.295 3.08-.431.401-.053.806-.093 1.21-.104.649-.017 1.128.37 1.196.97.227 2.006.398 4.018.682 6.016.124.875-.059 1.638-.43 2.413-.404.842-.723 1.721-1.16 2.547-.314.593-.285 1.154-.162 1.767.298 1.481.566 2.968.824 4.456.118.68-.274 1.196-.934 1.3-.638.1-1.197-.305-1.323-.975-.341-1.818-.693-3.634-.997-5.458-.058-.352.007-.758.141-1.096.31-.778.69-1.533 1.062-2.29.08-.161.244-.287.394-.458l-3.652-.254c.07.728.134 1.423.206 2.118.096.946.213 1.89.292 2.837.054.65-.4 1.151-1.036 1.203-.643.052-1.164-.357-1.234-1.019-.206-1.916-.393-3.834-.588-5.75a7.813 7.813 0 00-.038-.31c-.112-.757.4-1.323 1.22-1.282 1.423.073 2.846.183 4.269.277.291.019.583.033.889-.02-.832-.187-1.661-.387-2.498-.556-.286-.058-.382-.176-.403-.441-.054-.675-.154-1.345-.206-2.02-.01-.115.094-.289.202-.35.413-.238.85-.44 1.249-.725-.675.178-1.35.357-2.025.533-.457.119-.913.242-1.374.348-.538.124-1.04-.13-1.16-.633-.308-1.28-.59-2.565-.869-3.852-.096-.444.098-.788.508-1.017-.22-.883-.036-1.361.596-1.573.535-.18 1.146.046 1.388.514.282.546.063 1.034-.673 1.488l.702 3.099 2.39-.633-.014-.073h-.001z' />
<path d='M17.03 1.977c.005 1.093-.945 1.988-2.117 1.995-1.163.008-2.131-.89-2.136-1.98C12.773.9 13.722.006 14.897 0c1.17-.006 2.13.882 2.133 1.977zM8.994 2.716c-.524.862-.07 1.684.063 2.518.029.18.118.355.115.532a.53.53 0 01-.177.38c-.08.061-.278.046-.392-.002-.548-.227-1.085-.474-1.624-.718-.713-.323-.999-.893-.978-1.591.02-.666.384-1.16 1.05-1.427.7-.281 1.328-.116 1.942.308z' />
</g>
<defs>
<clipPath id='clip0_44293_325999'>
<path fill='#fff' d='M0 0H13V24H0z' transform='translate(6)' />
</clipPath>
</defs>
</svg>
)
Loading…
Cancel
Save