fix(#1701): add changes from another tasks

keep-around/fdb88b04b32b9392e76795099e2ec47c9856b38b
Andrei Dekterev 3 years ago
parent 70cbe4e041
commit b74b1b5f41
  1. 2
      src/features/MatchPage/components/FinishedMatch/index.tsx
  2. 4
      src/features/MatchPage/components/LiveMatch/index.tsx
  3. 4
      src/features/MatchPage/index.tsx
  4. 9
      src/features/MatchPage/store/hooks/index.tsx
  5. 1
      src/features/MatchSidePlaylists/components/TabVideo/styled.tsx
  6. 1
      src/features/MatchSidePlaylists/styled.tsx
  7. 2
      src/features/MultiSourcePlayer/components/ProgressBar/index.tsx
  8. 1
      src/features/MultiSourcePlayer/hooks/index.tsx
  9. 24
      src/features/StreamPlayer/components/Controls/index.tsx
  10. 1
      src/features/StreamPlayer/components/ProgressBar/hooks.tsx
  11. 38
      src/features/StreamPlayer/components/ProgressBar/styled.tsx
  12. 50
      src/features/StreamPlayer/styled.tsx

@ -2,6 +2,8 @@ import { Fragment } from 'react'
import isEmpty from 'lodash/isEmpty' import isEmpty from 'lodash/isEmpty'
import { isMobileDevice } from 'config/userAgent'
import type { Events } from 'requests/getMatchEvents' import type { Events } from 'requests/getMatchEvents'
import type { MatchInfo } from 'requests/getMatchInfo' import type { MatchInfo } from 'requests/getMatchInfo'

@ -7,10 +7,13 @@ import { StreamPlayer } from 'features/StreamPlayer'
import { YoutubePlayer } from 'features/StreamPlayer/components/YoutubePlayer' import { YoutubePlayer } from 'features/StreamPlayer/components/YoutubePlayer'
import { MatchSidePlaylists } from 'features/MatchSidePlaylists' import { MatchSidePlaylists } from 'features/MatchSidePlaylists'
import { isMobileDevice } from 'config/userAgent'
import { Container } from '../../styled' import { Container } from '../../styled'
import { useLiveMatch } from './hooks' import { useLiveMatch } from './hooks'
import { TournamentData } from '../../types' import { TournamentData } from '../../types'
import { MatchProfileCardMobile } from '../MatchProfileCardMobile'
type Props = { type Props = {
// events: Events, // events: Events,
@ -64,6 +67,7 @@ export const LiveMatch = ({
/> />
) )
)} )}
{isMobileDevice ? <MatchProfileCardMobile profile={profile} /> : null}
</Container> </Container>
<MatchSidePlaylists <MatchSidePlaylists

