2021-05-28 16:15:17 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { mapDispatchToProps } from '../actions';
|
|
|
|
import { GlobalModalContainer } from '../../components/GlobalModalContainer';
|
|
|
|
import { StateType } from '../reducer';
|
|
|
|
import { getIntl } from '../selectors/user';
|
|
|
|
import { SmartChatColorPicker } from './ChatColorPicker';
|
|
|
|
import { ConversationColorType } from '../../types/Colors';
|
|
|
|
|
|
|
|
function renderChatColorPicker({
|
2021-06-02 21:05:09 +00:00
|
|
|
setGlobalDefaultConversationColor,
|
2021-05-28 16:15:17 +00:00
|
|
|
}: {
|
2021-06-02 21:05:09 +00:00
|
|
|
setGlobalDefaultConversationColor: (color: ConversationColorType) => unknown;
|
2021-05-28 16:15:17 +00:00
|
|
|
}): JSX.Element {
|
|
|
|
return (
|
2021-06-02 21:05:09 +00:00
|
|
|
<SmartChatColorPicker
|
|
|
|
isGlobal
|
|
|
|
onSelectColor={setGlobalDefaultConversationColor}
|
|
|
|
/>
|
2021-05-28 16:15:17 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapStateToProps = (state: StateType) => {
|
|
|
|
return {
|
|
|
|
...state.globalModals,
|
|
|
|
i18n: getIntl(state),
|
|
|
|
renderChatColorPicker,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const smart = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
|
|
|
export const SmartGlobalModalContainer = smart(GlobalModalContainer);
|