Ott 445 add date (#145)

* fix(ott-423): found small bug

* fix(ott-445): deleted status added date

* fix(ott-445): changed day with month

* fix(ott-445): some minor changes

* fix(ott-445): moved time and date to helper

Co-authored-by: Armen <armen9339@gmail.com>
keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Andrey Razdorskiy 5 years ago committed by GitHub
parent 07428aa2a4
commit c92b6a74a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      src/features/MatchCard/CardFinished/index.tsx
  2. 20
      src/features/MatchCard/CardLive/index.tsx
  3. 21
      src/features/MatchCard/CardSoon/index.tsx
  4. 14
      src/features/MatchCard/styled.tsx
  5. 8
      src/features/MatchPage/MatchProfileCard/index.tsx
  6. 15
      src/features/MatchPage/MatchProfileCard/styled.tsx
  7. 5
      src/features/Matches/helpers.tsx

@ -1,38 +1,32 @@
import React from 'react' import React from 'react'
import styled from 'styled-components/macro'
import type { Match } from 'features/Matches' import type { Match } from 'features/Matches'
import { getSportColor } from 'helpers' import { getSportColor } from 'helpers'
import { SportName } from 'features/Common' import { SportName } from 'features/Common'
import { T9n } from 'features/T9n'
import { useCard } from '../hooks' import { useCard } from '../hooks'
import { CardFinishedHover } from '../CardFinishedHover' import { CardFinishedHover } from '../CardFinishedHover'
import { import {
CardWrapper, CardWrapper,
Info, Info,
MatchStatus as CommonMatchStatus, MatchDate,
Preview, Preview,
PreviewWrapper, PreviewWrapper,
Score, Score,
Team, Team,
TeamName, TeamName,
Teams, Teams,
Time,
TournamentName, TournamentName,
} from '../styled' } from '../styled'
const MatchStatus = styled(CommonMatchStatus)`
color: #313131;
background-color: #EACB6F;
`
type CardFinishedProps = { type CardFinishedProps = {
match: Match, match: Match,
} }
export const CardFinished = ({ export const CardFinished = ({
match: { match: {
date,
id, id,
preview, preview,
sportName, sportName,
@ -41,6 +35,7 @@ export const CardFinished = ({
team1Score, team1Score,
team2Name, team2Name,
team2Score, team2Score,
time,
tournamentName, tournamentName,
}, },
}: CardFinishedProps) => { }: CardFinishedProps) => {
@ -67,7 +62,12 @@ export const CardFinished = ({
onClick={open} onClick={open}
onKeyPress={onKeyPress} onKeyPress={onKeyPress}
> >
<MatchStatus><T9n t='game_finished' /></MatchStatus> <MatchDate>
{date}
<Time>
{time}
</Time>
</MatchDate>
<PreviewWrapper> <PreviewWrapper>
<Preview <Preview
alt={tournamentName} alt={tournamentName}

@ -1,38 +1,32 @@
import React from 'react' import React from 'react'
import styled from 'styled-components/macro'
import type { Match } from 'features/Matches' import type { Match } from 'features/Matches'
import { getSportColor } from 'helpers' import { getSportColor } from 'helpers'
import { SportName } from 'features/Common' import { SportName } from 'features/Common'
import { T9n } from 'features/T9n'
import { useCard } from '../hooks' import { useCard } from '../hooks'
import { import {
CardWrapper, CardWrapper,
Info, Info,
MatchStatus as CommonMatchStatus, MatchDate,
Preview, Preview,
PreviewWrapper, PreviewWrapper,
Score, Score,
Team, Team,
TeamName, TeamName,
Teams, Teams,
Time,
TournamentName, TournamentName,
} from '../styled' } from '../styled'
import { CardLiveHover } from '../CardLiveHover' import { CardLiveHover } from '../CardLiveHover'
const MatchStatus = styled(CommonMatchStatus)`
color: #fff;
background-color: #cc0000;
`
type CardLiveProps = { type CardLiveProps = {
match: Match, match: Match,
} }
export const CardLive = ({ export const CardLive = ({
match: { match: {
date,
id, id,
preview, preview,
sportName, sportName,
@ -41,6 +35,7 @@ export const CardLive = ({
team1Score, team1Score,
team2Name, team2Name,
team2Score, team2Score,
time,
tournamentName, tournamentName,
}, },
}: CardLiveProps) => { }: CardLiveProps) => {
@ -67,7 +62,12 @@ export const CardLive = ({
onClick={open} onClick={open}
onKeyPress={onKeyPress} onKeyPress={onKeyPress}
> >
<MatchStatus><T9n t='live' /></MatchStatus> <MatchDate>
{date}
<Time>
{time}
</Time>
</MatchDate>
<PreviewWrapper> <PreviewWrapper>
<Preview <Preview
alt={tournamentName} alt={tournamentName}

@ -2,17 +2,16 @@ import type { BaseSyntheticEvent } from 'react'
import React, { useCallback } from 'react' import React, { useCallback } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import format from 'date-fns/format'
import { devices } from 'config/devices' import { devices } from 'config/devices'
import type { Match } from 'features/Matches' import type { Match } from 'features/Matches'
import { getSportColor, handleImageError } from 'helpers' import { getSportColor, handleImageError } from 'helpers'
import { SportName } from 'features/Common' import { SportName } from 'features/Common'
import { T9n } from 'features/T9n'
import { import {
MatchStatus as CommonMatchStatus, MatchDate,
CardWrapper as CommonCardWrapper, CardWrapper as CommonCardWrapper,
Time,
Info, Info,
PreviewWrapper, PreviewWrapper,
Team, Team,
@ -21,12 +20,6 @@ import {
TournamentName, TournamentName,
} from '../styled' } from '../styled'
const MatchStatus = styled(CommonMatchStatus)`
top: 20px;
color: rgba(255, 255, 255, 0.3);
border: 1px solid currentColor;
`
const CardWrapper = styled(CommonCardWrapper)` const CardWrapper = styled(CommonCardWrapper)`
cursor: pointer; cursor: pointer;
` `
@ -71,11 +64,10 @@ export const CardSoon = ({
team1Name, team1Name,
team2Logo, team2Logo,
team2Name, team2Name,
time,
tournamentName, tournamentName,
}, },
}: CardSoonProps) => { }: CardSoonProps) => {
const startTime = format(new Date(date), 'HH:mm')
const onError = useCallback((e: BaseSyntheticEvent) => handleImageError({ const onError = useCallback((e: BaseSyntheticEvent) => handleImageError({
e, e,
sport: sportType, sport: sportType,
@ -84,7 +76,12 @@ export const CardSoon = ({
return ( return (
<CardWrapper> <CardWrapper>
<MatchStatus><T9n t='kickoff_in' /> {startTime}</MatchStatus> <MatchDate>
{date}
<Time>
{time}
</Time>
</MatchDate>
<PreviewWrapper> <PreviewWrapper>
<TeamLogos> <TeamLogos>
<TeamLogo <TeamLogo

@ -20,7 +20,6 @@ export const CardWrapper = styled.li.attrs({
transition: border 0.5s ease-out; transition: border 0.5s ease-out;
margin-right: 16px; margin-right: 16px;
@media${devices.laptop} { @media${devices.laptop} {
width: 279px; width: 279px;
height: 279px; height: 279px;
@ -55,20 +54,22 @@ export const Preview = styled.img`
` `
export const MatchStatus = styled.div` export const MatchDate = styled.div`
position: absolute; position: absolute;
top: 24px; top: 25px;
left: 24px; left: 24px;
width: 125px; width: 135px;
height: 24px; height: 24px;
border-radius: 2px; border-radius: 2px;
padding: 5px 5px; padding: 8px;
font-size: 11px; font-size: 11px;
font-weight: bold; font-weight: bold;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.1em; letter-spacing: 0.1em;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
color: white;
background: #6D6D6D;
@media${devices.tablet} { @media${devices.tablet} {
top: 10px; top: 10px;
@ -77,6 +78,9 @@ export const MatchStatus = styled.div`
padding: 6px 8px; padding: 6px 8px;
} }
` `
export const Time = styled.span`
margin-left: 10px;
`
export const Info = styled.div` export const Info = styled.div`
padding: 33px 24px 0; padding: 33px 24px 0;

@ -18,6 +18,7 @@ import {
Teams, Teams,
Score, Score,
Tournament, Tournament,
Dash,
StyledLink, StyledLink,
} from './styled' } from './styled'
@ -53,11 +54,13 @@ export const MatchProfileCard = () => {
{team1.name} {team1.name}
</StyledLink> </StyledLink>
)} )}
{!isHidden && ( {!isHidden
? (
<Score> <Score>
{team1?.score} : {team2?.score} {team1?.score} : {team2?.score}
</Score> </Score>
)} )
: <Dash />}
{team2 && ( {team2 && (
<StyledLink to={getProfileUrl({ <StyledLink to={getProfileUrl({
id: team2.id, id: team2.id,
@ -69,6 +72,7 @@ export const MatchProfileCard = () => {
</StyledLink> </StyledLink>
)} )}
</Teams> </Teams>
<Tournament> <Tournament>
<SportName <SportName
color={color} color={color}

@ -33,6 +33,21 @@ export const StyledLink = styled(Link)`
} }
` `
export const Dash = styled.span`
position: relative;
width: 40px;
border-bottom: 3px solid white;
margin: 0 15px;
height: fit-content;
align-self: center;
@media${devices.tablet} {
width: 16px;
border-bottom: 1px solid white;
margin: 0 4px;
}
`
export const Score = styled.div` export const Score = styled.div`
display: flex; display: flex;
margin: 0 20px; margin: 0 20px;

@ -3,6 +3,8 @@ import flatten from 'lodash/flatten'
import pipe from 'lodash/fp/pipe' import pipe from 'lodash/fp/pipe'
import fpMap from 'lodash/fp/map' import fpMap from 'lodash/fp/map'
import format from 'date-fns/format'
import type { Content } from 'requests' import type { Content } from 'requests'
import { ProfileTypes } from 'config' import { ProfileTypes } from 'config'
import { getProfileLogo, getSportLexic } from 'helpers' import { getProfileLogo, getSportLexic } from 'helpers'
@ -20,7 +22,7 @@ const prepareMatch = ({
team1, team1,
team2, team2,
}) => ({ }) => ({
date, date: format(new Date(date), 'dd:MM:yy'),
id, id,
preview: '/images/preview.png', preview: '/images/preview.png',
sportName: getSportLexic(sport), sportName: getSportLexic(sport),
@ -40,6 +42,7 @@ const prepareMatch = ({
}), }),
team2Name: team2[`name_${suffix}` as Name], team2Name: team2[`name_${suffix}` as Name],
team2Score: team2.score, team2Score: team2.score,
time: format(new Date(date), 'HH:mm'),
tournamentName: rest[`name_${suffix}` as Name], tournamentName: rest[`name_${suffix}` as Name],
})) }))

Loading…
Cancel
Save