2019-04-21 13:44:30 +03:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-28 17:38:10 +03:00
|
|
|
import { PureComponent } from 'react';
|
2019-04-21 13:44:30 +03:00
|
|
|
|
2022-10-11 11:41:15 +03:00
|
|
|
import { assetHost } from 'flavours/glitch/utils/config';
|
2019-04-21 13:44:30 +03:00
|
|
|
|
2023-11-15 13:01:51 +02:00
|
|
|
import { unicodeMapping } from '../features/emoji/emoji_unicode_mapping_light';
|
|
|
|
|
2023-05-28 15:18:23 +03:00
|
|
|
export default class AutosuggestEmoji extends PureComponent {
|
2019-04-21 13:44:30 +03:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
emoji: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { emoji } = this.props;
|
|
|
|
let url;
|
|
|
|
|
|
|
|
if (emoji.custom) {
|
|
|
|
url = emoji.imageUrl;
|
|
|
|
} else {
|
|
|
|
const mapping = unicodeMapping[emoji.native] || unicodeMapping[emoji.native.replace(/\uFE0F$/, '')];
|
|
|
|
|
|
|
|
if (!mapping) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
url = `${assetHost}/emoji/${mapping.filename}.svg`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2023-11-15 22:58:43 +02:00
|
|
|
<div className='autosuggest-emoji'>
|
2019-04-21 13:44:30 +03:00
|
|
|
<img
|
|
|
|
className='emojione'
|
|
|
|
src={url}
|
|
|
|
alt={emoji.native || emoji.colons}
|
|
|
|
/>
|
|
|
|
|
|
|
|
{emoji.colons}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|