@flozy/editor 4.0.2 → 4.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +14 -9
- package/dist/Editor/CommonEditor.js +185 -170
- package/dist/Editor/DialogWrapper.js +4 -3
- package/dist/Editor/Editor.css +5 -19
- package/dist/Editor/Elements/AI/PopoverAIInput.js +52 -41
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +4 -15
- package/dist/Editor/Elements/AppHeader/AppHeader.js +39 -26
- package/dist/Editor/Elements/Button/EditorButton.js +33 -38
- package/dist/Editor/Elements/Carousel/CarouselButton.js +0 -1
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -59
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
- package/dist/Editor/Elements/Embed/Image.js +15 -14
- package/dist/Editor/Elements/Embed/Video.js +12 -8
- package/dist/Editor/Elements/Emoji/EmojiButton.js +11 -7
- package/dist/Editor/Elements/Form/Form.js +43 -27
- package/dist/Editor/Elements/Form/FormField.js +21 -10
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
- package/dist/Editor/Elements/Form/Workflow/index.js +5 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +437 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +206 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +23 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +236 -0
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +44 -0
- package/dist/Editor/Elements/FreeGrid/Options/More.js +24 -0
- package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +47 -0
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +19 -0
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +75 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +214 -0
- package/dist/Editor/Elements/Grid/Grid.js +11 -9
- package/dist/Editor/Elements/Grid/GridItem.js +31 -23
- package/dist/Editor/Elements/Link/Link.js +1 -6
- package/dist/Editor/Elements/Link/LinkButton.js +2 -4
- package/dist/Editor/Elements/Link/LinkPopup.js +15 -18
- package/dist/Editor/Elements/NewLine/NewLineButton.js +0 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +1 -1
- package/dist/Editor/Elements/SimpleText/index.js +18 -16
- package/dist/Editor/Elements/SimpleText/style.js +43 -0
- package/dist/Editor/ErrorBoundary.js +30 -0
- package/dist/Editor/MiniEditor.js +1 -3
- package/dist/Editor/Styles/EditorStyles.js +28 -0
- package/dist/Editor/Toolbar/Basic/index.js +2 -4
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +11 -5
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +14 -26
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +2 -68
- package/dist/Editor/Toolbar/PopupTool/index.js +8 -0
- package/dist/Editor/Toolbar/Toolbar.js +7 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +16 -48
- package/dist/Editor/common/ColorPickerButton.js +9 -25
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/EditorCmds.js +0 -3
- package/dist/Editor/common/Icon.js +16 -34
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
- package/dist/Editor/common/LinkSettings/index.js +1 -2
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
- package/dist/Editor/common/MentionsPopup/index.js +12 -8
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +142 -0
- package/dist/Editor/common/RnD/ContextMenu/index.js +38 -0
- package/dist/Editor/common/RnD/ContextMenu/styles.js +21 -0
- package/dist/Editor/common/RnD/DragInfo/index.js +31 -0
- package/dist/Editor/common/RnD/DragInfo/styles.js +15 -0
- package/dist/Editor/common/RnD/DragOver/index.js +55 -0
- package/dist/Editor/common/RnD/DragOver/styles.js +23 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +102 -0
- package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +26 -0
- package/dist/Editor/common/RnD/ElementOptions/index.js +95 -0
- package/dist/Editor/common/RnD/ElementOptions/styles.js +41 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +153 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +36 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +60 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +9 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +48 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +30 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +17 -0
- package/dist/Editor/common/RnD/ElementSettings/index.js +17 -0
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +18 -0
- package/dist/Editor/common/RnD/ElementSettings/styles.js +94 -0
- package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +52 -0
- package/dist/Editor/common/RnD/GuideLines/index.js +33 -0
- package/dist/Editor/common/RnD/GuideLines/styles.js +62 -0
- package/dist/Editor/common/RnD/OptionsPopup/index.js +50 -0
- package/dist/Editor/common/RnD/OptionsPopup/style.js +36 -0
- package/dist/Editor/common/RnD/RnDCopy.js +23 -0
- package/dist/Editor/common/RnD/ShadowElement.js +34 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +40 -0
- package/dist/Editor/common/RnD/SwitchViewport/styles.js +24 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +63 -0
- package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +19 -0
- package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +13 -0
- package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +20 -0
- package/dist/Editor/common/RnD/TransformHandles/index.js +67 -0
- package/dist/Editor/common/RnD/Utils/alignmentDetection.js +26 -0
- package/dist/Editor/common/RnD/Utils/calculateDropItem.js +98 -0
- package/dist/Editor/common/RnD/Utils/collisionDetection.js +52 -0
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +181 -0
- package/dist/Editor/common/RnD/Utils/index.js +251 -0
- package/dist/Editor/common/RnD/VirtualElement/index.js +77 -0
- package/dist/Editor/common/RnD/VirtualElement/styles.js +27 -0
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +28 -0
- package/dist/Editor/common/RnD/index.js +567 -0
- package/dist/Editor/common/RnD/styles.js +4 -0
- package/dist/Editor/common/Section/index.js +21 -12
- package/dist/Editor/common/Section/styles.js +7 -4
- package/dist/Editor/common/Shorthands/elements.js +12 -54
- package/dist/Editor/common/StyleBuilder/boxStyle.js +30 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +36 -44
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +23 -33
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -31
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +18 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
- package/dist/Editor/common/StyleBuilder/index.js +5 -3
- package/dist/Editor/common/StyleBuilder/sectionStyle.js +13 -2
- package/dist/Editor/helper/RnD/focusOnNewItem.js +39 -0
- package/dist/Editor/helper/RnD/scrollToNewSection.js +24 -0
- package/dist/Editor/helper/breakpoint.js +5 -0
- package/dist/Editor/helper/index.js +139 -0
- package/dist/Editor/helper/theme.js +48 -186
- package/dist/Editor/hooks/useBreakpoints.js +34 -0
- package/dist/Editor/hooks/useMouseMove.js +37 -12
- package/dist/Editor/hooks/withCommon.js +2 -1
- package/dist/Editor/hooks/withErrorHandling.js +14 -0
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +1 -1
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +197 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +60 -164
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/events.js +5 -0
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/form.js +7 -2
- package/dist/Editor/utils/formfield.js +1 -1
- package/dist/Editor/utils/freegrid.js +91 -0
- package/dist/Editor/utils/helper.js +44 -30
- package/dist/Editor/utils/insertAppHeader.js +47 -40
- package/package.json +5 -2
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
- package/dist/Editor/common/CustomColorPicker/index.js +0 -106
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog/index.js +0 -94
- package/dist/Editor/common/CustomDialog/style.js +0 -67
- package/dist/Editor/common/CustomSelect.js +0 -33
- package/dist/Editor/hooks/useEditorTheme.js +0 -139
- package/dist/Editor/theme/index.js +0 -144
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
- package/dist/Editor/themeSettings/buttons/index.js +0 -290
- package/dist/Editor/themeSettings/buttons/style.js +0 -21
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
- package/dist/Editor/themeSettings/fonts/index.js +0 -213
- package/dist/Editor/themeSettings/fonts/style.js +0 -44
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -320
- package/dist/Editor/themeSettings/style.js +0 -152
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -356
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
- package/dist/Editor/themeSettingsAI/style.js +0 -247
@@ -1,356 +0,0 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Button, Checkbox, CircularProgress, Divider, Drawer, FormControlLabel, Grid, IconButton, InputAdornment, Tab, Tabs, TextField, TextareaAutosize, Typography, styled } from "@mui/material";
|
3
|
-
|
4
|
-
// Style
|
5
|
-
import Style from "./style";
|
6
|
-
|
7
|
-
// icons
|
8
|
-
import { CloseIcon } from "../common/iconslist";
|
9
|
-
import { CloudIcon } from "./icons";
|
10
|
-
import { TickIcon } from "./icons";
|
11
|
-
import { ResetIcon } from "./icons";
|
12
|
-
import { useEditorTheme } from "../hooks/useEditorTheme";
|
13
|
-
import ActiveTheme from "../themeSettings/ActiveTheme";
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
15
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
16
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
17
|
-
function generateUniqueId() {
|
18
|
-
const timestamp = Date.now(); // current timestamp in milliseconds
|
19
|
-
const randomNum = Math.floor(Math.random() * 1000000); // random number for uniqueness
|
20
|
-
return `id_${timestamp}_${randomNum}`;
|
21
|
-
}
|
22
|
-
async function getTheme(fileInputRef, onThemeChange, setLoading) {
|
23
|
-
const file = fileInputRef.current?.files[0];
|
24
|
-
if (file) {
|
25
|
-
setLoading(true);
|
26
|
-
// Create a FormData object to hold the file
|
27
|
-
const formData = new FormData();
|
28
|
-
formData.append("file", file); // 'image' is the key that your backend will use to access the file
|
29
|
-
|
30
|
-
try {
|
31
|
-
// Send the file using the fetch API
|
32
|
-
const response = await fetch("https://aicheck.agenciflow.com/create", {
|
33
|
-
method: "POST",
|
34
|
-
body: formData
|
35
|
-
});
|
36
|
-
|
37
|
-
// Handle the response
|
38
|
-
if (response.ok) {
|
39
|
-
const data = await response.json(); // Assuming the response is JSON
|
40
|
-
const theme = JSON.parse(data?.response || "{}");
|
41
|
-
onThemeChange({
|
42
|
-
id: generateUniqueId(),
|
43
|
-
name: "AI Generated",
|
44
|
-
theme: theme
|
45
|
-
});
|
46
|
-
} else {
|
47
|
-
console.error("Error:", response.statusText);
|
48
|
-
}
|
49
|
-
} catch (error) {
|
50
|
-
console.error("Fetch error:", error);
|
51
|
-
}
|
52
|
-
setLoading(false);
|
53
|
-
} else {
|
54
|
-
console.log("No file selected");
|
55
|
-
}
|
56
|
-
}
|
57
|
-
const ThemeSettingsAI = props => {
|
58
|
-
const {
|
59
|
-
className,
|
60
|
-
openAITheme,
|
61
|
-
setOpenAITheme
|
62
|
-
} = props;
|
63
|
-
|
64
|
-
// State
|
65
|
-
// const [themeDrawer, setThemeDrawer] = useState(true);
|
66
|
-
const [themeTabType, setThemeTabType] = React.useState(0);
|
67
|
-
const [enableGenerateTheme, setEnableGenerateTheme] = React.useState(false);
|
68
|
-
const [generateTheme] = React.useState(false);
|
69
|
-
const [loading, setLoading] = React.useState(false);
|
70
|
-
const [imageSrc, setImageSrc] = useState(null);
|
71
|
-
const {
|
72
|
-
updateTheme
|
73
|
-
} = useEditorTheme();
|
74
|
-
const onThemeChange = theme => {
|
75
|
-
updateTheme(theme, {
|
76
|
-
action: "THEME_CHANGE"
|
77
|
-
});
|
78
|
-
};
|
79
|
-
|
80
|
-
// image upload
|
81
|
-
const fileInputRef = React.useRef(null);
|
82
|
-
const handleDivClick = () => {
|
83
|
-
// Trigger the click event on the hidden file input element
|
84
|
-
fileInputRef.current.click();
|
85
|
-
};
|
86
|
-
const handleImageUpload = event => {
|
87
|
-
const file = event.target.files[0];
|
88
|
-
if (file) {
|
89
|
-
const reader = new FileReader();
|
90
|
-
reader.onload = () => {
|
91
|
-
setImageSrc(reader.result);
|
92
|
-
};
|
93
|
-
reader.readAsDataURL(file);
|
94
|
-
setEnableGenerateTheme(true);
|
95
|
-
}
|
96
|
-
};
|
97
|
-
const handleTabChange = (event, newValue) => {
|
98
|
-
setThemeTabType(newValue);
|
99
|
-
};
|
100
|
-
const handleClose = () => {
|
101
|
-
setOpenAITheme(false);
|
102
|
-
};
|
103
|
-
|
104
|
-
// themeCard
|
105
|
-
// const ThemeCard = () => {
|
106
|
-
// return (
|
107
|
-
// <Grid className="themeCardWrapper">
|
108
|
-
// {/* remove selected based on condition */}
|
109
|
-
// <Grid
|
110
|
-
// container
|
111
|
-
// justifyContent={"space-between"}
|
112
|
-
// className="themeCard selected"
|
113
|
-
// >
|
114
|
-
// <TickIcon />
|
115
|
-
// <Grid>
|
116
|
-
// <Typography variant="body1" className="fs-14 fw-500">
|
117
|
-
// Slate Gray
|
118
|
-
// </Typography>
|
119
|
-
// <Typography
|
120
|
-
// variant="body2"
|
121
|
-
// color={"textSecondary"}
|
122
|
-
// className="fs-12"
|
123
|
-
// >
|
124
|
-
// Muted Elegance
|
125
|
-
// </Typography>
|
126
|
-
// </Grid>
|
127
|
-
// <Grid className="flexAlign" sx={{ gap: "5px" }}>
|
128
|
-
// <Grid className="primaryCard"></Grid>
|
129
|
-
// <Grid className="secondaryCard"></Grid>
|
130
|
-
// <Grid className="otherColors" sx={{ gap: "5px" }}>
|
131
|
-
// <Grid className="smallCard"></Grid>
|
132
|
-
// <Grid className="smallCard"></Grid>
|
133
|
-
// <Grid className="smallCard"></Grid>
|
134
|
-
// <Grid className="smallCard"></Grid>
|
135
|
-
// </Grid>
|
136
|
-
// </Grid>
|
137
|
-
// </Grid>
|
138
|
-
// </Grid>
|
139
|
-
// );
|
140
|
-
// };
|
141
|
-
|
142
|
-
return /*#__PURE__*/_jsx(Grid, {
|
143
|
-
className: className,
|
144
|
-
children: /*#__PURE__*/_jsx(Drawer, {
|
145
|
-
className: className,
|
146
|
-
open: openAITheme,
|
147
|
-
onClose: handleClose,
|
148
|
-
anchor: "right",
|
149
|
-
children: /*#__PURE__*/_jsxs(Grid, {
|
150
|
-
className: "settingsContainer",
|
151
|
-
children: [/*#__PURE__*/_jsxs(Grid, {
|
152
|
-
container: true,
|
153
|
-
justifyContent: "space-between",
|
154
|
-
wrap: "nowrap",
|
155
|
-
className: "header",
|
156
|
-
children: [/*#__PURE__*/_jsx(Grid, {
|
157
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
158
|
-
variant: "body1",
|
159
|
-
className: "title",
|
160
|
-
children: "Create theme with AI"
|
161
|
-
})
|
162
|
-
}), /*#__PURE__*/_jsx(IconButton, {
|
163
|
-
className: "closeBtn",
|
164
|
-
onClick: handleClose,
|
165
|
-
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
166
|
-
})]
|
167
|
-
}), /*#__PURE__*/_jsxs(Tabs, {
|
168
|
-
value: themeTabType,
|
169
|
-
onChange: handleTabChange,
|
170
|
-
variant: "scrollable",
|
171
|
-
scrollButtons: false,
|
172
|
-
"aria-label": "scrollable prevent tabs example",
|
173
|
-
sx: {
|
174
|
-
mb: 2
|
175
|
-
},
|
176
|
-
children: [/*#__PURE__*/_jsx(Tab, {
|
177
|
-
label: /*#__PURE__*/_jsx(Typography, {
|
178
|
-
variant: "body1",
|
179
|
-
className: "fs-14 fw-500 transformNone",
|
180
|
-
children: "Image"
|
181
|
-
})
|
182
|
-
}), /*#__PURE__*/_jsx(Tab, {
|
183
|
-
label: /*#__PURE__*/_jsx(Typography, {
|
184
|
-
variant: "body1",
|
185
|
-
className: "fs-14 fw-500 transformNone",
|
186
|
-
children: "Text"
|
187
|
-
})
|
188
|
-
}), /*#__PURE__*/_jsx(Tab, {
|
189
|
-
label: /*#__PURE__*/_jsx(Typography, {
|
190
|
-
variant: "body1",
|
191
|
-
className: "fs-14 fw-500 transformNone",
|
192
|
-
children: "Image link"
|
193
|
-
})
|
194
|
-
})]
|
195
|
-
}), themeTabType === 0 && /*#__PURE__*/_jsx(Grid, {
|
196
|
-
className: "imageUpload",
|
197
|
-
children: /*#__PURE__*/_jsxs(Grid, {
|
198
|
-
container: true,
|
199
|
-
justifyContent: "center",
|
200
|
-
alignItems: "center",
|
201
|
-
className: "imgUploadInner",
|
202
|
-
onClick: handleDivClick,
|
203
|
-
children: [/*#__PURE__*/_jsx("input", {
|
204
|
-
type: "file",
|
205
|
-
accept: ".png",
|
206
|
-
ref: fileInputRef,
|
207
|
-
onChange: handleImageUpload,
|
208
|
-
style: {
|
209
|
-
display: "none"
|
210
|
-
}
|
211
|
-
}), imageSrc ? /*#__PURE__*/_jsxs(_Fragment, {
|
212
|
-
children: [/*#__PURE__*/_jsx(IconButton, {
|
213
|
-
className: "resetIcon",
|
214
|
-
onClick: () => setImageSrc(null),
|
215
|
-
children: /*#__PURE__*/_jsx(ResetIcon, {})
|
216
|
-
}), /*#__PURE__*/_jsx(Grid, {
|
217
|
-
className: "changeImgText",
|
218
|
-
children: "Change Image"
|
219
|
-
}), /*#__PURE__*/_jsx("img", {
|
220
|
-
src: imageSrc,
|
221
|
-
alt: "Uploaded Preview",
|
222
|
-
className: "uploadedImage"
|
223
|
-
})]
|
224
|
-
}) : /*#__PURE__*/_jsxs(Grid, {
|
225
|
-
container: true,
|
226
|
-
justifyContent: "center",
|
227
|
-
alignItems: "center",
|
228
|
-
direction: "column",
|
229
|
-
children: [/*#__PURE__*/_jsx(CloudIcon, {}), /*#__PURE__*/_jsx(Typography, {
|
230
|
-
variant: "body1",
|
231
|
-
className: "fw-600",
|
232
|
-
sx: {
|
233
|
-
pb: 0.5
|
234
|
-
},
|
235
|
-
children: "Upload a logo or image"
|
236
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
237
|
-
variant: "body2",
|
238
|
-
className: "fs-12",
|
239
|
-
color: "textSecondary",
|
240
|
-
children: "Click here to upload PDF, PPT, and image files."
|
241
|
-
})]
|
242
|
-
})]
|
243
|
-
})
|
244
|
-
}), themeTabType === 1 && /*#__PURE__*/_jsx(Grid, {
|
245
|
-
className: "textArea",
|
246
|
-
children: /*#__PURE__*/_jsx(TextareaAutosize, {
|
247
|
-
placeholder: "Describe the theme you are interested in..."
|
248
|
-
})
|
249
|
-
}), themeTabType === 2 && /*#__PURE__*/_jsxs(_Fragment, {
|
250
|
-
children: [/*#__PURE__*/_jsx(Grid, {
|
251
|
-
className: "textArea imageUrl invalidUrl",
|
252
|
-
children: /*#__PURE__*/_jsx(TextField, {
|
253
|
-
fullWidth: true,
|
254
|
-
placeholder: "Add Image URL",
|
255
|
-
size: "small"
|
256
|
-
// value={imageUrl}
|
257
|
-
,
|
258
|
-
id: "outlined-basic",
|
259
|
-
variant: "outlined",
|
260
|
-
InputProps: {
|
261
|
-
endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
|
262
|
-
position: "end",
|
263
|
-
children: /*#__PURE__*/_jsx(TickIcon, {})
|
264
|
-
})
|
265
|
-
}
|
266
|
-
})
|
267
|
-
}), /*#__PURE__*/_jsx(Grid, {
|
268
|
-
className: "imageUpload",
|
269
|
-
children: /*#__PURE__*/_jsx(Grid, {
|
270
|
-
container: true,
|
271
|
-
justifyContent: "center",
|
272
|
-
justifyItems: "center",
|
273
|
-
className: "imgUploadInner",
|
274
|
-
children: /*#__PURE__*/_jsx(Grid, {
|
275
|
-
container: true,
|
276
|
-
justifyContent: "center",
|
277
|
-
alignItems: "center",
|
278
|
-
direction: "column",
|
279
|
-
children: /*#__PURE__*/_jsx("img", {
|
280
|
-
src: "",
|
281
|
-
alt: ""
|
282
|
-
})
|
283
|
-
})
|
284
|
-
})
|
285
|
-
})]
|
286
|
-
}), /*#__PURE__*/_jsxs(Grid, {
|
287
|
-
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
288
|
-
sx: {
|
289
|
-
mb: 1,
|
290
|
-
mt: 1
|
291
|
-
},
|
292
|
-
control: /*#__PURE__*/_jsx(Checkbox, {
|
293
|
-
checked: enableGenerateTheme,
|
294
|
-
onChange: event => setEnableGenerateTheme(event.target.checked),
|
295
|
-
size: "small"
|
296
|
-
}),
|
297
|
-
label: /*#__PURE__*/_jsx(Typography, {
|
298
|
-
variant: "body2",
|
299
|
-
className: "fs-12",
|
300
|
-
children: "a generated theme is used, the site text style will also change."
|
301
|
-
})
|
302
|
-
}), /*#__PURE__*/_jsxs(Grid, {
|
303
|
-
container: true,
|
304
|
-
justifyContent: generateTheme ? "space-between" : "flex-end",
|
305
|
-
children: [generateTheme && /*#__PURE__*/_jsx(Button, {
|
306
|
-
className: "outlineBtn",
|
307
|
-
variant: "outlined",
|
308
|
-
size: "small",
|
309
|
-
color: "primary",
|
310
|
-
children: "Regenerate theme"
|
311
|
-
}), /*#__PURE__*/_jsxs(Button, {
|
312
|
-
variant: "contained",
|
313
|
-
size: "small",
|
314
|
-
className: `blueBtn ${enableGenerateTheme ? "eanbled" : "disabled"}`,
|
315
|
-
disabled: loading,
|
316
|
-
onClick: () => {
|
317
|
-
// setGenerateTheme(true);
|
318
|
-
getTheme(fileInputRef, onThemeChange, setLoading);
|
319
|
-
},
|
320
|
-
children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
|
321
|
-
size: 18,
|
322
|
-
style: {
|
323
|
-
marginRight: "10px"
|
324
|
-
}
|
325
|
-
}) : null, loading ? "Generating..." : "Generate Theme"]
|
326
|
-
})]
|
327
|
-
})]
|
328
|
-
}), /*#__PURE__*/_jsx(Divider, {
|
329
|
-
sx: {
|
330
|
-
mt: 2,
|
331
|
-
mb: 2
|
332
|
-
}
|
333
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
334
|
-
variant: "body1",
|
335
|
-
className: "fs-14 fw-600",
|
336
|
-
sx: {
|
337
|
-
mt: 1,
|
338
|
-
mb: 1
|
339
|
-
},
|
340
|
-
children: "Active Theme"
|
341
|
-
}), /*#__PURE__*/_jsx(Grid, {
|
342
|
-
className: "themeCardWrapper",
|
343
|
-
children: /*#__PURE__*/_jsxs(Grid, {
|
344
|
-
container: true,
|
345
|
-
justifyContent: "space-between",
|
346
|
-
className: "themeCard selected",
|
347
|
-
children: [/*#__PURE__*/_jsx(TickIcon, {}), /*#__PURE__*/_jsx(ActiveTheme, {
|
348
|
-
explore: false
|
349
|
-
})]
|
350
|
-
})
|
351
|
-
})]
|
352
|
-
})
|
353
|
-
})
|
354
|
-
});
|
355
|
-
};
|
356
|
-
export default styled(ThemeSettingsAI)(Style);
|
@@ -1,190 +0,0 @@
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
2
|
-
import { Button, CircularProgress, Dialog, Divider, Grid, IconButton, TextField, Typography, styled } from "@mui/material";
|
3
|
-
|
4
|
-
// Style
|
5
|
-
import Style from "./style";
|
6
|
-
|
7
|
-
// icons
|
8
|
-
import { CloseIcon } from "../common/iconslist";
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
11
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
12
|
-
const SaveTheme = props => {
|
13
|
-
const {
|
14
|
-
className,
|
15
|
-
enableGenerateTheme,
|
16
|
-
saveBtnLabel,
|
17
|
-
loading,
|
18
|
-
onSave,
|
19
|
-
defaultFormData = {}
|
20
|
-
} = props;
|
21
|
-
|
22
|
-
// State
|
23
|
-
const [saveTheme, setSaveTheme] = useState(false);
|
24
|
-
const [error, setError] = useState({});
|
25
|
-
const [form, setForm] = useState(defaultFormData);
|
26
|
-
const {
|
27
|
-
name,
|
28
|
-
mood_name
|
29
|
-
} = form;
|
30
|
-
const updateForm = update => {
|
31
|
-
setForm(prev => ({
|
32
|
-
...prev,
|
33
|
-
...update
|
34
|
-
}));
|
35
|
-
};
|
36
|
-
useEffect(() => {
|
37
|
-
setForm(defaultFormData);
|
38
|
-
}, [defaultFormData]);
|
39
|
-
const onClose = () => {
|
40
|
-
setSaveTheme(false);
|
41
|
-
setError({});
|
42
|
-
setForm({});
|
43
|
-
};
|
44
|
-
const validate = () => {
|
45
|
-
let err = {};
|
46
|
-
if (!name) {
|
47
|
-
err.name = "This field is required!";
|
48
|
-
}
|
49
|
-
if (!mood_name) {
|
50
|
-
err.mood_name = "This field is required!";
|
51
|
-
}
|
52
|
-
return err;
|
53
|
-
};
|
54
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
55
|
-
children: [/*#__PURE__*/_jsx(Button, {
|
56
|
-
variant: "contained",
|
57
|
-
size: "small",
|
58
|
-
className: `blueBtn ${enableGenerateTheme ? "eanbled" : "disabled"}`
|
59
|
-
// disabled={!enableGenerateTheme}
|
60
|
-
,
|
61
|
-
onClick: () => setSaveTheme(true),
|
62
|
-
children: saveBtnLabel
|
63
|
-
}), /*#__PURE__*/_jsx(Dialog, {
|
64
|
-
fullWidth: true,
|
65
|
-
maxWidth: "sm",
|
66
|
-
open: saveTheme,
|
67
|
-
onClose: onClose,
|
68
|
-
className: className,
|
69
|
-
children: /*#__PURE__*/_jsxs(Grid, {
|
70
|
-
className: "saveThemeContainer",
|
71
|
-
sx: {
|
72
|
-
p: 2
|
73
|
-
},
|
74
|
-
children: [/*#__PURE__*/_jsxs(Grid, {
|
75
|
-
container: true,
|
76
|
-
justifyContent: "space-between",
|
77
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
78
|
-
variant: "h4",
|
79
|
-
sx: {
|
80
|
-
fontSize: "20px"
|
81
|
-
},
|
82
|
-
className: "fw-600",
|
83
|
-
children: "Save Your theme"
|
84
|
-
}), /*#__PURE__*/_jsx(IconButton, {
|
85
|
-
onClick: onClose,
|
86
|
-
className: "closeBtn",
|
87
|
-
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
88
|
-
})]
|
89
|
-
}), /*#__PURE__*/_jsx(Divider, {
|
90
|
-
sx: {
|
91
|
-
mt: 1,
|
92
|
-
mb: 1
|
93
|
-
}
|
94
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
95
|
-
variant: "body1",
|
96
|
-
className: "fw-500",
|
97
|
-
sx: {
|
98
|
-
pb: 0.5
|
99
|
-
},
|
100
|
-
children: "Theme name"
|
101
|
-
}), /*#__PURE__*/_jsx(TextField, {
|
102
|
-
variant: "outlined",
|
103
|
-
fullWidth: true,
|
104
|
-
size: "small",
|
105
|
-
placeholder: "Ex : Forest green",
|
106
|
-
onChange: e => updateForm({
|
107
|
-
name: e.target.value
|
108
|
-
}),
|
109
|
-
value: name
|
110
|
-
}), /*#__PURE__*/_jsx(Error, {
|
111
|
-
error: error?.name
|
112
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
113
|
-
variant: "body1",
|
114
|
-
className: "fw-500",
|
115
|
-
sx: {
|
116
|
-
pt: 1,
|
117
|
-
pb: 0.5
|
118
|
-
},
|
119
|
-
children: "Category"
|
120
|
-
}), /*#__PURE__*/_jsx(TextField, {
|
121
|
-
variant: "outlined",
|
122
|
-
size: "small",
|
123
|
-
placeholder: "Ex : Nature and Calm",
|
124
|
-
fullWidth: true,
|
125
|
-
onChange: e => updateForm({
|
126
|
-
mood_name: e.target.value
|
127
|
-
}),
|
128
|
-
value: mood_name
|
129
|
-
}), /*#__PURE__*/_jsx(Error, {
|
130
|
-
error: error?.mood_name
|
131
|
-
}), /*#__PURE__*/_jsxs(Grid, {
|
132
|
-
container: true,
|
133
|
-
justifyContent: "flex-end",
|
134
|
-
sx: {
|
135
|
-
mt: 3
|
136
|
-
},
|
137
|
-
children: [/*#__PURE__*/_jsx(Button, {
|
138
|
-
variant: "outlined",
|
139
|
-
className: "seondaryOutlineBtn",
|
140
|
-
color: "secondary",
|
141
|
-
onClick: onClose,
|
142
|
-
children: "Cancel"
|
143
|
-
}), /*#__PURE__*/_jsxs(Button, {
|
144
|
-
variant: "contained",
|
145
|
-
color: "primary",
|
146
|
-
className: "blueBtn",
|
147
|
-
sx: {
|
148
|
-
ml: 1
|
149
|
-
},
|
150
|
-
disabled: loading,
|
151
|
-
onClick: async () => {
|
152
|
-
const err = validate();
|
153
|
-
setError(err);
|
154
|
-
if (Object.keys(err)?.length) {
|
155
|
-
return;
|
156
|
-
}
|
157
|
-
await onSave({
|
158
|
-
...form
|
159
|
-
});
|
160
|
-
onClose();
|
161
|
-
},
|
162
|
-
children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
|
163
|
-
size: 14,
|
164
|
-
style: {
|
165
|
-
marginRight: "10px"
|
166
|
-
}
|
167
|
-
}) : null, saveBtnLabel]
|
168
|
-
})]
|
169
|
-
})]
|
170
|
-
})
|
171
|
-
})]
|
172
|
-
});
|
173
|
-
};
|
174
|
-
export default styled(SaveTheme)(Style);
|
175
|
-
function Error({
|
176
|
-
error = ""
|
177
|
-
}) {
|
178
|
-
if (error) {
|
179
|
-
return /*#__PURE__*/_jsx(Typography, {
|
180
|
-
variant: "body1",
|
181
|
-
sx: {
|
182
|
-
color: "red",
|
183
|
-
mt: 1
|
184
|
-
},
|
185
|
-
children: error
|
186
|
-
});
|
187
|
-
} else {
|
188
|
-
return /*#__PURE__*/_jsx(_Fragment, {});
|
189
|
-
}
|
190
|
-
}
|