<commit_before>/*
 *
 * YoutubeControl
 *
 */

import React, { PropTypes } from 'react';
import { connect } from 'react-redux';

import { Flex } from 'react-flex';

import mapDispatchToProps from './actions';
import mapStateToProps from './selectors';

import YoutubeControlButton from 'components/YoutubeControlButton';

const YoutubeControl = (props) => {
  const {
    isPlaying,

    loadingPause,
    loadingResume,
    loadingPrevious,
    loadingNext,
    loadingSync,

    disablePause,
    disableResume,
    disablePrevious,
    disableNext,
    disableSync,

    onPause,
    onResume,
    onPrevious,
    onNext,
    onSync,
  } = props;

  const PauseButton = (
    <YoutubeControlButton
      loading={loadingPause}
      disabled={disablePause}
      onClick={onPause}
    >
      Pause
    </YoutubeControlButton>
  );

  const ResumeButton = (
    <YoutubeControlButton
      loading={loadingResume}
      disabled={disableResume}
      onClick={onResume}
    >
      Resume
    </YoutubeControlButton>
  );

  const PreviousButton = (
    <YoutubeControlButton
      loading={loadingPrevious}
      disabled={disablePrevious}
      onClick={onPrevious}
    >
     Previous
    </YoutubeControlButton>
  );

  const NextButton = (
    <YoutubeControlButton
      loading={loadingNext}
      disabled={disableNext}
      onClick={onNext}
    >
     Next
    </YoutubeControlButton>
  );

  const SyncButton = (
    <YoutubeControlButton
      loading={loadingSync}
      disabled={disableSync}
      onClick={onSync}
    >
     Sync
    </YoutubeControlButton>
  );

  return (
    <Flex
      justifyContent="space-between"
    >
      <div>
        {
          isPlaying ?
            <PauseButton /> :
            <ResumeButton />
        }
        <PreviousButton />
        <NextButton />
      </div>
      <div>
        <SyncButton />
      </div>
    </Flex>
  );
};

YoutubeControl.propTypes = {
  isPlaying: PropTypes.bool.isRequired,

  loadingPause: PropTypes.bool.isRequired,
  loadingResume: PropTypes.bool.isRequired,
  loadingPrevious: PropTypes.bool.isRequired,
  loadingNext: PropTypes.bool.isRequired,<commit_msg>Fix control buttons bug<commit_after>/*
 *
 * YoutubeControl
 *
 */

import React, { PropTypes } from 'react';
import { connect } from 'react-redux';

import { Flex } from 'react-flex';

import mapDispatchToProps from './actions';
import mapStateToProps from './selectors';

import YoutubeControlButton from 'components/YoutubeControlButton';

const YoutubeControl = props => {
  const {
    isPlaying,

    loadingPause,
    loadingResume,
    loadingPrevious,
    loadingNext,
    loadingSync,

    disablePause,
    disableResume,
    disablePrevious,
    disableNext,
    disableSync,

    onPause,
    onResume,
    onPrevious,
    onNext,
    onSync,
  } = props;

  const pauseButton = (
    <YoutubeControlButton
      loading={loadingPause}
      disabled={disablePause}
      onClick={onPause}
    >
      Pause
    </YoutubeControlButton>
  );

  const resumeButton = (
    <YoutubeControlButton
      loading={loadingResume}
      disabled={disableResume}
      onClick={onResume}
    >
      Resume
    </YoutubeControlButton>
  );

  const previousButton = (
    <YoutubeControlButton
      loading={loadingPrevious}
      disabled={disablePrevious}
      onClick={onPrevious}
    >
      Previous
    </YoutubeControlButton>
  );

  const nextButton = (
    <YoutubeControlButton
      loading={loadingNext}
      disabled={disableNext}
      onClick={onNext}
    >
      Next
    </YoutubeControlButton>
  );

  const syncButton = (
    <YoutubeControlButton
      loading={loadingSync}
      disabled={disableSync}
      onClick={onSync}
    >
      Sync
    </YoutubeControlButton>
  );

  return (
    <Flex
      justifyContent="space-between"
    >
      <div>
        {isPlaying ? pauseButton : resumeButton}
        {previousButton}
        {nextButton}
      </div>
      <div>
        {syncButton}
      </div>
    </Flex>
  );
};

YoutubeControl.propTypes = {
  isPlaying: PropTypes.bool.isRequired,

  loadingPause: PropTypes.bool.isRequired,
  loadingResume: PropTypes.bool.isRequired,
  loadingPrevious: PropTypes.bool.isRequired,
  loadingNext: PropTypes.bool.isRequired,
{'fraction_non_alphanumeric': 0.10284772887738292, 'fraction_numerical': 0.0, 'mean_word_length': 2.610875106202209, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6597961', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1280, 'n_words': 228}