WIP Dashboard work.
This commit is contained in:
@@ -1,35 +1,54 @@
|
|||||||
import React from "react";
|
|
||||||
import GridLayout from "react-grid-layout";
|
|
||||||
import { Card } from "antd";
|
import { Card } from "antd";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { Responsive, WidthProvider } from "react-grid-layout";
|
||||||
//Combination of the following:
|
//Combination of the following:
|
||||||
// /node_modules/react-grid-layout/css/styles.css
|
// /node_modules/react-grid-layout/css/styles.css
|
||||||
// /node_modules/react-resizable/css/styles.css
|
// /node_modules/react-resizable/css/styles.css
|
||||||
import "./dashboard-grid.styles.css";
|
import "./dashboard-grid.styles.css";
|
||||||
|
|
||||||
|
const ResponsiveReactGridLayout = WidthProvider(Responsive);
|
||||||
export default function DashboardGridComponent() {
|
export default function DashboardGridComponent() {
|
||||||
const layout = [
|
const [state, setState] = useState({
|
||||||
{ i: "a", x: 0, y: 0, w: 1, h: 2, static: true },
|
layout: [
|
||||||
{ i: "b", x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4 },
|
{ x: 0, y: 0, w: 2, h: 2 },
|
||||||
{ i: "c", x: 4, y: 0, w: 1, h: 2 }
|
{ x: 1, y: 0, w: 2, h: 2 },
|
||||||
];
|
{ x: 4, y: 0, w: 2, h: 2 }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultProps = {
|
||||||
|
className: "layout",
|
||||||
|
breakpoints: { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 },
|
||||||
|
cols: { lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 },
|
||||||
|
rowHeight: 100
|
||||||
|
};
|
||||||
|
|
||||||
|
// We're using the cols coming back from this to calculate where to add new items.
|
||||||
|
const onBreakpointChange = (breakpoint, cols) => {
|
||||||
|
console.log("breakpoint, cols", breakpoint, cols);
|
||||||
|
setState({ ...state, breakpoint: breakpoint, cols: cols });
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div style={{ width: "100%", height: " 100%" }}>
|
||||||
The Grid.
|
The Grid.
|
||||||
<GridLayout
|
<ResponsiveReactGridLayout
|
||||||
className="layout"
|
{...defaultProps}
|
||||||
layout={layout}
|
onBreakpointChange={onBreakpointChange}
|
||||||
cols={12}
|
|
||||||
rowHeight={30}
|
|
||||||
width={1200}
|
|
||||||
onLayoutChange={layout => {
|
onLayoutChange={layout => {
|
||||||
console.log(layout);
|
console.log("layout", layout);
|
||||||
|
setState({ ...state, layout });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Card key="a">a</Card>
|
{state.layout.map((item, index) => {
|
||||||
<Card key="b">b</Card>
|
console.log("item", item);
|
||||||
<Card key="c">c</Card>
|
return (
|
||||||
</GridLayout>
|
<Card style={{ width: "100px" }} key={index} data-grid={item}>
|
||||||
|
A Card {index}
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</ResponsiveReactGridLayout>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ export default function EmailOverlayComponent({
|
|||||||
editor={ClassicEditor}
|
editor={ClassicEditor}
|
||||||
data={messageOptions.html}
|
data={messageOptions.html}
|
||||||
onChange={(event, editor) => {
|
onChange={(event, editor) => {
|
||||||
|
// handleHtmlChange(editor.getData());
|
||||||
|
//TODO Ensure that removing onchange never introduces a race condition
|
||||||
|
}}
|
||||||
|
onBlur={(event, editor) => {
|
||||||
|
console.log("Blur.");
|
||||||
handleHtmlChange(editor.getData());
|
handleHtmlChange(editor.getData());
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -24,15 +24,17 @@ const mapDispatchToProps = dispatch => ({
|
|||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(function EmailOveralContainer({
|
)(function EmailOverlayContainer({
|
||||||
emailConfig,
|
emailConfig,
|
||||||
modalVisible,
|
modalVisible,
|
||||||
toggleEmailOverlayVisible
|
toggleEmailOverlayVisible
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [messageOptions, setMessageOptions] = useState(
|
const [messageOptions, setMessageOptions] = useState(
|
||||||
emailConfig.messageOptions
|
emailConfig.messageOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setMessageOptions(emailConfig.messageOptions);
|
setMessageOptions(emailConfig.messageOptions);
|
||||||
}, [setMessageOptions, emailConfig.messageOptions]);
|
}, [setMessageOptions, emailConfig.messageOptions]);
|
||||||
@@ -60,7 +62,6 @@ export default connect(
|
|||||||
html: ReactDOMServer.renderToStaticMarkup(
|
html: ReactDOMServer.renderToStaticMarkup(
|
||||||
<emailConfig.template data={data} />
|
<emailConfig.template data={data} />
|
||||||
)
|
)
|
||||||
//html: renderEmail(<emailConfig.template data={data} />)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +81,7 @@ export default connect(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleConfigChange = event => {
|
const handleConfigChange = event => {
|
||||||
const { name, value } = event.target;
|
const { name, value } = event.target;
|
||||||
setMessageOptions({ ...messageOptions, [name]: value });
|
setMessageOptions({ ...messageOptions, [name]: value });
|
||||||
|
|||||||
Reference in New Issue
Block a user