diff --git a/public/images/handball-icon.svg b/public/images/handball-icon.svg new file mode 100644 index 00000000..9b8b258d --- /dev/null +++ b/public/images/handball-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/images/player-fallback.png b/public/images/player-fallback.png new file mode 100644 index 00000000..56cdda75 Binary files /dev/null and b/public/images/player-fallback.png differ diff --git a/public/images/team-fallback.png b/public/images/team-fallback.png new file mode 100644 index 00000000..7ea91534 Binary files /dev/null and b/public/images/team-fallback.png differ diff --git a/public/images/tournament-fallback.png b/public/images/tournament-fallback.png new file mode 100644 index 00000000..d520362d Binary files /dev/null and b/public/images/tournament-fallback.png differ diff --git a/src/config/lexics/indexLexics.tsx b/src/config/lexics/indexLexics.tsx index 595409e5..7dad88ce 100644 --- a/src/config/lexics/indexLexics.tsx +++ b/src/config/lexics/indexLexics.tsx @@ -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, diff --git a/src/config/lexics/procedures.tsx b/src/config/lexics/procedures.tsx index 90314757..4ff200ad 100644 --- a/src/config/lexics/procedures.tsx +++ b/src/config/lexics/procedures.tsx @@ -1,5 +1,6 @@ export const proceduresLexics = { 3556: 3556, 6959: 6959, + 9760: 9760, 12980: 12980, } diff --git a/src/config/sportTypes.tsx b/src/config/sportTypes.tsx index 995131c4..75091116 100644 --- a/src/config/sportTypes.tsx +++ b/src/config/sportTypes.tsx @@ -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 diff --git a/src/features/Common/Image/index.tsx b/src/features/Common/Image/index.tsx index 3f5c1054..68390aa9 100644 --- a/src/features/Common/Image/index.tsx +++ b/src/features/Common/Image/index.tsx @@ -19,7 +19,7 @@ export const Image = ({ alt, className, dataSrc, - fallbackSrc, + fallbackSrc = '', onLoad, src, title, diff --git a/src/features/Common/SportName/styled.tsx b/src/features/Common/SportName/styled.tsx index c07511e2..50d2e835 100644 --- a/src/features/Common/SportName/styled.tsx +++ b/src/features/Common/SportName/styled.tsx @@ -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)` margin-right: 10px; font-size: 11px; - color: ${({ sport }) => getSportColor(sport)}; letter-spacing: 0.02em; text-transform: uppercase; diff --git a/src/features/Matches/helpers/prepareMatches.tsx b/src/features/Matches/helpers/prepareMatches.tsx index 1a431d62..f720b141 100644 --- a/src/features/Matches/helpers/prepareMatches.tsx +++ b/src/features/Matches/helpers/prepareMatches.tsx @@ -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, diff --git a/src/features/ProfileLink/helpers/__tests__/index.tsx b/src/features/ProfileLink/helpers/__tests__/index.tsx index 45132488..0cd8f303 100644 --- a/src/features/ProfileLink/helpers/__tests__/index.tsx +++ b/src/features/ProfileLink/helpers/__tests__/index.tsx @@ -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') }) diff --git a/src/features/ProfileLogo/index.tsx b/src/features/ProfileLogo/index.tsx index c3eeedd1..eeed4806 100644 --- a/src/features/ProfileLogo/index.tsx +++ b/src/features/ProfileLogo/index.tsx @@ -42,10 +42,7 @@ export const ProfileLogo = ({ size, sportType, }) - const fallbackSrc = getProfileFallbackLogo({ - profileType, - sportType, - }) + const fallbackSrc = getProfileFallbackLogo(profileType) return ( = { }, ], [SportTypes.BASKETBALL]: [], + [SportTypes.HANDBALL]: [], [SportTypes.HOCKEY]: [ { description: 'все матчи спартака в сезоне 2020-2021', diff --git a/src/helpers/getProfileFallbackLogo/index.tsx b/src/helpers/getProfileFallbackLogo/index.tsx index 98ab7f44..4f6fae3d 100644 --- a/src/helpers/getProfileFallbackLogo/index.tsx +++ b/src/helpers/getProfileFallbackLogo/index.tsx @@ -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] } diff --git a/src/helpers/getProfileLogo/index.tsx b/src/helpers/getProfileLogo/index.tsx index d8d82eea..ea816aa0 100644 --- a/src/helpers/getProfileLogo/index.tsx +++ b/src/helpers/getProfileLogo/index.tsx @@ -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 = { diff --git a/src/helpers/getSportColor/index.tsx b/src/helpers/getSportColor/index.tsx deleted file mode 100644 index 859fe0d2..00000000 --- a/src/helpers/getSportColor/index.tsx +++ /dev/null @@ -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] diff --git a/src/helpers/getSportLexic/index.tsx b/src/helpers/getSportLexic/index.tsx index 03d4e7a4..7e051783 100644 --- a/src/helpers/getSportLexic/index.tsx +++ b/src/helpers/getSportLexic/index.tsx @@ -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] diff --git a/src/helpers/index.tsx b/src/helpers/index.tsx index 1fef96c5..9b48538e 100644 --- a/src/helpers/index.tsx +++ b/src/helpers/index.tsx @@ -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'