Merge branch 'master' of github.com:coralproject/talk into e2e-browserstack

This commit is contained in:
Belen Curcio
2017-10-13 08:02:58 -03:00
37 changed files with 11892 additions and 1102 deletions
@@ -5,6 +5,7 @@ import Table from '../containers/Table';
import {Pager, Icon} from 'coral-ui';
import EmptyCard from '../../../components/EmptyCard';
import t from 'coral-framework/services/i18n';
import PropTypes from 'prop-types';
const tableHeaders = [
{
@@ -62,4 +63,12 @@ const People = ({commenters, searchValue, onSearchChange, ...props}) => {
);
};
People.propTypes = {
commenters: PropTypes.array,
searchValue: PropTypes.string,
onSearchChange: PropTypes.func,
totalPages: PropTypes.number,
onNewPageHandler: PropTypes.func,
};
export default People;
@@ -19,6 +19,13 @@
}
}
.username, .email {
max-width: 215px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.email {
display: block;
}
@@ -2,8 +2,10 @@ import React from 'react';
import {SelectField, Option} from 'react-mdl-selectfield';
import styles from '../components/Table.css';
import t from 'coral-framework/services/i18n';
import PropTypes from 'prop-types';
import cn from 'classnames';
export default ({headers, commenters, onHeaderClickHandler, onRoleChange, onCommenterStatusChange, viewUserDetail}) => (
const Table = ({headers, commenters, onHeaderClickHandler, onRoleChange, onCommenterStatusChange, viewUserDetail}) => (
<table className={`mdl-data-table ${styles.dataTable}`}>
<thead>
<tr>
@@ -21,7 +23,7 @@ export default ({headers, commenters, onHeaderClickHandler, onRoleChange, onComm
{commenters.map((row, i)=> (
<tr key={i}>
<td className="mdl-data-table__cell--non-numeric">
<button onClick={() => {viewUserDetail(row.id);}} className={styles.button}>{row.username}</button>
<button onClick={() => {viewUserDetail(row.id);}} className={cn(styles.username, styles.button)}>{row.username}</button>
<span className={styles.email}>{row.profiles.map(({id}) => id)}</span>
</td>
<td className="mdl-data-table__cell--non-numeric">
@@ -54,3 +56,14 @@ export default ({headers, commenters, onHeaderClickHandler, onRoleChange, onComm
</tbody>
</table>
);
Table.propTypes = {
headers: PropTypes.array,
commenters: PropTypes.array,
onHeaderClickHandler: PropTypes.func,
onRoleChange: PropTypes.func,
onCommenterStatusChange: PropTypes.func,
viewUserDetail: PropTypes.func,
};
export default Table;
@@ -1,10 +1,10 @@
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {compose} from 'react-apollo';
import {setRole, setCommenterStatus} from '../../../actions/community';
import Table from '../components/Table';
import {viewUserDetail} from '../../../actions/userDetail';
import PropTypes from 'prop-types';
class TableContainer extends Component {
@@ -22,6 +22,12 @@ class TableContainer extends Component {
}
}
TableContainer.propTypes = {
setRole: PropTypes.func,
setCommenterStatus: PropTypes.func,
commenters: PropTypes.array,
};
const mapStateToProps = (state) => ({
commenters: state.community.accounts,
});
@@ -33,7 +39,5 @@ const mapDispatchToProps = (dispatch) =>
viewUserDetail,
}, dispatch);
export default compose(
connect(mapStateToProps, mapDispatchToProps),
)(TableContainer);
export default connect(mapStateToProps, mapDispatchToProps)(TableContainer);
@@ -20,7 +20,7 @@
.mainContent {
width: calc(100% - 300px);
padding: 10px 14px;
padding: 10px 14px 80px 14px;
box-sizing: border-box;
max-width: 718px;
}
@@ -3,6 +3,7 @@
align-items: flex-start;
min-height: 100px;
max-width: 600px;
overflow: visible;
}
.header {
+8 -3
View File
@@ -85,9 +85,14 @@ export class CommentForm extends React.Component {
render() {
const {maxCharCount, submitEnabled, cancelButtonClassName, submitButtonClassName, charCountEnable, body, loadingState} = this.props;
const length = body.trim().length;
const isRespectingMaxCount = (length) => charCountEnable && maxCharCount && length > maxCharCount;
const disableSubmitButton = !length || isRespectingMaxCount(length) || !submitEnabled({body}) || loadingState === 'loading';
const length = body.length;
const isRespectingMaxCount = (length) => charCountEnable && maxCharCount && length > maxCharCount;
const disableSubmitButton =
!length ||
body.trim().length === 0 ||
isRespectingMaxCount(length) ||
!submitEnabled({body}) ||
loadingState === 'loading';
const disableCancelButton = loadingState === 'loading';
const disableTextArea = loadingState === 'loading';