@bigbinary/neeto-themes-frontend 1.1.12 → 1.1.14
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/dist/index.cjs.js +94 -45
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +77 -37
- package/dist/index.js.map +1 -1
- package/package.json +14 -13
- package/types.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -2,22 +2,31 @@ import { shallow } from 'zustand/shallow';
|
|
|
2
2
|
import React, { useEffect, forwardRef, useImperativeHandle, Fragment, useMemo, useRef, useReducer, useCallback, useState, memo } from 'react';
|
|
3
3
|
import i18next, { t as t$2 } from 'i18next';
|
|
4
4
|
import { withImmutableActions, useMutationWithInvalidation, useDebounce, useFuncDebounce, withT, withTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
|
-
import
|
|
5
|
+
import Spinner$1 from '@bigbinary/neetoui/Spinner';
|
|
6
6
|
import { create as create$3 } from 'zustand';
|
|
7
7
|
import { isNotPresent, snakeToCamelCase, noop as noop$1, isPresent, findBy, keysToCamelCase, humanize, existsBy, filterBy, findIndexBy, isNot, isNotEmpty } from '@bigbinary/neeto-cist';
|
|
8
|
+
import Alert from '@bigbinary/neetoui/Alert';
|
|
8
9
|
import { useTranslation, Trans } from 'react-i18next';
|
|
10
|
+
import '@bigbinary/neetoui/Toastr';
|
|
9
11
|
import { useQuery, useMutation } from 'react-query';
|
|
10
12
|
import axios from 'axios';
|
|
11
13
|
import { prop, mergeRight, equals, pipe, values, flatten as flatten$1, map, toUpper, join, isNil, isEmpty, mergeLeft, concat, __, inc, path } from 'ramda';
|
|
12
|
-
import
|
|
14
|
+
import Button$1 from '@bigbinary/neetoui/Button';
|
|
15
|
+
import Form from '@bigbinary/neetoui/formik/Form';
|
|
13
16
|
import * as yup from 'yup';
|
|
14
17
|
import { useFormikContext } from 'formik';
|
|
18
|
+
import Typography from '@bigbinary/neetoui/Typography';
|
|
15
19
|
import classnames from 'classnames';
|
|
16
20
|
import { MenuHorizontal, LeftArrow, Plus } from '@bigbinary/neeto-icons';
|
|
21
|
+
import { Dropdown, Typography as Typography$1, Modal as Modal$1, Spinner, Tab, Button, Input, Toastr, Switch } from '@bigbinary/neetoui';
|
|
17
22
|
import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
18
23
|
import { withEventTargetValue, joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils';
|
|
24
|
+
import ColorPicker from '@bigbinary/neetoui/ColorPicker';
|
|
25
|
+
import Select from '@bigbinary/neetoui/Select';
|
|
26
|
+
import Input$1 from '@bigbinary/neetoui/formik/Input';
|
|
19
27
|
import Search from '@bigbinary/neeto-molecules/Search';
|
|
20
28
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
29
|
+
import Tag from '@bigbinary/neetoui/Tag';
|
|
21
30
|
|
|
22
31
|
/** @type {import("neetocommons/react-utils").ZustandStoreHook} */
|
|
23
32
|
var useConfigStore = create$3(withImmutableActions(function (set) {
|
|
@@ -36,6 +45,7 @@ var useThemeStore = create$3(withImmutableActions(function (set) {
|
|
|
36
45
|
return {
|
|
37
46
|
currentTheme: {},
|
|
38
47
|
isCurrentThemeLoading: true,
|
|
48
|
+
previewingTheme: {},
|
|
39
49
|
setThemeState: set
|
|
40
50
|
};
|
|
41
51
|
}));
|
|
@@ -460,7 +470,7 @@ var hexToRgba = function hexToRgba(hex) {
|
|
|
460
470
|
return "".concat(r, ", ").concat(g, ", ").concat(b).concat(a !== undefined ? ", ".concat(a) : "");
|
|
461
471
|
};
|
|
462
472
|
|
|
463
|
-
var BASE_URL = "
|
|
473
|
+
var BASE_URL = "neeto_themes_engine";
|
|
464
474
|
|
|
465
475
|
var show$1 = function show(entityId) {
|
|
466
476
|
return axios.get("".concat(BASE_URL, "/api/v1/theme/entities/").concat(entityId));
|
|
@@ -574,6 +584,14 @@ var useListConfigs = function useListConfigs(_ref) {
|
|
|
574
584
|
|
|
575
585
|
var useThemeUtils = function useThemeUtils() {
|
|
576
586
|
var setConfigState = useConfigStore(prop("setConfigState"));
|
|
587
|
+
var _useThemeStore = useThemeStore(function (store) {
|
|
588
|
+
return {
|
|
589
|
+
previewingTheme: store["previewingTheme"],
|
|
590
|
+
currentTheme: store["currentTheme"]
|
|
591
|
+
};
|
|
592
|
+
}, shallow),
|
|
593
|
+
previewingTheme = _useThemeStore.previewingTheme,
|
|
594
|
+
currentTheme = _useThemeStore.currentTheme;
|
|
577
595
|
var _useListConfigs = useListConfigs({
|
|
578
596
|
onSuccess: function onSuccess(_ref) {
|
|
579
597
|
var _ref$config = _ref.config,
|
|
@@ -614,7 +632,9 @@ var useThemeUtils = function useThemeUtils() {
|
|
|
614
632
|
};
|
|
615
633
|
return {
|
|
616
634
|
setTheme: setTheme,
|
|
617
|
-
setVariable: setVariable
|
|
635
|
+
setVariable: setVariable,
|
|
636
|
+
previewingTheme: previewingTheme,
|
|
637
|
+
currentTheme: currentTheme
|
|
618
638
|
};
|
|
619
639
|
};
|
|
620
640
|
|
|
@@ -3668,7 +3688,7 @@ var ImageDirectUpload = function ImageDirectUpload(_ref) {
|
|
|
3668
3688
|
})
|
|
3669
3689
|
}), /*#__PURE__*/React.createElement("div", {
|
|
3670
3690
|
className: "flex flex-col space-y-1"
|
|
3671
|
-
}, !isDisabled && /*#__PURE__*/React.createElement(Typography, {
|
|
3691
|
+
}, !isDisabled && /*#__PURE__*/React.createElement(Typography$1, {
|
|
3672
3692
|
className: "neeto-ui-text-gray-800 text-center leading-4",
|
|
3673
3693
|
style: "body2"
|
|
3674
3694
|
}, /*#__PURE__*/React.createElement(Trans, {
|
|
@@ -3679,7 +3699,7 @@ var ImageDirectUpload = function ImageDirectUpload(_ref) {
|
|
|
3679
3699
|
"data-cy": "neeto-image-uploader-browse-text"
|
|
3680
3700
|
})
|
|
3681
3701
|
}
|
|
3682
|
-
})), setIsAssetLibraryOpen && /*#__PURE__*/React.createElement(Typography, {
|
|
3702
|
+
})), setIsAssetLibraryOpen && /*#__PURE__*/React.createElement(Typography$1, {
|
|
3683
3703
|
className: "text-center leading-4",
|
|
3684
3704
|
style: "body2",
|
|
3685
3705
|
onClick: function onClick(e) {
|
|
@@ -3697,7 +3717,7 @@ var ImageDirectUpload = function ImageDirectUpload(_ref) {
|
|
|
3697
3717
|
})), /*#__PURE__*/React.createElement("input", _extends$1({}, getInputProps(), {
|
|
3698
3718
|
"data-cy": "neeto-image-uploader-file-input",
|
|
3699
3719
|
disabled: isDisabled
|
|
3700
|
-
})), /*#__PURE__*/React.createElement(Typography, {
|
|
3720
|
+
})), /*#__PURE__*/React.createElement(Typography$1, {
|
|
3701
3721
|
className: "neeto-ui-text-gray-700 text-center leading-4",
|
|
3702
3722
|
"data-cy": "neeto-image-uploader-restriction-message",
|
|
3703
3723
|
lineHeight: "snug",
|
|
@@ -5218,7 +5238,7 @@ var Controls = function Controls(_ref) {
|
|
|
5218
5238
|
disabled: isFullImage,
|
|
5219
5239
|
label: t("neetoImageUploader.labels.lockAspectRatio"),
|
|
5220
5240
|
onChange: onToggleAspectRatioLock
|
|
5221
|
-
}), /*#__PURE__*/React.createElement(Typography, {
|
|
5241
|
+
}), /*#__PURE__*/React.createElement(Typography$1, {
|
|
5222
5242
|
className: "mb-2 mt-6",
|
|
5223
5243
|
style: "body2"
|
|
5224
5244
|
}, t("neetoImageUploader.imageEditor.aspectRatio")), /*#__PURE__*/React.createElement("div", {
|
|
@@ -5230,7 +5250,7 @@ var Controls = function Controls(_ref) {
|
|
|
5230
5250
|
type: "number",
|
|
5231
5251
|
value: aspectRatio.width,
|
|
5232
5252
|
onChange: withEventTargetValue(handleAspectWidthChange)
|
|
5233
|
-
}), /*#__PURE__*/React.createElement(Typography, null, " : "), /*#__PURE__*/React.createElement(Input, {
|
|
5253
|
+
}), /*#__PURE__*/React.createElement(Typography$1, null, " : "), /*#__PURE__*/React.createElement(Input, {
|
|
5234
5254
|
"data-cy": "aspect-ratio-height-input",
|
|
5235
5255
|
disabled: isFullImage,
|
|
5236
5256
|
size: "small",
|
|
@@ -6294,7 +6314,7 @@ var Images$1 = function Images(_ref) {
|
|
|
6294
6314
|
refetch();
|
|
6295
6315
|
}, [debouncedQuery]);
|
|
6296
6316
|
if (error) {
|
|
6297
|
-
return /*#__PURE__*/React.createElement(Typography, {
|
|
6317
|
+
return /*#__PURE__*/React.createElement(Typography$1, {
|
|
6298
6318
|
className: "mt-9 flex justify-center",
|
|
6299
6319
|
style: "body2"
|
|
6300
6320
|
}, t("neetoImageUploader.unsplash.errorMessage"));
|
|
@@ -6500,7 +6520,7 @@ var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
|
6500
6520
|
refetch();
|
|
6501
6521
|
}, [debouncedQuery]);
|
|
6502
6522
|
if (error) {
|
|
6503
|
-
return /*#__PURE__*/React.createElement(Typography, {
|
|
6523
|
+
return /*#__PURE__*/React.createElement(Typography$1, {
|
|
6504
6524
|
className: "mt-9 flex justify-center",
|
|
6505
6525
|
style: "body2"
|
|
6506
6526
|
}, t("neetoImageUploader.unsplash.errorMessage"));
|
|
@@ -6648,7 +6668,7 @@ var Modal = function Modal(_ref) {
|
|
|
6648
6668
|
className: "neeto-ui-bg-gray-400 absolute inset-0 z-50 flex h-full items-center justify-center opacity-50"
|
|
6649
6669
|
}, /*#__PURE__*/React.createElement(Spinner, null)), isNilOrEmpty(selectedImage) && isDragActive && /*#__PURE__*/React.createElement("div", _extends$1({
|
|
6650
6670
|
className: "neeto-ui-rounded-xl neeto-ui-bg-gray-400 absolute flex h-full w-full flex-col items-center justify-around border-4 border-dashed border-gray-900 opacity-40"
|
|
6651
|
-
}, getRootProps()), /*#__PURE__*/React.createElement(Typography, null, t("neetoImageUploader.common.dropHere"))), !isNilOrEmpty(selectedImage) ? /*#__PURE__*/React.createElement(ImageEditor, {
|
|
6671
|
+
}, getRootProps()), /*#__PURE__*/React.createElement(Typography$1, null, t("neetoImageUploader.common.dropHere"))), !isNilOrEmpty(selectedImage) ? /*#__PURE__*/React.createElement(ImageEditor, {
|
|
6652
6672
|
fixedAspectRatio: fixedAspectRatio,
|
|
6653
6673
|
handleImageEditComplete: handleImageEditComplete,
|
|
6654
6674
|
handleReset: function handleReset() {
|
|
@@ -6662,7 +6682,7 @@ var Modal = function Modal(_ref) {
|
|
|
6662
6682
|
onClick: function onClick(event) {
|
|
6663
6683
|
return event.stopPropagation();
|
|
6664
6684
|
}
|
|
6665
|
-
})), /*#__PURE__*/React.createElement(Modal$1.Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
6685
|
+
})), /*#__PURE__*/React.createElement(Modal$1.Header, null, /*#__PURE__*/React.createElement(Typography$1, {
|
|
6666
6686
|
style: "h2"
|
|
6667
6687
|
}, t("neetoImageUploader.common.imageLibrary"))), /*#__PURE__*/React.createElement("div", {
|
|
6668
6688
|
className: "px-6 py-2"
|
|
@@ -6697,7 +6717,7 @@ var Modal = function Modal(_ref) {
|
|
|
6697
6717
|
tab: activeTab
|
|
6698
6718
|
}), equals(activeTab, TABS[1].key) && /*#__PURE__*/React.createElement(Modal$1.Footer, {
|
|
6699
6719
|
className: "flex items-center justify-center gap-2"
|
|
6700
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
6720
|
+
}, /*#__PURE__*/React.createElement(Typography$1, {
|
|
6701
6721
|
style: "body2"
|
|
6702
6722
|
}, /*#__PURE__*/React.createElement(Trans, {
|
|
6703
6723
|
i18nKey: "neetoImageUploader.unsplash.poweredByUnsplash",
|
|
@@ -6978,6 +6998,12 @@ var Properties = function Properties() {
|
|
|
6978
6998
|
};
|
|
6979
6999
|
}, shallow),
|
|
6980
7000
|
variableNamesMap = _useConfigStore.variableNamesMap;
|
|
7001
|
+
var _useThemeStore = useThemeStore(function (store) {
|
|
7002
|
+
return {
|
|
7003
|
+
setThemeState: store["setThemeState"]
|
|
7004
|
+
};
|
|
7005
|
+
}, shallow),
|
|
7006
|
+
setThemeState = _useThemeStore.setThemeState;
|
|
6981
7007
|
var _useFormikContext = useFormikContext(),
|
|
6982
7008
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
6983
7009
|
values = _useFormikContext.values;
|
|
@@ -7000,6 +7026,9 @@ var Properties = function Properties() {
|
|
|
7000
7026
|
};
|
|
7001
7027
|
useEffect(function () {
|
|
7002
7028
|
setTheme(values);
|
|
7029
|
+
setThemeState({
|
|
7030
|
+
previewingTheme: values
|
|
7031
|
+
});
|
|
7003
7032
|
}, [values]);
|
|
7004
7033
|
return /*#__PURE__*/React.createElement(Card$2, {
|
|
7005
7034
|
title: t("neetoThemes.common.style")
|
|
@@ -7149,13 +7178,13 @@ var Customize = function Customize(_ref) {
|
|
|
7149
7178
|
});
|
|
7150
7179
|
})), /*#__PURE__*/React.createElement("div", {
|
|
7151
7180
|
className: "neeto-ui-bg-white neeto-ui-shadow-s sticky bottom-0 left-0 right-0 flex justify-end gap-x-2 px-4 py-6"
|
|
7152
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
7181
|
+
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
7153
7182
|
"data-cy": "reset-button",
|
|
7154
7183
|
disabled: !dirty || isSubmitting,
|
|
7155
7184
|
label: t("neetoThemes.buttons.reset"),
|
|
7156
7185
|
style: "text",
|
|
7157
7186
|
type: "reset"
|
|
7158
|
-
}), /*#__PURE__*/React.createElement(Button, {
|
|
7187
|
+
}), /*#__PURE__*/React.createElement(Button$1, {
|
|
7159
7188
|
"data-cy": "save-changes-button",
|
|
7160
7189
|
disabled: !dirty && (theme === null || theme === void 0 ? void 0 : theme.id) || isSubmitting,
|
|
7161
7190
|
label: t("neetoThemes.buttons.save"),
|
|
@@ -7320,7 +7349,7 @@ var Card = function Card(_ref) {
|
|
|
7320
7349
|
"data-cy": "active-theme-label",
|
|
7321
7350
|
label: t("neetoThemes.common.active"),
|
|
7322
7351
|
style: "success"
|
|
7323
|
-
}) : /*#__PURE__*/React.createElement(Button, {
|
|
7352
|
+
}) : /*#__PURE__*/React.createElement(Button$1, {
|
|
7324
7353
|
className: "flex-shrink-0",
|
|
7325
7354
|
"data-cy": "apply-theme-button",
|
|
7326
7355
|
disabled: isApplyingTheme,
|
|
@@ -7367,8 +7396,6 @@ var Themes = function Themes(_ref) {
|
|
|
7367
7396
|
_ref$defaultThemes = _ref.defaultThemes,
|
|
7368
7397
|
defaultThemes = _ref$defaultThemes === void 0 ? [] : _ref$defaultThemes,
|
|
7369
7398
|
onDeleteTheme = _ref.onDeleteTheme,
|
|
7370
|
-
previewingTheme = _ref.previewingTheme,
|
|
7371
|
-
setPreviewingTheme = _ref.setPreviewingTheme,
|
|
7372
7399
|
themeToHighlight = _ref.themeToHighlight,
|
|
7373
7400
|
highlightTheme = _ref.highlightTheme,
|
|
7374
7401
|
didScrollActiveThemeIntoView = _ref.didScrollActiveThemeIntoView,
|
|
@@ -7379,6 +7406,14 @@ var Themes = function Themes(_ref) {
|
|
|
7379
7406
|
t = _useTranslation.t;
|
|
7380
7407
|
var _useThemeUtils = useThemeUtils(),
|
|
7381
7408
|
setTheme = _useThemeUtils.setTheme;
|
|
7409
|
+
var _useThemeStore = useThemeStore(function (store) {
|
|
7410
|
+
return {
|
|
7411
|
+
setThemeState: store["setThemeState"],
|
|
7412
|
+
previewingTheme: store["previewingTheme"]
|
|
7413
|
+
};
|
|
7414
|
+
}, shallow),
|
|
7415
|
+
setThemeState = _useThemeStore.setThemeState,
|
|
7416
|
+
previewingTheme = _useThemeStore.previewingTheme;
|
|
7382
7417
|
var _useState = useState(""),
|
|
7383
7418
|
_useState2 = _slicedToArray$3(_useState, 2),
|
|
7384
7419
|
searchQuery = _useState2[0],
|
|
@@ -7393,6 +7428,9 @@ var Themes = function Themes(_ref) {
|
|
|
7393
7428
|
onSuccess: function onSuccess(_ref2) {
|
|
7394
7429
|
var theme = _ref2.theme;
|
|
7395
7430
|
setTheme(theme);
|
|
7431
|
+
setThemeState({
|
|
7432
|
+
previewingTheme: theme
|
|
7433
|
+
});
|
|
7396
7434
|
setThemeBeingApplied({});
|
|
7397
7435
|
}
|
|
7398
7436
|
}),
|
|
@@ -7406,8 +7444,9 @@ var Themes = function Themes(_ref) {
|
|
|
7406
7444
|
}, 100);
|
|
7407
7445
|
}, [didScrollActiveThemeIntoView, currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id]);
|
|
7408
7446
|
var setPreviewTheme = function setPreviewTheme(theme) {
|
|
7409
|
-
|
|
7410
|
-
|
|
7447
|
+
setThemeState({
|
|
7448
|
+
previewingTheme: theme
|
|
7449
|
+
});
|
|
7411
7450
|
setTheme(theme);
|
|
7412
7451
|
};
|
|
7413
7452
|
var filteredDefaultThemes = defaultThemes.filter(function (theme) {
|
|
@@ -7428,7 +7467,7 @@ var Themes = function Themes(_ref) {
|
|
|
7428
7467
|
if (isLoading || isCurrentThemeLoading) {
|
|
7429
7468
|
return /*#__PURE__*/React.createElement("div", {
|
|
7430
7469
|
className: "flex h-full w-full items-center justify-center"
|
|
7431
|
-
}, /*#__PURE__*/React.createElement(Spinner, null));
|
|
7470
|
+
}, /*#__PURE__*/React.createElement(Spinner$1, null));
|
|
7432
7471
|
}
|
|
7433
7472
|
return /*#__PURE__*/React.createElement("div", {
|
|
7434
7473
|
className: "neeto-themes-sidebar__scroll"
|
|
@@ -7456,7 +7495,7 @@ var Themes = function Themes(_ref) {
|
|
|
7456
7495
|
setThemeBeingApplied: setThemeBeingApplied,
|
|
7457
7496
|
theme: theme,
|
|
7458
7497
|
active: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === theme.id,
|
|
7459
|
-
isPreviewing: previewingTheme === theme.id,
|
|
7498
|
+
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
|
|
7460
7499
|
key: theme.id,
|
|
7461
7500
|
isApplyingTheme: isApplyingTheme && (themeBeingApplied === null || themeBeingApplied === void 0 ? void 0 : themeBeingApplied.id) === theme.id,
|
|
7462
7501
|
onCloneTheme: handleCloneTheme,
|
|
@@ -7473,7 +7512,7 @@ var Themes = function Themes(_ref) {
|
|
|
7473
7512
|
className: "flex flex-col gap-4 px-6"
|
|
7474
7513
|
}, filteredThemes.map(function (theme) {
|
|
7475
7514
|
var isActive = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === theme.id;
|
|
7476
|
-
var isPreviewing = previewingTheme === theme.id;
|
|
7515
|
+
var isPreviewing = (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id;
|
|
7477
7516
|
return /*#__PURE__*/React.createElement(Card$1, {
|
|
7478
7517
|
isPreviewing: isPreviewing,
|
|
7479
7518
|
onApplyTheme: onApplyTheme,
|
|
@@ -7503,7 +7542,7 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
7503
7542
|
className: "neeto-themes-sidebar__header px-4"
|
|
7504
7543
|
}, /*#__PURE__*/React.createElement("div", {
|
|
7505
7544
|
className: "flex items-center justify-start space-x-2"
|
|
7506
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
7545
|
+
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
7507
7546
|
"data-cy": "customize-themes-back-button",
|
|
7508
7547
|
icon: LeftArrow,
|
|
7509
7548
|
iconPosition: "left",
|
|
@@ -7531,7 +7570,7 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
7531
7570
|
weight: "semibold"
|
|
7532
7571
|
}, t("neetoThemes.build.leftSideBar.headerTabs.themes")), /*#__PURE__*/React.createElement("div", {
|
|
7533
7572
|
className: "self-end"
|
|
7534
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
7573
|
+
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
7535
7574
|
"data-cy": "customize-themes-add-theme-button",
|
|
7536
7575
|
icon: Plus,
|
|
7537
7576
|
iconPosition: "left",
|
|
@@ -7557,12 +7596,8 @@ var Sidebar = function Sidebar() {
|
|
|
7557
7596
|
setIsDeleteAlertOpen = _useState4[1];
|
|
7558
7597
|
var _useState5 = useState(null),
|
|
7559
7598
|
_useState6 = _slicedToArray$3(_useState5, 2),
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
var _useState7 = useState(null),
|
|
7563
|
-
_useState8 = _slicedToArray$3(_useState7, 2),
|
|
7564
|
-
themeToHighlight = _useState8[0],
|
|
7565
|
-
setThemeToHighlight = _useState8[1];
|
|
7599
|
+
themeToHighlight = _useState6[0],
|
|
7600
|
+
setThemeToHighlight = _useState6[1];
|
|
7566
7601
|
var _useConfigStore = useConfigStore(function (store) {
|
|
7567
7602
|
return {
|
|
7568
7603
|
entityType: store["entityType"],
|
|
@@ -7609,6 +7644,9 @@ var Sidebar = function Sidebar() {
|
|
|
7609
7644
|
};
|
|
7610
7645
|
var handleBackPress = function handleBackPress() {
|
|
7611
7646
|
setTheme(currentTheme);
|
|
7647
|
+
setThemeState({
|
|
7648
|
+
previewingTheme: currentTheme
|
|
7649
|
+
});
|
|
7612
7650
|
setCurrentScreen(DESIGN_SCREENS.THEMES);
|
|
7613
7651
|
themeToEdit.current = null;
|
|
7614
7652
|
};
|
|
@@ -7624,7 +7662,9 @@ var Sidebar = function Sidebar() {
|
|
|
7624
7662
|
var onCreateTheme = function onCreateTheme(createdTheme) {
|
|
7625
7663
|
setCurrentScreen(DESIGN_SCREENS.THEMES);
|
|
7626
7664
|
setTheme(createdTheme);
|
|
7627
|
-
|
|
7665
|
+
setThemeState({
|
|
7666
|
+
previewingTheme: createdTheme
|
|
7667
|
+
});
|
|
7628
7668
|
highlightTheme(createdTheme);
|
|
7629
7669
|
themeToEdit.current = null;
|
|
7630
7670
|
};
|
|
@@ -7654,9 +7694,11 @@ var Sidebar = function Sidebar() {
|
|
|
7654
7694
|
setTheme(currentTheme);
|
|
7655
7695
|
}, [currentTheme, entityId]);
|
|
7656
7696
|
useEffect(function () {
|
|
7697
|
+
if (isNotPresent(currentTheme)) return;
|
|
7657
7698
|
setThemeState({
|
|
7658
7699
|
currentTheme: currentTheme,
|
|
7659
|
-
isCurrentThemeLoading: isCurrentThemeLoading
|
|
7700
|
+
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
7701
|
+
previewingTheme: currentTheme
|
|
7660
7702
|
});
|
|
7661
7703
|
}, [currentTheme, isCurrentThemeLoading]);
|
|
7662
7704
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -7674,8 +7716,6 @@ var Sidebar = function Sidebar() {
|
|
|
7674
7716
|
didScrollActiveThemeIntoView: didScrollActiveThemeIntoView,
|
|
7675
7717
|
highlightTheme: highlightTheme,
|
|
7676
7718
|
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
7677
|
-
previewingTheme: previewingTheme,
|
|
7678
|
-
setPreviewingTheme: setPreviewingTheme,
|
|
7679
7719
|
themeToHighlight: themeToHighlight,
|
|
7680
7720
|
themes: themes,
|
|
7681
7721
|
isLoading: isLoading || isFetchingConfig,
|
|
@@ -7727,7 +7767,7 @@ var NeetoThemes = function NeetoThemes(_ref) {
|
|
|
7727
7767
|
className: "neeto-themes-preview__wrapper"
|
|
7728
7768
|
}, isCurrentThemeLoading ? /*#__PURE__*/React.createElement("div", {
|
|
7729
7769
|
className: "m-auto flex h-full w-full items-center justify-center"
|
|
7730
|
-
}, /*#__PURE__*/React.createElement(Spinner, null)) : children));
|
|
7770
|
+
}, /*#__PURE__*/React.createElement(Spinner$1, null)) : children));
|
|
7731
7771
|
};
|
|
7732
7772
|
var index = withTitle(NeetoThemes, t$2("neetoThemes.common.design"));
|
|
7733
7773
|
|