1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-23 04:18:21 +00:00
Files
seahub/frontend/src/components/review-list-view/review-list-view.js

89 lines
2.5 KiB
JavaScript
Raw Normal View History

2018-11-22 11:05:47 +08:00
import React, { Fragment } from 'react';
2018-10-15 15:51:29 +08:00
import PropTypes from 'prop-types';
import { Nav, NavItem, NavLink } from 'reactstrap';
import classnames from 'classnames';
2018-10-15 15:51:29 +08:00
import { gettext } from '../../utils/constants';
import ReviewListItem from './review-list-item';
const propTypes = {
isItemFreezed: PropTypes.bool.isRequired,
itemsList: PropTypes.array.isRequired,
2018-11-22 17:00:23 +08:00
getReviewList: PropTypes.func.isRequired,
activeTab: PropTypes.string.isRequired,
2018-10-15 15:51:29 +08:00
};
class ReviewListView extends React.Component {
2018-11-22 17:00:23 +08:00
constructor(props) {
super(props);
this.toggle = this.toggle.bind(this);
}
toggle(tab) {
2018-11-14 11:02:07 +08:00
if (this.props.activeTab !== tab) {
2018-11-22 17:00:23 +08:00
this.props.getReviewList(tab);
}
}
2018-10-15 15:51:29 +08:00
render() {
let items = this.props.itemsList;
return (
2018-11-22 11:05:47 +08:00
<Fragment>
<Nav pills>
<NavItem>
<NavLink
2018-11-14 11:02:07 +08:00
className={classnames({ active: this.props.activeTab === 'open' })}
onClick={() => { this.toggle('open');}}
2018-11-22 17:00:23 +08:00
>
2018-11-09 17:32:36 +08:00
{gettext('Open')}
</NavLink>
</NavItem>
<NavItem>
<NavLink
2018-11-14 11:02:07 +08:00
className={classnames({ active: this.props.activeTab === 'finished' })}
onClick={() => { this.toggle('finished');}}
2018-11-22 17:00:23 +08:00
>
2018-11-09 17:32:36 +08:00
{gettext('Published')}
</NavLink>
</NavItem>
<NavItem>
<NavLink
2018-11-14 11:02:07 +08:00
className={classnames({ active: this.props.activeTab === 'closed' })}
onClick={() => { this.toggle('closed');}}
2018-11-22 17:00:23 +08:00
>
2018-11-09 17:32:36 +08:00
{gettext('Closed')}
</NavLink>
</NavItem>
</Nav>
2018-10-15 15:51:29 +08:00
<table>
<thead>
<tr>
<th style={{width: '4%'}}>{/*img*/}</th>
<th style={{width: '26%'}}>{gettext('Name')}</th>
2018-11-14 11:02:07 +08:00
<th style={{width: '25%'}}>{gettext('Library')}</th>
2018-10-15 15:51:29 +08:00
<th style={{width: '20%'}}>{gettext('Last Update')}</th>
2018-11-14 11:02:07 +08:00
<th style={{width: '10%'}}>{gettext('Author')}</th>
<th style={{width: '15%'}}>{gettext('Reviewers')}</th>
2018-10-15 15:51:29 +08:00
</tr>
</thead>
<tbody>
{ items && items.map((item) => {
2018-11-14 11:02:07 +08:00
return (
2018-11-22 17:00:23 +08:00
<ReviewListItem
key={item.id}
item={item}
isItemFreezed={this.props.isItemFreezed}
/>
2018-11-14 11:02:07 +08:00
);
2018-10-15 15:51:29 +08:00
})}
</tbody>
</table>
2018-11-22 11:05:47 +08:00
</Fragment>
2018-10-15 15:51:29 +08:00
);
}
}
ReviewListView.propTypes = propTypes;
export default ReviewListView;