2022-05-20 04:39:54 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { injectIntl } from 'react-intl';
|
2023-11-14 02:36:49 +08:00
|
|
|
import data from '@emoji-mart/data';
|
|
|
|
import Picker from '@emoji-mart/react';
|
2022-05-20 04:39:54 +08:00
|
|
|
|
2024-03-07 01:28:18 +08:00
|
|
|
const DISABLE_EMOJIS = window.meetingClientSettings.public.chat.disableEmojis;
|
2022-07-08 00:12:35 +08:00
|
|
|
|
2022-05-20 04:39:54 +08:00
|
|
|
const propTypes = {
|
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
|
|
|
onEmojiSelect: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
const emojisToExclude = [
|
2022-07-08 00:12:35 +08:00
|
|
|
...DISABLE_EMOJIS,
|
2022-05-20 04:39:54 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
const EmojiPicker = (props) => {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
onEmojiSelect,
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
const i18n = {
|
|
|
|
search: intl.formatMessage({ id: 'app.emojiPicker.search' }),
|
|
|
|
notfound: intl.formatMessage({ id: 'app.emojiPicker.notFound' }),
|
|
|
|
clear: intl.formatMessage({ id: 'app.emojiPicker.clear' }),
|
|
|
|
skintext: intl.formatMessage({ id: 'app.emojiPicker.skintext' }),
|
|
|
|
categories: {
|
|
|
|
people: intl.formatMessage({ id: 'app.emojiPicker.categories.people' }),
|
|
|
|
nature: intl.formatMessage({ id: 'app.emojiPicker.categories.nature' }),
|
|
|
|
foods: intl.formatMessage({ id: 'app.emojiPicker.categories.foods' }),
|
|
|
|
places: intl.formatMessage({ id: 'app.emojiPicker.categories.places' }),
|
|
|
|
activity: intl.formatMessage({ id: 'app.emojiPicker.categories.activity' }),
|
|
|
|
objects: intl.formatMessage({ id: 'app.emojiPicker.categories.objects' }),
|
|
|
|
symbols: intl.formatMessage({ id: 'app.emojiPicker.categories.symbols' }),
|
|
|
|
flags: intl.formatMessage({ id: 'app.emojiPicker.categories.flags' }),
|
|
|
|
recent: intl.formatMessage({ id: 'app.emojiPicker.categories.recent' }),
|
|
|
|
search: intl.formatMessage({ id: 'app.emojiPicker.categories.search' }),
|
|
|
|
},
|
|
|
|
categorieslabel: intl.formatMessage({ id: 'app.emojiPicker.categories.label' }),
|
|
|
|
skintones: {
|
|
|
|
1: intl.formatMessage({ id: 'app.emojiPicker.skintones.1' }),
|
|
|
|
2: intl.formatMessage({ id: 'app.emojiPicker.skintones.2' }),
|
|
|
|
3: intl.formatMessage({ id: 'app.emojiPicker.skintones.3' }),
|
|
|
|
4: intl.formatMessage({ id: 'app.emojiPicker.skintones.4' }),
|
|
|
|
5: intl.formatMessage({ id: 'app.emojiPicker.skintones.5' }),
|
|
|
|
6: intl.formatMessage({ id: 'app.emojiPicker.skintones.6' }),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Picker
|
2023-11-14 02:36:49 +08:00
|
|
|
data={data}
|
|
|
|
onEmojiSelect={(emojiObject, event) => onEmojiSelect(emojiObject, event)}
|
2022-05-20 04:39:54 +08:00
|
|
|
emojiSize={24}
|
|
|
|
i18n={i18n}
|
2023-11-14 02:36:49 +08:00
|
|
|
previewPosition="none"
|
|
|
|
skinTonePosition="none"
|
|
|
|
theme="light"
|
|
|
|
dynamicWidth
|
|
|
|
exceptEmojis={emojisToExclude}
|
2022-05-20 04:39:54 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
EmojiPicker.propTypes = propTypes;
|
|
|
|
|
2023-11-14 22:03:05 +08:00
|
|
|
export default injectIntl(EmojiPicker);
|