BOD-34 Added jobs items and conditional rendering for print center.
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import EmailOverlayComponent from "./email-overlay.component";
|
||||
import { EmailSettings } from "../../emails/constants";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
modalVisible: selectEmailVisible,
|
||||
@@ -31,10 +32,16 @@ export function EmailOverlayContainer({
|
||||
bodyshop,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [messageOptions, setMessageOptions] = useState(
|
||||
emailConfig.messageOptions
|
||||
);
|
||||
const defaultEmailFrom = {
|
||||
from: {
|
||||
name: bodyshop.shopname || EmailSettings.fromNameDefault,
|
||||
address: EmailSettings.fromAddress,
|
||||
},
|
||||
replyTo: bodyshop.email,
|
||||
};
|
||||
const [messageOptions, setMessageOptions] = useState({
|
||||
...defaultEmailFrom,
|
||||
});
|
||||
const client = useApolloClient();
|
||||
|
||||
const renderEmail = () => {
|
||||
@@ -78,7 +85,11 @@ export function EmailOverlayContainer({
|
||||
context: { ...contextData, bodyshop: bodyshop },
|
||||
})
|
||||
.then((r) => {
|
||||
setMessageOptions({ ...messageOptions, html: r.data });
|
||||
setMessageOptions({
|
||||
...emailConfig.messageOptions,
|
||||
...defaultEmailFrom,
|
||||
html: r.data,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -119,8 +130,7 @@ export function EmailOverlayContainer({
|
||||
onOk={handleOk}
|
||||
onCancel={() => {
|
||||
toggleEmailOverlayVisible();
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<LoadingSpinner loading={false}>
|
||||
<EmailOverlayComponent
|
||||
handleConfigChange={handleConfigChange}
|
||||
@@ -131,8 +141,7 @@ export function EmailOverlayContainer({
|
||||
onClick={() => {
|
||||
console.log(messageOptions.html);
|
||||
navigator.clipboard.writeText(messageOptions.html);
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
Get HTML
|
||||
</button>
|
||||
</LoadingSpinner>
|
||||
|
||||
Reference in New Issue
Block a user