slice-machine-ui 1.11.1-dev-slices-templates-feature.0 → 1.11.1-dev-next-release.4

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.
Files changed (67) hide show
  1. package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +2 -1
  2. package/components/ModalFormCard/index.tsx +93 -102
  3. package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +2 -1
  4. package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +6 -36
  5. package/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +11 -91
  6. package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +39 -50
  7. package/lib/builders/common/Zone/components/EmptyState/index.tsx +14 -13
  8. package/lib/builders/common/Zone/index.jsx +33 -22
  9. package/out/404.html +1 -1
  10. package/out/[lib]/[sliceName]/[variation]/screenshot.html +1 -1
  11. package/out/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  12. package/out/[lib]/[sliceName]/[variation].html +1 -1
  13. package/out/_next/static/N2nU1yPW38KWsgo9OL-hs/_buildManifest.js +1 -0
  14. package/out/_next/static/chunks/119-626b7b48e4535694.js +1 -0
  15. package/out/_next/static/chunks/18539003-b0b0df3d19f7d641.js +101 -0
  16. package/out/_next/static/chunks/377-c283ea91a489e394.js +1 -0
  17. package/out/_next/static/chunks/{482-5ae2d1fd2572cb1f.js → 482-ad5ef8eecedd8b52.js} +1 -1
  18. package/out/_next/static/chunks/{573-c4f805b20b6710f3.js → 573-aaae870d20e5f86c.js} +1 -1
  19. package/out/_next/static/chunks/677-d8555c165c261511.js +1 -0
  20. package/out/_next/static/chunks/{791-091202c1718b4ac3.js → 740-d0642219804fa9f0.js} +2 -2
  21. package/out/_next/static/chunks/799-4787c871f6119407.js +1 -0
  22. package/out/_next/static/chunks/pages/[lib]/[sliceName]/[variation]/{simulator-e51d1161076d4797.js → simulator-2c6033d99c3672e0.js} +1 -1
  23. package/out/_next/static/chunks/pages/[lib]/[sliceName]/{[variation]-4b4fed1e884838ad.js → [variation]-bd1822e54ac8836c.js} +1 -1
  24. package/out/_next/static/chunks/pages/{_app-81ca04ca12daa27c.js → _app-2351f4803a15a482.js} +98 -98
  25. package/out/_next/static/chunks/pages/{changelog-c08cc37b54d73a60.js → changelog-dda7774c702c6b47.js} +1 -1
  26. package/out/_next/static/chunks/pages/{changes-3b7c6b9b312b5e2f.js → changes-26dab4f4657a54e4.js} +1 -1
  27. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-207b0c837912e5a9.js → [customTypeId]-a69df1ad7fd8b927.js} +1 -1
  28. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-a6a8ebd9f4b3b608.js → [pageTypeId]-5e4e26de800fccff.js} +1 -1
  29. package/out/_next/static/chunks/pages/slices-d1c96629e458440c.js +1 -0
  30. package/out/_next/static/css/{a978ac70ea31c6d7.css → 6639e1548a7d3442.css} +1 -1
  31. package/out/_next/static/css/{bbe0f7491bdca3fc.css → 6c430d5aaa4ef12a.css} +1 -1
  32. package/out/_next/static/css/74653a9f89a68929.css +1 -0
  33. package/out/_next/static/css/{f7381722c36382c6.css → d4b59834999106a5.css} +1 -1
  34. package/out/changelog.html +1 -1
  35. package/out/changes.html +1 -1
  36. package/out/custom-types/[customTypeId].html +1 -1
  37. package/out/custom-types.html +1 -1
  38. package/out/index.html +1 -1
  39. package/out/page-types/[pageTypeId].html +1 -1
  40. package/out/slices.html +1 -1
  41. package/package.json +7 -7
  42. package/src/components/List/List.css.ts +2 -0
  43. package/src/components/List/List.tsx +7 -3
  44. package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +4 -16
  45. package/src/features/customTypes/customTypesMessages.ts +4 -3
  46. package/test/pages/custom-types.test.tsx +20 -38
  47. package/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +0 -88
  48. package/lib/builders/CustomTypeBuilder/SliceZone/sliceTemplatesComingSoon.ts +0 -122
  49. package/out/_next/static/chunks/18539003-b49b17dc02a89c7b.js +0 -101
  50. package/out/_next/static/chunks/377-04a57b21fc2cae35.js +0 -1
  51. package/out/_next/static/chunks/777-46aec69eb0a68a03.js +0 -1
  52. package/out/_next/static/chunks/799-48a1855b96a3623f.js +0 -1
  53. package/out/_next/static/chunks/962-6beea758652e94f7.js +0 -1
  54. package/out/_next/static/chunks/pages/slices-1eef0d0c3ecf2c35.js +0 -1
  55. package/out/_next/static/css/de841cf04740a2ad.css +0 -1
  56. package/out/_next/static/nCPhQUlpV0HcPF-4XlM3-/_buildManifest.js +0 -1
  57. package/out/alternateGrid.png +0 -0
  58. package/out/customerLogos.png +0 -0
  59. package/out/hero.png +0 -0
  60. package/out/videoHighlight.png +0 -0
  61. package/public/alternateGrid.png +0 -0
  62. package/public/customerLogos.png +0 -0
  63. package/public/hero.png +0 -0
  64. package/public/videoHighlight.png +0 -0
  65. package/src/features/slicesTemplates/actions/createSlicesTemplates.ts +0 -40
  66. package/src/features/slicesTemplates/useSlicesTemplates.ts +0 -38
  67. /package/out/_next/static/{nCPhQUlpV0HcPF-4XlM3- → N2nU1yPW38KWsgo9OL-hs}/_ssgManifest.js +0 -0
