signal-desktop/ts/state/smart/ReactionPicker.tsx

51 lines
1.5 KiB
TypeScript
Raw Normal View History

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
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';
import { getPreferredReactionEmoji } from '../selectors/items';
2023-11-16 19:55:35 +00:00
import type { Props as InternalProps } from '../../components/conversation/ReactionPicker';
import { ReactionPicker } from '../../components/conversation/ReactionPicker';
2020-10-02 20:05:09 +00:00
type ExternalProps = Omit<
2023-11-16 19:55:35 +00:00
InternalProps,
| 'i18n'
| 'onSetSkinTone'
| 'openCustomizePreferredReactionsModal'
| 'preferredReactionEmoji'
| 'selectionStyle'
| 'skinTone'
>;
2020-10-02 20:05:09 +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}
/>
);
})
);