ensl_gathers/app/javascripts/components/gatherArchive.js

36 lines
913 B
JavaScript
Raw Permalink Normal View History

import React from "react";
import { array } from "prop-types";
import { CompletedGather } from "javascripts/components/gather";
2016-02-18 15:36:03 +00:00
class ArchivedGathers extends React.Component {
static propTypes = {
archive: array.isRequired,
maps: array.isRequired
}
2016-02-18 15:36:03 +00:00
render = () => {
let archive = this.props.archive
.sort((a, b) => {
return new Date(b.createdAt) - new Date(a.createdAt);
})
.map((archivedGather, index) => {
return <CompletedGather
key={archivedGather.gather.done.time}
show={(index === 0) ? true : false}
gather={archivedGather.gather}
maps={this.props.maps} />
});
2016-02-18 15:36:03 +00:00
return (
<div className="panel panel-primary">
<div className="panel-heading">Archived Gathers</div>
<div className="panel-body">
{archive}
</div>
</div>
);
}
}
export { ArchivedGathers }