@@ -117,7 +117,8 @@ export const CreateSliceModal: FC<CreateSliceModalProps> = ({
117
117
  }}
118
118
  actionMessage={
119
119
  customType
120
- ? CUSTOM_TYPES_MESSAGES[customType.format].sliceZoneModalActionMessage
120
+ ? CUSTOM_TYPES_MESSAGES[customType.format]
121
+ .createSliceFromTypeActionMessage
121
122
  : undefined
122
123
  }
123
124
  >
@@ -6,9 +6,8 @@ import {
6
6
  FormikErrors,
7
7
  FormikTouched,
8
8
  FormikValues,
9
- FormikProps,
10
9
  } from "formik";
11
- import { SetStateAction } from "react";
10
+ import { ReactNode, SetStateAction } from "react";
12
11
  import { Flex, Heading, Close, Button as ThemeButton } from "theme-ui";
13
12
 
14
13
  import { Button } from "@components/Button";
@@ -45,9 +44,7 @@ type ModalCardProps<T extends FormikValues> = {
45
44
  omitFooter?: boolean;
46
45
  isLoading?: boolean;
47
46
  dataCy?: string;
48
- actionMessage?:
49
- | ((props: FormikProps<T>) => React.ReactNode)
50
- | React.ReactNode;
47
+ actionMessage?: ReactNode;
51
48
  };
52
49
 
