Search integration (React Version) (#84)

* algolia integration skeleton

* Configuration Defaults

* Implemented partial entries with lazy loading of complete file

* Moved backend selection logic to actioncreators

* basic pagination for entries

* general search skeleton

* Basic search result listing

* Redo search for different search terms

* search results pagination

* Changing integration config & handling

* Changing integration config & handling

* new integration config model
This commit is contained in:
Cássio Souza
2016-10-10 15:34:21 -03:00
committed by GitHub
parent 45d810a25f
commit 2815a86e0c
25 changed files with 493 additions and 111 deletions

View File

@ -9,6 +9,7 @@ import styles from './CollectionPage.css';
import CollectionPageHOC from './editorialWorkflow/CollectionPageHOC';
class DashboardPage extends React.Component {
static propTypes = {
collection: ImmutablePropTypes.map.isRequired,
collections: ImmutablePropTypes.orderedMap.isRequired,
@ -30,16 +31,21 @@ class DashboardPage extends React.Component {
}
}
handleLoadMore = (page) => {
const { collection, dispatch } = this.props;
dispatch(loadEntries(collection, page));
};
render() {
const { collections, collection, entries } = this.props;
const { collections, collection, page, entries } = this.props;
if (collections == null) {
return <h1>No collections defined in your config.yml</h1>;
}
return <div className={styles.root}>
{entries ?
<EntryListing collection={collection} entries={entries}/>
<EntryListing collections={collection} entries={entries} page={page} onPaginate={this.handleLoadMore}>
Listing {collection.get('name')}
</EntryListing>
:
<Loader active>{['Loading Entries', 'Caching Entries', 'This might take several minutes']}</Loader>
}
@ -58,9 +64,11 @@ function mapStateToProps(state, ownProps) {
const { collections } = state;
const { name, slug } = ownProps.params;
const collection = name ? collections.get(name) : collections.first();
const page = state.entries.getIn(['pages', collection.get('name'), 'page']);
const entries = selectEntries(state, collection.get('name'));
return { slug, collection, collections, entries };
return { slug, collection, collections, page, entries };
}
export default connect(mapStateToProps)(DashboardPage);