slice-machine-ui 1.23.2-alpha.bmo-add-github-settings-page.4 → 1.23.2-alpha.bmo-add-github-settings-page.6
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/components/DeleteSliceModal/index.tsx +34 -24
- package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +61 -38
- package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +2 -2
- package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +33 -21
- package/components/Navigation/ChangesListItem.tsx +14 -32
- package/lib/models/common/widgets/StructuredText/index.ts +1 -1
- package/out/404.html +1 -1
- package/out/_next/static/chunks/25-01f422cea8066349.js +1 -0
- package/out/_next/static/chunks/{318-bd030cc1725e23b5.js → 318-99b5914b60bf1d17.js} +1 -1
- package/out/_next/static/chunks/727-f8fefdd3e50cab2a.js +1 -0
- package/out/_next/static/chunks/799-b467582de0a7254f.js +1 -0
- package/out/_next/static/chunks/904-4653b7a849f4db94.js +1 -0
- package/out/_next/static/chunks/pages/{_app-027b9e90438a0d83.js → _app-95e9373e879af96c.js} +26 -26
- package/out/_next/static/chunks/pages/{changes-8de69920dfb5a48f.js → changes-ac7d64fc8ec82b39.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-3f862ad6111a1fc0.js → [customTypeId]-97ab3b90b85d645d.js} +1 -1
- package/out/_next/static/chunks/pages/{custom-types-94b8f8dbf7727412.js → custom-types-3c8e721ec6802127.js} +1 -1
- package/out/_next/static/chunks/pages/index-cf93d16e9c63b6db.js +1 -0
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-d1ffca11c42f2603.js → [pageTypeId]-84a22c5e480d3fa9.js} +1 -1
- package/out/_next/static/chunks/pages/settings-0961cf5b601e4baf.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-b12346e58ac9abea.js → simulator-c498e9c80cae8cce.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-8038454f751ad0b9.js +1 -0
- package/out/_next/static/chunks/pages/slices-4522d604117d8c66.js +1 -0
- package/out/_next/static/{eFhKCr9d2Q8SjtAKgFjlm → giA50Mi0bmd47Gv-gysZU}/_buildManifest.js +1 -1
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/pages/slices.tsx +20 -8
- package/src/apiClient.ts +1 -22
- package/src/domain/__tests__/customType.test.ts +179 -0
- package/src/domain/customType.ts +110 -2
- package/src/domain/slice.ts +38 -0
- package/src/features/customTypes/PageTypeOnboarding.tsx +21 -26
- package/src/features/customTypes/actions/convertCustomToPageType.ts +14 -10
- package/src/features/customTypes/actions/createCustomType.ts +69 -0
- package/src/features/customTypes/actions/deleteCustomType.ts +13 -3
- package/src/features/customTypes/actions/renameCustomType.ts +10 -4
- package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -1
- package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +8 -8
- package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +18 -17
- package/src/features/settings/git/GitProvider.ts +1 -1
- package/src/features/settings/git/GitRepositoryConnectDialog.tsx +1 -2
- package/src/features/slices/actions/createSlice.ts +5 -29
- package/src/features/slices/actions/deleteSlice.ts +33 -0
- package/src/features/slices/actions/renameSlice.ts +37 -0
- package/src/modules/availableCustomTypes/index.ts +29 -135
- package/src/modules/loading/types.ts +0 -5
- package/src/modules/modal/types.ts +0 -3
- package/src/modules/slices/index.ts +27 -193
- package/src/modules/slices/selector.ts +0 -14
- package/src/modules/useSliceMachineActions.ts +70 -89
- package/src/modules/userContext/index.ts +3 -3
- package/src/redux/saga.ts +0 -4
- package/test/src/modules/availableCustomTypes/index.test.ts +2 -243
- package/test/src/modules/slices.test.ts +1 -267
- package/out/_next/static/chunks/25-37d6fa7f064be04b.js +0 -1
- package/out/_next/static/chunks/727-2235967a881f9035.js +0 -1
- package/out/_next/static/chunks/731-a9b66ccdc3fae2c2.js +0 -1
- package/out/_next/static/chunks/904-6d6937d53ea2761e.js +0 -1
- package/out/_next/static/chunks/pages/index-64cfb8b0948ba8ef.js +0 -1
- package/out/_next/static/chunks/pages/settings-41fc2a11b6be2683.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-62b55bae7f1b3793.js +0 -1
- package/out/_next/static/chunks/pages/slices-81e382c3374273df.js +0 -1
- package/src/features/customTypes/__tests__/createCustomType.test.ts +0 -159
- package/src/features/customTypes/customTypesTable/createCustomType.ts +0 -107
- package/test/components/CreateCustomTypeModal.test.tsx +0 -73
- /package/out/_next/static/{eFhKCr9d2Q8SjtAKgFjlm → giA50Mi0bmd47Gv-gysZU}/_ssgManifest.js +0 -0
|
@@ -1,46 +1,54 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { MdOutlineDelete } from "react-icons/md";
|
|
3
|
+
import { Close, Flex, Heading, Paragraph, Text, useThemeUI } from "theme-ui";
|
|
4
|
+
|
|
1
5
|
import SliceMachineModal from "@components/SliceMachineModal";
|
|
2
|
-
import { useSelector } from "react-redux";
|
|
3
|
-
import { SliceMachineStoreType } from "@src/redux/type";
|
|
4
|
-
import { isModalOpen } from "@src/modules/modal";
|
|
5
|
-
import { ModalKeysEnum } from "@src/modules/modal/types";
|
|
6
6
|
import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
7
|
-
import { Close, Flex, Heading, Paragraph, Text, useThemeUI } from "theme-ui";
|
|
8
7
|
import Card from "@components/Card";
|
|
9
|
-
import { MdOutlineDelete } from "react-icons/md";
|
|
10
8
|
import { Button } from "@components/Button";
|
|
11
|
-
import {
|
|
12
|
-
import { isLoading } from "@src/modules/loading";
|
|
9
|
+
import { deleteSlice } from "@src/features/slices/actions/deleteSlice";
|
|
13
10
|
|
|
14
11
|
type DeleteSliceModalProps = {
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
libName: string;
|
|
15
14
|
sliceId: string;
|
|
16
15
|
sliceName: string;
|
|
17
|
-
|
|
16
|
+
onClose: () => void;
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
export const DeleteSliceModal: React.FunctionComponent<
|
|
21
20
|
DeleteSliceModalProps
|
|
22
|
-
> = ({ sliceId, sliceName, libName }) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
isDeletingSlice: isLoading(store, LoadingKeysEnum.DELETE_SLICE),
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
21
|
+
> = ({ sliceId, sliceName, libName, isOpen, onClose }) => {
|
|
22
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
23
|
+
const { deleteSliceSuccess } = useSliceMachineActions();
|
|
24
|
+
const { theme } = useThemeUI();
|
|
29
25
|
|
|
30
|
-
const
|
|
26
|
+
const onDelete = async () => {
|
|
27
|
+
setIsDeleting(true);
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
await deleteSlice({
|
|
30
|
+
sliceID: sliceId,
|
|
31
|
+
sliceName,
|
|
32
|
+
libraryID: libName,
|
|
33
|
+
onSuccess: () => {
|
|
34
|
+
deleteSliceSuccess(sliceId, libName);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
onClose();
|
|
39
|
+
setIsDeleting(false);
|
|
40
|
+
};
|
|
33
41
|
|
|
34
42
|
return (
|
|
35
43
|
<SliceMachineModal
|
|
36
|
-
isOpen={
|
|
44
|
+
isOpen={isOpen}
|
|
37
45
|
shouldCloseOnOverlayClick={true}
|
|
38
46
|
style={{
|
|
39
47
|
content: {
|
|
40
48
|
maxWidth: 612,
|
|
41
49
|
},
|
|
42
50
|
}}
|
|
43
|
-
onRequestClose={
|
|
51
|
+
onRequestClose={onClose}
|
|
44
52
|
>
|
|
45
53
|
<Card
|
|
46
54
|
bodySx={{
|
|
@@ -79,7 +87,7 @@ export const DeleteSliceModal: React.FunctionComponent<
|
|
|
79
87
|
Delete Slice
|
|
80
88
|
</Heading>
|
|
81
89
|
</Flex>
|
|
82
|
-
<Close type="button" onClick={
|
|
90
|
+
<Close type="button" onClick={onClose} />
|
|
83
91
|
</Flex>
|
|
84
92
|
)}
|
|
85
93
|
Footer={() => (
|
|
@@ -96,7 +104,7 @@ export const DeleteSliceModal: React.FunctionComponent<
|
|
|
96
104
|
<Button
|
|
97
105
|
label="Cancel"
|
|
98
106
|
variant="secondary"
|
|
99
|
-
onClick={
|
|
107
|
+
onClick={onClose}
|
|
100
108
|
sx={{
|
|
101
109
|
mr: "10px",
|
|
102
110
|
fontWeight: "bold",
|
|
@@ -107,9 +115,11 @@ export const DeleteSliceModal: React.FunctionComponent<
|
|
|
107
115
|
<Button
|
|
108
116
|
label="Delete"
|
|
109
117
|
variant="danger"
|
|
110
|
-
isLoading={
|
|
118
|
+
isLoading={isDeleting}
|
|
111
119
|
sx={{ minHeight: 39, minWidth: 78 }}
|
|
112
|
-
onClick={() =>
|
|
120
|
+
onClick={() => {
|
|
121
|
+
void onDelete();
|
|
122
|
+
}}
|
|
113
123
|
/>
|
|
114
124
|
</Flex>
|
|
115
125
|
)}
|
|
@@ -2,25 +2,28 @@ import { SetStateAction, useState } from "react";
|
|
|
2
2
|
import { Box } from "theme-ui";
|
|
3
3
|
import { FormikErrors } from "formik";
|
|
4
4
|
import { useSelector } from "react-redux";
|
|
5
|
+
import { useRouter } from "next/router";
|
|
5
6
|
|
|
6
7
|
import ModalFormCard from "@components/ModalFormCard";
|
|
7
|
-
import { InputBox } from "../components/InputBox";
|
|
8
|
-
import { SelectRepeatable } from "../components/SelectRepeatable";
|
|
9
8
|
import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
10
9
|
import { SliceMachineStoreType } from "@src/redux/type";
|
|
11
10
|
import {
|
|
12
11
|
selectAllCustomTypeIds,
|
|
13
12
|
selectAllCustomTypeLabels,
|
|
14
13
|
} from "@src/modules/availableCustomTypes";
|
|
15
|
-
import { isModalOpen } from "@src/modules/modal";
|
|
16
|
-
import { ModalKeysEnum } from "@src/modules/modal/types";
|
|
17
|
-
import { isLoading } from "@src/modules/loading";
|
|
18
|
-
import { LoadingKeysEnum } from "@src/modules/loading/types";
|
|
19
|
-
import { telemetry } from "@src/apiClient";
|
|
20
14
|
import { slugify } from "@lib/utils/str";
|
|
21
15
|
import { API_ID_REGEX } from "@lib/consts";
|
|
22
16
|
import type { CustomTypeFormat } from "@slicemachine/manager";
|
|
23
17
|
import { CUSTOM_TYPES_MESSAGES } from "@src/features/customTypes/customTypesMessages";
|
|
18
|
+
import {
|
|
19
|
+
CustomTypeOrigin,
|
|
20
|
+
createCustomType,
|
|
21
|
+
} from "@src/features/customTypes/actions/createCustomType";
|
|
22
|
+
import { CUSTOM_TYPES_CONFIG } from "@src/features/customTypes/customTypesConfig";
|
|
23
|
+
import { getFormat } from "@src/domain/customType";
|
|
24
|
+
|
|
25
|
+
import { InputBox } from "../components/InputBox";
|
|
26
|
+
import { SelectRepeatable } from "../components/SelectRepeatable";
|
|
24
27
|
|
|
25
28
|
interface FormValues {
|
|
26
29
|
id: string;
|
|
@@ -30,46 +33,64 @@ interface FormValues {
|
|
|
30
33
|
|
|
31
34
|
type CreateCustomTypeModalProps = {
|
|
32
35
|
format: CustomTypeFormat;
|
|
33
|
-
|
|
36
|
+
isCreating: boolean;
|
|
37
|
+
isOpen: boolean;
|
|
38
|
+
origin?: CustomTypeOrigin;
|
|
39
|
+
onCreateChange: (isCreating: boolean) => void;
|
|
40
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
34
41
|
};
|
|
35
42
|
|
|
36
43
|
export const CreateCustomTypeModal: React.FC<CreateCustomTypeModalProps> = ({
|
|
37
44
|
format,
|
|
45
|
+
isCreating,
|
|
46
|
+
isOpen,
|
|
38
47
|
origin = "table",
|
|
48
|
+
onCreateChange,
|
|
49
|
+
onOpenChange,
|
|
39
50
|
}) => {
|
|
40
|
-
const {
|
|
41
|
-
|
|
42
|
-
const {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
customTypeIds: selectAllCustomTypeIds(store),
|
|
49
|
-
customTypeLabels: selectAllCustomTypeLabels(store),
|
|
50
|
-
isCreateCustomTypeModalOpen: isModalOpen(
|
|
51
|
-
store,
|
|
52
|
-
ModalKeysEnum.CREATE_CUSTOM_TYPE,
|
|
53
|
-
),
|
|
54
|
-
isCreatingCustomType: isLoading(store, LoadingKeysEnum.CREATE_CUSTOM_TYPE),
|
|
55
|
-
}));
|
|
51
|
+
const { createCustomTypeSuccess } = useSliceMachineActions();
|
|
52
|
+
|
|
53
|
+
const { customTypeIds, customTypeLabels } = useSelector(
|
|
54
|
+
(store: SliceMachineStoreType) => ({
|
|
55
|
+
customTypeIds: selectAllCustomTypeIds(store),
|
|
56
|
+
customTypeLabels: selectAllCustomTypeLabels(store),
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
56
59
|
const customTypesMessages = CUSTOM_TYPES_MESSAGES[format];
|
|
57
60
|
const [isIdFieldPristine, setIsIdFieldPristine] = useState(true);
|
|
61
|
+
const router = useRouter();
|
|
58
62
|
|
|
59
|
-
const
|
|
60
|
-
|
|
63
|
+
const onSubmit = async ({ id, label, repeatable }: FormValues) => {
|
|
64
|
+
onCreateChange(true);
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
event: "custom-type:created",
|
|
64
|
-
id,
|
|
65
|
-
name,
|
|
66
|
+
await createCustomType({
|
|
66
67
|
format,
|
|
67
|
-
|
|
68
|
+
id,
|
|
69
|
+
label,
|
|
68
70
|
origin,
|
|
71
|
+
repeatable,
|
|
72
|
+
onSuccess: async (newCustomType) => {
|
|
73
|
+
createCustomTypeSuccess(newCustomType);
|
|
74
|
+
|
|
75
|
+
const format = getFormat(newCustomType);
|
|
76
|
+
const customTypesConfig = CUSTOM_TYPES_CONFIG[format];
|
|
77
|
+
|
|
78
|
+
setIsIdFieldPristine(true);
|
|
79
|
+
|
|
80
|
+
await router.push({
|
|
81
|
+
pathname: customTypesConfig.getBuilderPagePathname(id),
|
|
82
|
+
query:
|
|
83
|
+
newCustomType.format === "page"
|
|
84
|
+
? {
|
|
85
|
+
newPageType: true,
|
|
86
|
+
}
|
|
87
|
+
: undefined,
|
|
88
|
+
});
|
|
89
|
+
},
|
|
69
90
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
91
|
+
|
|
92
|
+
onCreateChange(false);
|
|
93
|
+
onOpenChange(false);
|
|
73
94
|
};
|
|
74
95
|
|
|
75
96
|
const handleLabelChange = (
|
|
@@ -106,16 +127,18 @@ export const CreateCustomTypeModal: React.FC<CreateCustomTypeModalProps> = ({
|
|
|
106
127
|
return (
|
|
107
128
|
<ModalFormCard
|
|
108
129
|
dataCy="create-ct-modal"
|
|
109
|
-
isOpen={
|
|
130
|
+
isOpen={isOpen}
|
|
110
131
|
widthInPx="530px"
|
|
111
132
|
formId="create-custom-type"
|
|
112
133
|
buttonLabel={"Create"}
|
|
113
134
|
close={() => {
|
|
114
|
-
|
|
135
|
+
onOpenChange(false);
|
|
115
136
|
setIsIdFieldPristine(true);
|
|
116
137
|
}}
|
|
117
|
-
onSubmit={
|
|
118
|
-
|
|
138
|
+
onSubmit={(values) => {
|
|
139
|
+
void onSubmit(values);
|
|
140
|
+
}}
|
|
141
|
+
isLoading={isCreating}
|
|
119
142
|
initialValues={{
|
|
120
143
|
repeatable: true,
|
|
121
144
|
id: "",
|
|
@@ -31,7 +31,7 @@ export const RenameCustomTypeModal: React.FC<RenameCustomTypeModalProps> = ({
|
|
|
31
31
|
}) => {
|
|
32
32
|
const customTypeName = customType?.label ?? "";
|
|
33
33
|
const customTypeId = customType?.id ?? "";
|
|
34
|
-
const {
|
|
34
|
+
const { renameCustomTypeSuccess } = useSliceMachineActions();
|
|
35
35
|
|
|
36
36
|
const [isRenaming, setIsRenaming] = useState(false);
|
|
37
37
|
|
|
@@ -46,7 +46,7 @@ export const RenameCustomTypeModal: React.FC<RenameCustomTypeModalProps> = ({
|
|
|
46
46
|
await renameCustomType({
|
|
47
47
|
model: customType,
|
|
48
48
|
newLabel: values.customTypeName,
|
|
49
|
-
onSuccess:
|
|
49
|
+
onSuccess: renameCustomTypeSuccess,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
setIsRenaming(false);
|
|
@@ -1,50 +1,62 @@
|
|
|
1
1
|
import { Box } from "theme-ui";
|
|
2
|
-
import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
3
|
-
import ModalFormCard from "../../ModalFormCard";
|
|
4
|
-
import { InputBox } from "../components/InputBox";
|
|
5
2
|
import { useSelector } from "react-redux";
|
|
3
|
+
|
|
4
|
+
import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
6
5
|
import { SliceMachineStoreType } from "@src/redux/type";
|
|
7
|
-
import { isModalOpen } from "@src/modules/modal";
|
|
8
|
-
import { ModalKeysEnum } from "@src/modules/modal/types";
|
|
9
6
|
import { getLibraries, getRemoteSlices } from "@src/modules/slices";
|
|
7
|
+
import { ComponentUI } from "@lib/models/common/ComponentUI";
|
|
8
|
+
import { renameSlice } from "@src/features/slices/actions/renameSlice";
|
|
9
|
+
|
|
10
|
+
import { InputBox } from "../components/InputBox";
|
|
11
|
+
import ModalFormCard from "../../ModalFormCard";
|
|
10
12
|
import { SliceModalValues } from "../formsTypes";
|
|
11
13
|
import { validateSliceModalValues } from "../formsValidator";
|
|
12
14
|
|
|
13
15
|
interface RenameSliceModalProps {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
slice?: ComponentUI;
|
|
18
|
+
onClose: () => void;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export const RenameSliceModal: React.FC<RenameSliceModalProps> = ({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
slice,
|
|
23
|
+
isOpen,
|
|
24
|
+
onClose,
|
|
23
25
|
}) => {
|
|
24
|
-
const {
|
|
25
|
-
const {
|
|
26
|
+
const { renameSliceSuccess } = useSliceMachineActions();
|
|
27
|
+
const { localLibs, remoteLibs } = useSelector(
|
|
26
28
|
(store: SliceMachineStoreType) => ({
|
|
27
|
-
isRenameSliceModalOpen: isModalOpen(store, ModalKeysEnum.RENAME_SLICE),
|
|
28
29
|
localLibs: getLibraries(store),
|
|
29
30
|
remoteLibs: getRemoteSlices(store),
|
|
30
31
|
}),
|
|
31
32
|
);
|
|
33
|
+
const initialSliceName = slice?.model.name ?? "";
|
|
34
|
+
|
|
35
|
+
const handleOnSubmit = async (values: SliceModalValues) => {
|
|
36
|
+
if (slice) {
|
|
37
|
+
await renameSlice({
|
|
38
|
+
slice,
|
|
39
|
+
newSliceName: values.sliceName,
|
|
40
|
+
onSuccess: (renamedSlice) => {
|
|
41
|
+
renameSliceSuccess(renamedSlice.from, renamedSlice.model);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
onClose();
|
|
46
|
+
}
|
|
35
47
|
};
|
|
36
48
|
|
|
37
49
|
return (
|
|
38
50
|
<ModalFormCard<SliceModalValues>
|
|
39
51
|
dataCy="rename-slice-modal"
|
|
40
|
-
isOpen={
|
|
52
|
+
isOpen={isOpen}
|
|
41
53
|
widthInPx="530px"
|
|
42
|
-
formId={`rename-slice-modal-${
|
|
43
|
-
close={
|
|
54
|
+
formId={`rename-slice-modal-${slice?.model.id ?? ""}`}
|
|
55
|
+
close={onClose}
|
|
44
56
|
buttonLabel="Rename"
|
|
45
|
-
onSubmit={handleOnSubmit}
|
|
57
|
+
onSubmit={(values) => void handleOnSubmit(values)}
|
|
46
58
|
initialValues={{
|
|
47
|
-
sliceName:
|
|
59
|
+
sliceName: initialSliceName,
|
|
48
60
|
}}
|
|
49
61
|
content={{
|
|
50
62
|
title: "Rename a slice",
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { type FC
|
|
1
|
+
import { type FC } from "react";
|
|
2
2
|
import Link from "next/link";
|
|
3
3
|
import { useRouter } from "next/router";
|
|
4
|
-
import { SliceMachineStoreType } from "@src/redux/type";
|
|
5
|
-
import { useSelector } from "react-redux";
|
|
6
4
|
|
|
7
5
|
import { SideNavLink, SideNavListItem } from "@src/components/SideNav";
|
|
8
6
|
import { RadarIcon } from "@src/icons/RadarIcon";
|
|
9
|
-
import { isLoading } from "@src/modules/loading";
|
|
10
|
-
import { LoadingKeysEnum } from "@src/modules/loading/types";
|
|
11
7
|
import {
|
|
12
8
|
HoverCard,
|
|
13
9
|
HoverCardCloseButton,
|
|
@@ -15,11 +11,8 @@ import {
|
|
|
15
11
|
HoverCardMedia,
|
|
16
12
|
HoverCardTitle,
|
|
17
13
|
} from "@src/components/HoverCard";
|
|
18
|
-
import {
|
|
19
|
-
userHasSeenChangesToolTip,
|
|
20
|
-
userHasSeenSimulatorToolTip,
|
|
21
|
-
} from "@src/modules/userContext";
|
|
22
14
|
import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
15
|
+
|
|
23
16
|
import { ChangesRightElement } from "./ChangesRightElement";
|
|
24
17
|
|
|
25
18
|
export const ChangesListItem: FC = () => {
|
|
@@ -63,30 +56,19 @@ export const ChangesListItem: FC = () => {
|
|
|
63
56
|
);
|
|
64
57
|
};
|
|
65
58
|
|
|
59
|
+
// TODO(DT-1925): Reactivate this feature
|
|
66
60
|
const useOpenChangesHoverCard = () => {
|
|
67
|
-
const {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
hasSeenChangesToolTip: userHasSeenChangesToolTip(store),
|
|
74
|
-
hasSeenSimulatorToolTip: userHasSeenSimulatorToolTip(store),
|
|
75
|
-
isSavingCustomType: isLoading(store, LoadingKeysEnum.SAVE_CUSTOM_TYPE),
|
|
76
|
-
isSavingSlice: isLoading(store, LoadingKeysEnum.SAVE_SLICE),
|
|
77
|
-
}));
|
|
78
|
-
|
|
79
|
-
const isSaving = isSavingCustomType || isSavingSlice;
|
|
80
|
-
const [prevIsSaving, setPrevIsSaving] = useState(isSaving);
|
|
61
|
+
// const { hasSeenChangesToolTip, hasSeenSimulatorToolTip } = useSelector(
|
|
62
|
+
// (store: SliceMachineStoreType) => ({
|
|
63
|
+
// hasSeenChangesToolTip: userHasSeenChangesToolTip(store),
|
|
64
|
+
// hasSeenSimulatorToolTip: userHasSeenSimulatorToolTip(store),
|
|
65
|
+
// }),
|
|
66
|
+
// );
|
|
81
67
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
// return (
|
|
69
|
+
// !hasSeenChangesToolTip &&
|
|
70
|
+
// hasSeenSimulatorToolTip
|
|
71
|
+
// );
|
|
85
72
|
|
|
86
|
-
return
|
|
87
|
-
!hasSeenChangesToolTip &&
|
|
88
|
-
hasSeenSimulatorToolTip &&
|
|
89
|
-
!isSaving &&
|
|
90
|
-
prevIsSaving
|
|
91
|
-
);
|
|
73
|
+
return false;
|
|
92
74
|
};
|
|
@@ -51,7 +51,7 @@ export const StructuredTextWidget: Widget<RichText, typeof schema> = {
|
|
|
51
51
|
label,
|
|
52
52
|
placeholder: "",
|
|
53
53
|
allowTargetBlank: true,
|
|
54
|
-
|
|
54
|
+
multi: optionValues.join(","),
|
|
55
55
|
},
|
|
56
56
|
}),
|
|
57
57
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
package/out/404.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/3c26dbbbd8f4be12.css" as="style"/><link rel="stylesheet" href="/_next/static/css/3c26dbbbd8f4be12.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/3c26dbbbd8f4be12.css" as="style"/><link rel="stylesheet" href="/_next/static/css/3c26dbbbd8f4be12.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-95e9373e879af96c.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/giA50Mi0bmd47Gv-gysZU/_buildManifest.js" defer=""></script><script src="/_next/static/giA50Mi0bmd47Gv-gysZU/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"giA50Mi0bmd47Gv-gysZU","runtimeConfig":{"sentryEnvironment":"alpha"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25],{54132:function(e,n,t){"use strict";t.d(n,{Z:function(){return s}});var r=t(62230),o=t(85244),i=t(98240),c=t(52322);t(2784);var d=t(75289),a=function(e){var n=e.bg,t=e.background,o=e.sx,i=e.withRadius,a=e.radius,s=e.children;return(0,c.jsx)(d.xu,{sx:(0,r.Z)({p:4,bg:n||t},i?{borderBottomLeftRadius:a,borderBottomRightRadius:a}:null,o),children:s})},s=function(e){var n=e.Header,t=void 0===n?null:n,s=e.SubHeader,l=void 0===s?null:s,u=e.Body,v=void 0===u?null:u,f=e.Footer,m=void 0===f?null:f,h=e.borderFooter,p=e.radius,b=void 0===p?"6px":p,g=e.bodySx,Z=e.footerSx,x=e.sx,_=e.bg,y=e.background,C=e.children,j=(0,i.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,c.jsxs)(d.Zb,(0,o.Z)((0,r.Z)({sx:(0,r.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:b},void 0===x?null:x)},j),{children:[t?(0,c.jsx)(t,{radius:b}):null,l?(0,c.jsx)(l,{radius:b}):null,(0,c.jsxs)(a,{bg:_,background:y,sx:void 0===g?{}:g,withRadius:!m,children:[v?(0,c.jsx)(v,{}):null,C||null]}),m?(0,c.jsx)(a,{bg:_,background:y,sx:(0,r.Z)({},void 0!==h&&h?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===Z?{}:Z),radius:b,withRadius:!0,children:"object"==typeof m?m:(0,c.jsx)(m,{})}):null]}))}},75329:function(e,n,t){"use strict";t.d(n,{Sn:function(){return d},lS:function(){return r},nG:function(){return o},pq:function(){return a},rd:function(){return c},xo:function(){return i}});var r=["components"],o=["png","jpg","jpeg"],i=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,c="placeholders/What_are_Slices_mrvome",d="SM_HELP_VIDEOS/mock_data",a="slice-machine-simulator"},38876:function(e,n,t){"use strict";t.d(n,{MP:function(){return i},T3:function(){return d},Ti:function(){return o},lV:function(){return a}});var r=/-(\w)/g;function o(e){return e.includes("-")?"['".concat(e,"']"):".".concat(e)}function i(e){return e?(e=e.replace(/_/g,"-").replace(r,function(e,n){return n?n.toUpperCase():""}))[0].toUpperCase()+e.slice(1):""}var c=/\B([A-Z])/g;function d(e){var n;return e.replace(c,"-$1").toLowerCase().replace(/-/g,"_")}var a=function(e){return e.trim().replace(/ /g,"_").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}},24804:function(e,n,t){"use strict";t.d(n,{Zb:function(){return p},T$:function(){return g},eW:function(){return Z},ZB:function(){return b},Lm:function(){return x}});var r=t(67557),o=t(62230),i=t(85244),c=t(98240),d=t(52322),a=t(50002),s=t(22715),l=t(6277),u=t(2784);t(71457);var v={solid:"_1ecs97d3c _1ecs97dap _1ecs97d4pk _1ecs97d4wx",outlined:"_1ecs97d2i _1ecs97d9v _1ecs97dw _1ecs97d89 _1ecs97d2w _1ecs97da9 _1ecs97d4oq _1ecs97d4w3 _1ecs97d4oc _1ecs97d4vp"},f={div:"_1ecs97dez0 _1ecs97dez3 _1ecs97dezd",img:"kedahr9 _1ecs97df77 _1ecs97dezn"},m={small:"kedahr2",medium:"kedahr3"},h={solid:"kedahr4 _1ecs97d1u _1ecs97d97 _1ecs97d4pe _1ecs97d4wr",outlined:"kedahr5 _1ecs97d18 _1ecs97d8l _1ecs97d4o6 _1ecs97d4vj"},p=function(e){var n,t=e.checked,s=e.size,f=e.variant,p=void 0===f?"solid":f,b=(e.interactive,e.disabled,e.onClick,e.href,e.component),g=void 0===b?"a":b,Z=(e.replace,(0,c.Z)(e,["checked","size","variant","interactive","disabled","onClick","href","component","replace"])),x=(0,i.Z)((0,o.Z)({},Z),{className:(0,l.W)("_1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dez1 _1ecs97dezr _1ecs97dezv",m[void 0===s?"medium":s],h[p],(n={},(0,r.Z)(n,"kedahr6",e.interactive),(0,r.Z)(n,v[p],e.interactive),n)),"data-state":!0===(void 0!==t&&t)?"checked":void 0});return!0===e.interactive&&void 0===e.href?(0,d.jsx)("div",(0,i.Z)((0,o.Z)({},x),{"data-disabled":!0===e.disabled?"":void 0,onClick:function(n){if(!0!==e.disabled&&void 0!==e.onClick){var t=n.target;(0,a.JY)(t)===n.currentTarget&&e.onClick(n)}},tabIndex:!0===e.disabled?void 0:0})):!0===e.interactive?(0,u.createElement)(g,(0,o.Z)((0,i.Z)((0,o.Z)({},x),{href:e.href,onClick:function(e){var n=e.target;(0,a.JY)(n)!==e.currentTarget&&e.preventDefault()}}),"a"===g?{}:{replace:e.replace})):(0,d.jsx)("div",(0,o.Z)({},x))},b=function(e){var n=e.className,t=e.component,r=void 0===t?"img":t,a=e.overlay,s=(0,c.Z)(e,["className","component","overlay"]);return(0,d.jsxs)("div",{className:"kedahr7 _1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97deze _1ecs97dezd _1ecs97df7d _1ecs97dezv",children:[(0,u.createElement)(r,(0,i.Z)((0,o.Z)({},s),{className:(0,l.W)(f[r],n)})),Boolean(a)?(0,d.jsx)("div",{className:"kedahra _1ecs97dez0 _1ecs97dez3 _1ecs97df9d _1ecs97dezt _1ecs97df0i",children:a}):void 0]})},g=function(e){return(0,d.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:"kedahrc kedahrb _1ecs97dez0 _1ecs97dez2 _1ecs97dez8 _1ecs97dez1 _1ecs97dezc _1ecs97df71 _1ecs97dezi"}))},Z=function(e){var n=e.action,t=e.subtitle,r=e.title,a=(0,c.Z)(e,["action","subtitle","title"]);return(0,d.jsxs)("div",(0,i.Z)((0,o.Z)({},a),{className:"kedahrd kedahrb _1ecs97dez0 _1ecs97dez2 _1ecs97dez8 _1ecs97dez1 _1ecs97dezc _1ecs97df92 _1ecs97df73",children:[(0,d.jsxs)("div",{className:"kedahre _1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97deze _1ecs97dezd _1ecs97df51",children:[(0,d.jsx)(s.xv,{component:"span",noWrap:!0,variant:"bold",children:r}),(0,d.jsx)(s.xv,{color:"grey11",component:"span",noWrap:!0,variant:"small",children:t})]}),n]}))},x=function(e){var n=e.children,t=(0,c.Z)(e,["children"]);return(0,d.jsx)("div",(0,i.Z)((0,o.Z)({},t),{className:"kedahrf _1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97df6v _1ecs97dfb5 _1ecs97dezh _1ecs97dfhi _1ecs97dezt",children:(0,d.jsx)(s.xv,{align:"center",color:"inherit",component:"span",noWrap:!0,variant:"smallBold",children:n})}))}},5479:function(e,n,t){"use strict";t.d(n,{AK:function(){return h},Dj:function(){return u},Kp:function(){return m},L4:function(){return p},PQ:function(){return x},cx:function(){return l},d7:function(){return v},fo:function(){return Z},gR:function(){return g},ux:function(){return f},xS:function(){return b}});var r=t(67557),o=t(62230),i=t(85244),c=t(17064),d=t(81541),a=t(38876),s="default";function l(e){return e.model.variations.length-Object.keys(e.screenshots).length}function u(e){var n,t,r;return null!==(r=null!==(t=null===(n=e.config)||void 0===n?void 0:n.label)&&void 0!==t?t:"Group"===e.type||"Slice"===e.type||"Boolean"!==e.type&&"Separator"!==e.type?e.fieldset:void 0)&&void 0!==r?r:e.type}function v(e,n){var t;return null===(t=e.screenshots[n.id])||void 0===t?void 0:t.url}function f(e,n){var t={},r={};if("type"in e){if("Slice"===e.type){for(var o in e["non-repeat"])t[o]=e["non-repeat"][o].type;for(var i in e.repeat)r[i]=e.repeat[i].type}else if("Group"===e.type)for(var c in null===(l=e.config)||void 0===l?void 0:l.fields)r[c]=null!==(v=null===(u=e.config)||void 0===u?void 0:u.fields[c].type)&&void 0!==v?v:"";else t[n]=e.type}else if("id"in e){var d=!0,a=!1,s=void 0;try{for(var l,u,v,f,m,h=(null!==(f=e.primary)&&void 0!==f?f:[])[Symbol.iterator]();!(d=(m=h.next()).done);d=!0){var p=m.value,b=p.key,g=p.value;t[b]=g.type}}catch(Z){a=!0,s=Z}finally{try{d||null==h.return||h.return()}finally{if(a)throw s}}var x=!0,_=!1,y=void 0;try{for(var C,j,k=(null!==(C=e.items)&&void 0!==C?C:[])[Symbol.iterator]();!(x=(j=k.next()).done);x=!0){var z=j.value,S=z.key,w=z.value;r[S]=w.type}}catch(T){_=!0,y=T}finally{try{x||null==k.return||k.return()}finally{if(_)throw y}}}return{primary:JSON.stringify(Object.keys(t).sort().map(function(e){return[e,t[e]]})),items:JSON.stringify(Object.keys(r).sort().map(function(e){return[e,r[e]]}))}}function m(e){var n=e.slice,t=e.id,r=e.name,c=e.copiedVariation,d=(0,i.Z)((0,o.Z)({},c),{id:t,name:r});return{slice:(0,i.Z)((0,o.Z)({},n),{model:(0,i.Z)((0,o.Z)({},n.model),{variations:n.model.variations.concat([d])})}),variation:d}}function h(e){var n=e.slice,t=e.variationId,c=e.widgetArea,d=e.fieldId;return(0,i.Z)((0,o.Z)({},n),{model:(0,i.Z)((0,o.Z)({},n.model),{variations:n.model.variations.map(function(e){if(e.id===t){var n;return(0,i.Z)((0,o.Z)({},e),(0,r.Z)({},c,null===(n=e[c])||void 0===n?void 0:n.filter(function(e){return e.key!==d})))}return e})})})}function p(e){var n=e.slice,t=e.variationId,c=e.widgetArea,d=e.previousFieldId,a=e.newFieldId,s=e.newField;return(0,i.Z)((0,o.Z)({},n),{model:(0,i.Z)((0,o.Z)({},n.model),{variations:n.model.variations.map(function(e){if(e.id===t){var n;return(0,i.Z)((0,o.Z)({},e),(0,r.Z)({},c,null===(n=e[c])||void 0===n?void 0:n.map(function(e){return e.key===d?{key:a,value:s}:e})))}return e})})})}function b(e){var n=e.slice,t=e.variationId,c=e.widgetArea,d=e.newFieldId,a=e.newField;return(0,i.Z)((0,o.Z)({},n),{model:(0,i.Z)((0,o.Z)({},n.model),{variations:n.model.variations.map(function(e){if(e.id===t){var n;return(0,i.Z)((0,o.Z)({},e),(0,r.Z)({},c,null===(n=e[c])||void 0===n?void 0:n.concat([{key:d,value:a},])))}return e})})})}function g(e){var n,t,a=e.slice,s=e.variationId,l=e.widgetArea,u=e.sourceIndex,v=e.destinationIndex,f=null!==(t=null===(n=a.model.variations.find(function(e){return e.id===s}))||void 0===n?void 0:n[l])&&void 0!==t?t:[],m=(0,d.Z)(f),h=(0,c.Z)(m.splice(u,1),1)[0];return m.splice(v,0,h),(0,i.Z)((0,o.Z)({},a),{model:(0,i.Z)((0,o.Z)({},a.model),{variations:a.model.variations.map(function(e){return e.id===s?(0,i.Z)((0,o.Z)({},e),(0,r.Z)({},l,m)):e})})})}function Z(e){return{id:(0,a.T3)(e),type:"SharedSlice",name:e,description:e,variations:[{id:s,name:(0,a.MP)(s),docURL:"...",version:"initial",description:(0,a.MP)(s),imageUrl:""},]}}function x(e,n){return(0,i.Z)((0,o.Z)({},e),{model:(0,i.Z)((0,o.Z)({},e.model),{name:n})})}},34728:function(e,n,t){"use strict";t.d(n,{O:function(){return d}});var r=t(52322),o=t(22715),i=t(32681),c=t(79096),d=function(e){var n=function(e){var n=a[e.modelType];switch(e.modelStatus){case i.G.New:return{badgeColor:"green",badgeTitle:"New",tooltipContent:"This ".concat(n," exists only locally. Upon sync, it will be pushed to your remote repository.")};case i.G.Modified:return{badgeColor:"amber",badgeTitle:"Modified",tooltipContent:"This ".concat(n," has been modified locally. Upon sync, changes will be pushed to your remote repository.")};case i.G.Synced:return{badgeColor:"purple",badgeTitle:"Synced",tooltipContent:"This ".concat(n," is in sync with the remote repository.")};case i.G.Deleted:return{badgeColor:"tomato",badgeTitle:"Deleted",tooltipContent:"This ".concat(n," has been deleted locally.")};case i.G.Unknown:if(!e.isOnline)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (no internet connection)."};if(e.authStatus===c.t.UNAUTHORIZED)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (not connected to Prismic)."};if(e.authStatus===c.t.FORBIDDEN)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (you don't have access to the repository)."};default:return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (unknown error)."}}}(e),t=n.badgeColor,d=n.badgeTitle,s=n.tooltipContent;return(0,r.jsx)(o.u,{content:s,side:"bottom",children:(0,r.jsx)(o.Ct,{color:t,title:d})})},a={CustomType:"type",Slice:"slice"}},71749:function(e,n,t){"use strict";t.d(n,{b:function(){return b}});var r=t(62230),o=t(85244),i=t(52322),c=t(22715),d=t(39097),a=t.n(d),s=t(67557),l=t(17064),u={build:function(e){var n;return(0,o.Z)((0,r.Z)({},e),{screenshots:(n=e.screenshots)?Object.entries(n).reduce(function(e,n){var t,i=(0,l.Z)(n,2),c=i[0],d=i[1];return d.hash?(0,o.Z)((0,r.Z)({},e),(0,s.Z)({},c,(0,r.Z)({},d,{hash:d.hash}))):e},{}):{}})},variation:function(e,n){if(e.model.variations.length)return n?e.model.variations.find(function(e){return e.id===n}):e.model.variations[0]}},v=t(24804),f=t(5479),m=t(34728),h=t(49451),p=function(e){return(0,i.jsx)("svg",(0,o.Z)((0,r.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 5.5C4 4.67157 4.67157 4 5.5 4H18.5C19.3284 4 20 4.67157 20 5.5V12.4413C20 12.4512 19.9997 12.461 19.9991 12.4707C20.0072 12.6083 19.9586 12.7485 19.8536 12.8536C19.6583 13.0488 19.3417 13.0488 19.1464 12.8536L16.3536 10.0607C16.1583 9.8654 15.8417 9.8654 15.6464 10.0607L11.8536 13.8536C11.6583 14.0488 11.3417 14.0488 11.1464 13.8536L9.35355 12.0607C9.15829 11.8654 8.84171 11.8654 8.64645 12.0607L5 15.7071V18.5C5 18.7761 5.22386 19 5.5 19H12.5C12.7761 19 13 19.2239 13 19.5C13 19.7761 12.7761 20 12.5 20H5.5C4.67157 20 4 19.3284 4 18.5V15.5003V15.4997V5.5ZM11.5 12.7929L14.9393 9.35355C15.5251 8.76777 16.4749 8.76777 17.0607 9.35355L19 11.2929V5.5C19 5.22386 18.7761 5 18.5 5H5.5C5.22386 5 5 5.22386 5 5.5V14.2929L7.93934 11.3536C8.52513 10.7678 9.47487 10.7678 10.0607 11.3536L11.5 12.7929ZM16.5 13C16.7761 13 17 13.2239 17 13.5V16H19.5C19.7761 16 20 16.2239 20 16.5C20 16.7761 19.7761 17 19.5 17H17V19.5C17 19.7761 16.7761 20 16.5 20C16.2239 20 16 19.7761 16 19.5V17H13.5C13.2239 17 13 16.7761 13 16.5C13 16.2239 13.2239 16 13.5 16H16V13.5C16 13.2239 16.2239 13 16.5 13Z",fill:"currentColor"})}))},b=function(e){var n,t=e.action,d=e.isComingSoon,s=void 0!==d&&d,l=e.isDeleted,b=e.onUpdateScreenshot,x=e.selected,_=void 0!==x&&x,y=e.slice,C=e.variant,j=e.variationId,k=u.variation(y,j);if(!k)return null;var z=(0,f.d7)(y,k),S=s||void 0!==l&&l,w=!S&&!!b,T="outlined"===C,I=void 0!==j;return n="selection"===e.mode?{disabled:S,interactive:!0,onClick:function(){e.onSelectedChange(!_)}}:S?{interactive:!1}:{component:a(),href:h.Y.getBuilderPagePathname({libraryName:y.href,sliceName:y.model.name,variationId:k.id}),interactive:!0,replace:e.replace},(0,i.jsxs)(v.Zb,(0,o.Z)((0,r.Z)({"aria-label":"".concat(y.model.name," ").concat(k.name," slice card"),checked:_,"data-cy":"shared-slice-card","data-testid":"shared-slice-card"},n,"outlined"===C?{size:"small",variant:"outlined"}:{}),{children:[void 0!==z?(0,i.jsx)(v.ZB,{alt:"Preview image",overlay:w&&!T?(0,i.jsx)(c.xu,{alignItems:"center",justifyContent:"center",children:(0,i.jsx)(g,{onClick:b})}):void 0,src:z}):(0,i.jsx)(v.ZB,{component:"div",children:(0,i.jsxs)(c.xu,{alignItems:"center",flexDirection:"column",gap:8,justifyContent:"center",children:[(0,i.jsx)(c.xv,{color:"grey11",component:"span",children:"No screenshot available"}),w&&!T?(0,i.jsx)(g,{onClick:b}):void 0]})}),(0,i.jsx)(v.eW,{action:"checkbox"===t.type&&"selection"===e.mode?(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:(0,i.jsx)(c.XZ,{checked:_,disabled:S,onCheckedChange:e.onSelectedChange})}):"menu"===t.type?(0,i.jsxs)(c.h_,{modal:!0,children:[(0,i.jsx)(c.$F,{disabled:S,children:(0,i.jsx)(c.hU,{hiddenLabel:"Slice actions",icon:"moreVert"})}),(0,i.jsxs)(c.AW,{align:"end","data-cy":"slice-action-icon-dropdown",children:[w&&T?(0,i.jsx)(c.Xi,{onSelect:b,startIcon:(0,i.jsx)(p,{}),children:"Update screenshot"}):void 0,(0,i.jsx)(c.Xi,{onSelect:t.onRename,startIcon:(0,i.jsx)(c.I5,{name:"edit"}),children:"Rename"}),!0===t.removeDisabled&&I?(0,i.jsx)(c.u,{content:"The slice needs to have at least one variation.",side:"bottom",stableMount:!0,children:(0,i.jsx)(Z,{disabled:!0,onSelect:t.onRemove})}):(0,i.jsx)(Z,{disabled:!0===t.removeDisabled,onSelect:t.onRemove})]})]}):"remove"===t.type?(0,i.jsx)(c.hU,{icon:"close",onClick:function(){return!S&&t.onRemove()},hiddenLabel:"Remove slice"}):"status"===t.type?(0,i.jsx)(m.O,{authStatus:t.authStatus,isOnline:t.isOnline,modelStatus:t.modelStatus,modelType:"Slice"}):void 0,subtitle:(0,i.jsxs)(i.Fragment,{children:[I?k.id:"".concat(y.model.variations.length," variation").concat(y.model.variations.length>1?"s":""),s?(0,i.jsxs)(c.xv,{color:"purple11",component:"span",variant:"small",children:[" ","• (coming soon)"]}):void 0]}),title:I?k.name:y.model.name}),w&&!I&&(0,f.cx)(y)>0?(0,i.jsx)(v.Lm,{children:"Missing screenshot"}):void 0]}))},g=function(e){return(0,i.jsx)(c.zx,{onClick:e.onClick,renderStartIcon:function(){return(0,i.jsx)(p,{color:c.TV.color.greyLight11})},color:"grey",children:"Update screenshot"})},Z=function(e){return(0,i.jsx)(c.Xi,(0,o.Z)((0,r.Z)({},e),{color:"tomato",startIcon:(0,i.jsx)(c.I5,{name:"delete"}),children:"Delete"}))}},49451:function(e,n,t){"use strict";t.d(n,{Y:function(){return r}});var r={getBuilderPagePathname:function(e){return"/slices/".concat(e.libraryName.replaceAll("/","--"),"/").concat(e.sliceName,"/").concat(e.variationId)}}},71457:function(){}}]);
|