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

@ -36,6 +36,7 @@ import { useTabEvents } from './useTabEvents'
import { useTeamsStats } from './useTeamsStats'
import { useStatsTab } from './useStatsTab'
import { usePlayersStats } from './usePlayersStats'
import { useLang } from '../../../LexicsStore/hooks/useLang'
type PlayingData = {
player: {
@ -82,6 +83,7 @@ export const useMatchPage = () => {
paramName: '',
playerOrTeamName: '',
})
const { lang } = useLang()
const { profileId: matchId, sportType } = usePageParams()
@ -175,7 +177,10 @@ export const useMatchPage = () => {
sportType,
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

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

Loading…
Cancel
Save