feat(906): live match side playlist (#337)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 5 years ago committed by GitHub
parent d696c4b181
commit 35e82eff28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      src/features/MatchPage/components/LiveMatch/index.tsx
  2. 27
      src/features/MatchPage/components/LiveMatchSidePlaylists/index.tsx
  3. 7
      src/features/MatchPage/styled.tsx
  4. 2
      src/features/MatchPage/types.tsx
  5. 57
      src/features/MatchSidePlaylists/components/MatchPlaylists/index.tsx
  6. 6
      src/features/MatchSidePlaylists/styled.tsx

@ -1,9 +1,12 @@
import { Fragment } from 'react'
import type { MatchInfo } from 'requests' import type { MatchInfo } from 'requests'
import { StreamPlayer } from 'features/StreamPlayer' import { StreamPlayer } from 'features/StreamPlayer'
import { useLiveMatch } from './hooks' import { useLiveMatch } from './hooks'
import { MatchProfileCard } from '../MatchProfileCard' import { MatchProfileCard } from '../MatchProfileCard'
import { LiveMatchSidePlaylists } from '../LiveMatchSidePlaylists'
import { Container } from '../../styled' import { Container } from '../../styled'
type Props = { type Props = {
@ -19,14 +22,17 @@ export const LiveMatch = ({ profile }: Props) => {
} = useLiveMatch() } = useLiveMatch()
return ( return (
<Container marginRight={320}> <Fragment>
<MatchProfileCard profile={profile} /> <Container>
<StreamPlayer <MatchProfileCard profile={profile} />
url={matchUrl} <StreamPlayer
onPlayingChange={onPlayingChange} url={matchUrl}
onProgressChange={onPlayerProgressChange} onPlayingChange={onPlayingChange}
resumeFrom={lastPlayPosition.second} onProgressChange={onPlayerProgressChange}
/> resumeFrom={lastPlayPosition.second}
</Container> />
</Container>
<LiveMatchSidePlaylists />
</Fragment>
) )
} }

@ -0,0 +1,27 @@
import type { MatchPlaylistOption } from 'features/MatchPage/types'
import { PlaylistTypes } from 'features/MatchPage/types'
import { FULL_GAME_KEY } from 'features/MatchPage/helpers/buildPlaylists'
import { Wrapper, Container } from 'features/MatchSidePlaylists/styled'
import { MatchPlaylists } from 'features/MatchSidePlaylists/components/MatchPlaylists'
const fullGamePlaylist: MatchPlaylistOption = {
data: [],
id: FULL_GAME_KEY,
lexic: FULL_GAME_KEY,
type: PlaylistTypes.MATCH,
}
const selectedPlaylist = fullGamePlaylist
const playlists = [fullGamePlaylist]
export const LiveMatchSidePlaylists = () => (
<Wrapper>
<Container>
<MatchPlaylists
playlists={playlists}
selectedMathPlaylist={selectedPlaylist}
/>
</Container>
</Wrapper>
)

@ -16,17 +16,12 @@ export const Wrapper = styled.div`
} }
` `
type ContainerProps = { export const Container = styled.div`
marginRight?: number,
}
export const Container = styled.div<ContainerProps>`
max-width: 2090px; max-width: 2090px;
max-height: 896px; max-height: 896px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-grow: 1; flex-grow: 1;
margin-right: ${({ marginRight = 0 }) => `${marginRight}px`};
@media ${devices.laptop} { @media ${devices.laptop} {
max-width: 80%; max-width: 80%;

@ -10,7 +10,7 @@ export type MatchPlaylistOption = {
data: Episodes, data: Episodes,
duration?: number, duration?: number,
id: string, id: string,
lexic: number, lexic: number | string,
type: PlaylistTypes.MATCH, type: PlaylistTypes.MATCH,
} }

@ -8,38 +8,39 @@ import { T9n } from 'features/T9n'
import { isEqual } from 'features/MatchSidePlaylists' import { isEqual } from 'features/MatchSidePlaylists'
import { PlayButton } from '../PlayButton' import { PlayButton } from '../PlayButton'
import { Item } from '../../styled'
type Props = { type Props = {
onSelect: (selectedMathPlaylist: PlaylistOption) => void, onSelect?: (selectedMathPlaylist: PlaylistOption) => void,
playlists?: MatchPlaylistOptions, playlists: MatchPlaylistOptions,
selectedMathPlaylist?: PlaylistOption, selectedMathPlaylist?: PlaylistOption,
} }
const List = styled.ul`` const List = styled.ul``
export const MatchPlaylists = (props: Props) => { const Item = styled.li`
const { margin-bottom: 10px;
onSelect, width: 100%;
playlists, height: 50px;
selectedMathPlaylist, `
} = props
export const MatchPlaylists = ({
return ( onSelect,
<List> playlists,
{ selectedMathPlaylist,
map(playlists, (playlist) => ( }: Props) => (
<Item key={playlist.id}> <List>
<PlayButton {
duration={playlist.duration} map(playlists, (playlist) => (
active={isEqual(playlist, selectedMathPlaylist)} <Item key={playlist.id}>
onClick={() => onSelect(playlist)} <PlayButton
> duration={playlist.duration}
<T9n t={playlist.lexic} /> active={isEqual(playlist, selectedMathPlaylist)}
</PlayButton> onClick={() => onSelect?.(playlist)}
</Item> >
)) <T9n t={playlist.lexic} />
} </PlayButton>
</List> </Item>
) ))
} }
</List>
)

@ -50,12 +50,6 @@ export const Button = styled.button<ButtonProps>`
)} )}
` `
export const Item = styled.li`
margin-bottom: 10px;
width: 100%;
height: 50px;
`
export const Title = styled.span` export const Title = styled.span`
font-weight: 500; font-weight: 500;
font-size: 20px; font-size: 20px;

Loading…
Cancel
Save