@ -10,6 +10,8 @@ import {
} from 'features/PageLayout' } from 'features/PageLayout'
import { FavoritesActions } from 'requests' import { FavoritesActions } from 'requests'
import { isMobileDevice } from 'config/userAgent'
import { ProfileTypes } from 'config' import { ProfileTypes } from 'config'
import { usePageLogger } from 'hooks/usePageLogger' import { usePageLogger } from 'hooks/usePageLogger'
@ -73,7 +75,7 @@ const MatchPageComponent = () => {
return ( return (
<PageWrapper> <PageWrapper>
<ProfileHeader color='#2B2A28' height={4.5}> <ProfileHeader color='#2B2A28' height={4.5}>
<MatchProfileCard profile={profile} /> {isMobileDevice ? null : <MatchProfileCard profile={profile} />}
</ProfileHeader> </ProfileHeader>
<Main> <Main>
<UserFavorites /> <UserFavorites />

@ -3,6 +3,7 @@ import {
useState, useState,
useMemo, useMemo,
} from 'react' } from 'react'
import { useToggle } from 'hooks'
import type { MatchInfo } from 'requests/getMatchInfo' import type { MatchInfo } from 'requests/getMatchInfo'
import { getMatchInfo } from 'requests/getMatchInfo' import { getMatchInfo } from 'requests/getMatchInfo'
@ -37,6 +38,11 @@ const addScoresFromPlaylists = (
export const useMatchPage = () => { export const useMatchPage = () => {
const [matchProfile, setMatchProfile] = useState<MatchInfo>(null) const [matchProfile, setMatchProfile] = useState<MatchInfo>(null)
const { profileId: matchId, sportType } = usePageParams() const { profileId: matchId, sportType } = usePageParams()
const {
close: hideProfileCard,
isOpen: profileCardShown,
open: showProfileCard,
} = useToggle(true)
useEffect(() => { useEffect(() => {
getMatchInfo(sportType, matchId).then(setMatchProfile) getMatchInfo(sportType, matchId).then(setMatchProfile)
@ -74,10 +80,13 @@ export const useMatchPage = () => {
return { return {
events, events,
handlePlaylistClick, handlePlaylistClick,
hideProfileCard,
isStarted, isStarted,
matchPlaylists, matchPlaylists,
profile, profile,
profileCardShown,
selectedPlaylist, selectedPlaylist,
setFullMatchPlaylistDuration, setFullMatchPlaylistDuration,
showProfileCard,
} }
} }

@ -9,5 +9,6 @@ export const MatchesWrapper = styled.div`
margin-bottom: 15px; margin-bottom: 15px;
} }
${customScrollbar} ${customScrollbar}
` `

@ -138,7 +138,6 @@ export const BlockTitle = styled.span`
color: rgba(255, 255, 255, 0.5); color: rgba(255, 255, 255, 0.5);
text-transform: uppercase; text-transform: uppercase;
` `
export const BackToTopBtn = styled.div` export const BackToTopBtn = styled.div`
position: absolute; position: absolute;
left: 50%; left: 50%;

@ -1,8 +1,8 @@
import { useSlider } from 'features/StreamPlayer/hooks/useSlider' import { useSlider } from 'features/StreamPlayer/hooks/useSlider'
import { TimeTooltip } from 'features/StreamPlayer/components/TimeTooltip' import { TimeTooltip } from 'features/StreamPlayer/components/TimeTooltip'
import { Scrubber } from 'features/StreamPlayer/components/ProgressBar/styled' import { Scrubber } from 'features/StreamPlayer/components/ProgressBar/styled'
import { Chapters } from 'features/StreamPlayer/components/Chapters'
import { Chapters } from 'features/StreamPlayer/components/Chapters'
import type { Props } from './hooks' import type { Props } from './hooks'
import { useProgressBar } from './hooks' import { useProgressBar } from './hooks'
import { ProgressBarList } from './styled' import { ProgressBarList } from './styled'

@ -13,6 +13,7 @@ import { useVolume } from 'features/VideoPlayer/hooks/useVolume'
import { useNoNetworkPopupStore } from 'features/NoNetworkPopup' import { useNoNetworkPopupStore } from 'features/NoNetworkPopup'
import { useEventListener, useObjectState } from 'hooks' import { useEventListener, useObjectState } from 'hooks'
import { MatchInfo } from 'requests'
import { MatchInfo } from 'requests' import { MatchInfo } from 'requests'

@ -11,7 +11,7 @@ import { Chapters } from 'features/MultiSourcePlayer/types'
import { ControlsMobile } from './Components/ControlsMobile' import { ControlsMobile } from './Components/ControlsMobile'
import { ControlsWeb } from './Components/ControlsWeb' import { ControlsWeb } from './Components/ControlsWeb'
import { ProgressBar } from '../ProgressBar' // import { ProgressBar } from '../ProgressBar'
export type ControlsProps = { export type ControlsProps = {
activeChapterIndex?: number, activeChapterIndex?: number,
@ -65,7 +65,7 @@ export const Controls = (props: ControlsProps) => {
isStorage, isStorage,
loadedProgress, loadedProgress,
onProgressChange, onProgressChange,
onProgressChangeLive, // onProgressChangeLive,
onTouchEnd, onTouchEnd,
onTouchStart, onTouchStart,
playedProgress, playedProgress,
@ -87,15 +87,15 @@ export const Controls = (props: ControlsProps) => {
const progressBarElement = useMemo(() => { const progressBarElement = useMemo(() => {
if (isLive || isStorage) { if (isLive || isStorage) {
return ( // return (
<ProgressBar // <ProgressBar
duration={duration} // duration={duration}
isScrubberVisible={controlsVisible} // isScrubberVisible={controlsVisible}
onPlayedProgressChange={onProgressChangeLive!} // onPlayedProgressChange={onProgressChangeLive!}
playedProgress={playedProgress} // playedProgress={playedProgress}
loadedProgress={loadedProgress} // loadedProgress={loadedProgress}
/> // />
) // )
} }
return ( return (
<ProgressBarMultiSource <ProgressBarMultiSource
@ -121,7 +121,7 @@ export const Controls = (props: ControlsProps) => {
isStorage, isStorage,
loadedProgress, loadedProgress,
onProgressChange, onProgressChange,
onProgressChangeLive, // onProgressChangeLive,
onTouchEnd, onTouchEnd,
onTouchStart, onTouchStart,
playedProgress, playedProgress,

@ -10,6 +10,7 @@ export type Props = {
allPlayedProgress: number, allPlayedProgress: number,
chapters: Chapters, chapters: Chapters,
duration: number, duration: number,
isScrubberVisible?: boolean,
loadedProgress: number, loadedProgress: number,
onPlayedProgressChange: (progress: number, seeking: boolean) => void, onPlayedProgressChange: (progress: number, seeking: boolean) => void,
onTouchEnd?: () => any, onTouchEnd?: () => any,

@ -1,13 +1,40 @@
import styled, { css } from 'styled-components/macro' import styled, { css } from 'styled-components/macro'
import { isMobileDevice } from 'config/userAgent' import { isMobileDevice } from 'config/userAgent'
import { Wrapper } from '../TimeTooltip/styled' import { Wrapper } from '../TimeTooltip/styled'
export const ProgressBarList = styled.div` export const ProgressBarList = styled.div`
flex-grow: 1; flex-grow: 1;
height: 4px; height: 4px;
position: relative; position: relative;
background-color: rgba(255, 255, 255, 0.3);
cursor: pointer;
${isMobileDevice
? css`
height: 1px;
`
: ''}
`
export const LoadedProgress = styled.div`
position: absolute;
z-index: 1;
background-color: rgba(255, 255, 255, 0.6);
height: 100%;
`
export const PlayedProgress = styled.div`
position: absolute;
z-index: 2;
background-color: #CC0000;
height: 100%;
${isMobileDevice
? css`
background-color: #FFFFFF;
`
: ''}
` `
export const Scrubber = styled.div` export const Scrubber = styled.div`
@ -15,7 +42,7 @@ export const Scrubber = styled.div`
outline: none; outline: none;
position: absolute; position: absolute;
top: 0; top: 0;
transform: translate(-50%, -43%); transform: translate(-50%, -38%);
z-index: 3; z-index: 3;
width: 18px; width: 18px;
height: 18px; height: 18px;
@ -29,10 +56,9 @@ export const Scrubber = styled.div`
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 30px; width: 14px;
height: 30px; height: 14px;
background-clip: padding-box; background-color: #FFFFFF;
border: 10px solid transparent;
` `
: ''} : ''}
` `

@ -1,22 +1,29 @@
import styled, { css } from 'styled-components/macro' import styled, { css } from 'styled-components'
import { isMobileDevice } from 'config/userAgent' import { isMobileDevice } from 'config/userAgent'
import { devices } from 'config'
export const ControlsGradient = styled.div` export const ControlsGradient = styled.div<{ isVisible?: boolean }>`
background-image: url(/images/player-controls-gradient.png); background-image: url(/images/player-controls-gradient.png);
bottom: 0; bottom: 0;
position: absolute; position: absolute;
width: 100%; width: 100%;
pointer-events: none; pointer-events: none;
height: 145px; height: 145px;
${({ isVisible }) => (isMobileDevice
? css`
height: 100%;
background: ${(isVisible
? 'linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(255,255,255,0) 25%, rgba(255,255,255,0) 75%, rgba(0,0,0,0.7) 100%)'
: 'initial')}
` : '')}
` `
type HoverStylesProps = { type HoverStylesProps = {
visible: boolean, visible: boolean,
} }
const hoverStyles = css<HoverStylesProps>` export const hoverStyles = css<HoverStylesProps>`
transition: opacity 0.3s ease-in-out; transition: opacity 0.3s ease-in-out;
${({ visible }) => (visible ${({ visible }) => (visible
? css`opacity: 1;` ? css`opacity: 1;`
@ -113,9 +120,12 @@ export const PlayerWrapper = styled.div<PlayStopProps>`
padding-top: 56.25%; padding-top: 56.25%;
`} `}
${devices.laptop} { ${isMobileDevice
? css`
min-height: auto; min-height: auto;
} margin-bottom: 15px;
`
: ''};
` `
type LoaderWrapperProps = { type LoaderWrapperProps = {
@ -151,7 +161,7 @@ export const ButtonBase = styled.button`
const sizes = { const sizes = {
lg: 92, lg: 92,
sm: 24, sm: 29,
} }
type PlayStopProps = { type PlayStopProps = {
@ -176,8 +186,8 @@ export const PlayStop = styled(ButtonBase)<PlayStopProps>`
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 20%; width: ${sizes.sm}px;
height: 60%; height: ${sizes.sm}px;
margin-right: 0; margin-right: 0;
padding: 0; padding: 0;
` `
@ -248,15 +258,17 @@ export const Backward = styled(ButtonBase)<ButtonProps>`
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 15%; width: ${rewindButtonSizes.sides.sm}px;
font-size: 14px; height: ${rewindButtonSizes.sides.sm}px;
margin-right: 6px; font-size: ${rewindButtonSizes.fontSizes.sm}px;
` `
: ''}; : ''};
` `
export const Forward = styled(Backward)` export const Forward = styled(Backward)`
background-image: url(/images/player-forward.svg); background-image: url(/images/player-forward.svg);
margin-left: 10px;
margin-right: 0;
` `
type PlaybackTimeProps = { type PlaybackTimeProps = {
@ -299,7 +311,7 @@ export const CenterControls = styled.div<CenterControlsProps>`
pointer-events: ${({ playing }) => (playing ? 'none' : 'auto')}; pointer-events: ${({ playing }) => (playing ? 'none' : 'auto')};
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 70%; width: 135px;
` `
: ''}; : ''};
` `
@ -314,11 +326,15 @@ export const LiveBtn = styled(ButtonBase)`
padding: 4.5px 8px; padding: 4.5px 8px;
background-color: #CC0000; background-color: #CC0000;
border-radius: 1.3px; border-radius: 1.3px;
`
${isMobileDevice export const TeamsDetailsWrapper = styled.div`
? css` position: absolute;
` top: 20px;
: ''}; left: 15px;
font-size: 16px;
color: #FFFFFF;
z-index: 50;
` `
export const ChaptersText = styled.span` export const ChaptersText = styled.span`

Loading…
Cancel
Save