<commit_before>import React, { Component } from 'react';

// Controls
import InlineEdit from '../../common/InlineEdit';

import Dropzone from 'react-dropzone';

/*
 * A single Agendum.
 */
export default class Agendum extends Component {
    constructor(props) {
        super(props);
        this.state = {
            isEditing: false
        }
    }

    onFieldEditModeChange = (isEditMode) => this.setState({ isEditing: isEditMode })
    onFieldChange = (e, field, value) => {
        if (e.key === 'Enter') {
            this.props.onAgendumChange({ [field]: value });
        }
    }

    render() {
        /* 
            At the end of the agenda list (of "existing" agendums)
            There will be a stripped down version of the Agendum
            component which allows you to set a title, thus creating
            a new agendum (which will then become and "existing" agendum).

            This section renders that stripped down component.
        */
        if (!this.props.isExistingAgendum) {
            return(
                <div className="card grey lighten-3">
                    <div className="card-content">
                        <span className="card-title" id="new_title">
                            <input type="text"
                                onKeyUp={(e) => this.onFieldChange(e, e.target.name, e.target.value)}
                                placeholder="New Agendum"
                                name="title" />
                        </span>
                    </div>
                </div>
            );
        }

        // If we've made it this far, this is an "existing" agendum.
        const descriptionValue = this.props.agendum.description 
            || "Click here to add a description.";

        return(
            <div className={`card ${this.props.agendum.selected ? "selected" : ""}`}
                onClick={() => this.props.onAgendumSelect(this.props.agendum.id)}>

                <div className="card-head">
                    <span className="card-title" id={`${this.props.agendum.id}_title`}>
                        <InlineEdit<commit_msg>Fix bug with editing existing agendums<commit_after>import React, { Component } from 'react';

// Controls
import InlineEdit from '../../common/InlineEdit';

import Dropzone from 'react-dropzone';

/*
 * A single Agendum.
 */
export default class Agendum extends Component {
    constructor(props) {
        super(props);
        this.state = {
            isEditing: false
        }
    }

    onFieldEditModeChange = (isEditMode) => this.setState({ isEditing: isEditMode })
    onFieldChange = (field, value) => this.props.onAgendumChange({ [field]: value });

    onNewAgendumTitleChange = (e) => {
        if (e.key === 'Enter') {
            this.props.onAgendumChange({ [e.target.name]: e.target.value });
        }
    }

    render() {
        /* 
            At the end of the agenda list (of "existing" agendums)
            There will be a stripped down version of the Agendum
            component which allows you to set a title, thus creating
            a new agendum (which will then become and "existing" agendum).

            This section renders that stripped down component.
        */
        if (!this.props.isExistingAgendum) {
            return(
                <div className="card grey lighten-3">
                    <div className="card-content">
                        <span className="card-title" id="new_title">
                            <input type="text"
                                onKeyUp={this.onNewAgendumTitleChange}
                                placeholder="New Agendum"
                                name="title" />
                        </span>
                    </div>
                </div>
            );
        }

        // If we've made it this far, this is an "existing" agendum.
        const descriptionValue = this.props.agendum.description 
            || "Click here to add a description.";

        return(
            <div className={`card ${this.props.agendum.selected ? "selected" : ""}`}
                onClick={() => this.props.onAgendumSelect(this.props.agendum.id)}>

                <div className="card-head">
                    <span className="card-title" id={`${this.props.agendum.id}_title`}>
                        <InlineEdit
{'fraction_non_alphanumeric': 0.11433840479483633, 'fraction_numerical': 0.0004610419548178884, 'mean_word_length': 1.6013189448441247, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 31, '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': '5446468', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1136, 'n_words': 301}