fix(2114): added handball sport type

keep-around/e14ec8443d1ea0efc6c70cf0754a6edc7fe18603
Mirlan 4 years ago
parent 08eca093b9
commit e14ec8443d
  1. 3
      public/images/handball-icon.svg
  2. BIN
      public/images/player-fallback.png
  3. BIN
      public/images/team-fallback.png
  4. BIN
      public/images/tournament-fallback.png
  5. 1
      src/config/lexics/indexLexics.tsx
  6. 1
      src/config/lexics/procedures.tsx
  7. 2
      src/config/sportTypes.tsx
  8. 2
      src/features/Common/Image/index.tsx
  9. 3
      src/features/Common/SportName/styled.tsx
  10. 2
      src/features/Matches/helpers/prepareMatches.tsx
  11. 6
      src/features/ProfileLink/helpers/__tests__/index.tsx
  12. 5
      src/features/ProfileLogo/index.tsx
  13. 1
      src/features/UserAccount/components/PageSubscriptions/index.tsx
  14. 34
      src/helpers/getProfileFallbackLogo/index.tsx
  15. 1
      src/helpers/getProfileLogo/index.tsx
  16. 9
      src/helpers/getSportColor/index.tsx
  17. 10
      src/helpers/getSportLexic/index.tsx
  18. 1
      src/helpers/index.tsx

@ -0,0 +1,3 @@
<svg width="11" height="11" viewBox="0 0 11 11" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.70069 0.845845C3.08862 1.09966 2.53941 1.47284 2.06846 1.95439C1.59737 2.43607 1.23291 2.99795 0.984617 3.62383C0.744915 4.22851 0.623291 4.86751 0.623291 5.52296C0.623291 6.17826 0.744915 6.81726 0.984617 7.42166C1.23291 8.04769 1.59751 8.60956 2.06846 9.0911C2.53941 9.57293 3.08849 9.94584 3.70069 10.1996C4.2919 10.4451 4.91652 10.5691 5.55736 10.5691C6.1982 10.5691 6.82268 10.4447 7.41389 10.1996C8.02583 9.94584 8.57532 9.57293 9.04613 9.0911C9.51722 8.60956 9.88181 8.04796 10.13 7.42166C10.3697 6.81726 10.491 6.17826 10.491 5.52296C10.491 4.86751 10.3695 4.22851 10.13 3.62383C9.88181 2.99795 9.51694 2.43593 9.04613 1.95439C8.57532 1.47284 8.02637 1.09966 7.41389 0.845845C6.82268 0.600819 6.1982 0.476562 5.55736 0.476562C4.91652 0.476562 4.2919 0.600819 3.70069 0.845845ZM1.85643 7.6473C1.61878 7.49474 1.3998 7.31902 1.20591 7.11207C0.909761 6.25971 0.859584 5.33692 1.05579 4.46099C1.1481 4.27481 1.25309 4.09603 1.37185 3.92478C1.40853 3.87192 1.44248 3.81684 1.48175 3.76552L2.59517 4.43937C2.59517 4.4483 2.59517 4.45806 2.59517 4.46796C2.59231 5.08046 2.65312 5.68849 2.7742 6.28774C2.77461 6.29053 2.77502 6.29206 2.77556 6.29457L1.91206 7.67938C1.89325 7.66962 1.87457 7.65902 1.85643 7.6473ZM5.16699 9.98837C5.35911 10.0886 5.55668 10.1733 5.7597 10.2422C4.89729 10.2805 4.0263 10.0739 3.25633 9.62202L5.12282 9.96215C5.13713 9.9715 5.15172 9.98042 5.16699 9.98837ZM5.16018 9.64377L2.95759 9.24227C2.69989 8.92222 2.4681 8.58362 2.26889 8.22173C2.21817 8.12969 2.16158 8.04029 2.11863 7.94421L2.98131 6.56079C3.0004 6.56568 3.02167 6.57084 3.04581 6.57739C3.58548 6.72508 4.13469 6.83009 4.68773 6.91237C4.72004 6.91697 4.74704 6.92101 4.77008 6.92352L5.80415 8.75222C5.62472 9.01022 5.44324 9.26682 5.2578 9.52063C5.22699 9.56289 5.19426 9.60347 5.16018 9.64377ZM8.8247 8.86476C8.64935 9.04425 8.46324 9.20602 8.26839 9.35021C8.23608 9.08608 8.18031 8.82725 8.10164 8.57442L9.20498 6.46917C9.5089 6.32762 9.80205 6.16711 10.0742 5.9681C10.1098 5.9423 10.1394 5.91343 10.1623 5.88192C10.0824 6.96982 9.63652 8.03458 8.8247 8.86476ZM8.77575 6.13447C8.81679 6.21452 8.85729 6.29541 8.89792 6.37741L7.83221 8.41069C7.82608 8.41209 7.82021 8.41348 7.81408 8.41432C7.238 8.52435 6.65729 8.58292 6.07167 8.58571L5.00815 6.70485C5.17367 6.39052 5.3377 6.07493 5.50037 5.7592C5.61081 5.54499 5.71934 5.32939 5.82774 5.11393L8.02883 4.88271C8.29839 5.28713 8.55377 5.7002 8.77575 6.13447ZM8.3292 3.7227C8.22476 4.00483 8.11296 4.28402 8.00183 4.56377L5.8576 4.78899C5.83197 4.75441 5.80538 4.72038 5.77743 4.68789C5.52423 4.39461 5.26939 4.10314 5.01496 3.81084C5.01728 3.80791 5.0196 3.80568 5.02192 3.80303C4.91925 3.69816 4.8163 3.59329 4.71363 3.48814L5.31057 1.64995C5.35175 1.6388 5.3932 1.62945 5.43506 1.62485C5.75957 1.5911 6.08449 1.55289 6.40982 1.53365C6.60902 1.52221 6.80932 1.51566 7.01193 1.5303L8.48887 3.23293C8.43801 3.39721 8.38838 3.56191 8.3292 3.7227ZM8.8247 2.18087C9.23211 2.59784 9.54762 3.07367 9.77069 3.58199C9.49472 3.38773 9.19966 3.22791 8.88946 3.09766C8.8412 3.0773 8.7917 3.05931 8.74139 3.0416L7.28763 1.36574C7.29772 1.29336 7.30304 1.22084 7.30522 1.14777C7.85825 1.37801 8.37665 1.72275 8.8247 2.18087ZM4.07756 1.05977C4.08329 1.0641 4.08602 1.06772 4.08929 1.0687C4.42157 1.18612 4.72386 1.35905 5.00883 1.56419L4.45116 3.28188C4.4483 3.28272 4.44557 3.28355 4.44284 3.28481C4.32872 3.33306 4.21241 3.37629 4.10006 3.42859C3.63715 3.64377 3.18584 3.8821 2.7607 4.16785L1.66023 3.50194C1.66186 3.4668 1.66773 3.4311 1.67945 3.3993C1.75335 3.19793 1.82603 2.99544 1.90961 2.7981C1.97397 2.6461 2.04732 2.49925 2.12736 2.35575C2.17972 2.29662 2.23398 2.23804 2.28989 2.18087C2.81251 1.64647 3.43018 1.26701 4.08779 1.04262C4.08438 1.04806 4.08084 1.05378 4.07756 1.05977Z" fill="#F6BE4F"/>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

