'use strict'; const React = require('react'); const FeatureForm = require('./FeatureForm'); const LogEntryList = require('../log/LogEntryList'); const eventStore = require('../../stores/EventStore'); const Feature = React.createClass({ getInitialState () { return { editMode: false, showHistory: false, events: [], }; }, handleEventsResponse (response) { this.setState({ events: response }); }, toggleHistory () { eventStore.getEventsByName(this.props.feature.name).then(this.handleEventsResponse); this.setState({ showHistory: !this.state.showHistory }); }, toggleEditMode () { this.setState({ editMode: !this.state.editMode }); }, saveFeature (feature) { this.props.onChange(feature); this.toggleEditMode(); }, archiveFeature () { if (window.confirm(`Are you sure you want to delete ${this.props.feature.name}?`)) { // eslint-disable-line no-alert this.props.onArchive(this.props.feature); } }, renderEditMode () { return (