@openlettermarketing/olc-react-sdk 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/.eslintignore +0 -1
- package/.eslintrc.cjs +0 -18
- package/.eslintrc.yml +0 -47
- package/.prettierignore +0 -3
- package/.prettierrc.yml +0 -5
- package/CHANGELOG.md +0 -4
- package/babel.config.json +0 -10
- package/examples/.eslintrc.yml +0 -4
- package/index.html +0 -18
- package/public/vite.svg +0 -1
- package/src/App.tsx +0 -72
- package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
- package/src/assets/images/input/cancel.tsx +0 -20
- package/src/assets/images/input/search.tsx +0 -20
- package/src/assets/images/modal-icons/cancelIcon.png +0 -0
- package/src/assets/images/modal-icons/del.tsx +0 -19
- package/src/assets/images/modal-icons/delete.svg +0 -3
- package/src/assets/images/modal-icons/modal-cross.tsx +0 -23
- package/src/assets/images/modal-icons/save.tsx +0 -23
- package/src/assets/images/templates/add-icon.svg +0 -5
- package/src/assets/images/templates/back-arrow.tsx +0 -19
- package/src/assets/images/templates/back-dialog-icon.png +0 -0
- package/src/assets/images/templates/back-dialog-icon.svg +0 -3
- package/src/assets/images/templates/barcode.png +0 -0
- package/src/assets/images/templates/bi-fold-self-mailers.tsx +0 -28
- package/src/assets/images/templates/black-trash-icon.svg +0 -3
- package/src/assets/images/templates/cancel.svg +0 -4
- package/src/assets/images/templates/cancelIcon.png +0 -0
- package/src/assets/images/templates/clipboard.svg +0 -3
- package/src/assets/images/templates/contact-search.svg +0 -3
- package/src/assets/images/templates/content-copy-icon.tsx +0 -24
- package/src/assets/images/templates/cross.svg +0 -3
- package/src/assets/images/templates/custom-template-icon-black.svg +0 -3
- package/src/assets/images/templates/custom-template-icon.svg +0 -3
- package/src/assets/images/templates/custom-template.tsx +0 -23
- package/src/assets/images/templates/dummy-template.svg +0 -21
- package/src/assets/images/templates/dynamic-field.tsx +0 -119
- package/src/assets/images/templates/edit-pencil-icon.tsx +0 -21
- package/src/assets/images/templates/filter-2.svg +0 -13
- package/src/assets/images/templates/info-icon.svg +0 -12
- package/src/assets/images/templates/info-icon.tsx +0 -37
- package/src/assets/images/templates/one-barcode.png +0 -0
- package/src/assets/images/templates/personal-letter.tsx +0 -53
- package/src/assets/images/templates/plus-icon.svg +0 -5
- package/src/assets/images/templates/postcard.tsx +0 -32
- package/src/assets/images/templates/professional-letter.tsx +0 -53
- package/src/assets/images/templates/real-penned-letters.tsx +0 -57
- package/src/assets/images/templates/search.svg +0 -3
- package/src/assets/images/templates/size-image-lg.tsx +0 -20
- package/src/assets/images/templates/size-image-mid.tsx +0 -20
- package/src/assets/images/templates/size-image.tsx +0 -20
- package/src/assets/images/templates/template-copy.svg +0 -3
- package/src/assets/images/templates/template-default-design.tsx +0 -21
- package/src/assets/images/templates/template-delete.svg +0 -3
- package/src/assets/images/templates/template-edit.svg +0 -4
- package/src/assets/images/templates/template-save-icon.svg +0 -3
- package/src/assets/images/templates/template-search-2.svg +0 -9
- package/src/assets/images/templates/template-search.svg +0 -4
- package/src/assets/images/templates/thumbnail.svg +0 -10
- package/src/assets/images/templates/trash-icon.svg +0 -13
- package/src/assets/images/templates/tri-fold-self-mailers.tsx +0 -93
- package/src/components/CreateTemplate/index.tsx +0 -381
- package/src/components/CreateTemplate/styles.scss +0 -363
- package/src/components/GenericUIBlocks/Button/index.tsx +0 -21
- package/src/components/GenericUIBlocks/Button/styles.scss +0 -15
- package/src/components/GenericUIBlocks/CircularProgress/index.tsx +0 -18
- package/src/components/GenericUIBlocks/CircularProgress/styles.scss +0 -98
- package/src/components/GenericUIBlocks/Dialog/index.tsx +0 -127
- package/src/components/GenericUIBlocks/Dialog/styles.scss +0 -106
- package/src/components/GenericUIBlocks/Divider/index.tsx +0 -12
- package/src/components/GenericUIBlocks/Divider/styles.scss +0 -7
- package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +0 -86
- package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +0 -77
- package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +0 -24
- package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +0 -9
- package/src/components/GenericUIBlocks/GenericSnackbar/index.tsx +0 -53
- package/src/components/GenericUIBlocks/GenericSnackbar/styles.scss +0 -34
- package/src/components/GenericUIBlocks/Grid/index.tsx +0 -82
- package/src/components/GenericUIBlocks/Input/index.tsx +0 -89
- package/src/components/GenericUIBlocks/Input/styles.scss +0 -80
- package/src/components/GenericUIBlocks/Typography/index.tsx +0 -18
- package/src/components/GenericUIBlocks/Typography/styles.scss +0 -27
- package/src/components/SidePanel/customFields/customFieldSection.tsx +0 -173
- package/src/components/SidePanel/customFields/styles.scss +0 -47
- package/src/components/SidePanel/index.tsx +0 -42
- package/src/components/SidePanel/templates/customTemplateSection.tsx +0 -503
- package/src/components/SidePanel/templates/styles.scss +0 -151
- package/src/components/TemplateBuilder/index.tsx +0 -301
- package/src/components/TemplateBuilder/styles.scss +0 -66
- package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +0 -58
- package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +0 -123
- package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +0 -98
- package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +0 -88
- package/src/components/TopNavigation/SaveTemplateModel/index.tsx +0 -60
- package/src/components/TopNavigation/SaveTemplateModel/styles.scss +0 -128
- package/src/components/TopNavigation/index.tsx +0 -406
- package/src/components/TopNavigation/styles.scss +0 -83
- package/src/importMeta.d.ts +0 -9
- package/src/index.scss +0 -137
- package/src/index.tsx +0 -79
- package/src/libs/test.ts +0 -7
- package/src/redux/actions/action-types.ts +0 -42
- package/src/redux/actions/customFieldAction.ts +0 -28
- package/src/redux/actions/snackbarActions.ts +0 -16
- package/src/redux/actions/templateActions.ts +0 -456
- package/src/redux/reducers/customFieldReducer.ts +0 -97
- package/src/redux/reducers/index.ts +0 -14
- package/src/redux/reducers/snackbarReducer.ts +0 -41
- package/src/redux/reducers/templateReducer.ts +0 -353
- package/src/redux/store.ts +0 -18
- package/src/styles/colors.scss +0 -61
- package/src/test/mocks.js +0 -89
- package/src/test/setupJest.js +0 -1
- package/src/utils/api.ts +0 -36
- package/src/utils/constants.ts +0 -40
- package/src/utils/customStyles.ts +0 -135
- package/src/utils/fetchWrapper.ts +0 -68
- package/src/utils/fonts.json +0 -1597
- package/src/utils/helper.ts +0 -19
- package/src/utils/local-storage.ts +0 -15
- package/src/utils/message.ts +0 -71
- package/src/utils/template-builder.ts +0 -147
- package/src/utils/templateRestrictedArea/biFold.ts +0 -433
- package/src/utils/templateRestrictedArea/postCard.ts +0 -439
- package/src/utils/templateRestrictedArea/professional.ts +0 -422
- package/src/utils/templateRestrictedArea/realPenned.ts +0 -244
- package/src/utils/templateRestrictedArea/triFold.ts +0 -434
- package/tsconfig.json +0 -29
- package/tsconfig.node.json +0 -12
- package/vite.config.ts +0 -8
- package/webpack.config.js +0 -80
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
// Import Polotno and third-party libraries
|
|
4
|
-
import { PolotnoContainer, WorkspaceWrap } from 'polotno';
|
|
5
|
-
import { setUploadFunc } from 'polotno/config';
|
|
6
|
-
import { Toolbar } from 'polotno/toolbar/toolbar';
|
|
7
|
-
import { ZoomButtons } from 'polotno/toolbar/zoom-buttons';
|
|
8
|
-
import { Workspace } from 'polotno/canvas/workspace';
|
|
9
|
-
import { setGoogleFonts } from 'polotno/config';
|
|
10
|
-
import merge from 'deepmerge';
|
|
11
|
-
|
|
12
|
-
// Hooks
|
|
13
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
14
|
-
import { useParams, useNavigate } from 'react-router-dom';
|
|
15
|
-
import { RootState } from '../../redux/reducers';
|
|
16
|
-
import { AppDispatch } from '../../redux/store';
|
|
17
|
-
import { StoreType } from 'polotno/model/store';
|
|
18
|
-
|
|
19
|
-
// Actions
|
|
20
|
-
import {
|
|
21
|
-
getAllCustomFields,
|
|
22
|
-
getOneTemplate,
|
|
23
|
-
uploadFile,
|
|
24
|
-
} from '../../redux/actions/templateActions';
|
|
25
|
-
import { TEMPLATE_LOADING } from '../../redux/actions/action-types';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Utils
|
|
29
|
-
import { drawRestrictedAreaOnPage, getFileAsBlob } from '../../utils/template-builder';
|
|
30
|
-
import { addElementsforRealPennedLetters } from '../../utils/templateRestrictedArea/realPenned';
|
|
31
|
-
import { DPI, multiPageLetters } from '../../utils/constants';
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
import fonts from "../../utils/fonts.json";
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
import LexiRegularFont from "../../assets/Fonts/Lexi-Regular.ttf";
|
|
36
|
-
|
|
37
|
-
// Components
|
|
38
|
-
import TopNavigation from '../TopNavigation';
|
|
39
|
-
import SidePanel from '../SidePanel';
|
|
40
|
-
import GenericSnackbar from '../GenericUIBlocks/GenericSnackbar';
|
|
41
|
-
|
|
42
|
-
import './styles.scss';
|
|
43
|
-
|
|
44
|
-
setUploadFunc(uploadFile)
|
|
45
|
-
/**
|
|
46
|
-
* This code defines a React functional component called `TemplateBuilder` that is responsible for rendering a template builder interface.
|
|
47
|
-
* It includes various useEffect hooks to handle component lifecycle events and state updates.
|
|
48
|
-
* The component uses the `polotno` library to create a canvas workspace where users can design templates.
|
|
49
|
-
* It also includes a side panel with different sections for adding and customizing elements on the canvas.
|
|
50
|
-
*
|
|
51
|
-
* @param {Object} props - The component props.
|
|
52
|
-
* @param {Object} props.store - The store object passed as a prop to the `TemplateBuilder` component.
|
|
53
|
-
* @param {Object} props.styles - The styles contain CSS Properties passed as a prop to the `TemplateBuilder` component.
|
|
54
|
-
* @returns {JSX.Element} The rendered template builder interface.
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
// styles
|
|
58
|
-
import './styles.scss'
|
|
59
|
-
|
|
60
|
-
interface TemplateBuilderProps {
|
|
61
|
-
store: StoreType,
|
|
62
|
-
returnRoute?: string | null,
|
|
63
|
-
styles?: React.CSSProperties;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const TemplateBuilder: React.FC<TemplateBuilderProps> = ({ store, styles, returnRoute }) => {
|
|
67
|
-
const [isStoreUpdated, setIsStoreUpdated] = useState(false);
|
|
68
|
-
const [switchTabCount, setSwitchTabCount] = useState(1);
|
|
69
|
-
|
|
70
|
-
const { id } = useParams();
|
|
71
|
-
const dispatch: AppDispatch = useDispatch();
|
|
72
|
-
const navigate = useNavigate();
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const template = useSelector((state: RootState) => state.templates.template) as Record<string, any>;
|
|
76
|
-
const product = useSelector((state: RootState) => state.templates.product) as Record<string, any>;
|
|
77
|
-
const envelopeType = useSelector(
|
|
78
|
-
(state: RootState) => state.templates.envelopeType
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
const currentTemplateType = product?.productType;
|
|
82
|
-
|
|
83
|
-
const containerStyle = merge(
|
|
84
|
-
{
|
|
85
|
-
width: '100vw',
|
|
86
|
-
height: '90vh',
|
|
87
|
-
position: 'relative',
|
|
88
|
-
backgroundColor: 'var(--mainBackgroundColor) !important',
|
|
89
|
-
},
|
|
90
|
-
styles || {}
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
handleLoadTemplate();
|
|
95
|
-
}, [template]);
|
|
96
|
-
|
|
97
|
-
// Event listener for visibility change
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
const handleVisibilityChange = () => {
|
|
100
|
-
if (document.hidden) {
|
|
101
|
-
setSwitchTabCount((prev) => prev + 1);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
106
|
-
|
|
107
|
-
return () => {
|
|
108
|
-
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
109
|
-
};
|
|
110
|
-
}, []);
|
|
111
|
-
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
if (!product) {
|
|
114
|
-
navigate('/create-template');
|
|
115
|
-
}
|
|
116
|
-
}, []);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
useEffect(() => {
|
|
120
|
-
if (product) {
|
|
121
|
-
setGoogleFonts(fonts);
|
|
122
|
-
// remove this component from the history stack
|
|
123
|
-
|
|
124
|
-
if (id) {
|
|
125
|
-
// @ts-ignore
|
|
126
|
-
dispatch(getOneTemplate(id));
|
|
127
|
-
} else if (store.pages.length === 0) {
|
|
128
|
-
createInitialPage();
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
dispatch(getAllCustomFields());
|
|
132
|
-
|
|
133
|
-
const handleChange = () => {
|
|
134
|
-
if (!isStoreUpdated) {
|
|
135
|
-
setIsStoreUpdated(true);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const off = store.on("change", handleChange);
|
|
140
|
-
|
|
141
|
-
return () => {
|
|
142
|
-
store.history.clear();
|
|
143
|
-
store.clear();
|
|
144
|
-
off();
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
}, []);
|
|
148
|
-
|
|
149
|
-
useEffect(() => {
|
|
150
|
-
if (!id && product && store.pages.length === 0) {
|
|
151
|
-
createInitialPage();
|
|
152
|
-
}
|
|
153
|
-
}, [product]);
|
|
154
|
-
|
|
155
|
-
useEffect(() => {
|
|
156
|
-
const handleBeforeUnload = (event: { returnValue: string; }) => {
|
|
157
|
-
const message = "Are you sure you want to leave?";
|
|
158
|
-
event.returnValue = message;
|
|
159
|
-
return message;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const addBeforeUnloadListener = () => {
|
|
163
|
-
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
164
|
-
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const removeBeforeUnloadListener = () => {
|
|
168
|
-
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
if (isStoreUpdated) {
|
|
172
|
-
addBeforeUnloadListener();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return () => {
|
|
176
|
-
removeBeforeUnloadListener();
|
|
177
|
-
};
|
|
178
|
-
}, [isStoreUpdated]);
|
|
179
|
-
|
|
180
|
-
const createInitialPage = async () => {
|
|
181
|
-
if (product) {
|
|
182
|
-
|
|
183
|
-
store.addPage();
|
|
184
|
-
const paperSize = product?.selectedSize?.split("x");
|
|
185
|
-
store.setUnit({
|
|
186
|
-
unit: "in",
|
|
187
|
-
dpi: DPI,
|
|
188
|
-
});
|
|
189
|
-
store.setSize(+paperSize[1] * DPI, +paperSize[0] * DPI);
|
|
190
|
-
if (multiPageLetters.includes(product.productType)) {
|
|
191
|
-
store.addPage();
|
|
192
|
-
store.selectPage(store.pages[0].id);
|
|
193
|
-
}
|
|
194
|
-
//@ts-ignore
|
|
195
|
-
drawRestrictedAreaOnPage(store, product, envelopeType);
|
|
196
|
-
|
|
197
|
-
if (currentTemplateType === "Real Penned Letter") {
|
|
198
|
-
handleRealPennedLetters();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
store.history.clear();
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
setIsStoreUpdated(false);
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
const handleRealPennedLetters = async () => {
|
|
208
|
-
try {
|
|
209
|
-
// Load Lexi Regular Fonts Into Store
|
|
210
|
-
store.addFont({
|
|
211
|
-
fontFamily: "lexi Regular",
|
|
212
|
-
url: LexiRegularFont,
|
|
213
|
-
});
|
|
214
|
-
addElementsforRealPennedLetters(store);
|
|
215
|
-
|
|
216
|
-
const response = await fetch(LexiRegularFont);
|
|
217
|
-
const blob = await response.blob();
|
|
218
|
-
|
|
219
|
-
const reader = new FileReader();
|
|
220
|
-
// Load Lexi Regular Base64 into JSON
|
|
221
|
-
reader.onloadend = () => {
|
|
222
|
-
store.addFont({
|
|
223
|
-
fontFamily: "lexi Regular",
|
|
224
|
-
url: reader.result,
|
|
225
|
-
} as any);
|
|
226
|
-
};
|
|
227
|
-
reader.readAsDataURL(blob);
|
|
228
|
-
} catch (error) {
|
|
229
|
-
console.error("Error loading the font file:", error);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
const handleLoadTemplate = async () => {
|
|
234
|
-
if (template) {
|
|
235
|
-
const workspaceElement = document.querySelector(
|
|
236
|
-
".polotno-workspace-container"
|
|
237
|
-
);
|
|
238
|
-
if (workspaceElement) {
|
|
239
|
-
workspaceElement.classList.add("show-loader");
|
|
240
|
-
}
|
|
241
|
-
// @ts-ignore
|
|
242
|
-
const paperDimensions = template?.product?.paperSize.split('x');
|
|
243
|
-
store.setUnit({
|
|
244
|
-
unit: "in",
|
|
245
|
-
dpi: 96,
|
|
246
|
-
});
|
|
247
|
-
store.setSize(+paperDimensions[1] * DPI, +paperDimensions[0] * DPI);
|
|
248
|
-
const jsonData = await getFileAsBlob(template?.templateUrl);
|
|
249
|
-
store.loadJSON(jsonData);
|
|
250
|
-
await store.waitLoading();
|
|
251
|
-
setIsStoreUpdated(false);
|
|
252
|
-
dispatch({ type: TEMPLATE_LOADING, payload: false });
|
|
253
|
-
if (workspaceElement) {
|
|
254
|
-
workspaceElement.classList.add("hide-loader");
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
// Incase of Real Penned Letters hide tooltip
|
|
260
|
-
const Tooltip = () => null;
|
|
261
|
-
|
|
262
|
-
return (
|
|
263
|
-
<div className="polotno-container">
|
|
264
|
-
{switchTabCount > 0 && (
|
|
265
|
-
<div className='builder-wrapper'>
|
|
266
|
-
<TopNavigation
|
|
267
|
-
store={store}
|
|
268
|
-
isStoreUpdated={isStoreUpdated}
|
|
269
|
-
returnRoute={returnRoute}
|
|
270
|
-
/>
|
|
271
|
-
|
|
272
|
-
<PolotnoContainer
|
|
273
|
-
style={containerStyle}
|
|
274
|
-
>
|
|
275
|
-
<SidePanel store={store} currentTemplateType={currentTemplateType} />
|
|
276
|
-
<WorkspaceWrap>
|
|
277
|
-
{currentTemplateType !== "Real Penned Letter" && (
|
|
278
|
-
<Toolbar store={store} downloadButtonEnabled={false} />
|
|
279
|
-
)}
|
|
280
|
-
{currentTemplateType !== "Real Penned Letter" ? (
|
|
281
|
-
<Workspace store={store} pageControlsEnabled={false} />
|
|
282
|
-
) : (
|
|
283
|
-
<Workspace
|
|
284
|
-
store={store}
|
|
285
|
-
pageControlsEnabled={false}
|
|
286
|
-
components={{ Tooltip }}
|
|
287
|
-
/>
|
|
288
|
-
)}
|
|
289
|
-
<ZoomButtons store={store} />
|
|
290
|
-
</WorkspaceWrap>
|
|
291
|
-
</PolotnoContainer>
|
|
292
|
-
<GenericSnackbar />
|
|
293
|
-
</div>
|
|
294
|
-
)}
|
|
295
|
-
</div>
|
|
296
|
-
);
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
export default TemplateBuilder;
|
|
300
|
-
|
|
301
|
-
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
.polotno-container {
|
|
2
|
-
.builder-wrapper {
|
|
3
|
-
@media (max-width: 600px) {
|
|
4
|
-
display: none;
|
|
5
|
-
}
|
|
6
|
-
.polotno-side-panel {
|
|
7
|
-
& .polotno-side-tabs-container {
|
|
8
|
-
background-color: var(--sidepanelBgColor);
|
|
9
|
-
& .polotno-side-tabs-inner {
|
|
10
|
-
& .polotno-side-panel-tab {
|
|
11
|
-
color: var(--sidepanelTextColor);
|
|
12
|
-
&.active,
|
|
13
|
-
&:hover {
|
|
14
|
-
background-color: var(--sidepanelOptionHoverColor);
|
|
15
|
-
opacity: 0.8;
|
|
16
|
-
color: var(--sidepanelTextColorHover);
|
|
17
|
-
svg {
|
|
18
|
-
color: var(--primaryColor);
|
|
19
|
-
path {
|
|
20
|
-
stroke: var(--primaryColor) !important;
|
|
21
|
-
}
|
|
22
|
-
line {
|
|
23
|
-
stroke: var(--primaryColor) !important;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
& .polotno-panel-container {
|
|
31
|
-
background-color: var(--mainBackgroundColor);
|
|
32
|
-
& > div > p {
|
|
33
|
-
display: none;
|
|
34
|
-
}
|
|
35
|
-
.bp5-tabs {
|
|
36
|
-
.bp5-tab-list {
|
|
37
|
-
.bp5-tab-indicator-wrapper {
|
|
38
|
-
.bp5-tab-indicator {
|
|
39
|
-
background-color: var(--primaryColor);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
.bp5-tab[aria-selected='true'] {
|
|
43
|
-
color: var(--primaryColor);
|
|
44
|
-
&:focus {
|
|
45
|
-
outline: none;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
.bp5-tab[aria-selected='false'] {
|
|
49
|
-
color: var(--textColor);
|
|
50
|
-
&:focus {
|
|
51
|
-
outline: none;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
.polotno-workspace-container {
|
|
59
|
-
background-color: transparent !important;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.bp5-popover-transition-container {
|
|
65
|
-
z-index: 2200 !important;
|
|
66
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
// Utils
|
|
4
|
-
import { MESSAGES } from "../../../utils/message";
|
|
5
|
-
|
|
6
|
-
// Components
|
|
7
|
-
import Dialog from '../../GenericUIBlocks/Dialog';
|
|
8
|
-
|
|
9
|
-
// images
|
|
10
|
-
import ModalCross from '../../../assets/images/modal-icons/modal-cross';
|
|
11
|
-
|
|
12
|
-
// Styles
|
|
13
|
-
import "./styles.scss";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* ConfirmNavigateDialog Component
|
|
18
|
-
* A modal for duplicating a template.
|
|
19
|
-
*
|
|
20
|
-
* @param {boolean} open - Boolean indicating whether the modal is open.
|
|
21
|
-
* @param {Function} handleClose - Function to handle the closing of the modal.
|
|
22
|
-
* @returns {JSX.Element} The duplicate template modal component.
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const cancelDialogStyles = {
|
|
27
|
-
maxWidth: '450px',
|
|
28
|
-
minHeight: '260px',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// Define the props type
|
|
32
|
-
interface ConfirmNavigateDialogProps {
|
|
33
|
-
open: boolean;
|
|
34
|
-
handleClose: () => void;
|
|
35
|
-
handleNavigateAction: () => void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const ConfirmNavigateDialog: React.FC<ConfirmNavigateDialogProps> = ({ open, handleClose, handleNavigateAction }) => {
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Dialog
|
|
43
|
-
icon={<ModalCross fill="var(--primaryColor)" />}
|
|
44
|
-
customStyles={cancelDialogStyles}
|
|
45
|
-
open={open}
|
|
46
|
-
handleClose={handleClose}
|
|
47
|
-
title={MESSAGES.TEMPLATE.CANCEL.TITLE}
|
|
48
|
-
subHeading={MESSAGES.TEMPLATE.CANCEL.HEADING}
|
|
49
|
-
description={MESSAGES.TEMPLATE.CANCEL.PARAGRAPH}
|
|
50
|
-
onSubmit={handleNavigateAction}
|
|
51
|
-
onCancel={handleClose}
|
|
52
|
-
cancelText={MESSAGES.TEMPLATE.CANCEL.BACK_BUTTON}
|
|
53
|
-
submitText={MESSAGES.TEMPLATE.CANCEL.CANCEL_BUTTON}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default ConfirmNavigateDialog;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
.confirmCancelTemplateLeaveModal {
|
|
2
|
-
.MuiPaper-root {
|
|
3
|
-
width: 100% !important;
|
|
4
|
-
max-width: 407px !important;
|
|
5
|
-
height: 100% !important;
|
|
6
|
-
max-height: 258px !important;
|
|
7
|
-
margin: 0 auto !important;
|
|
8
|
-
border-radius: 11px;
|
|
9
|
-
background: #fff8ee;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.confirmTemplateLeaveModalTitle {
|
|
13
|
-
color: #ed5c2f;
|
|
14
|
-
text-align: center;
|
|
15
|
-
font-size: 22px;
|
|
16
|
-
font-style: normal;
|
|
17
|
-
font-weight: 700;
|
|
18
|
-
line-height: normal;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.confirmTemplateLeaveModalContent {
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
gap: 10px;
|
|
25
|
-
padding: 16px 16px 0px 16px !important;
|
|
26
|
-
|
|
27
|
-
.trashIconWrapper {
|
|
28
|
-
text-align: center;
|
|
29
|
-
|
|
30
|
-
p {
|
|
31
|
-
color: #ed5c2f;
|
|
32
|
-
text-align: center;
|
|
33
|
-
font-size: 22px;
|
|
34
|
-
font-style: normal;
|
|
35
|
-
font-weight: 700;
|
|
36
|
-
line-height: normal;
|
|
37
|
-
margin-top: 12px;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.confirmTemplateLeaveText {
|
|
42
|
-
display: flex;
|
|
43
|
-
flex-direction: column;
|
|
44
|
-
justify-content: center;
|
|
45
|
-
align-items: center;
|
|
46
|
-
gap: 10px;
|
|
47
|
-
|
|
48
|
-
p {
|
|
49
|
-
color: #000;
|
|
50
|
-
text-align: center;
|
|
51
|
-
font-size: 16px;
|
|
52
|
-
font-style: normal;
|
|
53
|
-
font-weight: 600;
|
|
54
|
-
line-height: normal;
|
|
55
|
-
|
|
56
|
-
&:last-child {
|
|
57
|
-
color: #000;
|
|
58
|
-
text-align: center;
|
|
59
|
-
font-size: 14px;
|
|
60
|
-
font-style: normal;
|
|
61
|
-
font-weight: 400;
|
|
62
|
-
line-height: 16px;
|
|
63
|
-
/* 114.286% */
|
|
64
|
-
letter-spacing: 0.28px;
|
|
65
|
-
margin: 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.MuiInputBase-root {
|
|
71
|
-
border-radius: 7px;
|
|
72
|
-
border: 0.5px solid #303030;
|
|
73
|
-
background: #fff;
|
|
74
|
-
width: 100%;
|
|
75
|
-
padding: 10px 22px;
|
|
76
|
-
|
|
77
|
-
&:focus,
|
|
78
|
-
&:focus-visible {
|
|
79
|
-
outline: none !important;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&::after,
|
|
83
|
-
&::before {
|
|
84
|
-
display: none !important;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.actionBtns {
|
|
90
|
-
justify-content: center;
|
|
91
|
-
align-items: center;
|
|
92
|
-
margin-bottom: 13px;
|
|
93
|
-
gap: 11px;
|
|
94
|
-
|
|
95
|
-
button {
|
|
96
|
-
border-radius: 3px !important;
|
|
97
|
-
text-transform: capitalize;
|
|
98
|
-
|
|
99
|
-
&:first-child {
|
|
100
|
-
border: 0.5px solid rgba(48, 48, 48, 0.5);
|
|
101
|
-
background: #fff;
|
|
102
|
-
color: #000;
|
|
103
|
-
font-size: 14px;
|
|
104
|
-
font-style: normal;
|
|
105
|
-
font-weight: 600;
|
|
106
|
-
line-height: normal;
|
|
107
|
-
min-width: 100px !important;
|
|
108
|
-
min-height: 40px !important;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
&:last-child {
|
|
112
|
-
color: #fff;
|
|
113
|
-
font-size: 14px;
|
|
114
|
-
font-style: normal;
|
|
115
|
-
font-weight: 600;
|
|
116
|
-
line-height: normal;
|
|
117
|
-
background: #ed5c2f;
|
|
118
|
-
max-width: 146px !important;
|
|
119
|
-
min-height: 40px !important;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
// Hooks
|
|
4
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
5
|
-
import { RootState, AppDispatch } from '../../../redux/store';
|
|
6
|
-
|
|
7
|
-
// Actions
|
|
8
|
-
import { searchAndAdvanceChange } from '../../../redux/actions/templateActions';
|
|
9
|
-
import { failure } from '../../../redux/actions/snackbarActions';
|
|
10
|
-
|
|
11
|
-
// Utils
|
|
12
|
-
import { MESSAGES } from '../../../utils/message';
|
|
13
|
-
|
|
14
|
-
// UI Components
|
|
15
|
-
import Dialog from '../../../components/GenericUIBlocks/Dialog';
|
|
16
|
-
import Input from '../../../components/GenericUIBlocks/Input';
|
|
17
|
-
|
|
18
|
-
// Styles
|
|
19
|
-
import './styles.scss';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* EditTemplateNameModel Component
|
|
24
|
-
* A modal for duplicating a template.
|
|
25
|
-
*
|
|
26
|
-
* @param {boolean} open - Boolean indicating whether the modal is open.
|
|
27
|
-
* @param {Function} handleClose - Function to handle the closing of the modal.
|
|
28
|
-
* @returns {JSX.Element} The duplicate template modal component.
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
interface EditTemplateNameModelProps {
|
|
33
|
-
open: boolean;
|
|
34
|
-
handleClose: () => void;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const editDialogStyles = {
|
|
38
|
-
maxWidth: '630px',
|
|
39
|
-
minHeight: '210px',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const EditTemplateNameModel: React.FC<EditTemplateNameModelProps> = ({
|
|
43
|
-
open,
|
|
44
|
-
handleClose,
|
|
45
|
-
}) => {
|
|
46
|
-
const [title, setTitle] = useState('');
|
|
47
|
-
|
|
48
|
-
const dispatch: AppDispatch = useDispatch();
|
|
49
|
-
|
|
50
|
-
const templateTitle =
|
|
51
|
-
useSelector((state: RootState) => state.templates.title) || '';
|
|
52
|
-
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
setTitle(templateTitle);
|
|
55
|
-
}, []);
|
|
56
|
-
|
|
57
|
-
// Handle the duplication of the template
|
|
58
|
-
const handleEditName = async () => {
|
|
59
|
-
let errorText = '';
|
|
60
|
-
if (!title) {
|
|
61
|
-
errorText = MESSAGES.TEMPLATE.NAME_REQUIRED;
|
|
62
|
-
} else if (title.length > 50) {
|
|
63
|
-
errorText = MESSAGES.TEMPLATE.NAME_LESS_50;
|
|
64
|
-
}
|
|
65
|
-
if (errorText) {
|
|
66
|
-
dispatch(failure(errorText));
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
dispatch(searchAndAdvanceChange('title', title.trim()));
|
|
70
|
-
handleClose();
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<Dialog
|
|
75
|
-
open={open}
|
|
76
|
-
loading={false}
|
|
77
|
-
handleClose={handleClose}
|
|
78
|
-
title="Edit Template Name"
|
|
79
|
-
cancelText={MESSAGES.TEMPLATE.SAVE.CANCEL_BUTTON}
|
|
80
|
-
submitText="Save"
|
|
81
|
-
customStyles={editDialogStyles}
|
|
82
|
-
onSubmit={handleEditName}
|
|
83
|
-
onCancel={handleClose}
|
|
84
|
-
>
|
|
85
|
-
<Input
|
|
86
|
-
variant="input"
|
|
87
|
-
type="text"
|
|
88
|
-
label="Template Name"
|
|
89
|
-
placeholder="Holidays"
|
|
90
|
-
value={title}
|
|
91
|
-
onChange={e => setTitle(e.target.value)}
|
|
92
|
-
/>
|
|
93
|
-
</Dialog>
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export default EditTemplateNameModel;
|
|
98
|
-
|