ampache_react/app/components/Artists.jsx
Phyks (Lucas Verney) fffe9c4cd3 Major code review
Major code review, cleaning the code and adding a lot of comments. Also
implements a separate store to keep entities with a reference count and
garbage collection. This closes #15.

Known issues at the moment are:
* Webplayer is no longer working, it has to be refactored.
* AlbumPage is to be implemented.
2016-08-10 21:40:25 +02:00

45 lines
1.2 KiB
JavaScript

// NPM imports
import React, { Component, PropTypes } from "react";
import Immutable from "immutable";
// Other components
import FilterablePaginatedGrid from "./elements/Grid";
import DismissibleAlert from "./elements/DismissibleAlert";
/**
* Paginated artists grid
*/
export default class Artists extends Component {
render () {
// Handle error
let error = null;
if (this.props.error) {
error = (<DismissibleAlert type="danger" text={this.props.error} />);
}
// Define grid props
const grid = {
isFetching: this.props.isFetching,
items: this.props.artists,
itemsType: "artist",
itemsLabel: "app.common.artist",
subItemsType: "albums",
subItemsLabel: "app.common.album"
};
return (
<div>
{ error }
<FilterablePaginatedGrid grid={grid} pagination={this.props.pagination} />
</div>
);
}
}
Artists.propTypes = {
error: PropTypes.string,
isFetching: PropTypes.bool.isRequired,
artists: PropTypes.instanceOf(Immutable.List).isRequired,
pagination: PropTypes.object.isRequired,
};