Refactor smart components
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
parent
05c09ef769
commit
27b55e472d
109 changed files with 3583 additions and 2629 deletions
|
@ -1,19 +1,23 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import { mapDispatchToProps } from '../actions';
|
||||
import { useSelector } from 'react-redux';
|
||||
import React, { memo } from 'react';
|
||||
import { CrashReportDialog } from '../../components/CrashReportDialog';
|
||||
import type { StateType } from '../reducer';
|
||||
import { getIntl } from '../selectors/user';
|
||||
import { useCrashReportsActions } from '../ducks/crashReports';
|
||||
import { getCrashReportsIsPending } from '../selectors/crashReports';
|
||||
|
||||
const mapStateToProps = (state: StateType) => {
|
||||
return {
|
||||
...state.crashReports,
|
||||
i18n: getIntl(state),
|
||||
};
|
||||
};
|
||||
|
||||
const smart = connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
export const SmartCrashReportDialog = smart(CrashReportDialog);
|
||||
export const SmartCrashReportDialog = memo(function SmartCrashReportDialog() {
|
||||
const i18n = useSelector(getIntl);
|
||||
const isPending = useSelector(getCrashReportsIsPending);
|
||||
const { writeCrashReportsToLog, eraseCrashReports } =
|
||||
useCrashReportsActions();
|
||||
return (
|
||||
<CrashReportDialog
|
||||
i18n={i18n}
|
||||
isPending={isPending}
|
||||
writeCrashReportsToLog={writeCrashReportsToLog}
|
||||
eraseCrashReports={eraseCrashReports}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue