{"size": 2135, "ext": "js", "max_stars_repo_path": "shared/pages/CoinInfo/tabs/Socials/Socials.js", "max_stars_repo_name": "enachi1046/coinstats", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "shared/pages/CoinInfo/tabs/Socials/Socials.js", "max_issues_repo_name": "enachi1046/coinstats", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "shared/pages/CoinInfo/tabs/Socials/Socials.js", "max_forks_repo_name": "enachi1046/coinstats", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.2465753425, "max_line_length": 274, "alphanum_fraction": 0.5915690867}
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Row, Col } from 'reactstrap';
import { isClient } from 'utils/env/index';

import TwitterIFrame from '../../components/TwitterIFrame';
import RedditIFrame from '../../components/RedditIFrame';

class SocialsTab extends Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    if (isClient()) {
      const href = window.location.href.split('/');
      const tab = href[href.length - 1];
      if (tab === 'socials') {
        this.props.onTitleChange(
          `${this.props.coin.name} (${
            this.props.coin.symbol
          }/USD) Price | Cryptocurrency News | Coin Stats`,
        );
        this.props.onDescriptionChange(
          `Cryptocurrency news, updates and discussions from social media; Twitter and Reddit. Coin Stats provides ${
            this.props.coin.name
          } (${
            this.props.coin.symbol
          }) latest news, price changes, charts, market cap, volume...`,
        );
        this.props.onKeyWordsChange(
          `${
            this.props.coin.name
          } price, ${this.props.coin.symbol.toLowerCase()} news, ${this.props.coin.name.toLowerCase()} news, ${this.props.coin.symbol.toLowerCase()} twitter, ${this.props.coin.symbol.toLowerCase()} reddit, cryptocurrency news, ${this.props.coin.name.toLowerCase()} chart, ${
            this.props.coin.symbol
          } chart, cryptocurrency, crypto news`,
        );
      }
    }
  }

  render() {
    const { coin } = this.props;
    return (
      <div className="coin-info-socials">
        <Row>
          <Col md={6}>
            {coin.twitterUrl ? <TwitterIFrame url={coin.twitterUrl} /> : null}
          </Col>
          <Col md={6}>
            {coin.redditUrl ? <RedditIFrame url={coin.redditUrl} /> : null}
          </Col>
        </Row>
      </div>
    );
  }
}

function mapStateToProps(state) {
  return {
    news: state.news.newsByCoin || [],
  };
}

function mapDispatchToProps(dispatch) {
  return {};
}

export default connect(
  mapStateToProps,
  mapDispatchToProps,
)(SocialsTab);
