<commit_before>// Modules
import React from 'react';
import Relay from 'react-relay';
import { Card, CardActions, CardTitle, CardText } from 'material-ui/Card';
import moment from 'moment';
import IconButton from 'material-ui/IconButton';
import FontIcon from 'material-ui/FontIcon';
import markdownJS from 'markdown';
import Languages from '../../../utils/languages.json';

// Child Components icons
import GithubIcon from '../../shared/icons/github.es6';
import sanitize from '../../../utils/sanitize.es6';

const markdown = markdownJS.markdown;

const Github = (props) => {
  const { achievement, remove } = props;
  const starFields = { pr: 'comments', repo: 'stargazers_count' };
  const count = achievement[starFields[achievement.category]];

  return (
    <div className={`achievement ${achievement.source_name}`}>
      <div className="achievement-block">
        <div className={`achievement-point ${achievement.source_name}`}>
          <GithubIcon />
        </div>

        <div className="achievement-content">
          <Card className="achievement-card full-width">
            <div className="achievement-card-content">
              <h2 className="intro">
                <i className="icon material-icons">lock_open</i>
                <span>Open Source/{achievement.category} </span>
              </h2>

              {achievement.is_owner ?
                <IconButton
                  className="remove"
                  tooltip="Remove"
                  tooltipStyles={{ top: 25 }}
                  onClick={event => remove(event, achievement)}
                >
                  <FontIcon className="material-icons">close</FontIcon>
                </IconButton> : ''
              }

              <time className="date">
                {
                  moment(achievement.created_at, 'YYYY-MM-DD HH:mm:ss [UTC]')
                  .format('MMMM Do YYYY')
                  .toString()
                }
              </time>

              <CardTitle
                className="achievement-card-header"
                title={
                  <div className="title">
                    <a
                      href={achievement.html_url}
                      target="_blank"
                      rel="noopener noreferrer"
                    >
                      {achievement.name || achievement.title}
                    </a>
                  </div>
                }
              />

              <CardText
                className="achievement-card-description"
                dangerouslySetInnerHTML={{
                  __html: sanitize(achievement.description || markdown.toHTML(achievement.body)),
                }}
              />

              <CardActions className="meta">
                {achievement.language ?
                  <span
                    className="badge"
                    style={{
                      backgroundColor: Languages[achievement.language],
                    }}
                  >
                    {achievement.language}
                  </span> : ''
                }

                <span className="badge">
                  {`${count}`}
                  <FontIcon
                    color="#fff"
                    className="material-icons"
                    style={{
                      fontSize: 20,
                      verticalAlign: 'top',
                      marginLeft: 5,
                    }}
                  >
                    star
                  </FontIcon>
                </span>
              </CardActions>
            </div>
          </Card>
        </div>
      </div>
    </div>
  );
};

Github.propTypes = {
  achievement: React.PropTypes.object,
  remove: React.PropTypes.func,
};

const GithubContainer = Relay.createContainer(Github, {
  fragments: {
    achievement: () => Relay.QL`
      fragment on Import {
        id,
        name,
        title,
        source_name,
        description,
        category,
        body,
        developer_id,
        connection_id,
        language,
        html_url,
        is_owner,
        comments,
        stargazers_count,
        pinned,
        created_at,
      }
    `,
  },
});

export default GithubContainer;
<commit_msg>Add as badge<commit_after>// Modules
import React from 'react';
import Relay from 'react-relay';
import { Card, CardActions, CardTitle, CardText } from 'material-ui/Card';
import moment from 'moment';
import IconButton from 'material-ui/IconButton';
import FontIcon from 'material-ui/FontIcon';
import markdownJS from 'markdown';
import Languages from '../../../utils/languages.json';

// Child Components icons
import GithubIcon from '../../shared/icons/github.es6';
import sanitize from '../../../utils/sanitize.es6';

const markdown = markdownJS.markdown;

const Github = (props) => {
  const { achievement, remove } = props;
  const starFields = { pr: 'comments', repo: 'stargazers_count' };
  const count = achievement[starFields[achievement.category]];

  return (
    <div className={`achievement ${achievement.source_name}`}>
      <div className="achievement-block">
        <div className={`achievement-point ${achievement.source_name}`}>
          <GithubIcon />
        </div>

        <div className="achievement-content">
          <Card className="achievement-card full-width">
            <div className="achievement-card-content">
              <h2 className="intro">
                <i className="icon material-icons">lock_open</i>
                <span>Open Source</span>
              </h2>

              {achievement.is_owner ?
                <IconButton
                  className="remove"
                  tooltip="Remove"
                  tooltipStyles={{ top: 25 }}
                  onClick={event => remove(event, achievement)}
                >
                  <FontIcon className="material-icons">close</FontIcon>
                </IconButton> : ''
              }

              <time className="date">
                {
                  moment(achievement.created_at, 'YYYY-MM-DD HH:mm:ss [UTC]')
                  .format('MMMM Do YYYY')
                  .toString()
                }
              </time>

              <CardTitle
                className="achievement-card-header"
                title={
                  <div className="title">
                    <a
                      href={achievement.html_url}
                      target="_blank"
                      rel="noopener noreferrer"
                    >
                      {achievement.name || achievement.title}
                    </a>
                  </div>
                }
              />

              <CardText
                className="achievement-card-description"
                dangerouslySetInnerHTML={{
                  __html: sanitize(achievement.description || markdown.toHTML(achievement.body)),
                }}
              />

              <CardActions className="meta">
                <span className="badge">
                  {achievement.category}
                </span>

                {achievement.language ?
                  <span
                    className="badge"
                    style={{
                      backgroundColor: Languages[achievement.language],
                    }}
                  >
                    {achievement.language}
                  </span> : ''
                }

                <span className="badge">
                  {`${count}`}
                  <FontIcon
                    color="#fff"
                    className="material-icons"
                    style={{
                      fontSize: 20,
                      verticalAlign: 'top',
                      marginLeft: 5,
                    }}
                  >
                    star
                  </FontIcon>
                </span>
              </CardActions>
            </div>
          </Card>
        </div>
      </div>
    </div>
  );
};

Github.propTypes = {
  achievement: React.PropTypes.object,
  remove: React.PropTypes.func,
};

const GithubContainer = Relay.createContainer(Github, {
  fragments: {
    achievement: () => Relay.QL`
      fragment on Import {
        id,
        name,
        title,
        source_name,
        description,
        category,
        body,
        developer_id,
        connection_id,
        language,
        html_url,
        is_owner,
        comments,
        stargazers_count,
        pinned,
        created_at,
      }
    `,
  },
});

export default GithubContainer;

{'fraction_non_alphanumeric': 0.11276346604215456, 'fraction_numerical': 0.002107728337236534, 'mean_word_length': 1.2990578734858682, 'pattern_counts': {'":': 0, '<': 83, '<?xml version=': 0, '>': 89, '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': '6649100', 'n_tokens_mistral': 2250, 'n_tokens_neox': 2126, 'n_words': 411}