Ott 813 calc hide score (#296)

* refactor(799): display mdash

* refactor(799): updated score showing condition
keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 5 years ago committed by GitHub
parent 75f6911da1
commit 082fa10967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/features/BuyMatchPopup/components/MatchSubscriptions/index.tsx
  2. 15
      src/features/MatchCard/CardFrontside/index.tsx
  3. 4
      src/features/MatchPopup/components/FinishedPlaylistPage/index.tsx
  4. 2
      src/features/MatchPopup/components/LivePlaylistPage/index.tsx
  5. 3
      src/features/MatchPopup/types.tsx
  6. 2
      src/features/Matches/helpers/prepareMatches.tsx
  7. 1
      src/requests/getMatches/types.tsx

@ -45,7 +45,7 @@ export const MatchSubscriptionsStep = () => {
<Header height={50}> <Header height={50}>
<HeaderTitle> <HeaderTitle>
<Name nameObj={match.team1} /> <Name nameObj={match.team1} />
{' '} {MDASH} {' '} {` ${MDASH} `}
<Name nameObj={match.team2} /> <Name nameObj={match.team2} />
</HeaderTitle> </HeaderTitle>
<HeaderActions position='right'> <HeaderActions position='right'>

@ -45,6 +45,7 @@ export const CardFrontside = ({
const { const {
accessibleBySubscription, accessibleBySubscription,
accessibleInUsersCountry, accessibleInUsersCountry,
calc,
date, date,
formattedDate, formattedDate,
hasVideo, hasVideo,
@ -60,9 +61,13 @@ export const CardFrontside = ({
const { open } = useBuyMatchPopupStore() const { open } = useBuyMatchPopupStore()
const { isScoreHidden } = useMatchSwitchesStore() const { isScoreHidden } = useMatchSwitchesStore()
const { selectedMatchStatus } = useHeaderFiltersStore() const { selectedMatchStatus } = useHeaderFiltersStore()
const unixTimeOfMatch = getUnixTime(date) const isInFuture = getUnixTime(date) > getUnixTime(new Date())
const isInFuture = unixTimeOfMatch > getUnixTime(new Date()) const showScore = !(
const isFutureMatch = isInFuture || selectedMatchStatus === MatchStatuses.Soon !calc
|| isInFuture
|| selectedMatchStatus === MatchStatuses.Soon
|| isScoreHidden
)
return ( return (
<CardWrapper <CardWrapper
@ -121,11 +126,11 @@ export const CardFrontside = ({
<Teams> <Teams>
<Team> <Team>
<TeamName nameObj={team1} /> <TeamName nameObj={team1} />
{isFutureMatch ? null : !isScoreHidden && <Score>{team1.score}</Score>} {showScore && <Score>{team1.score}</Score>}
</Team> </Team>
<Team> <Team>
<TeamName nameObj={team2} /> <TeamName nameObj={team2} />
{isFutureMatch ? null : !isScoreHidden && <Score>{team2.score}</Score>} {showScore && <Score>{team2.score}</Score>}
</Team> </Team>
</Teams> </Teams>
</Info> </Info>

@ -2,6 +2,8 @@ import { Fragment } from 'react'
import isEmpty from 'lodash/isEmpty' import isEmpty from 'lodash/isEmpty'
import { MDASH } from 'config'
import { useMatchSwitchesStore } from 'features/MatchSwitches' import { useMatchSwitchesStore } from 'features/MatchSwitches'
import { Name } from 'features/Name' import { Name } from 'features/Name'
import { MediaQuery } from 'features/MediaQuery' import { MediaQuery } from 'features/MediaQuery'
@ -47,7 +49,7 @@ export const FinishedPlaylistPage = () => {
<HeaderTitle> <HeaderTitle>
<Name nameObj={team1} /> <Name nameObj={team1} />
{isScoreHidden ? ' - ' : score} {isScoreHidden || !match.calc ? ` ${MDASH} ` : score}
<Name nameObj={team2} /> <Name nameObj={team2} />
</HeaderTitle> </HeaderTitle>

@ -28,7 +28,7 @@ export const LivePlaylistPage = () => {
<Header> <Header>
<HeaderTitle> <HeaderTitle>
<Name nameObj={team1} /> <Name nameObj={team1} />
{' '} {MDASH} {' '} {` ${MDASH} `}
<Name nameObj={team2} /> <Name nameObj={team2} />
</HeaderTitle> </HeaderTitle>

@ -3,7 +3,8 @@ import { SportTypes } from 'config'
import type { Match } from 'features/Matches/hooks' import type { Match } from 'features/Matches/hooks'
export type MatchData = Pick<Match, ( export type MatchData = Pick<Match, (
'id' 'calc'
| 'id'
| 'team1' | 'team1'
| 'team2' | 'team2'
| 'sportType' | 'sportType'

@ -7,6 +7,7 @@ import { getSportLexic } from 'helpers'
const prepareMatch = ({ const prepareMatch = ({
access, access,
calc,
date: matchDate, date: matchDate,
has_video, has_video,
id, id,
@ -23,6 +24,7 @@ const prepareMatch = ({
return { return {
accessibleBySubscription: sub, accessibleBySubscription: sub,
accessibleInUsersCountry: access, accessibleInUsersCountry: access,
calc,
date, date,
formattedDate: format(date, 'dd.MM.yy'), formattedDate: format(date, 'dd.MM.yy'),
hasVideo: has_video, hasVideo: has_video,

@ -15,6 +15,7 @@ export type Team = {
export type Match = { export type Match = {
access: boolean, access: boolean,
calc: boolean,
date: string, date: string,
/** наличие mp4 видео */ /** наличие mp4 видео */
has_video: boolean, has_video: boolean,

Loading…
Cancel
Save