<commit_before>var React = require("react");
var Reflux = require("reflux");
var Router = require("react-router");

var api = require("../api");
var GroupHeader = require("./groupDetails/header");
var GroupStore = require("../stores/groupStore");
var LoadingError = require("../components/loadingError");
var LoadingIndicator = require("../components/loadingIndicator");
var PropTypes = require("../proptypes");
var utils = require("../utils");

var SharedGroupDetails = React.createClass({
  contextTypes: {
    router: React.PropTypes.func
  },

  mixins: [
    Reflux.listenTo(GroupStore, "onGroupChange")
  ],

  childContextTypes: {
    group: PropTypes.Group,
  },

  getChildContext() {
    return {
      group: this.state.group,
    };
  },

  getInitialState() {
    return {
      group: null,
      loading: true,
      error: false
    };
  },

  componentWillMount() {
    this.fetchData();
  },

  fetchData() {
    this.setState({
      loading: true,
      error: false
    });

    api.request(this.getGroupDetailsEndpoint(), {
      success: (data) => {
        this.setState({
          loading: false
        });
        GroupStore.loadInitialData([data]);
      }, error: () => {
        this.setState({
          loading: false,
          error: true
        });
      }
    });
  },

  onGroupChange(itemIds) {
    var id = this.context.router.getCurrentParams().groupId;
    if (itemIds.has(id)) {
      this.setState({
        group: GroupStore.get(id),
      });
    }
  },

  getGroupDetailsEndpoint() {
    var id = this.context.router.getCurrentParams().shareId;

    return '/groups/?shareId=' + id;
  },

  render() {
    var group = this.state.group;
    var params = this.context.router.getCurrentParams();

    if (this.state.loading)
      return <LoadingIndicator />;
    else if (this.state.error)
      return <LoadingError onRetry={this.fetchData} />;

    return (
      <div className={this.props.className}>
        Group Details
      </div>
    );<commit_msg>Render basics of page layout for shared event<commit_after>var React = require("react");
var Reflux = require("reflux");
var Router = require("react-router");

var api = require("../api");
var Count = require("../components/count");
var DocumentTitle = require("react-document-title");
var Footer = require("../components/footer");
var Header = require("../components/header");
var LoadingError = require("../components/loadingError");
var LoadingIndicator = require("../components/loadingIndicator");
var PropTypes = require("../proptypes");

var SharedGroupHeader = React.createClass({
  render() {
    var group = this.props.group,
        userCount = 0;

    if (group.tags["sentry:user"] !== undefined) {
      userCount = group.tags["sentry:user"].count;
    }

    return (
      <div className="group-detail">
        <div className="row">
          <div className="col-sm-9 details">
            <h3>
              {group.title}
            </h3>
            <div className="event-message">
              <span className="message">{group.culprit}</span>
            </div>
          </div>
          <div className="col-sm-3 stats">
            <div className="row">
              <div className="col-xs-6 count align-right">
                <Count value={group.count} />
                <span className="count-label">events</span>
              </div>
              <div className="col-xs-6 count align-right">
                <Count value={userCount} />
                <span className="count-label">users</span>
              </div>
            </div>
          </div>
        </div>
        <ul className="nav nav-tabs">
          <li className="active"><a>Overview</a></li>
        </ul>
      </div>
    );
  }
});

var SharedGroupDetails = React.createClass({
  contextTypes: {
    router: React.PropTypes.func
  },

  childContextTypes: {
    group: PropTypes.Group,
  },

  getChildContext() {
    return {
      group: this.state.group,
    };
  },

  getInitialState() {
    return {
      group: null,
      loading: true,
      error: false
    };
  },

  getTitle() {
    if (this.state.group)
      return this.state.group.title + ' | Sentry';
    return 'Sentry';
  },

  componentWillMount() {
    this.fetchData();
  },

  fetchData() {
    this.setState({
      loading: true,
      error: false
    });

    api.request(this.getGroupDetailsEndpoint(), {
      success: (data) => {
        this.setState({
          loading: false,
          group: data
        });
      }, error: () => {
        this.setState({
          loading: false,
          error: true
        });
      }
    });
  },

  getGroupDetailsEndpoint() {
    var id = this.context.router.getCurrentParams().shareId;

    return '/groups/?shareId=' + id;
  },

  render() {
    var group = this.state.group;
    var params = this.context.router.getCurrentParams();

    if (this.state.loading || !group)
      return <LoadingIndicator />;
    else if (this.state.error)
      return <LoadingError onRetry={this.fetchData} />;

    return (
      <DocumentTitle title={this.getTitle()}>
        <div className="app">
          <Header />
          <div className="container">
            <div className="content">
              <SharedGroupHeader group={group} />
              <div className="group-overview">
              </div>
            </div>
          </div>
          <Footer />
        </div>
      </DocumentTitle>
    );
{'fraction_non_alphanumeric': 0.15531836584468164, 'fraction_numerical': 0.0012881854987118145, 'mean_word_length': 2.1727962638645653, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 58, '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': '6886345', 'n_tokens_mistral': 1605, 'n_tokens_neox': 1581, 'n_words': 314}