2017-05-19 06:25:47 +02:00
|
|
|
// import './assets/fonts/fonts.scss';
|
2016-09-22 02:18:54 +02:00
|
|
|
import './sass/main.scss';
|
2016-09-21 22:40:25 +02:00
|
|
|
|
2017-01-14 20:55:42 +01:00
|
|
|
import Inferno from 'inferno';
|
|
|
|
import Component from 'inferno-component';
|
2016-09-21 22:40:25 +02:00
|
|
|
|
2017-04-19 23:11:37 +02:00
|
|
|
import dictionary from './managers/DictionaryData';
|
|
|
|
|
2017-04-04 22:39:35 +02:00
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
|
|
require('inferno-devtools');
|
|
|
|
}
|
|
|
|
|
|
|
|
import {Header} from './components/structure/Header';
|
2017-04-19 23:11:37 +02:00
|
|
|
import {MainDisplay} from './components/MainDisplay';
|
2017-04-04 22:39:35 +02:00
|
|
|
import {Footer} from './components/structure/Footer';
|
|
|
|
|
2017-04-04 06:24:14 +02:00
|
|
|
class App extends Component {
|
|
|
|
constructor (props) {
|
2016-09-21 22:40:25 +02:00
|
|
|
super(props);
|
2017-04-19 23:11:37 +02:00
|
|
|
|
|
|
|
this.state = {
|
|
|
|
name: dictionary.name
|
|
|
|
, specification: dictionary.specification
|
|
|
|
, description: dictionary.description
|
|
|
|
, partsOfSpeech: dictionary.partsOfSpeech
|
|
|
|
, searchConfig: null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
get dictionaryInfo () {
|
|
|
|
const {name, specification, description, partsOfSpeech} = this.state;
|
|
|
|
const info = {
|
|
|
|
name
|
|
|
|
, specification
|
|
|
|
, description
|
|
|
|
, partsOfSpeech
|
|
|
|
};
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2017-05-19 07:43:29 +02:00
|
|
|
get wordsToDisplayPromise () {
|
2017-04-19 23:11:37 +02:00
|
|
|
// const {searchIn, searchTerm, filteredPartsOfSpeech} = this.state.searchConfig;
|
|
|
|
|
|
|
|
// TODO: Sort out searching to remove this temporary solution.
|
2017-05-19 07:43:29 +02:00
|
|
|
return dictionary.wordsPromise;
|
2017-04-19 23:11:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
search (searchConfig) {
|
|
|
|
this.setState({
|
|
|
|
searchConfig: searchConfig
|
|
|
|
});
|
2016-09-22 22:05:49 +02:00
|
|
|
}
|
|
|
|
|
2017-04-04 06:24:14 +02:00
|
|
|
render () {
|
2016-09-21 22:40:25 +02:00
|
|
|
return (
|
2016-09-22 02:18:54 +02:00
|
|
|
<div>
|
2017-04-19 23:11:37 +02:00
|
|
|
<Header
|
|
|
|
search={searchConfig => this.search(searchConfig)} />
|
2017-01-14 20:55:42 +01:00
|
|
|
|
2017-04-19 23:11:37 +02:00
|
|
|
<MainDisplay
|
|
|
|
dictionaryInfo={this.dictionaryInfo}
|
2017-05-19 07:43:29 +02:00
|
|
|
wordsToDisplay={this.wordsToDisplayPromise} />
|
2016-09-27 23:12:48 +02:00
|
|
|
|
2017-04-04 22:39:35 +02:00
|
|
|
<Footer />
|
2016-09-22 02:18:54 +02:00
|
|
|
</div>
|
2016-09-21 22:40:25 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-04 06:24:14 +02:00
|
|
|
Inferno.render(<App />, document.getElementById('site'));
|