<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';
import actions from '../../actions';

class SetlistSongsInputList extends Component {
  constructor(props) {
    super(props);
    this.state = {
      active: false,
      song: { ...this.props.song }
    }
  }
  saveSong = () => {
    const { song, saveSetlistSong, setlistId } = this.props;
    const updateBody = this.state.song
    saveSetlistSong(setlistId, song._id, updateBody);
    this.setState({ active: false });
  }
  deleteSong = () => {
    const { song, deleteSetlistSong, setlistId } = this.props;
    deleteSetlistSong(setlistId, song._id);
  }
  renderActionButtons = () => {
    return this.state.active
    ? (
      <div>
        <button
          onClick={this.deleteSong}
          className="btn btn-danger">
          Delete
        </button>
        <button
          onClick={this.saveSong}
          className="btn btn-primary">
          Save
        </button>
      </div>
    )
    : <div></div>;
  }
  render() {
    return (
      <div className="form-group row">
        <div className="col-md-8">
        <input
          value={this.state.song.name}
          ref={songName => this.songName = songName}
          onChange={() => this.setState({ song: { name: this.songName.value } })}
          onFocus={() => this.setState({ active: true })}
          className="form-control"/>
        </div>
        {this.renderActionButtons()}
      </div>
    );
  }
}
const mapStateToProps = state => ({ setlistId: state.setlist._id });
export default connect(mapStateToProps, actions)(SetlistSongsInputList);
<commit_msg>Added unreleased checkbox and lyrics textarea.<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';
import actions from '../../actions';

class SetlistSongsInputList extends Component {
  constructor(props) {
    super(props);
    this.state = {
      active: false,
      song: { ...this.props.song }
    }
  }
  saveSong = () => {
    const { song, saveSetlistSong, setlistId } = this.props;
    const updateBody = this.state.song
    saveSetlistSong(setlistId, song._id, updateBody);
    this.setState({ active: false });
  }
  deleteSong = () => {
    const { song, deleteSetlistSong, setlistId } = this.props;
    deleteSetlistSong(setlistId, song._id);
  }
  renderLyricsTextArea = () => {
    return this.state.active
    ? (
      <div className="col-md-12">
        <p>Lyrics</p>
        <textarea
          ref={lyrics => this.lyrics = lyrics}
          placeholder="Enter the lyrics to this song"
          className="form-control"
          onChange={() => this.setState({ song: { ...this.state.song, lyrics: this.lyrics.value } })}>
        </textarea>
      </div>
    )
    : <div></div>
  }
  renderUnreleasedCheckBox = () => {
    return this.state.active
    ? (
      <div className="col-md-6">
        <p>This song is unreleased</p>
        <input
          type="checkbox"
          ref={unreleased => this.unreleased = unreleased}
          onChange={() => this.setState({ song: { ...this.state.song, unreleased: this.unreleased.checked } })}
          className="form-control"/>
      </div>
    )
    : <div></div>
  }
  renderActionButtons = () => {
    return this.state.active
    ? (
      <div className="col-md-6">
        <button
          onClick={this.deleteSong}
          className="btn btn-danger">
          Delete
        </button>
        <button
          onClick={this.saveSong}
          className="btn btn-primary">
          Save
        </button>
      </div>
    )
    : <div></div>;
  }
  render() {
    return (
      <div className="form-group row">
        <div className="col-md-12">
        <input
          value={this.state.song.name}
          ref={songName => this.songName = songName}
          onChange={() => this.setState({ song: { ...this.state.song, name: this.songName.value } })}
          onFocus={() => this.setState({ active: true })}
          className="form-control"/>
        </div>
        <div className="col-md-12">
          {this.renderUnreleasedCheckBox()}
          {this.renderActionButtons()}
          {this.renderLyricsTextArea()}
        </div>
      </div>
    );
  }
}
const mapStateToProps = state => ({ setlistId: state.setlist._id });
export default connect(mapStateToProps, actions)(SetlistSongsInputList);

{'fraction_non_alphanumeric': 0.15335463258785942, 'fraction_numerical': 0.002053856686444546, 'mean_word_length': 2.2442635085122133, 'pattern_counts': {'":': 0, '<': 46, '<?xml version=': 0, '>': 66, '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': '6269172', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1338, 'n_words': 259}