fix console warnings

This commit is contained in:
KDSBrowne 2017-12-14 09:31:05 -08:00
parent b450db91f7
commit b59106912a
4 changed files with 28 additions and 34 deletions

View File

@ -1,6 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl, intlShape } from 'react-intl';
import _ from 'lodash';
import Button from '/imports/ui/components/button/component';
import Dropdown from '/imports/ui/components/dropdown/component';
@ -72,12 +73,17 @@ class ActionsDropdown extends Component {
</DropdownTrigger>
<DropdownContent placement="top left">
<DropdownList>
<DropdownListItem
icon="presentation"
label={intl.formatMessage(intlMessages.presentationLabel)}
description={intl.formatMessage(intlMessages.presentationDesc)}
onClick={this.handlePresentationClick}
/>
{
[
(<DropdownListItem
key={_.uniqueId('actions-list-item-')}
icon="presentation"
label={intl.formatMessage(intlMessages.presentationLabel)}
description={intl.formatMessage(intlMessages.presentationDesc)}
onClick={this.handlePresentationClick}
/>)
]
}
</DropdownList>
</DropdownContent>
</Dropdown>

View File

@ -2,11 +2,13 @@ import React, { Component, Children, cloneElement } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import KEY_CODES from '/imports/utils/keyCodes';
import styles from './styles';
import ListItem from './item/component';
import ListSeparator from './separator/component';
import ListTitle from './title/component';
const propTypes = {
/* We should recheck this proptype, sometimes we need to create an container and send to dropdown,
but with this */
@ -14,11 +16,10 @@ const propTypes = {
children: PropTypes.arrayOf((propValue, key, componentName, location, propFullName) => {
if (propValue[key].type !== ListItem &&
propValue[key].type !== ListSeparator &&
propValue[key].type !== ListTitle) {
return new Error(
`Invalid prop \`${propFullName}\` supplied to` +
` \`${componentName}\`. Validation failed.`,
);
propValue[key].type !== ListTitle &&
propValue[key].type.name !== 'UserActions') {
return new Error(`Invalid prop \`${propFullName}\` supplied to` +
` \`${componentName}\`. Validation failed.`);
}
return true;
}).isRequired,
@ -122,6 +123,9 @@ export default class DropdownList extends Component {
}
render() {
//console.log('DropdownList render');
//console.log(this.props.children);
const { children, style, className } = this.props;
const boundChildren = Children.map(children,

View File

@ -8,7 +8,6 @@ import UserList from './component';
const propTypes = {
openChats: PropTypes.arrayOf(String).isRequired,
openChat: PropTypes.string.isRequired,
users: PropTypes.arrayOf(Object).isRequired,
currentUser: PropTypes.shape({}).isRequired,
meeting: PropTypes.shape({}).isRequired,
@ -23,12 +22,6 @@ const propTypes = {
toggleVoice: PropTypes.func.isRequired,
changeRole: PropTypes.func.isRequired,
roving: PropTypes.func.isRequired,
userActions: PropTypes.func.isRequired,
children: PropTypes.Object,
};
const defaultProps = {
children: {},
};
const UserListContainer = (props) => {
@ -36,10 +29,7 @@ const UserListContainer = (props) => {
users,
currentUser,
openChats,
openChat,
userActions,
isBreakoutRoom,
children,
meeting,
getAvailableActions,
normalizeEmojiName,
@ -59,35 +49,28 @@ const UserListContainer = (props) => {
meeting={meeting}
currentUser={currentUser}
openChats={openChats}
openChat={openChat}
isBreakoutRoom={isBreakoutRoom}
setEmojiStatus={setEmojiStatus}
assignPresenter={assignPresenter}
kickUser={kickUser}
toggleVoice={toggleVoice}
changeRole={changeRole}
userActions={userActions}
getAvailableActions={getAvailableActions}
normalizeEmojiName={normalizeEmojiName}
isMeetingLocked={isMeetingLocked}
isPublicChat={isPublicChat}
roving={roving}
>
{children}
</UserList>
/>
);
};
UserListContainer.propTypes = propTypes;
UserListContainer.defaultProps = defaultProps;
export default createContainer(({ params }) => ({
users: Service.getUsers(),
meeting: Meetings.findOne({}),
currentUser: Service.getCurrentUser(),
openChats: Service.getOpenChats(params.chatID),
openChat: params.chatID,
userActions: Service.userActions,
isBreakoutRoom: meetingIsBreakout(),
getAvailableActions: Service.getAvailableActions,
normalizeEmojiName: Service.normalizeEmojiName,

View File

@ -283,11 +283,12 @@ class UserListContent extends Component {
>
{
[
(<DropdownListTitle
description={intl.formatMessage(messages.menuTitleContext)}
key={_.uniqueId('dropdown-list-title')}
>
{user.name}
(
<DropdownListTitle
description={intl.formatMessage(messages.menuTitleContext)}
key={_.uniqueId('dropdown-list-title')}
>
{user.name}
</DropdownListTitle>),
(<DropdownListSeparator key={_.uniqueId('action-separator')} />),
].concat(actions)