fix(2841): fix match title & subtitle

keep-around/2fd168b18eeebc91eac94ae86d817c12edfe1576
nevainero 3 years ago
parent ec0f90fb20
commit d5cd315970
  1. 2
      .drone.yml
  2. 9
      src/features/MatchCard/CardFrontside/hooks.tsx
  3. 26
      src/features/MatchPage/components/MatchDescription/index.tsx
  4. 7
      src/features/MatchPage/components/MatchDescription/styled.tsx
  5. 18
      src/features/TournamentSubtitle/index.tsx
  6. 8
      src/features/TournamentSubtitle/styled.tsx

@ -290,7 +290,7 @@ steps:
- apk add --no-cache aws-cli bash git openssh-client make rsync - apk add --no-cache aws-cli bash git openssh-client make rsync
- npm install --legacy-peer-deps - npm install --legacy-peer-deps
- make build-e - make build-e
- aws s3 sync build s3://instat-frontend-test-d --delete - aws s3 sync build s3://instat-frontend-test-e --delete
- aws cloudfront create-invalidation --distribution-id E1S8ZOPGSJZ7Q3 --paths "/*" - aws cloudfront create-invalidation --distribution-id E1S8ZOPGSJZ7Q3 --paths "/*"

@ -24,6 +24,7 @@ export const useCardPreview = ({
(async () => { (async () => {
if (!currentPreviewURL) return if (!currentPreviewURL) return
try {
const image = await fetch(String(currentPreviewURL), { const image = await fetch(String(currentPreviewURL), {
headers: { Authorization: `Bearer ${readToken()}` }, headers: { Authorization: `Bearer ${readToken()}` },
}).then(async (result) => ({ }).then(async (result) => ({
@ -34,8 +35,14 @@ export const useCardPreview = ({
if (image.status === 200) { if (image.status === 200) {
setPreviewImage(URL.createObjectURL(image.blob)) setPreviewImage(URL.createObjectURL(image.blob))
} }
} catch (e) {
// eslint-disable-next-line no-console
console.error(e)
}
})() })()
}, [currentPreviewURL])
return () => URL.revokeObjectURL(previewImage)
}, [currentPreviewURL, previewImage])
return { previewImage } return { previewImage }
} }

@ -25,11 +25,11 @@ import {
Description, Description,
DescriptionInnerBlock, DescriptionInnerBlock,
MatchDate, MatchDate,
StyledLink,
Score, Score,
StyledLink,
Time,
Title, Title,
Views, Views,
Time,
} from './styled' } from './styled'
export const MatchDescription = () => { export const MatchDescription = () => {
@ -39,17 +39,11 @@ export const MatchDescription = () => {
const { suffix } = useLexicsStore() const { suffix } = useLexicsStore()
const { profile, profileCardShown } = useMatchPageStore() const { profile, profileCardShown } = useMatchPageStore()
const getTeamName = useCallback((team: Team) => { const getTeamName = useCallback((team: Team) => (
if (isMobileDevice) { isMobileDevice
const teamNameLimit = 14 ? getName({ nameObj: team, suffix })
let name = getName({ nameObj: team, suffix }) : <Name nameObj={team} />
if (name.length > teamNameLimit) { ), [suffix])
name = `${name.substring(0, teamNameLimit)}...`
}
return name
}
return <Name nameObj={team} />
}, [suffix])
if (!profile) return <Description /> if (!profile) return <Description />
@ -95,12 +89,18 @@ export const MatchDescription = () => {
<TournamentSubtitle <TournamentSubtitle
countryId={country_id} countryId={country_id}
tournament={tournament} tournament={tournament}
time={isMobileDevice ? changedTimeFormat : null}
date={isMobileDevice ? localDate : null}
/> />
</DescriptionInnerBlock> </DescriptionInnerBlock>
{
!isMobileDevice && (
<Views> <Views>
<Time>{changedTimeFormat}</Time> <Time>{changedTimeFormat}</Time>
<MatchDate>{localDate}</MatchDate> <MatchDate>{localDate}</MatchDate>
</Views> </Views>
)
}
</Description> </Description>
) )
} }

@ -25,6 +25,10 @@ export const Description = styled.div<{isHidden?: boolean}>`
export const DescriptionInnerBlock = styled.div` export const DescriptionInnerBlock = styled.div`
margin-right: 10px; margin-right: 10px;
${isMobileDevice ? css`
width: 100%;
` : ''}
` `
export const Score = styled.span` export const Score = styled.span`
@ -44,7 +48,6 @@ export const StyledLink = styled(ProfileLink)`
display: flex; display: flex;
align-items: center; align-items: center;
color: #fff; color: #fff;
white-space: nowrap;
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
@ -53,6 +56,7 @@ export const StyledLink = styled(ProfileLink)`
export const Title = styled.div` export const Title = styled.div`
display: flex; display: flex;
flex-wrap: wrap;
font-weight: 500; font-weight: 500;
font-size: 20px; font-size: 20px;
@ -77,6 +81,7 @@ export const Views = styled.div`
color: #fff; color: #fff;
opacity: 0.7; opacity: 0.7;
font-size: 20px; font-size: 20px;
min-width: 90px;
${isMobileDevice ${isMobileDevice
? css` ? css`

@ -20,17 +20,27 @@ import {
FavoriteSign, FavoriteSign,
Wrapper, Wrapper,
StyledLink, StyledLink,
SubtitleMain,
} from './styled' } from './styled'
import {
Time,
MatchDate,
Views,
} from '../MatchPage/components/MatchDescription/styled'
type Props = { type Props = {
countryId: number, countryId: number,
date?: string | null,
sportType?: SportTypes, sportType?: SportTypes,
time?: string | null,
tournament: TournamentType, tournament: TournamentType,
} }
export const TournamentSubtitle = ({ export const TournamentSubtitle = ({
countryId, countryId,
date,
sportType, sportType,
time,
tournament, tournament,
}: Props) => { }: Props) => {
const { isInFavorites } = useUserFavoritesStore() const { isInFavorites } = useUserFavoritesStore()
@ -39,6 +49,7 @@ export const TournamentSubtitle = ({
return ( return (
<Wrapper> <Wrapper>
<SubtitleMain>
{!isLffClient && ( {!isLffClient && (
<Fragment> <Fragment>
<SportIcon <SportIcon
@ -58,6 +69,13 @@ export const TournamentSubtitle = ({
<Name nameObj={tournament} /> <Name nameObj={tournament} />
</StyledLink> </StyledLink>
{tournamentInFavorites && <FavoriteSign marginLeft={12} />} {tournamentInFavorites && <FavoriteSign marginLeft={12} />}
</SubtitleMain>
{time && date && (
<Views>
<Time>{time}</Time>
<MatchDate>{date}</MatchDate>
</Views>
)}
</Wrapper> </Wrapper>
) )
} }

@ -5,6 +5,14 @@ import { isMobileDevice } from 'config/userAgent'
import { ProfileLink } from 'features/ProfileLink' import { ProfileLink } from 'features/ProfileLink'
export const Wrapper = styled.div` export const Wrapper = styled.div`
${isMobileDevice ? css`
width: 100%;
display: flex;
justify-content: space-between;
` : ''}
`
export const SubtitleMain = styled.div`
display: flex; display: flex;
align-items: center; align-items: center;
` `

Loading…
Cancel
Save