- the great reformat

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-02-06 18:20:58 -05:00
parent 30c530bcc4
commit e83badb454
912 changed files with 108516 additions and 107493 deletions

View File

@@ -1,76 +1,77 @@
import { Button } from "antd";
import { JsonEditor as Editor } from "jsoneditor-react";
import {Button} from "antd";
import {JsonEditor as Editor} from "jsoneditor-react";
import "jsoneditor-react/es/editor.min.css";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function ShopTemplateTestRender({
bodyshop,
query,
emailEditorRef,
style,
}) {
const [variables, setVariables] = useState({ id: "uuid" });
const [loading, setLoading] = useState(false);
const { t } = useTranslation();
bodyshop,
query,
emailEditorRef,
style,
}) {
const [variables, setVariables] = useState({id: "uuid"});
const [loading, setLoading] = useState(false);
const {t} = useTranslation();
const handleTestRender = async () => {
try {
setLoading(true);
emailEditorRef.current.exportHtml(async (data) => {
const handleTestRender = async () => {
try {
// const inlineHtml = await axios.post("/render/inlinecss", {
// html: data.html,
// url: `${window.location.protocol}://${window.location.host}/`,
// });
setLoading(true);
// const { data: contextData } = await client.query({
// query: gql(query),
// variables: variables,
//
// });
emailEditorRef.current.exportHtml(async (data) => {
try {
// const inlineHtml = await axios.post("/render/inlinecss", {
// html: data.html,
// url: `${window.location.protocol}://${window.location.host}/`,
// });
// const renderResponse = await axios.post("/render", {
// view: inlineHtml.data,
// context: { ...contextData, bodyshop: bodyshop },
// });
// displayTemplateInWindowNoprint(renderResponse.data);
// const { data: contextData } = await client.query({
// query: gql(query),
// variables: variables,
//
// });
setLoading(false);
// const renderResponse = await axios.post("/render", {
// view: inlineHtml.data,
// context: { ...contextData, bodyshop: bodyshop },
// });
// displayTemplateInWindowNoprint(renderResponse.data);
setLoading(false);
} catch (error) {
setLoading(false);
alert(error);
}
});
} catch (error) {
setLoading(false);
alert(error);
setLoading(false);
alert(error);
}
});
} catch (error) {
setLoading(false);
alert(error);
}
};
};
return (
<div style={{ ...style, margin: "1rem", display: "flex" }}>
<div style={{ flex: 1 }}>
<Editor value={variables} onChange={(e) => setVariables(e)} />
</div>
<Button loading={loading} type="ghost" onClick={handleTestRender}>
{t("bodyshop.actions.testrender")}
</Button>
</div>
);
return (
<div style={{...style, margin: "1rem", display: "flex"}}>
<div style={{flex: 1}}>
<Editor value={variables} onChange={(e) => setVariables(e)}/>
</div>
<Button loading={loading} type="ghost" onClick={handleTestRender}>
{t("bodyshop.actions.testrender")}
</Button>
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
mapStateToProps,
mapDispatchToProps
)(ShopTemplateTestRender);