53
50
  function ModalCard<Values extends FormikValues>({
@@ -91,108 +88,102 @@ function ModalCard<Values extends FormikValues>({
91
88
  onSubmit(values);
92
89
  }}
93
90
  >
94
- {(formikProps) => {
95
- const {
96
- isValid,
97
- isSubmitting,
98
- values,
99
- errors,
100
- touched,
101
- setFieldValue,
102
- setValues,
103
- } = formikProps;
104
-
105
- return (
106
- <Form
107
- id={formId}
108
- {...(dataCy != null ? { "data-cy": dataCy } : null)}
109
- >
110
- <Card
111
- borderFooter
112
- footerSx={{
113
- p: 3,
114
- position: "sticky",
115
- bottom: 0,
116
- background: "gray",
117
- }}
118
- bodySx={{ px: 4, py: 4 }}
119
- sx={{ border: "none" }}
120
- {...cardProps}
121
- Header={({ radius }: { radius: string | number }) => (
91
+ {({
92
+ isValid,
93
+ isSubmitting,
94
+ values,
95
+ errors,
96
+ touched,
97
+ setFieldValue,
98
+ setValues,
99
+ }) => (
100
+ <Form
101
+ id={formId}
102
+ {...(dataCy != null ? { "data-cy": dataCy } : null)}
103
+ >
104
+ <Card
105
+ borderFooter
106
+ footerSx={{
107
+ p: 3,
108
+ position: "sticky",
109
+ bottom: 0,
110
+ background: "gray",
111
+ }}
112
+ bodySx={{ px: 4, py: 4 }}
113
+ sx={{ border: "none" }}
114
+ {...cardProps}
115
+ Header={({ radius }: { radius: string | number }) => (
116
+ <Flex
117
+ sx={{
118
+ position: "sticky",
119
+ top: 0,
120
+ zIndex: 1,
121
+ p: "16px",
122
+ pl: 4,
123
+ bg: "headSection",
124
+ alignItems: "center",
125
+ justifyContent: "space-between",
126
+ borderTopLeftRadius: radius,
127
+ borderTopRightRadius: radius,
128
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
129
+ borderBottom: (t) => `1px solid ${t.colors?.borders}`,
130
+ }}
131
+ >
132
+ <Heading sx={{ fontSize: "20px" }}>{title}</Heading>
133
+ <Close type="button" onClick={close} />
134
+ </Flex>
135
+ )}
136
+ Footer={
137
+ !omitFooter ? (
122
138
  <Flex
123
139
  sx={{
124
- position: "sticky",
125
- top: 0,
126
- zIndex: 1,
127
- p: "16px",
128
- pl: 4,
129
- bg: "headSection",
130
- alignItems: "center",
131
- justifyContent: "space-between",
132
- borderTopLeftRadius: radius,
133
- borderTopRightRadius: radius,
134
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
135
- borderBottom: (t) => `1px solid ${t.colors?.borders}`,
140
+ alignItems: "space-between",
136
141
  }}
137
142
  >
138
- <Heading sx={{ fontSize: "20px" }}>{title}</Heading>
139
- <Close type="button" onClick={close} />
140
- </Flex>
141
- )}
142
- Footer={
143
- !omitFooter ? (
144
- <Flex
145
- sx={{
146
- alignItems: "space-between",
147
- }}
148
- >
149
- <Flex sx={{ fontSize: "14px", alignItems: "center" }}>
150
- {typeof actionMessage === "function"
151
- ? actionMessage(formikProps)
152
- : actionMessage}
153
- </Flex>
154
- <Flex sx={{ ml: "auto" }}>
155
- <ThemeButton
156
- mr={2}
157
- type="button"
158
- onClick={close}
159
- variant="secondary"
160
- disabled={isSubmitting || isLoading}
161
- >
162
- Cancel
163
- </ThemeButton>
164
- <Button
165
- label={buttonLabel}
166
- form={formId}
167
- type="submit"
168
- disabled={!isValid || isSubmitting || isLoading}
169
- isLoading={isSubmitting || isLoading}
170
- sx={{
171
- fontWeight: "400",
172
- paddingBlock: "8px",
173
- paddingInline: "16px",
174
- fontSize: "14px",
175
- borderRadius: "4px",
176
- }}
177
- />
178
- </Flex>
143
+ <Flex sx={{ fontSize: "14px", alignItems: "center" }}>
144
+ {actionMessage}
179
145
  </Flex>
180
- ) : null
181
- }
182
- >
183
- {children({
184
- isValid,
185
- isSubmitting,
186
- values,
187
- errors,
188
- touched,
189
- setFieldValue,
190
- setValues,
191
- })}
192
- </Card>
193
- </Form>
194
- );
195
- }}
146
+ <Flex sx={{ ml: "auto" }}>
147
+ <ThemeButton
148
+ mr={2}
149
+ type="button"
150
+ onClick={close}
151
+ variant="secondary"
152
+ disabled={isSubmitting || isLoading}
153
+ >
154
+ Cancel
155
+ </ThemeButton>
156
+ <Button
157
+ label={buttonLabel}
158
+ form={formId}
159
+ type="submit"
160
+ disabled={!isValid || isSubmitting || isLoading}
161
+ isLoading={isSubmitting || isLoading}
162
+ sx={{
163
+ fontWeight: "400",
164
+ paddingBlock: "8px",
165
+ paddingInline: "16px",
166
+ fontSize: "14px",
167
+ borderRadius: "4px",
168
+ }}
169
+ />
170
+ </Flex>
171
+ </Flex>
172
+ ) : null
173
+ }
174
+ >
175
+ {children({
176
+ isValid,
177
+ isSubmitting,
178
+ values,
179
+ errors,
180
+ touched,
181
+ setFieldValue,
182
+ setValues,
183
+ })}
184
+ </Card>
185
+ </Form>
186
+ )}
196
187
  </Formik>
197
188
  </SliceMachineModal>
198
189
  );
@@ -1,6 +1,7 @@
1
- import { ComponentUI } from "@lib/models/common/ComponentUI";
2
1
  import ModalFormCard from "../../../../components/ModalFormCard";
2
+
3
3
  import UpdateSliceZoneModalList from "./UpdateSliceZoneModalList";
4
+ import { ComponentUI } from "@lib/models/common/ComponentUI";
4
5
 
5
6
  interface UpdateSliceModalProps {
6
7
  isOpen: boolean;
@@ -1,5 +1,5 @@
1
1
  import { FieldArray } from "formik";
2
- import { Checkbox, Box, Text } from "theme-ui";
2
+ import { Checkbox, Box } from "theme-ui";
3
3
 
4
4
  import { SharedSlice } from "@lib/models/ui/Slice";
5
5
 
@@ -10,8 +10,7 @@ import { ComponentUI } from "@lib/models/common/ComponentUI";
10
10
  const UpdateSliceZoneModalList: React.FC<{
11
11
  availableSlices: ReadonlyArray<ComponentUI>;
12
12
  values: SliceZoneFormValues;
13
- placeholderSlices?: ReadonlyArray<ComponentUI>;
14
- }> = ({ availableSlices, values, placeholderSlices }) => (
13
+ }> = ({ availableSlices, values }) => (
15
14
  <FieldArray
16
15
  name="sliceKeys"
17
16
  render={(arrayHelpers) => (
@@ -20,10 +19,6 @@ const UpdateSliceZoneModalList: React.FC<{
20
19
  elems={availableSlices}
21
20
  defineElementKey={(slice: ComponentUI) => slice.model.name}
22
21
  renderElem={(slice: ComponentUI) => {
23
- const isPlaceholderSlice = placeholderSlices?.find(
24
- (s) => s.model.id === slice.model.id
25
- );
26
-
27
22
  return SharedSlice.render({
28
23
  slice: slice,
29
24
  Wrapper: ({ slice, children, sx }) => {
@@ -31,10 +26,6 @@ const UpdateSliceZoneModalList: React.FC<{
31
26
  <Box
32
27
  data-testid="slicezone-modal-item"
33
28
  onClick={() => {
34
- if (isPlaceholderSlice) {
35
- return;
36
- }
37
-
38
29
  const isInSliceZone = values.sliceKeys.includes(
39
30
  slice.model.id
40
31
  );
@@ -46,37 +37,16 @@ const UpdateSliceZoneModalList: React.FC<{
46
37
  arrayHelpers.push(slice.model.id);
47
38
  }}
48
39
  key={`${slice.from}-${slice.model.name}`}
49
- sx={
50
- !isPlaceholderSlice
51
- ? {
52
- cursor: "pointer",
53
- ...sx,
54
- }
55
- : {
56
- opacity: 0.5,
57
- ...sx,
58
- }
59
- }
40
+ sx={{
41
+ cursor: "pointer",
42
+ ...sx,
43
+ }}
60
44
  >
61
45
  {children}
62
46
  </Box>
63
47
  );
64
48
  },
65
49
  StatusOrCustom: ({ slice }: { slice: ComponentUI }) => {
66
- if (isPlaceholderSlice) {
67
- return (
68
- <Text
69
- sx={{
70
- fontSize: 12,
71
- color: "purpleStrong",
72
- fontWeight: "bold",
73
- }}
74
- >
75
- Coming soon
76
- </Text>
77
- );
78
- }
79
-
80
50
  const isInSliceZone = values.sliceKeys.includes(slice.model.id);
81
51
 
82
52
  return (
@@ -1,13 +1,4 @@
1
- import {
2
- Button,
3
- Box,
4
- Switch,
5
- DropdownMenu,
6
- DropdownMenuTrigger,
7
- DropdownMenuContent,
8
- DropdownMenuItem,
9
- Icon,
10
- } from "@prismicio/editor-ui";
1
+ import { Button, Box, Switch } from "@prismicio/editor-ui";
11
2
  import { useEffect, useMemo, useState } from "react";
12
3
  import { useSelector } from "react-redux";
13
4
  import { BaseStyles } from "theme-ui";
@@ -30,15 +21,10 @@ import {
30
21
  getRemoteSlices,
31
22
  } from "@src/modules/slices";
32
23
  import type { SliceMachineStoreType } from "@src/redux/type";
33
- import { useSlicesTemplates } from "@src/features/slicesTemplates/useSlicesTemplates";
34
- import { createSlicesTemplates } from "@src/features/slicesTemplates/actions/createSlicesTemplates";
35
24
 
36
25
  import { DeleteSliceZoneModal } from "./DeleteSliceZoneModal";
37
26
  import { SlicesList } from "./List";
38
27
  import UpdateSliceZoneModal from "./UpdateSliceZoneModal";
39
- import { SlicesTemplatesModal } from "./SlicesTemplatesModal";
40
- import { getState } from "@src/apiClient";
41
- import useSliceMachineActions from "@src/modules/useSliceMachineActions";
42
28
 
43
29
  const mapAvailableAndSharedSlices = (
44
30
  sliceZone: SlicesSM,
@@ -114,11 +100,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
114
100
  sliceZone,
115
101
  tabId,
116
102
  }) => {
117
- const availableSlicesTemplates = useSlicesTemplates();
118
- const [isSlicesTemplatesModalOpen, setIsSlicesTemplatesModalOpen] =
119
- useState(false);
120
- const [isUpdateSliceZoneModalOpen, setIsUpdateSliceZoneModalOpen] =
121
- useState(false);
103
+ const [formIsOpen, setFormIsOpen] = useState(false);
122
104
  const [isCreateSliceModalOpen, setIsCreateSliceModalOpen] = useState(false);
123
105
  const { remoteSlices, libraries, slices } = useSelector(
124
106
  (store: SliceMachineStoreType) => ({
@@ -127,7 +109,6 @@ const SliceZone: React.FC<SliceZoneProps> = ({
127
109
  slices: getFrontendSlices(store),
128
110
  })
129
111
  );
130
- const { createSliceSuccess } = useSliceMachineActions();
131
112
  const localLibraries: readonly LibraryUI[] = libraries.filter(
132
113
  (library) => library.isLocal
133
114
  );
@@ -161,63 +142,33 @@ const SliceZone: React.FC<SliceZoneProps> = ({
161
142
  .map((e) => (e.payload as NonSharedSliceInSliceZone).key);
162
143
 
163
144
  const onAddNewSlice = () => {
164
- setIsUpdateSliceZoneModalOpen(true);
145
+ setFormIsOpen(true);
165
146
  };
166
147
 
167
148
  const onCreateNewSlice = () => {
168
149
  setIsCreateSliceModalOpen(true);
169
150
  };
170
151
 
171
- const openSlicesTemplatesModal = () => {
172
- setIsSlicesTemplatesModalOpen(true);
173
- };
174
-
175
152
  return (
176
153
  <Box flexDirection="column">
177
154
  <List>
178
155
  <ListHeader
179
156
  actions={
180
- sliceZone && slicesInSliceZone.length > 0 ? (
181
- <Box gap={8}>
182
- <DropdownMenu>
183
- <DropdownMenuTrigger>
184
- <Button variant="secondary" startIcon="add">
185
- Create
186
- </Button>
187
- </DropdownMenuTrigger>
188
-
189
- <DropdownMenuContent align="end">
190
- <DropdownMenuItem
191
- startIcon={<Icon name="add" />}
192
- onSelect={onCreateNewSlice}
193
- >
194
- Blank slice
195
- </DropdownMenuItem>
196
-
197
- {availableSlicesTemplates.length > 0 ? (
198
- <DropdownMenuItem
199
- onSelect={() => {
200
- openSlicesTemplatesModal();
201
- }}
202
- startIcon={<Icon name="centerFocusWeak" />}
203
- >
204
- Use a template
205
- </DropdownMenuItem>
206
- ) : undefined}
207
- </DropdownMenuContent>
208
- </DropdownMenu>
209
-
157
+ sliceZone ? (
158
+ <>
159
+ <Button onClick={onCreateNewSlice} startIcon="add">
160
+ New slice
161
+ </Button>
210
162
  {availableSlices.length > 0 ? (
211
163
  <Button
212
164
  data-cy="update-slices"
213
165
  onClick={onAddNewSlice}
214
166
  startIcon="edit"
215
- variant="secondary"
216
167
  >
217
168
  Update Slices
218
169
  </Button>
219
170
  ) : undefined}
220
- </Box>
171
+ </>
221
172
  ) : undefined
222
173
  }
223
174
  toggle={
@@ -253,14 +204,12 @@ const SliceZone: React.FC<SliceZoneProps> = ({
253
204
  <SliceZoneBlankSlate
254
205
  onAddNewSlice={onAddNewSlice}
255
206
  onCreateNewSlice={onCreateNewSlice}
256
- openSlicesTemplatesModal={openSlicesTemplatesModal}
257
207
  projectHasAvailableSlices={availableSlices.length > 0}
258
- isSlicesTemplatesSupported={availableSlicesTemplates.length > 0}
259
208
  />
260
209
  )
261
210
  ) : undefined}
262
211
  <UpdateSliceZoneModal
263
- isOpen={isUpdateSliceZoneModalOpen}
212
+ isOpen={formIsOpen}
264
213
  formId={`tab-slicezone-form-${tabId}`}
265
214
  availableSlices={availableSlices}
266
215
  slicesInSliceZone={sharedSlicesInSliceZone}
@@ -268,36 +217,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
268
217
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
269
218
  onSelectSharedSlices(sliceKeys, nonSharedSlicesKeysInSliceZone)
270
219
  }
271
- close={() => setIsUpdateSliceZoneModalOpen(false)}
272
- />
273
- <SlicesTemplatesModal
274
- isOpen={isSlicesTemplatesModalOpen}
275
- formId={`tab-slicezone-form-${tabId}`}
276
- availableSlicesTemplates={availableSlicesTemplates}
277
- onSubmit={({ sliceKeys }) =>
278
- void createSlicesTemplates({
279
- templateIds: sliceKeys,
280
- localLibrariesNames: localLibraries.map((library) => library.name),
281
- onSuccess: async (slicesIds: string[]) => {
282
- // TODO(DT-1453): Remove the need of the global getState
283
- const serverState = await getState();
284
-
285
- // Update Redux store
286
- createSliceSuccess(serverState.libraries);
287
-
288
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
289
- onSelectSharedSlices(
290
- slicesIds.concat(
291
- sharedSlicesInSliceZone.map((s) => s.model.id)
292
- ),
293
- nonSharedSlicesKeysInSliceZone
294
- );
295
-
296
- setIsSlicesTemplatesModalOpen(false);
297
- },
298
- })
299
- }
300
- close={() => setIsSlicesTemplatesModalOpen(false)}
220
+ close={() => setFormIsOpen(false)}
301
221
  />
302
222
  <DeleteSliceZoneModal
303
223
  isDeleteSliceZoneModalOpen={isDeleteSliceZoneModalOpen}
@@ -1,5 +1,5 @@
1
- import { Box, ErrorBoundary, Text } from "@prismicio/editor-ui";
2
- import { FC, Suspense } from "react";
1
+ import { Box } from "@prismicio/editor-ui";
2
+ import type { FC } from "react";
3
3
  import type { DropResult } from "react-beautiful-dnd";
4
4
  import { useSelector } from "react-redux";
5
5
  import type { AnyObjectSchema } from "yup";
@@ -139,54 +139,43 @@ const TabZone: FC<TabZoneProps> = ({
139
139
 
140
140
  return (
141
141
  <Box backgroundColor="grey2" flexDirection="column" gap={8}>
142
- <ErrorBoundary>
143
- <Suspense
144
- fallback={
145
- <Box padding={32}>
146
- <Text>Loading...</Text>
147
- </Box>
148
- }
149
- >
150
- <Zone
151
- zoneType="customType"
152
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
153
- tabId={tabId}
154
- title="Static Zone"
155
- dataTip={""}
156
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
157
- fields={fields}
158
- // @ts-expect-error propsType and typescript are incompatible on this type, we can remove the error when migrating the Zone component
159
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
160
- poolOfFieldsToCheck={poolOfFields}
161
- showHints={true}
162
- EditModal={EditModal}
163
- widgetsArray={ctBuilderArray}
164
- onDeleteItem={onDeleteItem}
165
- onSave={onSave}
166
- onSaveNewField={onSaveNewField}
167
- onDragEnd={onDragEnd}
168
- renderHintBase={({ item }) =>
169
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
170
- `data${transformKeyAccessor(item.key)}`
171
- }
172
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
173
- renderFieldAccessor={(key) => `data${transformKeyAccessor(key)}`}
174
- dataCy="ct-static-zone"
175
- isRepeatableCustomType={customType.repeatable}
176
- />
177
- <SliceZone
178
- customType={customType}
179
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
180
- tabId={tabId}
181
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
182
- sliceZone={sliceZone}
183
- onRemoveSharedSlice={onRemoveSharedSlice}
184
- onCreateSliceZone={onCreateSliceZone}
185
- onDeleteSliceZone={onDeleteSliceZone}
186
- onSelectSharedSlices={onSelectSharedSlices}
187
- />
188
- </Suspense>
189
- </ErrorBoundary>
142
+ <Zone
143
+ zoneType="customType"
144
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
145
+ tabId={tabId}
146
+ title="Static Zone"
147
+ dataTip={""}
148
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
149
+ fields={fields}
150
+ // @ts-expect-error propsType and typescript are incompatible on this type, we can remove the error when migrating the Zone component
151
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
152
+ poolOfFieldsToCheck={poolOfFields}
153
+ showHints={true}
154
+ EditModal={EditModal}
155
+ widgetsArray={ctBuilderArray}
156
+ onDeleteItem={onDeleteItem}
157
+ onSave={onSave}
158
+ onSaveNewField={onSaveNewField}
159
+ onDragEnd={onDragEnd}
160
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
161
+ renderHintBase={({ item }) => `data${transformKeyAccessor(item.key)}`}
162
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
163
+ renderFieldAccessor={(key) => `data${transformKeyAccessor(key)}`}
164
+ dataCy="ct-static-zone"
165
+ isRepeatableCustomType={customType.repeatable}
166
+ />
167
+
168
+ <SliceZone
169
+ customType={customType}
170
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
171
+ tabId={tabId}
172
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
173
+ sliceZone={sliceZone}
174
+ onRemoveSharedSlice={onRemoveSharedSlice}
175
+ onCreateSliceZone={onCreateSliceZone}
176
+ onDeleteSliceZone={onDeleteSliceZone}
177
+ onSelectSharedSlices={onSelectSharedSlices}
178
+ />
190
179
  </Box>
191
180
  );
192
181
  };
@@ -1,5 +1,5 @@
1
- import { Box, Text, Heading } from "theme-ui";
2
- import { Button } from "@prismicio/editor-ui";
1
+ import { Box, Button, Text, Heading } from "theme-ui";
2
+ import { FaPlus } from "react-icons/fa";
3
3
 
4
4
  const ZoneEmptyState = ({
5
5
  onEnterSelectMode,
@@ -16,17 +16,18 @@ const ZoneEmptyState = ({
16
16
  Add a field to your {zoneName} Zone
17
17
  </Text>
18
18
  </Box>
19
- <Box sx={{ display: "flex", justifyContent: "center", marginTop: 16 }}>
20
- <Button
21
- variant="secondary"
22
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
23
- onClick={() => onEnterSelectMode()}
24
- data-cy={`add-${zoneName}-field`}
25
- startIcon="add"
26
- >
27
- Add a new field
28
- </Button>
29
- </Box>
19
+ <Button
20
+ mt={3}
21
+ variant="buttons.darkSmall"
22
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
23
+ onClick={() => onEnterSelectMode()}
24
+ data-cy={`add-${zoneName}-field`}
25
+ >
26
+ <FaPlus
27
+ style={{ marginRight: "8px", position: "relative", top: "2px" }}
28
+ />{" "}
29
+ Add a new field
30
+ </Button>
30
31
  </Box>
31
32
  );
32
33