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

View File

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

View File

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

View File

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