slice-machine-ui 2.17.3-alpha.jp-remove-image-to-slice-experiment.1 → 2.17.3-alpha.jp-revert-section-naming-experiment.2
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/out/404.html +1 -1
- package/out/_next/static/{ce5aK5e3S4mimRW6pM_1C → TDI0oMeAJsBzW3-NbPUKW}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/489-949e8f6070a61205.js +1 -0
- package/out/_next/static/chunks/{630-29c729ad2a291ef6.js → 630-799c128fd87fa645.js} +1 -1
- package/out/_next/static/chunks/7-4221ce4f79fb2ff2.js +1 -0
- package/out/_next/static/chunks/pages/{_app-b4198e0ebcc68d2d.js → _app-79bce46871ddade7.js} +1 -1
- package/out/_next/static/chunks/pages/changes-b4b7d3047cf012a0.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-4024560ca59ad2be.js → [customTypeId]-d4b2bfcf2a7dd717.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-0d2416da0958eb40.js → [pageTypeId]-912b2d65b2db290d.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-0ecd552897e61e29.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-0a51da2e35d6e62f.js +1 -0
- package/out/_next/static/chunks/pages/slices-12e4d75d553a0426.js +1 -0
- 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/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/CreateSliceFromImageModal.tsx +8 -21
- package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +52 -38
- package/src/features/navigation/Navigation.tsx +1 -7
- package/src/legacy/components/ChangesItems/ChangesItems.tsx +1 -8
- package/src/legacy/components/Forms/CreateSliceModal/CreateSliceModal.tsx +3 -8
- package/src/legacy/components/Simulator/components/FailedConnect/index.tsx +51 -56
- package/src/legacy/components/ToasterContainer/index.tsx +3 -14
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +1 -4
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +1 -5
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +53 -40
- package/src/legacy/lib/builders/SliceBuilder/index.tsx +1 -6
- package/src/legacy/lib/builders/common/Zone/components/ZoneEmptyState/ZoneEmptyState.tsx +5 -10
- package/src/pages/slices.tsx +36 -57
- package/out/_next/static/chunks/489-f1d584386a1ead7e.js +0 -1
- package/out/_next/static/chunks/907-590c914f55547b96.js +0 -1
- package/out/_next/static/chunks/pages/changes-564336edb0ed18b0.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5008e29008aa04f4.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-bd5e45632c419567.js +0 -1
- package/out/_next/static/chunks/pages/slices-a0aa3bbe2cf1689c.js +0 -1
- package/src/features/builder/useSectionsNamingExperiment.ts +0 -15
- package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +0 -74
- package/src/utils/textConversion.ts +0 -11
- /package/out/_next/static/{ce5aK5e3S4mimRW6pM_1C → TDI0oMeAJsBzW3-NbPUKW}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionList,
|
|
3
3
|
ActionListItem,
|
|
4
|
+
BackgroundIcon,
|
|
4
5
|
BlankSlate,
|
|
5
6
|
BlankSlateActions,
|
|
6
7
|
BlankSlateDescription,
|
|
@@ -9,11 +10,6 @@ import {
|
|
|
9
10
|
} from "@prismicio/editor-ui";
|
|
10
11
|
import { FC } from "react";
|
|
11
12
|
|
|
12
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
13
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
14
|
-
|
|
15
|
-
import { getSliceCreationOptions } from "./sliceCreationOptions";
|
|
16
|
-
|
|
17
13
|
export type SliceZoneBlankSlateProps = {
|
|
18
14
|
openUpdateSliceZoneModal: () => void;
|
|
19
15
|
openCreateSliceModal: () => void;
|
|
@@ -31,12 +27,6 @@ export const SliceZoneBlankSlate: FC<SliceZoneBlankSlateProps> = ({
|
|
|
31
27
|
projectHasAvailableSlices,
|
|
32
28
|
isSlicesTemplatesSupported,
|
|
33
29
|
}) => {
|
|
34
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
35
|
-
const sliceCreationOptions = getSliceCreationOptions({
|
|
36
|
-
menuType: "ActionList",
|
|
37
|
-
sectionsNamingExperiment,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
30
|
return (
|
|
41
31
|
<BlankSlate data-testid="slice-zone-blank-slate" sx={{ width: 648 }}>
|
|
42
32
|
<BlankSlateIcon
|
|
@@ -45,55 +35,79 @@ export const SliceZoneBlankSlate: FC<SliceZoneBlankSlateProps> = ({
|
|
|
45
35
|
name="add"
|
|
46
36
|
size="large"
|
|
47
37
|
/>
|
|
48
|
-
<BlankSlateTitle size="big">
|
|
49
|
-
Add {pluralize(sectionsNamingExperiment.value)}
|
|
50
|
-
</BlankSlateTitle>
|
|
38
|
+
<BlankSlateTitle size="big">Add slices</BlankSlateTitle>
|
|
51
39
|
<BlankSlateDescription>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
content. Each on different pages with different content. Each{" "}
|
|
55
|
-
{sectionsNamingExperiment.value} has its own component in your code.
|
|
40
|
+
Slices are website sections that you can reuse on different pages with
|
|
41
|
+
different content. Each slice has its own component in your code.
|
|
56
42
|
</BlankSlateDescription>
|
|
57
43
|
<BlankSlateActions>
|
|
58
44
|
<ActionList>
|
|
59
45
|
<ActionListItem
|
|
60
|
-
renderStartIcon={() =>
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
renderStartIcon={() => (
|
|
47
|
+
<BackgroundIcon
|
|
48
|
+
name="autoFixHigh"
|
|
49
|
+
size="small"
|
|
50
|
+
iconSize="medium"
|
|
51
|
+
color="purple"
|
|
52
|
+
variant="solid"
|
|
53
|
+
radius={6}
|
|
54
|
+
/>
|
|
55
|
+
)}
|
|
63
56
|
onClick={openCreateSliceFromImageModal}
|
|
64
|
-
description=
|
|
57
|
+
description="Build a slice based on your design image."
|
|
65
58
|
>
|
|
66
|
-
|
|
59
|
+
Generate from image
|
|
67
60
|
</ActionListItem>
|
|
68
61
|
<ActionListItem
|
|
69
|
-
renderStartIcon={() =>
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
renderStartIcon={() => (
|
|
63
|
+
<BackgroundIcon
|
|
64
|
+
name="add"
|
|
65
|
+
size="small"
|
|
66
|
+
iconSize="medium"
|
|
67
|
+
color="white"
|
|
68
|
+
variant="solid"
|
|
69
|
+
radius={6}
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
72
72
|
onClick={openCreateSliceModal}
|
|
73
|
-
description=
|
|
73
|
+
description="Build a custom slice your way."
|
|
74
74
|
>
|
|
75
|
-
|
|
75
|
+
Start from scratch
|
|
76
76
|
</ActionListItem>
|
|
77
77
|
{isSlicesTemplatesSupported && (
|
|
78
78
|
<ActionListItem
|
|
79
|
-
renderStartIcon={() =>
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
renderStartIcon={() => (
|
|
80
|
+
<BackgroundIcon
|
|
81
|
+
name="contentCopy"
|
|
82
|
+
size="small"
|
|
83
|
+
iconSize="medium"
|
|
84
|
+
color="white"
|
|
85
|
+
variant="solid"
|
|
86
|
+
radius={6}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
82
89
|
onClick={openSlicesTemplatesModal}
|
|
83
|
-
description=
|
|
90
|
+
description="Choose from ready-made examples."
|
|
84
91
|
>
|
|
85
|
-
|
|
92
|
+
Use a template
|
|
86
93
|
</ActionListItem>
|
|
87
94
|
)}
|
|
88
95
|
{projectHasAvailableSlices && (
|
|
89
96
|
<ActionListItem
|
|
90
|
-
renderStartIcon={() =>
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
renderStartIcon={() => (
|
|
98
|
+
<BackgroundIcon
|
|
99
|
+
name="folder"
|
|
100
|
+
size="small"
|
|
101
|
+
iconSize="medium"
|
|
102
|
+
color="white"
|
|
103
|
+
variant="solid"
|
|
104
|
+
radius={6}
|
|
105
|
+
/>
|
|
106
|
+
)}
|
|
93
107
|
onClick={openUpdateSliceZoneModal}
|
|
94
|
-
description=
|
|
108
|
+
description="Select from your created slices."
|
|
95
109
|
>
|
|
96
|
-
|
|
110
|
+
Reuse an existing slice
|
|
97
111
|
</ActionListItem>
|
|
98
112
|
)}
|
|
99
113
|
</ActionList>
|
|
@@ -15,11 +15,9 @@ import { FolderIcon } from "@/icons/FolderIcon";
|
|
|
15
15
|
import { LightningIcon } from "@/icons/Lightning";
|
|
16
16
|
import { MenuBookIcon } from "@/icons/MenuBookIcon";
|
|
17
17
|
import { SettingsIcon } from "@/icons/SettingsIcon";
|
|
18
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
19
18
|
|
|
20
19
|
import { ChangesItem } from "../../legacy/components/Navigation/ChangesItem";
|
|
21
20
|
import { Environment } from "../../legacy/components/Navigation/Environment";
|
|
22
|
-
import { useSectionsNamingExperiment } from "../builder/useSectionsNamingExperiment";
|
|
23
21
|
import { NavigationItem } from "./NavigationItem";
|
|
24
22
|
import { SliceMachineVersion } from "./SliceMachineVersion";
|
|
25
23
|
import { UpdateInfo } from "./UpdateInfo";
|
|
@@ -29,7 +27,6 @@ export function Navigation() {
|
|
|
29
27
|
|
|
30
28
|
const gitIntegrationExperiment = useGitIntegrationExperiment();
|
|
31
29
|
const { documentationLink } = useMarketingContent();
|
|
32
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
33
30
|
const adapter = useAdapterName();
|
|
34
31
|
|
|
35
32
|
interface CustomTypeNavigationItemProps {
|
|
@@ -78,9 +75,7 @@ export function Navigation() {
|
|
|
78
75
|
<CustomTypeNavigationItem type="custom" />
|
|
79
76
|
|
|
80
77
|
<NavigationItem
|
|
81
|
-
title=
|
|
82
|
-
capitalizeFirstLetter(sectionsNamingExperiment.value),
|
|
83
|
-
)}
|
|
78
|
+
title="Slices"
|
|
84
79
|
href="/slices"
|
|
85
80
|
Icon={FolderIcon}
|
|
86
81
|
active={router.asPath.startsWith("/slices")}
|
|
@@ -101,7 +96,6 @@ export function Navigation() {
|
|
|
101
96
|
<OnboardingGuide />
|
|
102
97
|
</Suspense>
|
|
103
98
|
</ErrorBoundary>
|
|
104
|
-
|
|
105
99
|
<NavigationItem
|
|
106
100
|
title="Documentation"
|
|
107
101
|
href={documentationLink}
|
|
@@ -4,7 +4,6 @@ import { AiOutlineExclamationCircle } from "react-icons/ai";
|
|
|
4
4
|
|
|
5
5
|
import { countMissingScreenshots } from "@/domain/slice";
|
|
6
6
|
import { ErrorBoundary } from "@/ErrorBoundary";
|
|
7
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
8
7
|
import { SharedSliceCard } from "@/features/slices/sliceCards/SharedSliceCard";
|
|
9
8
|
import { ModelsStatuses } from "@/features/sync/getUnSyncChanges";
|
|
10
9
|
import { useScreenshotChangesModal } from "@/hooks/useScreenshotChangesModal";
|
|
@@ -16,7 +15,6 @@ import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
|
16
15
|
import { LocalOrRemoteCustomType } from "@/legacy/lib/models/common/ModelData";
|
|
17
16
|
import { ModelStatus } from "@/legacy/lib/models/common/ModelStatus";
|
|
18
17
|
import { AuthStatus } from "@/modules/userContext/types";
|
|
19
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
20
18
|
|
|
21
19
|
import { DevCollaborationExperiment } from "./DevCollaborationExperiment";
|
|
22
20
|
|
|
@@ -36,7 +34,6 @@ export const ChangesItems: React.FC<ChangesItemsProps> = ({
|
|
|
36
34
|
isOnline,
|
|
37
35
|
}) => {
|
|
38
36
|
const { modalPayload, onOpenModal } = useScreenshotChangesModal();
|
|
39
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
40
37
|
|
|
41
38
|
const { sliceFilterFn, defaultVariationSelector } = modalPayload;
|
|
42
39
|
|
|
@@ -71,11 +68,7 @@ export const ChangesItems: React.FC<ChangesItemsProps> = ({
|
|
|
71
68
|
<Box padding={{ bottom: 8 }}>
|
|
72
69
|
<ChangesSectionHeader>
|
|
73
70
|
<Box>
|
|
74
|
-
<Text variant="h5">
|
|
75
|
-
{pluralize(
|
|
76
|
-
capitalizeFirstLetter(sectionsNamingExperiment.value),
|
|
77
|
-
)}
|
|
78
|
-
</Text>
|
|
71
|
+
<Text variant="h5">Slices</Text>
|
|
79
72
|
<Text variant="h5" sx={{ marginLeft: 8 }}>
|
|
80
73
|
{unSyncedSlices.length}
|
|
81
74
|
</Text>
|
|
@@ -4,7 +4,6 @@ import Select from "react-select";
|
|
|
4
4
|
import { Box, Label } from "theme-ui";
|
|
5
5
|
|
|
6
6
|
import { getState } from "@/apiClient";
|
|
7
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
8
7
|
import { useOnboarding } from "@/features/onboarding/useOnboarding";
|
|
9
8
|
import { createSlice } from "@/features/slices/actions/createSlice";
|
|
10
9
|
import { useAutoSync } from "@/features/sync/AutoSyncProvider";
|
|
@@ -12,7 +11,6 @@ import ModalFormCard from "@/legacy/components/ModalFormCard";
|
|
|
12
11
|
import { LibraryUI } from "@/legacy/lib/models/common/LibraryUI";
|
|
13
12
|
import { SliceSM } from "@/legacy/lib/models/common/Slice";
|
|
14
13
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
15
|
-
import { capitalizeFirstLetter } from "@/utils/textConversion";
|
|
16
14
|
|
|
17
15
|
import { InputBox } from "../components/InputBox";
|
|
18
16
|
import { validateSliceModalValues } from "../formsValidator";
|
|
@@ -38,7 +36,6 @@ export const CreateSliceModal: FC<CreateSliceModalProps> = ({
|
|
|
38
36
|
const [isCreatingSlice, setIsCreatingSlice] = useState(false);
|
|
39
37
|
const { syncChanges } = useAutoSync();
|
|
40
38
|
const { completeStep } = useOnboarding();
|
|
41
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
42
39
|
|
|
43
40
|
const onSubmit = async (values: FormValues) => {
|
|
44
41
|
const sliceName = values.sliceName;
|
|
@@ -82,17 +79,15 @@ export const CreateSliceModal: FC<CreateSliceModalProps> = ({
|
|
|
82
79
|
validateSliceModalValues(values, localLibraries, remoteSlices)
|
|
83
80
|
}
|
|
84
81
|
content={{
|
|
85
|
-
title:
|
|
82
|
+
title: "Create a new slice",
|
|
86
83
|
}}
|
|
87
84
|
>
|
|
88
85
|
{({ touched, values, setFieldValue, errors }) => (
|
|
89
86
|
<Box>
|
|
90
87
|
<InputBox
|
|
91
88
|
name="sliceName"
|
|
92
|
-
label=
|
|
93
|
-
|
|
94
|
-
)} name`}
|
|
95
|
-
placeholder={`Pascalised ${sectionsNamingExperiment.value} API ID (e.g. TextBlock)`}
|
|
89
|
+
label="Slice name"
|
|
90
|
+
placeholder="Pascalised slice API ID (e.g. TextBlock)"
|
|
96
91
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
97
92
|
error={touched.sliceName ? errors.sliceName : undefined}
|
|
98
93
|
testId="slice-name-input"
|
|
@@ -1,71 +1,66 @@
|
|
|
1
1
|
import { IoMdRefresh } from "react-icons/io";
|
|
2
2
|
import { Image, Link, Text } from "theme-ui";
|
|
3
3
|
|
|
4
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
5
4
|
import { Button } from "@/legacy/components/Button";
|
|
6
5
|
|
|
7
6
|
import FullPage from "../FullPage";
|
|
8
7
|
|
|
9
|
-
const FailedConnect = ({ onRetrigger }: { onRetrigger: () => void }) =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const FailedConnect = ({ onRetrigger }: { onRetrigger: () => void }) => (
|
|
9
|
+
<FullPage>
|
|
10
|
+
<Image src="/iframe-not-running.png" sx={{ width: "320px" }} />
|
|
11
|
+
<Text
|
|
12
|
+
sx={{
|
|
13
|
+
color: "textClear",
|
|
14
|
+
mb: 2,
|
|
15
|
+
fontSize: "14px",
|
|
16
|
+
lineHeight: "24px",
|
|
17
|
+
fontWeight: "600",
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
Slice Machine can't render your slice
|
|
21
|
+
</Text>
|
|
22
|
+
<Text
|
|
23
|
+
sx={{
|
|
24
|
+
color: "failedConnectText",
|
|
25
|
+
maxWidth: "400px",
|
|
26
|
+
textAlign: "center",
|
|
27
|
+
fontSize: "12px",
|
|
28
|
+
lineHeight: "22px",
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
Ensure your website's development server is running by typing
|
|
32
|
+
<br />
|
|
15
33
|
<Text
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
fontSize: "14px",
|
|
20
|
-
lineHeight: "24px",
|
|
21
|
-
fontWeight: "600",
|
|
22
|
-
}}
|
|
34
|
+
as="code"
|
|
35
|
+
variant="styles.inlineCode"
|
|
36
|
+
sx={{ padding: "4px", borderRadius: "6px" }}
|
|
23
37
|
>
|
|
24
|
-
|
|
38
|
+
npm run dev
|
|
25
39
|
</Text>
|
|
26
|
-
|
|
40
|
+
in your terminal at the root of your website directory.
|
|
41
|
+
<br /> If that doesn't work, see the
|
|
42
|
+
<Link
|
|
43
|
+
target="_blank"
|
|
44
|
+
href="https://prismic.io/docs/slice-machine#simulate-slices"
|
|
27
45
|
sx={{
|
|
28
|
-
color: "
|
|
29
|
-
maxWidth: "400px",
|
|
30
|
-
textAlign: "center",
|
|
31
|
-
fontSize: "12px",
|
|
32
|
-
lineHeight: "22px",
|
|
46
|
+
color: "link",
|
|
33
47
|
}}
|
|
34
48
|
>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
troubleshooting instructions.
|
|
54
|
-
</Link>
|
|
55
|
-
</Text>
|
|
56
|
-
<Button
|
|
57
|
-
onClick={onRetrigger}
|
|
58
|
-
label="Refresh"
|
|
59
|
-
Icon={IoMdRefresh}
|
|
60
|
-
iconSize={20}
|
|
61
|
-
iconFill="#6F6E77"
|
|
62
|
-
variant="secondaryMedium"
|
|
63
|
-
sx={{
|
|
64
|
-
mt: "16px",
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
</FullPage>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
49
|
+
troubleshooting instructions.
|
|
50
|
+
</Link>
|
|
51
|
+
</Text>
|
|
52
|
+
<Button
|
|
53
|
+
onClick={onRetrigger}
|
|
54
|
+
label="Refresh"
|
|
55
|
+
Icon={IoMdRefresh}
|
|
56
|
+
iconSize={20}
|
|
57
|
+
iconFill="#6F6E77"
|
|
58
|
+
variant="secondaryMedium"
|
|
59
|
+
sx={{
|
|
60
|
+
mt: "16px",
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
</FullPage>
|
|
64
|
+
);
|
|
70
65
|
|
|
71
66
|
export default FailedConnect;
|
|
@@ -7,9 +7,6 @@ import {
|
|
|
7
7
|
TypeOptions,
|
|
8
8
|
} from "react-toastify";
|
|
9
9
|
|
|
10
|
-
import { UseSectionsNamingExperimentReturnType } from "@/features/builder/useSectionsNamingExperiment";
|
|
11
|
-
import { capitalizeFirstLetter } from "@/utils/textConversion";
|
|
12
|
-
|
|
13
10
|
const getIconAccordingToasterType = ({
|
|
14
11
|
type,
|
|
15
12
|
}: {
|
|
@@ -70,14 +67,6 @@ export const ToastMessageWithPath: React.FC<{
|
|
|
70
67
|
|
|
71
68
|
export const SliceToastMessage: React.FC<{
|
|
72
69
|
path: string;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<ToastMessageWithPath
|
|
77
|
-
message={`${capitalizeFirstLetter(
|
|
78
|
-
props.sectionsNamingExperiment.value,
|
|
79
|
-
)} saved successfully at `}
|
|
80
|
-
{...props}
|
|
81
|
-
/>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
70
|
+
}> = (props) => (
|
|
71
|
+
<ToastMessageWithPath message="Slice saved successfully at " {...props} />
|
|
72
|
+
);
|
|
@@ -3,7 +3,6 @@ import { FC } from "react";
|
|
|
3
3
|
import { Text } from "theme-ui";
|
|
4
4
|
|
|
5
5
|
import { getState } from "@/apiClient";
|
|
6
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
7
6
|
import { createSlicesTemplates } from "@/features/slicesTemplates/actions/createSlicesTemplates";
|
|
8
7
|
import { SliceTemplate } from "@/features/slicesTemplates/useSlicesTemplates";
|
|
9
8
|
import ModalFormCard from "@/legacy/components/ModalFormCard";
|
|
@@ -12,7 +11,6 @@ import { LibraryUI } from "@/legacy/lib/models/common/LibraryUI";
|
|
|
12
11
|
import { Slices } from "@/legacy/lib/models/common/Slice";
|
|
13
12
|
import { managerClient } from "@/managerClient";
|
|
14
13
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
15
|
-
import { pluralize } from "@/utils/textConversion";
|
|
16
14
|
|
|
17
15
|
import UpdateSliceZoneModalList from "./UpdateSliceZoneModalList";
|
|
18
16
|
|
|
@@ -38,7 +36,6 @@ export const SlicesTemplatesModal: FC<UpdateSliceModalProps> = ({
|
|
|
38
36
|
location,
|
|
39
37
|
}) => {
|
|
40
38
|
const { createSliceSuccess } = useSliceMachineActions();
|
|
41
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
42
39
|
|
|
43
40
|
return (
|
|
44
41
|
<ModalFormCard
|
|
@@ -82,7 +79,7 @@ export const SlicesTemplatesModal: FC<UpdateSliceModalProps> = ({
|
|
|
82
79
|
sliceKeys: [],
|
|
83
80
|
}}
|
|
84
81
|
content={{
|
|
85
|
-
title:
|
|
82
|
+
title: "Use template slices",
|
|
86
83
|
}}
|
|
87
84
|
validate={(values) => {
|
|
88
85
|
if (values.sliceKeys.length === 0) {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
|
|
2
2
|
import { Text } from "theme-ui";
|
|
3
3
|
|
|
4
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
5
4
|
import ModalFormCard from "@/legacy/components/ModalFormCard";
|
|
6
5
|
import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
7
|
-
import { pluralize } from "@/utils/textConversion";
|
|
8
6
|
|
|
9
7
|
import UpdateSliceZoneModalList from "./UpdateSliceZoneModalList";
|
|
10
8
|
|
|
@@ -25,8 +23,6 @@ const UpdateSliceZoneModal: React.FC<UpdateSliceModalProps> = ({
|
|
|
25
23
|
onSubmit,
|
|
26
24
|
availableSlices,
|
|
27
25
|
}) => {
|
|
28
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
29
|
-
|
|
30
26
|
return (
|
|
31
27
|
<ModalFormCard
|
|
32
28
|
isOpen
|
|
@@ -47,7 +43,7 @@ const UpdateSliceZoneModal: React.FC<UpdateSliceModalProps> = ({
|
|
|
47
43
|
sliceKeys: [],
|
|
48
44
|
}}
|
|
49
45
|
content={{
|
|
50
|
-
title:
|
|
46
|
+
title: "Select existing slices",
|
|
51
47
|
}}
|
|
52
48
|
testId="update-slices-modal"
|
|
53
49
|
validate={(values) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BackgroundIcon,
|
|
2
3
|
Box,
|
|
3
4
|
Button,
|
|
4
5
|
DropdownMenu,
|
|
@@ -15,10 +16,8 @@ import { BaseStyles } from "theme-ui";
|
|
|
15
16
|
|
|
16
17
|
import { telemetry } from "@/apiClient";
|
|
17
18
|
import { ListHeader } from "@/components/List";
|
|
18
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
19
19
|
import { CreateSliceFromImageModal } from "@/features/customTypes/customTypesBuilder/CreateSliceFromImageModal";
|
|
20
20
|
import { useCustomTypeState } from "@/features/customTypes/customTypesBuilder/CustomTypeProvider";
|
|
21
|
-
import { getSliceCreationOptions } from "@/features/customTypes/customTypesBuilder/sliceCreationOptions";
|
|
22
21
|
import { SliceZoneBlankSlate } from "@/features/customTypes/customTypesBuilder/SliceZoneBlankSlate";
|
|
23
22
|
import { useOnboarding } from "@/features/onboarding/useOnboarding";
|
|
24
23
|
import { addSlicesToSliceZone } from "@/features/slices/actions/addSlicesToSliceZone";
|
|
@@ -41,7 +40,6 @@ import {
|
|
|
41
40
|
} from "@/modules/slices";
|
|
42
41
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
43
42
|
import type { SliceMachineStoreType } from "@/redux/type";
|
|
44
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
45
43
|
|
|
46
44
|
import { DeleteSliceZoneModal } from "./DeleteSliceZoneModal";
|
|
47
45
|
import { SlicesList } from "./List";
|
|
@@ -133,11 +131,6 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
133
131
|
const { setCustomType } = useCustomTypeState();
|
|
134
132
|
const { completeStep } = useOnboarding();
|
|
135
133
|
const { openLoginModal } = useSliceMachineActions();
|
|
136
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
137
|
-
const sliceCreationOptions = getSliceCreationOptions({
|
|
138
|
-
menuType: "Dropdown",
|
|
139
|
-
sectionsNamingExperiment,
|
|
140
|
-
});
|
|
141
134
|
|
|
142
135
|
const localLibraries: readonly LibraryUI[] = libraries.filter(
|
|
143
136
|
(library) => library.isLocal,
|
|
@@ -235,45 +228,73 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
235
228
|
|
|
236
229
|
<DropdownMenuContent align="end">
|
|
237
230
|
<DropdownMenuItem
|
|
238
|
-
renderStartIcon={() =>
|
|
239
|
-
|
|
240
|
-
|
|
231
|
+
renderStartIcon={() => (
|
|
232
|
+
<BackgroundIcon
|
|
233
|
+
name="autoFixHigh"
|
|
234
|
+
size="extraSmall"
|
|
235
|
+
iconSize="small"
|
|
236
|
+
radius={6}
|
|
237
|
+
variant="solid"
|
|
238
|
+
color="purple"
|
|
239
|
+
/>
|
|
240
|
+
)}
|
|
241
241
|
onSelect={() => void openCreateSliceFromImageModal()}
|
|
242
|
-
description=
|
|
242
|
+
description="Build a slice based on your design image."
|
|
243
243
|
>
|
|
244
|
-
|
|
244
|
+
Generate from image
|
|
245
245
|
</DropdownMenuItem>
|
|
246
246
|
<DropdownMenuItem
|
|
247
|
-
renderStartIcon={() =>
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
renderStartIcon={() => (
|
|
248
|
+
<BackgroundIcon
|
|
249
|
+
name="add"
|
|
250
|
+
size="extraSmall"
|
|
251
|
+
iconSize="small"
|
|
252
|
+
radius={6}
|
|
253
|
+
variant="solid"
|
|
254
|
+
color="white"
|
|
255
|
+
/>
|
|
256
|
+
)}
|
|
250
257
|
onSelect={openCreateSliceModal}
|
|
251
|
-
description=
|
|
258
|
+
description="Build a custom slice your way."
|
|
252
259
|
>
|
|
253
|
-
|
|
260
|
+
Start from scratch
|
|
254
261
|
</DropdownMenuItem>
|
|
255
262
|
|
|
256
263
|
{availableSlicesTemplates.length > 0 ? (
|
|
257
264
|
<DropdownMenuItem
|
|
258
265
|
onSelect={openSlicesTemplatesModal}
|
|
259
|
-
renderStartIcon={() =>
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
266
|
+
renderStartIcon={() => (
|
|
267
|
+
<BackgroundIcon
|
|
268
|
+
name="contentCopy"
|
|
269
|
+
size="extraSmall"
|
|
270
|
+
iconSize="small"
|
|
271
|
+
radius={6}
|
|
272
|
+
variant="solid"
|
|
273
|
+
color="white"
|
|
274
|
+
/>
|
|
275
|
+
)}
|
|
276
|
+
description="Choose from ready-made examples."
|
|
263
277
|
>
|
|
264
|
-
|
|
278
|
+
Use a template
|
|
265
279
|
</DropdownMenuItem>
|
|
266
280
|
) : undefined}
|
|
267
281
|
|
|
268
282
|
{availableSlicesToAdd.length > 0 ? (
|
|
269
283
|
<DropdownMenuItem
|
|
270
284
|
onSelect={openUpdateSliceZoneModal}
|
|
271
|
-
renderStartIcon={() =>
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
285
|
+
renderStartIcon={() => (
|
|
286
|
+
<BackgroundIcon
|
|
287
|
+
name="folder"
|
|
288
|
+
size="extraSmall"
|
|
289
|
+
iconSize="small"
|
|
290
|
+
radius={6}
|
|
291
|
+
variant="solid"
|
|
292
|
+
color="white"
|
|
293
|
+
/>
|
|
294
|
+
)}
|
|
295
|
+
description="Select from your created slices."
|
|
275
296
|
>
|
|
276
|
-
|
|
297
|
+
Reuse an existing slice
|
|
277
298
|
</DropdownMenuItem>
|
|
278
299
|
) : undefined}
|
|
279
300
|
</DropdownMenuContent>
|
|
@@ -297,7 +318,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
297
318
|
) : undefined
|
|
298
319
|
}
|
|
299
320
|
>
|
|
300
|
-
|
|
321
|
+
Slices
|
|
301
322
|
</ListHeader>
|
|
302
323
|
|
|
303
324
|
{sliceZone ? (
|
|
@@ -374,11 +395,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
374
395
|
onSaveCallback: () => {
|
|
375
396
|
toast.success(
|
|
376
397
|
<ToastMessageWithPath
|
|
377
|
-
message=
|
|
378
|
-
sectionsNamingExperiment.value,
|
|
379
|
-
)} template(s) added to ${
|
|
380
|
-
sectionsNamingExperiment.value
|
|
381
|
-
} zone and created at: `}
|
|
398
|
+
message="Slice template(s) added to slice zone and created at: "
|
|
382
399
|
path={`${localLibraries[0].name}/`}
|
|
383
400
|
/>,
|
|
384
401
|
);
|
|
@@ -414,7 +431,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
414
431
|
onSaveCallback: () => {
|
|
415
432
|
toast.success(
|
|
416
433
|
<ToastMessageWithPath
|
|
417
|
-
message=
|
|
434
|
+
message="New slice added to slice zone and created at: "
|
|
418
435
|
path={`${localLibraries[0].name}/`}
|
|
419
436
|
/>,
|
|
420
437
|
);
|
|
@@ -442,11 +459,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
442
459
|
onSaveCallback: () => {
|
|
443
460
|
toast.success(
|
|
444
461
|
<ToastMessageWithPath
|
|
445
|
-
message=
|
|
446
|
-
sectionsNamingExperiment.value,
|
|
447
|
-
)}(s) added to ${
|
|
448
|
-
sectionsNamingExperiment.value
|
|
449
|
-
} zone and created at: `}
|
|
462
|
+
message="Slice(s) added to slice zone and created at: "
|
|
450
463
|
path={library}
|
|
451
464
|
/>,
|
|
452
465
|
);
|