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

48 lines
1.9 KiB
TypeScript
Raw Normal View History

2021-06-17 21:15:09 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { connect } from 'react-redux';
import { App } from '../../components/App';
2021-06-17 21:15:09 +00:00
import { SmartCallManager } from './CallManager';
import { SmartCustomizingPreferredReactionsModal } from './CustomizingPreferredReactionsModal';
2021-06-17 21:15:09 +00:00
import { SmartGlobalModalContainer } from './GlobalModalContainer';
import { SmartSafetyNumberViewer } from './SafetyNumberViewer';
import type { StateType } from '../reducer';
import { getPreferredBadgeSelector } from '../selectors/badges';
import { getIntl, getTheme } from '../selectors/user';
import {
getConversationsStoppingMessageSendBecauseOfVerification,
getNumberOfMessagesPendingBecauseOfVerification,
} from '../selectors/conversations';
import { getIsCustomizingPreferredReactions } from '../selectors/preferredReactions';
2021-06-17 21:15:09 +00:00
import { mapDispatchToProps } from '../actions';
import type { SafetyNumberProps } from '../../components/SafetyNumberChangeDialog';
2021-06-17 21:15:09 +00:00
const mapStateToProps = (state: StateType) => {
2021-06-17 21:15:09 +00:00
return {
...state.app,
2021-11-11 22:43:05 +00:00
conversationsStoppingMessageSendBecauseOfVerification:
getConversationsStoppingMessageSendBecauseOfVerification(state),
getPreferredBadge: getPreferredBadgeSelector(state),
i18n: getIntl(state),
isCustomizingPreferredReactions: getIsCustomizingPreferredReactions(state),
2021-11-11 22:43:05 +00:00
numberOfMessagesPendingBecauseOfVerification:
getNumberOfMessagesPendingBecauseOfVerification(state),
2021-06-17 21:15:09 +00:00
renderCallManager: () => <SmartCallManager />,
renderCustomizingPreferredReactionsModal: () => (
<SmartCustomizingPreferredReactionsModal />
),
2021-06-17 21:15:09 +00:00
renderGlobalModalContainer: () => <SmartGlobalModalContainer />,
renderSafetyNumber: (props: SafetyNumberProps) => (
<SmartSafetyNumberViewer {...props} />
),
2021-06-17 21:15:09 +00:00
theme: getTheme(state),
};
};
const smart = connect(mapStateToProps, mapDispatchToProps);
export const SmartApp = smart(App);