Change statuses and remove .scss suffix

This commit is contained in:
Klaus 2017-09-22 14:03:14 -03:00
parent f6e0785e6f
commit b3dd84505e
13 changed files with 49 additions and 49 deletions

View File

@ -46,19 +46,19 @@ const propTypes = {
); );
} }
return true; return null;
}, },
isOpen: PropTypes.bool, isOpen: PropTypes.bool,
onHide: PropTypes.bool, onHide: PropTypes.func,
onShow: PropTypes.bool, onShow: PropTypes.func,
autoFocus: PropTypes.bool, autoFocus: PropTypes.bool,
}; };
const defaultProps = { const defaultProps = {
children: null, children: null,
isOpen: false, isOpen: false,
onShow: false, onShow: () => { },
onHide: false, onHide: () => { },
autoFocus: false, autoFocus: false,
}; };

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Icon from '/imports/ui/components/icon/component'; import Icon from '/imports/ui/components/icon/component';
import styles from './styles.scss'; import styles from './styles';
const propTypes = { const propTypes = {
icon: PropTypes.string.isRequired, icon: PropTypes.string.isRequired,

View File

@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import styles from './styles.scss'; import styles from './styles';
const intlMessages = defineMessages({ const intlMessages = defineMessages({
unreadPlural: { unreadPlural: {

View File

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { withRouter, Link } from 'react-router'; import { withRouter, Link } from 'react-router';
import cx from 'classnames'; import cx from 'classnames';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import styles from './styles.scss'; import styles from './styles';
import ChatAvatar from './chat-avatar/component'; import ChatAvatar from './chat-avatar/component';
import ChatIcon from './chat-icon/component'; import ChatIcon from './chat-icon/component';
import ChatUnreadMessages from './chat-unread-messages/component'; import ChatUnreadMessages from './chat-unread-messages/component';

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import styles from './styles.scss'; import styles from './styles';
import UserListHeader from './user-list-header/component'; import UserListHeader from './user-list-header/component';
import UserContent from './user-list-content/component'; import UserContent from './user-list-content/component';

View File

@ -5,7 +5,7 @@ import Auth from '/imports/ui/services/auth';
import UnreadMessages from '/imports/ui/services/unread-messages'; import UnreadMessages from '/imports/ui/services/unread-messages';
import Storage from '/imports/ui/services/storage/session'; import Storage from '/imports/ui/services/storage/session';
import mapUser from '/imports/ui/services/user/mapUser'; import mapUser from '/imports/ui/services/user/mapUser';
import { EMOJI_STATUSES } from '/imports/utils/statuses'; import { EMOJI_STATUSES, EMOJI_NORMALIZE } from '/imports/utils/statuses';
import _ from 'lodash'; import _ from 'lodash';
const CHAT_CONFIG = Meteor.settings.public.chat; const CHAT_CONFIG = Meteor.settings.public.chat;
@ -37,21 +37,20 @@ const sortUsersByName = (a, b) => {
}; };
const sortUsersByEmoji = (a, b) => { const sortUsersByEmoji = (a, b) => {
if ((EMOJI_STATUSES.indexOf(a.emoji.status) > -1) const emojiA = a in EMOJI_STATUSES ? EMOJI_STATUSES[a] : a;
&& (EMOJI_STATUSES.indexOf(b.emoji.status) > -1)) { const emojiB = b in EMOJI_STATUSES ? EMOJI_STATUSES[b] : b;
if (emojiA && emojiB) {
if (a.emoji.changedAt < b.emoji.changedAt) { if (a.emoji.changedAt < b.emoji.changedAt) {
return -1; return -1;
} else if (a.emoji.changedAt > b.emoji.changedAt) { } else if (a.emoji.changedAt > b.emoji.changedAt) {
return 1; return 1;
} }
} else if (emojiA) {
return sortUsersByName(a, b);
} else if (EMOJI_STATUSES.indexOf(a.emoji.status) > -1) {
return -1; return -1;
} else if (EMOJI_STATUSES.indexOf(b.emoji.status) > -1) { } else if (emojiB) {
return 1; return 1;
} }
return 0; return 0;
}; };
@ -213,7 +212,7 @@ const getAvailableActions = (currentUser, user, router, isBreakoutRoom) => {
const allowedToChatPrivately = !user.isCurrent; const allowedToChatPrivately = !user.isCurrent;
const allowedToMuteAudio = hasAuthority && user.isVoiceUser && user.isMuted; const allowedToMuteAudio = hasAuthority && user.isVoiceUser && user.isMuted;
const allowedToUnmuteAudio = hasAuthority && user.isVoiceUser && !user.isMuted; const allowedToUnmuteAudio = hasAuthority && user.isVoiceUser && !user.isMuted;
const allowedToResetStatus = hasAuthority && user.emoji.status !== 'none'; const allowedToResetStatus = hasAuthority && user.emoji.status !== EMOJI_STATUSES.none;
// if currentUser is a moderator, allow kicking other users // if currentUser is a moderator, allow kicking other users
const allowedToKick = currentUser.isModerator && !user.isCurrent && !isBreakoutRoom; const allowedToKick = currentUser.isModerator && !user.isCurrent && !isBreakoutRoom;
@ -242,19 +241,9 @@ const getCurrentUser = () => {
return (currentUser) ? mapUser(currentUser) : null; return (currentUser) ? mapUser(currentUser) : null;
}; };
const normalizeEmojiName = (emoji) => { const normalizeEmojiName = emoji => (
const emojisNormalized = { emoji in EMOJI_NORMALIZE ? EMOJI_NORMALIZE[emoji] : emoji
agree: 'thumbs_up', );
disagree: 'thumbs_down',
thumbsUp: 'thumbs_up',
thumbsDown: 'thumbs_down',
raiseHand: 'hand',
away: 'time',
neutral: 'undecided',
};
return emoji in emojisNormalized ? emojisNormalized[emoji] : emoji;
};
const isMeetingLocked = (id) => { const isMeetingLocked = (id) => {
const meeting = Meetings.findOne({ meetingId: id }); const meeting = Meetings.findOne({ meetingId: id });

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import KEY_CODES from '/imports/utils/keyCodes'; import KEY_CODES from '/imports/utils/keyCodes';
import styles from './styles.scss'; import styles from './styles';
import UserParticipants from './user-participants/component'; import UserParticipants from './user-participants/component';
import UserMessages from './user-messages/component'; import UserMessages from './user-messages/component';

View File

@ -3,7 +3,7 @@ import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import cx from 'classnames'; import cx from 'classnames';
import styles from './styles.scss'; import styles from './styles';
import ChatListItem from './../../chat-list-item/component'; import ChatListItem from './../../chat-list-item/component';
const propTypes = { const propTypes = {

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Icon from '/imports/ui/components/icon/component'; import Icon from '/imports/ui/components/icon/component';
import styles from './styles.scss'; import styles from './styles';
const propTypes = { const propTypes = {
user: PropTypes.shape({ user: PropTypes.shape({

View File

@ -11,7 +11,7 @@ import DropdownContent from '/imports/ui/components/dropdown/content/component';
import DropdownList from '/imports/ui/components/dropdown/list/component'; import DropdownList from '/imports/ui/components/dropdown/list/component';
import DropdownListSeparator from '/imports/ui/components/dropdown/list/separator/component'; import DropdownListSeparator from '/imports/ui/components/dropdown/list/separator/component';
import DropdownListTitle from '/imports/ui/components/dropdown/list/title/component'; import DropdownListTitle from '/imports/ui/components/dropdown/list/title/component';
import styles from './styles.scss'; import styles from './styles';
import UserName from './../user-name/component'; import UserName from './../user-name/component';
import UserIcons from './../user-icons/component'; import UserIcons from './../user-icons/component';

View File

@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import Icon from '/imports/ui/components/icon/component'; import Icon from '/imports/ui/components/icon/component';
import styles from './styles.scss'; import styles from './styles';
const messages = defineMessages({ const messages = defineMessages({

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import styles from './styles.scss'; import styles from './styles';
const intlMessages = defineMessages({ const intlMessages = defineMessages({
participantsTitle: { participantsTitle: {

View File

@ -1,13 +1,24 @@
const EMOJI_STATUSES = [ const EMOJI_STATUSES = {
'away', away: 'away',
'raiseHand', raiseHand: 'raiseHand',
'neutral', neutral: 'neutral',
'confused', confused: 'confused',
'sad', sad: 'sad',
'happy', happy: 'happy',
'applause', applause: 'applause',
'thumbsUp', thumbsUp: 'thumbsUp',
'thumbsDown', thumbsDown: 'thumbsDown',
]; none: 'none',
};
export { EMOJI_STATUSES }; const EMOJI_NORMALIZE = {
agree: 'thumbs_up',
disagree: 'thumbs_down',
thumbsUp: 'thumbs_up',
thumbsDown: 'thumbs_down',
raiseHand: 'hand',
away: 'time',
neutral: 'undecided',
};
export { EMOJI_STATUSES, EMOJI_NORMALIZE };