feat(ott-1456): disable buttons for unanalyzed match (#443)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Ruslan Khayrullin 4 years ago committed by GitHub
parent ee4ea069a2
commit 4bc067970c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/features/MatchSidePlaylists/components/MatchPlaylists/index.tsx
  2. 3
      src/features/MatchSidePlaylists/components/PlayButton/index.tsx
  3. 1
      src/features/MatchSidePlaylists/components/TabWatch/index.tsx

@ -4,6 +4,8 @@ import map from 'lodash/map'
import { isMobileDevice } from 'config/userAgent' import { isMobileDevice } from 'config/userAgent'
import type { MatchPlaylistOptions, PlaylistOption } from 'features/MatchPage/types' import type { MatchPlaylistOptions, PlaylistOption } from 'features/MatchPage/types'
import type { MatchInfo } from 'requests'
import { FULL_GAME_KEY } from 'features/MatchPage/helpers/buildPlaylists'
import { T9n } from 'features/T9n' import { T9n } from 'features/T9n'
import { isEqual } from 'features/MatchSidePlaylists/helpers' import { isEqual } from 'features/MatchSidePlaylists/helpers'
@ -13,6 +15,7 @@ import { PlayButton } from '../PlayButton'
type Props = { type Props = {
onSelect?: (selectedMathPlaylist: PlaylistOption) => void, onSelect?: (selectedMathPlaylist: PlaylistOption) => void,
playlists: MatchPlaylistOptions, playlists: MatchPlaylistOptions,
profile: MatchInfo,
selectedMathPlaylist?: PlaylistOption, selectedMathPlaylist?: PlaylistOption,
} }
@ -33,6 +36,7 @@ const Item = styled.li`
export const MatchPlaylists = ({ export const MatchPlaylists = ({
onSelect, onSelect,
playlists, playlists,
profile,
selectedMathPlaylist, selectedMathPlaylist,
}: Props) => ( }: Props) => (
<List> <List>
@ -42,6 +46,7 @@ export const MatchPlaylists = ({
<PlayButton <PlayButton
duration={playlist.duration} duration={playlist.duration}
active={isEqual(playlist, selectedMathPlaylist)} active={isEqual(playlist, selectedMathPlaylist)}
disabled={playlist.id !== FULL_GAME_KEY && !profile?.calc}
onClick={() => onSelect?.(playlist)} onClick={() => onSelect?.(playlist)}
> >
<T9n t={playlist.lexic} /> <T9n t={playlist.lexic} />

@ -9,6 +9,7 @@ import { Button, Title } from '../../styled'
type Props = { type Props = {
active?: boolean, active?: boolean,
children: ReactNode, children: ReactNode,
disabled?: boolean,
duration?: number, duration?: number,
leftContent?: ReactNode, leftContent?: ReactNode,
onClick: () => void, onClick: () => void,
@ -22,6 +23,7 @@ const Duration = styled(Title)`
export const PlayButton = ({ export const PlayButton = ({
active, active,
children, children,
disabled,
duration, duration,
leftContent, leftContent,
onClick, onClick,
@ -29,6 +31,7 @@ export const PlayButton = ({
<Button <Button
onClick={onClick} onClick={onClick}
active={active} active={active}
disabled={disabled}
> >
{leftContent} {leftContent}
<Title> <Title>

@ -25,6 +25,7 @@ export const TabWatch = ({
}: Props) => ( }: Props) => (
<Fragment> <Fragment>
<MatchPlaylists <MatchPlaylists
profile={profile}
playlists={playlists.match} playlists={playlists.match}
selectedMathPlaylist={selectedPlaylist} selectedMathPlaylist={selectedPlaylist}
onSelect={onSelect} onSelect={onSelect}

Loading…
Cancel
Save