fix: accounts suggest field

This commit is contained in:
Ahmed Bouhuolia
2025-12-21 16:03:15 +02:00
parent b22328cff9
commit 31f5cbf335
22 changed files with 1189 additions and 2224 deletions

View File

@@ -1,16 +1,31 @@
// @ts-nocheck
import { connect } from 'react-redux';
import { Dispatch } from 'redux';
import { ComponentType } from 'react';
import t from '@/store/types';
export const mapStateToProps = (state, props) => {
return {};
};
export interface WithDialogActionsProps {
openDialog: (name: string, payload?: Record<string, unknown>) => void;
closeDialog: (name: string, payload?: Record<string, unknown>) => void;
}
export const mapDispatchToProps = (dispatch) => ({
export const mapDispatchToProps = (dispatch: Dispatch): WithDialogActionsProps => ({
openDialog: (name, payload) =>
dispatch({ type: t.OPEN_DIALOG, name, payload }),
closeDialog: (name, payload) =>
dispatch({ type: t.CLOSE_DIALOG, name, payload }),
});
export default connect(null, mapDispatchToProps);
/**
* HOC that injects dialog actions (openDialog, closeDialog) into a component.
* Properly preserves the wrapped component's prop types while omitting injected props.
*/
function withDialogActions<P>(
WrappedComponent: ComponentType<P>,
): ComponentType<Omit<P, keyof WithDialogActionsProps>> {
const Connected = connect(null, mapDispatchToProps)(
WrappedComponent as ComponentType<any>,
);
return Connected as unknown as ComponentType<Omit<P, keyof WithDialogActionsProps>>;
}
export default withDialogActions;