BOD-34 Basics of print center => redux setup, container/base component.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function PrintCenterModalComponent({ context }) {
|
||||
const { t } = useTranslation();
|
||||
const { type, id } = context;
|
||||
return <div>{`${type} - ${id}`}</div>;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { Modal } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { setEmailOptions } from "../../redux/email/email.actions";
|
||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||
import { selectPrintCenter } from "../../redux/modals/modals.selectors";
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../../redux/user/user.selectors";
|
||||
import PrintCenterModalComponent from "./print-center-modal.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
bodyshop: selectBodyshop,
|
||||
printCenterModal: selectPrintCenter,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setEmailOptions: (e) => dispatch(setEmailOptions(e)),
|
||||
toggleModalVisible: () => dispatch(toggleModalVisible("printCenter")),
|
||||
});
|
||||
|
||||
export function PrintCenterModalContainer({
|
||||
printCenterModal,
|
||||
toggleModalVisible,
|
||||
currentUser,
|
||||
bodyshop,
|
||||
setEmailOptions,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { visible, context, actions } = printCenterModal;
|
||||
// const { jobId, linesToOrder } = context;
|
||||
// const { refetch } = actions;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
visible={visible}
|
||||
onCancel={() => toggleModalVisible()}
|
||||
width='90%'
|
||||
title={t("printcenter.labels.title")}
|
||||
destroyOnClose>
|
||||
<PrintCenterModalComponent context={context} />
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(PrintCenterModalContainer);
|
||||
Reference in New Issue
Block a user