@ -91,6 +91,7 @@ export const indexLexics = {
gender_male_long: 13373,
go_to_extended_search_page: 13375,
goals: 13030,
handball: 9760,
hide_score: 12982,
highlights: 13033,
hockey: 6959,

@ -1,5 +1,6 @@
export const proceduresLexics = {
3556: 3556,
6959: 6959,
9760: 9760,
12980: 12980,
}

@ -1,5 +1,6 @@
export enum SportTypes {
FOOTBALL = 1,
HANDBALL = 8,
HOCKEY = 2,
BASKETBALL = 3,
}
@ -7,5 +8,6 @@ export enum SportTypes {
export const SPORT_NAMES = {
[SportTypes.BASKETBALL]: 'basketball',
[SportTypes.FOOTBALL]: 'football',
[SportTypes.HANDBALL]: 'handball',
[SportTypes.HOCKEY]: 'hockey',
} as const

@ -19,7 +19,7 @@ export const Image = ({
alt,
className,
dataSrc,
fallbackSrc,
fallbackSrc = '',
onLoad,
src,
title,

@ -2,8 +2,6 @@ import styled from 'styled-components/macro'
import { devices, SportTypes } from 'config'
import { getSportColor } from 'helpers'
import { T9n } from 'features/T9n'
type Props = {
@ -13,7 +11,6 @@ type Props = {
export const Text = styled(T9n)<Props>`
margin-right: 10px;
font-size: 11px;
color: ${({ sport }) => getSportColor(sport)};
letter-spacing: 0.02em;
text-transform: uppercase;

@ -4,7 +4,6 @@ import format from 'date-fns/format'
import type { Match } from 'requests'
import { getSportLexic } from 'helpers'
import { parseDate } from 'helpers/parseDate'
import { getMatchAccess } from './getMatchClickAction'
@ -35,7 +34,6 @@ const prepareMatch = (match: Match) => {
id,
live,
preview,
sportName: getSportLexic(sport),
sportType: sport,
storage,
team1,

@ -19,4 +19,10 @@ it('returns correct profile urls', () => {
profileType: ProfileTypes.TOURNAMENTS,
sportType: SportTypes.HOCKEY,
})).toBe('/hockey/tournaments/3')
expect(getProfileUrl({
id: 4,
profileType: ProfileTypes.TOURNAMENTS,
sportType: SportTypes.HANDBALL,
})).toBe('/handball/tournaments/4')
})

@ -42,10 +42,7 @@ export const ProfileLogo = ({
size,
sportType,
})
const fallbackSrc = getProfileFallbackLogo({
profileType,
sportType,
})
const fallbackSrc = getProfileFallbackLogo(profileType)
return (
<Image

@ -52,6 +52,7 @@ const data: Record<SportTypes, MatchSubscriptions> = {
},
],
[SportTypes.BASKETBALL]: [],
[SportTypes.HANDBALL]: [],
[SportTypes.HOCKEY]: [
{
description: 'все матчи спартака в сезоне 2020-2021',

@ -1,35 +1,13 @@
import { SportTypes, ProfileTypes } from 'config'
import { ProfileTypes } from 'config'
const FALLBACK_LOGOS = {
[SportTypes.BASKETBALL]: {
[ProfileTypes.PLAYERS]: 'https://basketball.instatscout.com/images/player-no-photo.png',
[ProfileTypes.TEAMS]: 'https://basketball.instatscout.com/images/team-no-photo.png',
[ProfileTypes.TOURNAMENTS]: 'https://basketball.instatscout.com/images/tournaments/180/no-photo.png',
},
[SportTypes.FOOTBALL]: {
[ProfileTypes.PLAYERS]: 'https://football.instatscout.com/images/player-no-photo.png',
[ProfileTypes.TEAMS]: 'https://football.instatscout.com/images/team-no-photo.png',
[ProfileTypes.TOURNAMENTS]: 'https://hockey.instatscout.com/images/tournaments/180/no-photo.png',
},
[SportTypes.HOCKEY]: {
[ProfileTypes.PLAYERS]: 'https://hockey.instatscout.com/images/player-no-photo.png',
[ProfileTypes.TEAMS]: 'https://hockey.instatscout.com/images/team-no-photo.png',
[ProfileTypes.TOURNAMENTS]: 'https://hockey.instatscout.com/images/tournaments/180/no-photo.png',
},
}
type Args = {
profileType: ProfileTypes,
sportType: SportTypes,
[ProfileTypes.PLAYERS]: '/images/player-fallback.png',
[ProfileTypes.TEAMS]: '/images/team-fallback.png',
[ProfileTypes.TOURNAMENTS]: '/images/tournament-fallback.png',
}
export const getProfileFallbackLogo = ({
profileType,
sportType = 1,
}: Args) => {
export const getProfileFallbackLogo = (profileType: ProfileTypes) => {
if (profileType === ProfileTypes.MATCHES) return ''
return FALLBACK_LOGOS[sportType][profileType]
return FALLBACK_LOGOS[profileType]
}

@ -8,6 +8,7 @@ const IMAGES_URLS = {
[SportTypes.BASKETBALL]: 'https://basketball.instatscout.com/images',
[SportTypes.FOOTBALL]: 'https://instatscout.com/images',
[SportTypes.HOCKEY]: 'https://hockey.instatscout.com/images',
[SportTypes.HANDBALL]: 'https://handball.instatscout.com/images',
}
type GetLogoArgs = {

@ -1,9 +0,0 @@
import { SportTypes } from 'config'
const colors = {
[SportTypes.BASKETBALL]: '#f1903b',
[SportTypes.FOOTBALL]: '#00a435',
[SportTypes.HOCKEY]: '#5eb1ff',
}
export const getSportColor = (sport: SportTypes) => colors[sport]

@ -1,9 +1,3 @@
import { SportTypes } from 'config'
import { SportTypes, SPORT_NAMES } from 'config'
const lexics = {
[SportTypes.FOOTBALL]: 'football',
[SportTypes.HOCKEY]: 'hockey',
[SportTypes.BASKETBALL]: 'basketball',
}
export const getSportLexic = (sport: SportTypes) => lexics[sport]
export const getSportLexic = (sport: SportTypes) => SPORT_NAMES[sport]

@ -2,7 +2,6 @@ export * from './callApi'
export * from './token'
export * from './getProfileLogo'
export * from './getProfileFallbackLogo'
export * from './getSportColor'
export * from './getSportLexic'
export * from './msToMinutesAndSeconds'
export * from './secondsToHms'

Loading…
Cancel
Save