import Inferno from 'inferno';
import Component from 'inferno-component';
import marked from 'marked';
import helper from '../../../Helper';
import { Modal } from '../../structure/Modal';
import { EditDictionaryForm } from './EditDictionaryForm';
import { EditLinguisticsForm } from './EditLinguisticsForm';
const DISPLAY = {
DETAILS: 1,
LINGUISTICS: 2,
SETTINGS: 3,
}
export class EditDictionaryModal extends Component {
constructor (props) {
super(props);
this.state = {
currentDisplay: DISPLAY.DETAILS,
name: props.name,
specification: props.specification,
description: props.description,
partsOfSpeech: props.partsOfSpeech.join('\n'),
consonants: props.details.phonology.consonants.join(' '),
vowels: props.details.phonology.vowels.join(' '),
blends: props.details.phonology.blends.join(' '),
onset: props.details.phonology.phonotactics.onset.join(' '),
nucleus: props.details.phonology.phonotactics.nucleus.join(' '),
coda: props.details.phonology.phonotactics.coda.join(' '),
exceptions: props.details.phonology.phonotactics.exceptions,
hasChanged: false,
}
}
hasChanged () {
return (
this.state.name != this.props.name
|| this.state.specification != this.props.specification
|| this.state.description != this.props.description
|| this.state.partsOfSpeech != this.props.partsOfSpeech.join('\n')
);
}
toggleDisplay (display) {
this.setState({
currentDisplay: display,
});
}
displaySection () {
let displayJSX;
switch(this.state.currentDisplay) {
case DISPLAY.DETAILS : {
displayJSX = (
Settings!