<commit_before>import React from "react";
import { connect } from "react-redux";
import userManager from "../utils/userManager";
import { loadSubscriptionsStart, loadSubscriptionsSuccess } from "../actions";
import ChannelInfo from "./channelInfo";
import { loadChannels } from "../utils/api";

class MainPage extends React.Component {
  // load the subscriptions
  componentWillMount() {
    this.props.dispatch(loadSubscriptionsStart());
    loadChannels().then(result => {
      this.props.dispatch(loadSubscriptionsSuccess(result));
    });
  }

  // the channels list
  get channels() {
    const { channels } = this.props;
    return (
      <ul style={styles.list}>
        {channels.map(channel => (
          <li key={channel.id} style={styles.li}>
            <ChannelInfo channel={channel} />
          </li>
        ))}
      </ul>
    );
  }

  // display the current user
  showUserInfoButtonClick(event) {}

  render() {
    const { user, channels } = this.props;

    return (
      <div style={styles.root}>
        <div style={styles.title}>
          <h3>Welcome, {user ? user.profile.name : "Mister Unknown"}!</h3>
          <p>Here are some of your YouTube channel subscriptions:</p>
        </div>
        {channels.length > 0 ? (
          this.channels
        ) : (
          <i>You have no subscriptions.</i>
        )}
        <button
          onClick={event => {
            event.preventDefault();
            alert(JSON.stringify(this.props.user, null, 2));
          }}
        >
          Show user info
        </button>
        <button
          onClick={() => {
            event.preventDefault();
            userManager.removeUser(); // removes the user data from sessionStorage
          }}
        >
          Logout
        </button>
      </div>
    );
  }
}

const styles = {
  root: {
    display: "flex",
    flexDirection: "column"
  },
  title: {
    flex: "1 0 auto"
  },
  list: {
    listStyle: "none"
  },
  li: {
    display: "flex"
  }
};

function mapStateToProps(state) {
  return {
    user: state.oidc.user,
    channels: state.subscriptions.channels
  };
}

export default connect(mapStateToProps)(MainPage);
<commit_msg>Added missing event variable to lambda function<commit_after>import React from "react";
import { connect } from "react-redux";
import userManager from "../utils/userManager";
import { loadSubscriptionsStart, loadSubscriptionsSuccess } from "../actions";
import ChannelInfo from "./channelInfo";
import { loadChannels } from "../utils/api";

class MainPage extends React.Component {
  // load the subscriptions
  componentWillMount() {
    this.props.dispatch(loadSubscriptionsStart());
    loadChannels().then(result => {
      this.props.dispatch(loadSubscriptionsSuccess(result));
    });
  }

  // the channels list
  get channels() {
    const { channels } = this.props;
    return (
      <ul style={styles.list}>
        {channels.map(channel => (
          <li key={channel.id} style={styles.li}>
            <ChannelInfo channel={channel} />
          </li>
        ))}
      </ul>
    );
  }

  // display the current user
  showUserInfoButtonClick(event) {}

  render() {
    const { user, channels } = this.props;

    return (
      <div style={styles.root}>
        <div style={styles.title}>
          <h3>Welcome, {user ? user.profile.name : "Mister Unknown"}!</h3>
          <p>Here are some of your YouTube channel subscriptions:</p>
        </div>
        {channels.length > 0 ? (
          this.channels
        ) : (
          <i>You have no subscriptions.</i>
        )}
        <button
          onClick={event => {
            event.preventDefault();
            alert(JSON.stringify(this.props.user, null, 2));
          }}
        >
          Show user info
        </button>
        <button
          onClick={event => {
            event.preventDefault();
            userManager.removeUser(); // removes the user data from sessionStorage
          }}
        >
          Logout
        </button>
      </div>
    );
  }
}

const styles = {
  root: {
    display: "flex",
    flexDirection: "column"
  },
  title: {
    flex: "1 0 auto"
  },
  list: {
    listStyle: "none"
  },
  li: {
    display: "flex"
  }
};

function mapStateToProps(state) {
  return {
    user: state.oidc.user,
    channels: state.subscriptions.channels
  };
}

export default connect(mapStateToProps)(MainPage);

{'fraction_non_alphanumeric': 0.13278008298755187, 'fraction_numerical': 0.00262065953264905, 'mean_word_length': 1.889589905362776, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 51, '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': '328965', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1291, 'n_words': 290}