fix(#664): add params to landing page

andreidekterev 3 years ago
parent 1e0a2cfc2d
commit f1c4c51b31
  1. 13
      src/features/Landings/index.tsx
  2. 7
      src/features/MatchPage/store/hooks/index.tsx
  3. 6
      src/requests/getMatchInfo.tsx

@ -37,8 +37,12 @@ import {
LogoBackground, LogoBackground,
TournamentInfoContainer, TournamentInfoContainer,
} from './styled' } from './styled'
import { checkUrlParams } from '../../helpers/parseUrlParams/parseUrlParams'
const Landings = () => { const Landings = () => {
const season = checkUrlParams('season')
const tournamentName = checkUrlParams('tournament')
const { const {
buttonColor, buttonColor,
buttonLexic, buttonLexic,
@ -46,7 +50,6 @@ const Landings = () => {
description, description,
gallery, gallery,
isInactiveLanding, isInactiveLanding,
isInactiveLandingData,
isNonExistLanding, isNonExistLanding,
logo, logo,
logoInsports, logoInsports,
@ -117,18 +120,18 @@ const Landings = () => {
<Fragment> <Fragment>
<DateInfo> <DateInfo>
{isInactiveLanding {isInactiveLanding
? <T9n t='inactive_period' /> ? season
: <T9n t='default_season' />}&nbsp; : <T9n t='default_season' />}&nbsp;
{isInactiveLandingData?.season}
</DateInfo> </DateInfo>
<TournamentTitle> <TournamentTitle>
<T9n t='inactive_title_1' />&nbsp; <T9n t='inactive_title_1' />&nbsp;
{isInactiveLandingData?.tournamentsTitle || defaultTournamentName}&nbsp; {tournamentName || defaultTournamentName}&nbsp;
<T9n t='inactive_title_2' /> <T9n t='inactive_title_2' />
</TournamentTitle> </TournamentTitle>
<TournamentDescription> <TournamentDescription>
<T9n t='inactive_description_1' />&nbsp; <T9n t='inactive_description_1' />&nbsp;
{isInactiveLandingData?.tournamentsTitle || defaultTournamentName}&nbsp; {tournamentName || defaultTournamentName}&nbsp;
<T9n t='inactive_description_2' /> <T9n t='inactive_description_2' />
</TournamentDescription> </TournamentDescription>
</Fragment> </Fragment>

@ -36,6 +36,7 @@ import { useTabEvents } from './useTabEvents'
import { useTeamsStats } from './useTeamsStats' import { useTeamsStats } from './useTeamsStats'
import { useStatsTab } from './useStatsTab' import { useStatsTab } from './useStatsTab'
import { usePlayersStats } from './usePlayersStats' import { usePlayersStats } from './usePlayersStats'
import { useLang } from '../../../LexicsStore/hooks/useLang'
type PlayingData = { type PlayingData = {
player: { player: {
@ -82,6 +83,7 @@ export const useMatchPage = () => {
paramName: '', paramName: '',
playerOrTeamName: '', playerOrTeamName: '',
}) })
const { lang } = useLang()
const { profileId: matchId, sportType } = usePageParams() const { profileId: matchId, sportType } = usePageParams()
@ -175,7 +177,10 @@ export const useMatchPage = () => {
sportType, sportType,
tournamentId: data?.tournament.id, tournamentId: data?.tournament.id,
})) }))
redirectToUrl(`${PAGES.landing}/default`) redirectToUrl(`
${PAGES.landing}/default
?season=${data?.season.name}
&tournament=${lang === 'ru' ? data?.tournament.name_rus : data?.tournament.name_eng}`)
}) })
}) })
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps

@ -28,6 +28,11 @@ export type MatchTournament = {
sportType: number, sportType: number,
} }
export type MatchSeason = {
id: number,
name: string,
}
export type VideoBound = { export type VideoBound = {
e: string, e: string,
h: string, h: string,
@ -55,6 +60,7 @@ export type MatchInfo = {
has_video: boolean, has_video: boolean,
live: boolean, live: boolean,
playbackUrl?: string, playbackUrl?: string,
season: MatchSeason,
sport: SportInfo, sport: SportInfo,
storage: boolean, storage: boolean,
sub: boolean, sub: boolean,

Loading…
Cancel
Save