diff --git a/src/components/Dictionary.jsx b/src/components/Dictionary.jsx
index d38dfe0..a3b8215 100644
--- a/src/components/Dictionary.jsx
+++ b/src/components/Dictionary.jsx
@@ -8,18 +8,18 @@ export class Dictionary extends React.Component {
super(props);
this.state = {
- name: "New",
- description: "A new dictionary.",
- createdBy: 'Someone',
- words: [],
- nextWordId: 1,
- externalID: 0,
- allowDuplicates: false,
- caseSensitive: false,
- partsOfSpeech: "Noun,Adjective,Verb,Adverb,Preposition,Pronoun,Conjunction",
- sortByEquivalent: false,
- isComplete: false,
- isPublic: false
+ name: this.props.reference.name,
+ description: this.props.reference.description,
+ createdBy: this.props.reference.createdBy,
+ words: this.props.reference.words,
+ nextWordId: this.props.reference.nextWordId,
+ externalID: this.props.reference.externalID,
+ allowDuplicates: this.props.reference.settings.allowDuplicates,
+ caseSensitive: this.props.reference.settings.caseSensitive,
+ partsOfSpeech: this.props.reference.settings.partOfSpeech,
+ sortByEquivalent: this.props.reference.settings.sortByEquivalent,
+ isComplete: this.props.reference.settings.isComplete,
+ isPublic: this.props.reference.settings.isPublic
}
// this.addTestWord();
@@ -28,13 +28,16 @@ export class Dictionary extends React.Component {
showWords() {
let words = this.state.words.map((word, index) => {
return
+ reference={word}
+ initialPosition={index} />;
+ // return ;
});
return
{words}
;
diff --git a/src/components/Word.jsx b/src/components/Word.jsx
index 2d2bc23..9ab46e6 100644
--- a/src/components/Word.jsx
+++ b/src/components/Word.jsx
@@ -5,12 +5,13 @@ export class Word extends React.Component {
super(props);
this.state = {
- name: this.props.name,
- wordId: this.props.wordId,
- pronunciation: this.props.pronunciation || '',
- partOfSpeech: this.props.partOfSpeech || '',
- simpleDefinition: this.props.simpleDefinition || '',
- longDefinition: this.props.longDefinition || '',
+ word: this.props.reference,
+ // name: this.props.name,
+ // wordId: this.props.wordId,
+ // pronunciation: this.props.pronunciation || '',
+ // partOfSpeech: this.props.partOfSpeech || '',
+ // simpleDefinition: this.props.simpleDefinition || '',
+ // longDefinition: this.props.longDefinition || '',
sortPosition: this.props.initialPosition
}
}
@@ -27,35 +28,35 @@ export class Word extends React.Component {
*/
showPronunciation() {
- if (this.state.pronunciation !== '') {
- return {this.state.pronunciation}
;
+ if (this.state.word.pronunciation !== '') {
+ return {this.state.word.pronunciation}
;
}
}
showPartOfSpeech() {
- if (this.state.partOfSpeech !== '') {
- return {this.state.partOfSpeech}
;
+ if (this.state.word.partOfSpeech !== '') {
+ return {this.state.word.partOfSpeech}
;
}
}
showSimpleDefinition() {
- if (this.state.simpleDefinition !== '') {
- return {this.state.simpleDefinition}
;
+ if (this.state.word.simpleDefinition !== '') {
+ return {this.state.word.simpleDefinition}
;
}
}
showLongDefinition() {
- if (this.state.longDefinition !== '') {
- return {this.state.longDefinition}
;
+ if (this.state.word.longDefinition !== '') {
+ return {this.state.word.longDefinition}
;
}
}
render() {
return (
-
+
- {this.state.name}
+ {this.state.word.name}
{this.showPronunciation()}
diff --git a/src/index.jsx b/src/index.jsx
index 7be6df2..70dc000 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -16,10 +16,27 @@ class Lexiconga extends React.Component {
scroll: {
x: 0,
y: 0
- }
- }
+ },
- // this.defaultDictionaryJSON = JSON.stringify(this.state.dictionaryDetails); //Saves a stringifyed default dictionary.
+ currentDictionary: {
+ name: "New",
+ description: "A new dictionary.",
+ createdBy: 'Someone',
+ words: [],
+ settings: {
+ allowDuplicates: false,
+ caseSensitive: false,
+ partsOfSpeech: "Noun,Adjective,Verb,Adverb,Preposition,Pronoun,Conjunction",
+ sortByEquivalent: false,
+ isComplete: false,
+ isPublic: false
+ },
+ nextWordId: 1,
+ externalID: 0
+ }
+ };
+
+ this.defaultDictionaryJSON = JSON.stringify(this.state.dictionaryDetails); //Saves a stringifyed default dictionary.
this.previousDictionary = {};
// this.addTestWord();
@@ -29,8 +46,8 @@ class Lexiconga extends React.Component {
return (
-
-
+
+
);
}