<commit_before>import React, { Component } from 'react';
import * as firebase from 'firebase';
import './index.css';

var channel = window.location.pathname.slice(1).toLowerCase(),
    user = window.location.search.slice(1);


class Destiny extends Component {

  constructor(props) {
    super(props);
    this.state = {
      destinyPoint: {},
      destinyRef: firebase.database().ref().child(`${channel}`).child('destiny'),
      message: {},
      messageRef: firebase.database().ref().child(`${channel}`).child('message'),
    };
  }

  componentDidMount() {
    this.state.destinyRef.on('value', snap => {
      if (snap.val() != null) {
      this.setState({
        destinyPoint: snap.val()
        });
      } else {
        this.setState({
          destinyPoint: 0
          });
      }
    });
  }

  destinyAdd() {
    this.state.destinyRef.push().set('lightside');
    this.state.messageRef.push().set(`${user} added a light side point.`);
  }
  destinyRemove() {
    if (this.state.destinyPoint !== 0) {
      this.state.destinyRef.child(Object.keys(this.state.destinyPoint)[Object.keys(this.state.destinyPoint).length-1]).remove();
      this.state.messageRef.push().set(`${user} removed a destiny point.`);
    }
  }
  flip (v, k) {
    if (v === 'lightside') {
      this.state.destinyRef.child(k).set('darkside');
      this.state.messageRef.push().set(`${user} used a light side point.`)
    } else {
      this.state.destinyRef.child(k).set('lightside');
      this.state.messageRef.push().set(`${user} used a dark side point.`)
    }
  }

  render() {
    return (
      <div className='App'>
        <div className="destiny-box">
          <div style={{float: 'left', marginLeft: 6}}>
            <button className='btnAdd' onClick={this.destinyAdd.bind(this)}>⬆</button>
            <button className='btnAdd' onClick={this.destinyRemove.bind(this)}>⬇</button>
          </div>
          <div style={{marginLeft: 40}}>
            {Object.entries(this.state.destinyPoint).map(([k,v])=>
              <span
              key={k}
              onClick={this.flip.bind(this, v, k)}>
              <img<commit_msg>css tweaks<commit_after>import React, { Component } from 'react';
import * as firebase from 'firebase';
import './index.css';

var channel = window.location.pathname.slice(1).toLowerCase(),
    user = window.location.search.slice(1);


class Destiny extends Component {

  constructor(props) {
    super(props);
    this.state = {
      destinyPoint: {},
      destinyRef: firebase.database().ref().child(`${channel}`).child('destiny'),
      message: {},
      messageRef: firebase.database().ref().child(`${channel}`).child('message'),
    };
  }

  componentDidMount() {
    this.state.destinyRef.on('value', snap => {
      if (snap.val() != null) {
      this.setState({
        destinyPoint: snap.val()
        });
      } else {
        this.setState({
          destinyPoint: 0
          });
      }
    });
  }

  destinyAdd() {
    this.state.destinyRef.push().set('lightside');
    this.state.messageRef.push().set(`${user} added a light side point.`);
  }
  destinyRemove() {
    if (this.state.destinyPoint !== 0) {
      this.state.destinyRef.child(Object.keys(this.state.destinyPoint)[Object.keys(this.state.destinyPoint).length-1]).remove();
      this.state.messageRef.push().set(`${user} removed a destiny point.`);
    }
  }
  flip (v, k) {
    if (v === 'lightside') {
      this.state.destinyRef.child(k).set('darkside');
      this.state.messageRef.push().set(`${user} used a light side point.`)
    } else {
      this.state.destinyRef.child(k).set('lightside');
      this.state.messageRef.push().set(`${user} used a dark side point.`)
    }
  }

  render() {
    return (
      <div className='App'>
        <div className="destiny-box">
          <div style={{float: 'left', marginLeft: 6}}>
            <button className='btnAdd' onClick={this.destinyAdd.bind(this)}>⬆</button>
            <button className='btnAdd' onClick={this.destinyRemove.bind(this)}>⬇</button>
          </div>
          <div style={{marginLeft: '45px', marginTop: '5px', paddingTop: '5px'}}>
            {Object.entries(this.state.destinyPoint).map(([k,v])=>
              <span
              key={k}
              onClick={this.flip.bind(this, v, k)}>
              <img
{'fraction_non_alphanumeric': 0.18384401114206128, 'fraction_numerical': 0.004178272980501393, 'mean_word_length': 2.6641156462585034, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, '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': '7341012', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1391, 'n_words': 224}