mirror of
https://github.com/Alamantus/Lexiconga.git
synced 2025-06-26 02:44:17 +02:00
Update app state to display words
This commit is contained in:
parent
55495f9f7f
commit
d34a86dc1b
4 changed files with 17 additions and 9 deletions
|
@ -7,7 +7,7 @@ import {WordForm} from './management/WordForm';
|
||||||
import {DictionaryDetails} from './display/DictionaryDetails';
|
import {DictionaryDetails} from './display/DictionaryDetails';
|
||||||
import {WordsList} from './display/WordsList';
|
import {WordsList} from './display/WordsList';
|
||||||
|
|
||||||
export const MainDisplay = ({dictionaryInfo, wordsToDisplayPromise}) => {
|
export const MainDisplay = ({dictionaryInfo, wordsToDisplay, updateDisplay, lastRender}) => {
|
||||||
return (
|
return (
|
||||||
<section className='section'>
|
<section className='section'>
|
||||||
<div className='container'>
|
<div className='container'>
|
||||||
|
@ -15,6 +15,7 @@ export const MainDisplay = ({dictionaryInfo, wordsToDisplayPromise}) => {
|
||||||
|
|
||||||
<LeftColumn>
|
<LeftColumn>
|
||||||
<WordForm
|
<WordForm
|
||||||
|
updateDisplay={() => updateDisplay()}
|
||||||
partsOfSpeech={dictionaryInfo.partsOfSpeech}
|
partsOfSpeech={dictionaryInfo.partsOfSpeech}
|
||||||
/>
|
/>
|
||||||
</LeftColumn>
|
</LeftColumn>
|
||||||
|
@ -34,7 +35,8 @@ export const MainDisplay = ({dictionaryInfo, wordsToDisplayPromise}) => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<WordsList
|
<WordsList
|
||||||
wordsPromise={wordsToDisplayPromise} />
|
lastRender={lastRender}
|
||||||
|
words={wordsToDisplay} />
|
||||||
</RightColumn>
|
</RightColumn>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,15 +15,14 @@ export class WordsList extends Component {
|
||||||
return (
|
return (
|
||||||
<div className='box'>
|
<div className='box'>
|
||||||
|
|
||||||
{this.props.wordsPromise
|
{this.props.words
|
||||||
&& this.props.wordsPromise.then(words => {
|
&& this.props.words.map(word => {
|
||||||
words.map(word => {
|
|
||||||
return (
|
return (
|
||||||
<WordDisplay key={`word_${word.id}`}
|
<WordDisplay key={`word_${word.id}`}
|
||||||
word={word} />
|
word={word} />
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
})}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -72,6 +72,7 @@ export class WordForm extends Component {
|
||||||
word.create()
|
word.create()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.clearForm();
|
this.clearForm();
|
||||||
|
this.props.updateDisplay();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ class App extends Component {
|
||||||
, specification: dictionary.specification
|
, specification: dictionary.specification
|
||||||
, description: dictionary.description
|
, description: dictionary.description
|
||||||
, partsOfSpeech: dictionary.partsOfSpeech
|
, partsOfSpeech: dictionary.partsOfSpeech
|
||||||
|
, displayedWords: []
|
||||||
, searchConfig: null
|
, searchConfig: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,11 +40,15 @@ class App extends Component {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
get wordsToDisplayPromise () {
|
updateDisplayedWords () {
|
||||||
// const {searchIn, searchTerm, filteredPartsOfSpeech} = this.state.searchConfig;
|
// const {searchIn, searchTerm, filteredPartsOfSpeech} = this.state.searchConfig;
|
||||||
|
|
||||||
// TODO: Sort out searching to remove this temporary solution.
|
// TODO: Sort out searching to remove this temporary solution.
|
||||||
return dictionary.wordsPromise;
|
dictionary.wordsPromise.then(words => {
|
||||||
|
this.setState({
|
||||||
|
displayedWords: words
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
search (searchConfig) {
|
search (searchConfig) {
|
||||||
|
@ -60,7 +65,8 @@ class App extends Component {
|
||||||
|
|
||||||
<MainDisplay
|
<MainDisplay
|
||||||
dictionaryInfo={this.dictionaryInfo}
|
dictionaryInfo={this.dictionaryInfo}
|
||||||
wordsToDisplay={this.wordsToDisplayPromise} />
|
wordsToDisplay={this.state.displayedWords}
|
||||||
|
updateDisplay={() => this.updateDisplayedWords()} />
|
||||||
|
|
||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue