localize user popup menu

This commit is contained in:
Anton Georgiev 2017-04-28 14:28:55 -04:00
parent 5abf6413a8
commit 5d0022f214
3 changed files with 66 additions and 38 deletions

View File

@ -6,6 +6,7 @@ import cx from 'classnames';
import { defineMessages, injectIntl } from 'react-intl';
import UserListItem from './user-list-item/component.jsx';
import ChatListItem from './chat-list-item/component.jsx';
import { callServer } from '/imports/ui/services/api';
const propTypes = {
openChats: PropTypes.array.isRequired,
@ -108,12 +109,44 @@ class UserList extends Component {
const {
users,
currentUser,
userActions,
compact,
isBreakoutRoom,
intl,
} = this.props;
const userActions = {
openChat: {
label: intl.formatMessage(intlMessages.ChatLabel),
handler: (router, user) => router.push(`/users/chat/${user.id}`),
icon: 'chat',
},
clearStatus: {
label: intl.formatMessage(intlMessages.ClearStatusLabel),
handler: user => callServer('setEmojiStatus', user.id, 'none'),
icon: 'clear_status',
},
setPresenter: {
label: intl.formatMessage(intlMessages.MakePresenterLabel),
handler: user => callServer('assignPresenter', user.id),
icon: 'presentation',
},
kick: {
label: intl.formatMessage(intlMessages.KickUserLabel),
handler: user => callServer('kickUser', user.id),
icon: 'circle_close',
},
mute: {
label: intl.formatMessage(intlMessages.MuteUserAudioLabel),
handler: user => callServer('muteUser', user.id),
icon: 'audio_off',
},
unmute: {
label: intl.formatMessage(intlMessages.UnmuteUserAudioLabel),
handler: user => callServer('unmuteUser', user.id),
icon: 'audio_on',
},
};
return (
<div className={styles.participants}>
{
@ -163,6 +196,30 @@ const intlMessages = defineMessages({
id: 'app.userlist.participantsTitle',
description: 'Title for the Users list',
},
ChatLabel: {
id: 'app.userlist.menu.chat.label',
description: 'Save the changes and close the settings menu',
},
ClearStatusLabel: {
id: 'app.userlist.menu.clearStatus.label',
description: 'Clear the emoji status of this user',
},
MakePresenterLabel: {
id: 'app.userlist.menu.makePresenter.label',
description: 'Set this user to be the presenter in this meeting',
},
KickUserLabel: {
id: 'app.userlist.menu.kickUser.label',
description: 'Forcefully remove this user from the meeting',
},
MuteUserAudioLabel: {
id: 'app.userlist.menu.muteUserAudio.label',
description: 'Forcefully mute this user',
},
UnmuteUserAudioLabel: {
id: 'app.userlist.menu.unmuteUserAudio.label',
description: 'Forcefully unmute this user',
},
});
UserList.propTypes = propTypes;

View File

@ -5,7 +5,6 @@ import UnreadMessages from '/imports/ui/services/unread-messages';
import Storage from '/imports/ui/services/storage/session';
import { EMOJI_STATUSES } from '/imports/utils/statuses.js';
import { callServer } from '/imports/ui/services/api';
import _ from 'lodash';
const CHAT_CONFIG = Meteor.settings.public.chat;
@ -39,7 +38,7 @@ const mapUser = user => ({
const mapOpenChats = chat => {
let currentUserId = Auth.userID;
return chat.message.from_userid !== Auth.userID
return chat.message.from_userid !== currentUserId
? chat.message.from_userid
: chat.message.to_userid;
};
@ -238,42 +237,8 @@ getCurrentUser = () => {
return (currentUser) ? mapUser(currentUser.user) : null;
};
const userActions = {
openChat: {
label: 'Chat',
handler: (router, user) => router.push(`/users/chat/${user.id}`),
icon: 'chat',
},
clearStatus: {
label: 'Clear Status',
handler: user => callServer('setEmojiStatus', user.id, 'none'),
icon: 'clear_status',
},
setPresenter: {
label: 'Make Presenter',
handler: user => callServer('assignPresenter', user.id),
icon: 'presentation',
},
kick: {
label: 'Kick User',
handler: user => callServer('kickUser', user.id),
icon: 'circle_close',
},
mute: {
label: 'Mute Audio',
handler: user => callServer('muteUser', user.id),
icon: 'audio_off',
},
unmute: {
label: 'Unmute Audio',
handler: user => callServer('unmuteUser', user.id),
icon: 'audio_on',
},
};
export default {
getUsers,
getOpenChats,
getCurrentUser,
userActions,
};

View File

@ -18,6 +18,12 @@
"app.userlist.menuTitleContext": "available options",
"app.userlist.chatlistitem.unreadSingular": "{count} New Message",
"app.userlist.chatlistitem.unreadPlural": "{count} New Messages",
"app.userlist.menu.chat.label": "Chat",
"app.userlist.menu.clearStatus.label": "Clear Status",
"app.userlist.menu.makePresenter.label": "Make Presenter",
"app.userlist.menu.kickUser.label": "Kick user",
"app.userlist.menu.muteUserAudio.label": "Mute user",
"app.userlist.menu.unmuteUserAudio.label": "Unmute user",
"app.chat.Label": "Chat",
"app.chat.emptyLogLabel": "Chat log empty",
"app.media.Label": "Media",