2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
import type { Ref } from 'react';
|
|
|
|
import React, { forwardRef, memo } from 'react';
|
2020-10-02 20:05:09 +00:00
|
|
|
import { useSelector } from 'react-redux';
|
2024-03-12 16:29:31 +00:00
|
|
|
import { usePreferredReactionsActions } from '../ducks/preferredReactions';
|
2023-08-09 00:53:06 +00:00
|
|
|
import { useItemsActions } from '../ducks/items';
|
2020-10-02 20:05:09 +00:00
|
|
|
import { getIntl } from '../selectors/user';
|
2021-09-09 23:47:30 +00:00
|
|
|
import { getPreferredReactionEmoji } from '../selectors/items';
|
2023-11-16 19:55:35 +00:00
|
|
|
import type { Props as InternalProps } from '../../components/conversation/ReactionPicker';
|
2021-10-26 19:15:33 +00:00
|
|
|
import { ReactionPicker } from '../../components/conversation/ReactionPicker';
|
2020-10-02 20:05:09 +00:00
|
|
|
|
2021-09-09 16:29:01 +00:00
|
|
|
type ExternalProps = Omit<
|
2023-11-16 19:55:35 +00:00
|
|
|
InternalProps,
|
2021-09-09 16:29:01 +00:00
|
|
|
| 'i18n'
|
2021-09-09 20:53:26 +00:00
|
|
|
| 'onSetSkinTone'
|
2021-09-09 16:29:01 +00:00
|
|
|
| 'openCustomizePreferredReactionsModal'
|
|
|
|
| 'preferredReactionEmoji'
|
|
|
|
| 'selectionStyle'
|
|
|
|
| 'skinTone'
|
2023-11-17 20:40:41 +00:00
|
|
|
>;
|
2020-10-02 20:05:09 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
export const SmartReactionPicker = memo(
|
|
|
|
forwardRef(function SmartReactionPickerInner(
|
|
|
|
props: ExternalProps,
|
|
|
|
ref: Ref<HTMLDivElement>
|
|
|
|
) {
|
|
|
|
const { openCustomizePreferredReactionsModal } =
|
|
|
|
usePreferredReactionsActions();
|
|
|
|
|
|
|
|
const { onSetSkinTone } = useItemsActions();
|
|
|
|
|
|
|
|
const i18n = useSelector(getIntl);
|
|
|
|
const preferredReactionEmoji = useSelector(getPreferredReactionEmoji);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ReactionPicker
|
|
|
|
i18n={i18n}
|
|
|
|
onSetSkinTone={onSetSkinTone}
|
|
|
|
openCustomizePreferredReactionsModal={
|
|
|
|
openCustomizePreferredReactionsModal
|
|
|
|
}
|
|
|
|
preferredReactionEmoji={preferredReactionEmoji}
|
|
|
|
ref={ref}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
})
|
|
|
|
);
|