<commit_before>import React from 'react';
import ReactDOM from 'react-dom';
import Layout from '../components/layout.jsx';
import Profile from '../components/profile.jsx';
import AppList from '../components/appList.jsx';

class Dashboard extends React.Component {
  constructor (props) {
    super(props);
    this.state = {data: window.initialData};
  }
  render () {
    return <div>
      <Layout>
        <Profile name={this.state.data.name} cn={this.state.data.cn} />
        <AppList apps={this.state.data.apps} />
      </Layout>
    </div>;<commit_msg>sort apps by creation date<commit_after>import React from 'react';
import ReactDOM from 'react-dom';
import Layout from '../components/layout.jsx';
import Profile from '../components/profile.jsx';
import AppList from '../components/appList.jsx';
import moment from 'moment';

class Dashboard extends React.Component {
  constructor (props) {
    super(props);
    window.initialData.apps.sort((a, b) => {
      let dateA = moment(a.created);
      let dateB = moment(b.created);

      if(dateA.isBefore(dateB)){
        return -1;
      } else if (dateB.isBefore(dateA)){
        return 1;
      } else {
        return 0;
      }
    });
    this.state = {data: window.initialData};
  }
  render () {
    return <div>
      <Layout>
        <Profile name={this.state.data.name} cn={this.state.data.cn} />
        <AppList apps={this.state.data.apps} />
      </Layout>
    </div>;
{'fraction_non_alphanumeric': 0.1539528432732316, 'fraction_numerical': 0.0020804438280166435, 'mean_word_length': 2.8377659574468086, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 16, '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': '5309916', 'n_tokens_mistral': 451, 'n_tokens_neox': 447, 'n_words': 108}