slice-machine-ui 2.17.3-beta.1 → 2.17.3-beta.11
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/Mn1b3xEWEJNa-mSgCSYLq/_buildManifest.js +1 -0
- package/out/_next/static/chunks/04ad993f.d7f986af0f739cc9.js +28 -0
- package/out/_next/static/chunks/248-bdbfde18c5a04eae.js +1 -0
- package/out/_next/static/chunks/34-8d9d9b2944824750.js +1 -0
- package/out/_next/static/chunks/489-6edb99e269996dd1.js +1 -0
- package/out/_next/static/chunks/50-586dc7ab5e584e76.js +1 -0
- package/out/_next/static/chunks/630-bb6e3db525588f16.js +1 -0
- package/out/_next/static/chunks/{647-7b9b5aa9468f9e4b.js → 647-4379a741c8d85d9e.js} +1 -1
- package/out/_next/static/chunks/907-445266211c48b1a5.js +1 -0
- package/out/_next/static/chunks/pages/{_app-20b580525c9dd4d8.js → _app-76c43bdc0320687e.js} +220 -222
- package/out/_next/static/chunks/pages/changelog-21b960abba5abf71.js +1 -0
- package/out/_next/static/chunks/pages/changes-bdfa50eadb1e5a42.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-a408f5a660e096a6.js → [customTypeId]-7102c23f96cd1768.js} +1 -1
- package/out/_next/static/chunks/pages/labs-d79597003a1ff74e.js +1 -0
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-f5e851ebe35049a8.js → [pageTypeId]-d4bc920a5efffa0a.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-b127d948a17968d3.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-98f85d5fb8d5c704.js +1 -0
- package/out/_next/static/chunks/pages/slices-046e5e978ffc3a42.js +1 -0
- package/out/_next/static/chunks/webpack-e0c07a2fe4908d81.js +1 -0
- package/out/_next/static/css/303dad78be1eb854.css +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/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 +6 -6
- package/src/apiClient.ts +1 -1
- package/src/domain/fields.ts +7 -7
- package/src/features/auth/LogoutButton.tsx +37 -0
- package/src/features/builder/AddFieldDropdown.tsx +2 -2
- package/src/features/changes/PushChangesButton.tsx +4 -67
- package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/CreateSliceFromImageModal.tsx +8 -21
- package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +13 -25
- package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +5 -11
- package/src/features/environments/actions/getActiveEnvironment.ts +14 -5
- package/src/features/environments/useActiveEnvironment.ts +8 -1
- package/src/features/environments/useEnvironments.ts +8 -1
- package/src/features/navigation/Navigation.tsx +4 -24
- package/src/features/slices/sliceCards/SharedSliceCard.tsx +2 -10
- package/src/legacy/components/AppLayout/index.tsx +34 -2
- package/src/legacy/components/ChangesItems/ChangesItems.tsx +1 -8
- package/src/legacy/components/Forms/CreateSliceModal/CreateSliceModal.tsx +3 -8
- package/src/legacy/components/ListItem/Header.tsx +18 -12
- package/src/legacy/components/ListItem/index.tsx +1 -0
- package/src/legacy/components/LoginModal/index.tsx +11 -3
- package/src/legacy/components/Navigation/Environment.tsx +11 -3
- package/src/legacy/components/Navigation/SideNavEnvironmentSelector/SideNavEnvironmentSelector.tsx +3 -0
- 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 +20 -28
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +1 -5
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +1 -6
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +13 -29
- package/src/legacy/lib/builders/SliceBuilder/index.tsx +1 -6
- package/src/legacy/lib/builders/common/EditModal/index.jsx +3 -10
- package/src/legacy/lib/builders/common/Zone/components/ZoneEmptyState/ZoneEmptyState.tsx +5 -10
- package/src/legacy/lib/models/common/widgets/Boolean/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Color/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/ContentRelationship/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Date/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Embed/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/GeoPoint/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Group/createGroupWidget.ts +2 -0
- package/src/legacy/lib/models/common/widgets/Image/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Link/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/LinkToMedia/index.ts +2 -0
- package/src/legacy/lib/models/common/widgets/Number/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Select/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/StructuredText/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Table/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Text/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Timestamp/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/UID/index.ts +3 -0
- package/src/legacy/lib/models/common/widgets/Widget.ts +1 -0
- package/src/pages/slices.tsx +19 -51
- package/out/_next/static/chunks/248-03446cd9e9f13730.js +0 -1
- package/out/_next/static/chunks/268-6a9214b97195af9c.js +0 -1
- package/out/_next/static/chunks/33641354.3864aefb6106ae71.js +0 -28
- package/out/_next/static/chunks/34-e684c5fd75cc9dd0.js +0 -1
- package/out/_next/static/chunks/44-a2056f993381ad0f.js +0 -1
- package/out/_next/static/chunks/630-29c729ad2a291ef6.js +0 -1
- package/out/_next/static/chunks/882-151468121d542ed6.js +0 -1
- package/out/_next/static/chunks/pages/changelog-063c5e11dfc8fd55.js +0 -1
- package/out/_next/static/chunks/pages/changes-564336edb0ed18b0.js +0 -1
- package/out/_next/static/chunks/pages/labs-9630bfb1005be02b.js +0 -1
- package/out/_next/static/chunks/pages/settings-01f4aeb9112a1f87.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-4a60cd5f2c71327e.js +0 -1
- package/out/_next/static/chunks/webpack-b3522fdebabf510a.js +0 -1
- package/out/_next/static/css/cc9b10286400c2b9.css +0 -1
- package/out/_next/static/css/e5f781f20e24a5ea.css +0 -1
- package/out/_next/static/qsIV6OuRkZuXZ3EaJau1x/_buildManifest.js +0 -1
- package/out/settings.html +0 -1
- package/out/videoHighlights.png +0 -0
- package/public/videoHighlights.png +0 -0
- package/src/components/FieldSet/FieldSet.module.css +0 -84
- package/src/components/FieldSet/FieldSet.module.css.d.ts +0 -16
- package/src/components/FieldSet/FieldSet.stories.tsx +0 -244
- package/src/components/FieldSet/FieldSet.tsx +0 -67
- package/src/components/FieldSet/index.ts +0 -9
- package/src/features/builder/useAiSliceGenerationExperiment.ts +0 -8
- package/src/features/builder/useSectionsNamingExperiment.ts +0 -15
- package/src/features/settings/SettingsPage.tsx +0 -50
- package/src/features/settings/git/ConnectGitRepository.tsx +0 -112
- package/src/features/settings/git/ConnectGitRepositoryBlankSlate.tsx +0 -33
- package/src/features/settings/git/GitOwnerSelect.tsx +0 -71
- package/src/features/settings/git/GitProvider.ts +0 -40
- package/src/features/settings/git/GitProviderConnectButtons.tsx +0 -63
- package/src/features/settings/git/GitRepositoriesList.tsx +0 -76
- package/src/features/settings/git/GitRepositoriesSearch.tsx +0 -69
- package/src/features/settings/git/GitRepositoryConnectDialog.tsx +0 -97
- package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +0 -62
- package/src/features/settings/git/useGitIntegrationExperiment.ts +0 -8
- package/src/features/settings/git/useGitOwners.ts +0 -12
- package/src/features/settings/git/useGitRepos.ts +0 -24
- package/src/features/settings/git/useLinkedGitRepos.ts +0 -41
- package/src/features/settings/git/useWriteAPIToken.ts +0 -23
- package/src/icons/BitbucketIcon.tsx +0 -19
- package/src/icons/GitHubIcon.tsx +0 -17
- package/src/icons/GitLabIcon.tsx +0 -19
- package/src/icons/SettingsIcon.tsx +0 -19
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/sliceTemplatesComingSoon.ts +0 -30
- package/src/pages/settings.tsx +0 -1
- package/src/utils/textConversion.ts +0 -11
- /package/out/_next/static/{qsIV6OuRkZuXZ3EaJau1x → Mn1b3xEWEJNa-mSgCSYLq}/_ssgManifest.js +0 -0
|
@@ -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,3 +1,4 @@
|
|
|
1
|
+
import { Box, Tooltip } from "@prismicio/editor-ui";
|
|
1
2
|
import * as CSS from "csstype";
|
|
2
3
|
import { IconType } from "react-icons";
|
|
3
4
|
import { Flex, Text, Theme } from "theme-ui";
|
|
@@ -9,6 +10,7 @@ interface ItemHeaderProps {
|
|
|
9
10
|
sliceFieldName: string | undefined;
|
|
10
11
|
theme: Theme;
|
|
11
12
|
WidgetIcon: IconType;
|
|
13
|
+
widgetIconTooltip: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
const ItemHeader: React.FC<ItemHeaderProps> = ({
|
|
@@ -16,20 +18,24 @@ const ItemHeader: React.FC<ItemHeaderProps> = ({
|
|
|
16
18
|
sliceFieldName,
|
|
17
19
|
theme,
|
|
18
20
|
WidgetIcon,
|
|
21
|
+
widgetIconTooltip,
|
|
19
22
|
}) => (
|
|
20
23
|
<Flex sx={{ alignItems: "center", position: "relative" }}>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
<Tooltip content={widgetIconTooltip} sideOffset={2} disableHoverableContent>
|
|
25
|
+
<Box margin={{ right: 8 }}>
|
|
26
|
+
<WidgetIcon
|
|
27
|
+
size={28}
|
|
28
|
+
style={{
|
|
29
|
+
color: theme.colors?.primary as CSS.Property.Color,
|
|
30
|
+
borderRadius: "4px",
|
|
31
|
+
padding: "4px",
|
|
32
|
+
border: "2px solid",
|
|
33
|
+
borderColor: theme.colors?.primary as CSS.Property.Color,
|
|
34
|
+
flexShrink: 0,
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
</Box>
|
|
38
|
+
</Tooltip>
|
|
33
39
|
<TextWithTooltip
|
|
34
40
|
text={text}
|
|
35
41
|
as="p"
|
|
@@ -114,6 +114,7 @@ function ListItem<F extends TabField, S extends AnyObjectSchema>({
|
|
|
114
114
|
renderFieldAccessor && renderFieldAccessor(key)
|
|
115
115
|
}
|
|
116
116
|
WidgetIcon={widget.Meta.icon}
|
|
117
|
+
widgetIconTooltip={widget.label}
|
|
117
118
|
/>
|
|
118
119
|
<Flex sx={{ flex: "0 0 auto" }}>
|
|
119
120
|
{shouldDisplayRepeatableBadge && (
|
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
Text,
|
|
14
14
|
} from "theme-ui";
|
|
15
15
|
|
|
16
|
-
import { checkAuthStatus,
|
|
16
|
+
import { checkAuthStatus, clearAuth, getState } from "@/apiClient";
|
|
17
17
|
import { getActiveEnvironment } from "@/features/environments/actions/getActiveEnvironment";
|
|
18
|
+
import { invalidateActiveEnvironmentData } from "@/features/environments/useActiveEnvironment";
|
|
19
|
+
import { invalidateEnvironmentsData } from "@/features/environments/useEnvironments";
|
|
18
20
|
import { useAutoSync } from "@/features/sync/AutoSyncProvider";
|
|
19
21
|
import { getUnSyncedChanges } from "@/features/sync/getUnSyncChanges";
|
|
20
22
|
import SliceMachineModal from "@/legacy/components/SliceMachineModal";
|
|
@@ -50,7 +52,7 @@ const LoginModal: React.FunctionComponent = () => {
|
|
|
50
52
|
}),
|
|
51
53
|
);
|
|
52
54
|
const { syncChanges } = useAutoSync();
|
|
53
|
-
const { closeModals, startLoadingLogin, stopLoadingLogin } =
|
|
55
|
+
const { closeModals, startLoadingLogin, stopLoadingLogin, refreshState } =
|
|
54
56
|
useSliceMachineActions();
|
|
55
57
|
|
|
56
58
|
const prismicBase = preferWroomBase(env.manifest.apiEndpoint);
|
|
@@ -64,7 +66,7 @@ const LoginModal: React.FunctionComponent = () => {
|
|
|
64
66
|
|
|
65
67
|
try {
|
|
66
68
|
startLoadingLogin();
|
|
67
|
-
await
|
|
69
|
+
await clearAuth();
|
|
68
70
|
window.open(loginRedirectUrl, "_blank");
|
|
69
71
|
await startPolling<CheckAuthStatusResponse, ValidAuthStatus>(
|
|
70
72
|
checkAuthStatus,
|
|
@@ -76,11 +78,17 @@ const LoginModal: React.FunctionComponent = () => {
|
|
|
76
78
|
60,
|
|
77
79
|
);
|
|
78
80
|
|
|
81
|
+
// refresh queries to update the UI
|
|
82
|
+
invalidateEnvironmentsData();
|
|
83
|
+
invalidateActiveEnvironmentData();
|
|
84
|
+
|
|
79
85
|
toast.success("Logged in");
|
|
80
86
|
stopLoadingLogin();
|
|
81
87
|
closeModals();
|
|
82
88
|
|
|
83
89
|
const serverState = await getState();
|
|
90
|
+
refreshState(serverState);
|
|
91
|
+
|
|
84
92
|
const slices = normalizeFrontendSlices(
|
|
85
93
|
serverState.libraries,
|
|
86
94
|
serverState.remoteSlices,
|
|
@@ -21,7 +21,8 @@ import { SideNavEnvironmentSelector } from "./SideNavEnvironmentSelector/SideNav
|
|
|
21
21
|
|
|
22
22
|
export function Environment() {
|
|
23
23
|
const { environments, error: useEnvironmentsError } = useEnvironments();
|
|
24
|
-
const { activeEnvironment } =
|
|
24
|
+
const { activeEnvironment, error: activeEnvironmentError } =
|
|
25
|
+
useActiveEnvironment();
|
|
25
26
|
const { refreshState, openLoginModal } = useSliceMachineActions();
|
|
26
27
|
const { syncChanges } = useAutoSync();
|
|
27
28
|
const isOnline = useNetwork();
|
|
@@ -82,7 +83,10 @@ export function Environment() {
|
|
|
82
83
|
return <SideNavEnvironmentSelector variant="offline" />;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
if (
|
|
86
|
+
if (
|
|
87
|
+
useEnvironmentsError === undefined &&
|
|
88
|
+
activeEnvironmentError === undefined
|
|
89
|
+
) {
|
|
86
90
|
return (
|
|
87
91
|
<SideNavEnvironmentSelector
|
|
88
92
|
environments={environments}
|
|
@@ -110,5 +114,9 @@ export function Environment() {
|
|
|
110
114
|
);
|
|
111
115
|
}
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
if (useEnvironmentsError !== undefined) {
|
|
118
|
+
throw useEnvironmentsError;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
throw activeEnvironmentError;
|
|
114
122
|
}
|
package/src/legacy/components/Navigation/SideNavEnvironmentSelector/SideNavEnvironmentSelector.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import type { Environment } from "@slicemachine/manager/client";
|
|
|
18
18
|
import { clsx } from "clsx";
|
|
19
19
|
import type { FC, ReactNode } from "react";
|
|
20
20
|
|
|
21
|
+
import { LogoutButton } from "@/features/auth/LogoutButton";
|
|
21
22
|
import { LoginIcon } from "@/icons/LoginIcon";
|
|
22
23
|
import { LogoIcon } from "@/icons/LogoIcon";
|
|
23
24
|
|
|
@@ -138,6 +139,8 @@ export const SideNavEnvironmentSelector: FC<SideNavEnvironmentSelectorProps> = (
|
|
|
138
139
|
}
|
|
139
140
|
/>
|
|
140
141
|
) : undefined}
|
|
142
|
+
|
|
143
|
+
{variant === "default" && <LogoutButton />}
|
|
141
144
|
</Box>
|
|
142
145
|
</>
|
|
143
146
|
)}
|
|
@@ -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,9 +11,7 @@ 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
|
-
import { sliceTemplatesComingSoon } from "./sliceTemplatesComingSoon";
|
|
18
15
|
import UpdateSliceZoneModalList from "./UpdateSliceZoneModalList";
|
|
19
16
|
|
|
20
17
|
interface UpdateSliceModalProps {
|
|
@@ -39,7 +36,6 @@ export const SlicesTemplatesModal: FC<UpdateSliceModalProps> = ({
|
|
|
39
36
|
location,
|
|
40
37
|
}) => {
|
|
41
38
|
const { createSliceSuccess } = useSliceMachineActions();
|
|
42
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
43
39
|
|
|
44
40
|
return (
|
|
45
41
|
<ModalFormCard
|
|
@@ -83,7 +79,7 @@ export const SlicesTemplatesModal: FC<UpdateSliceModalProps> = ({
|
|
|
83
79
|
sliceKeys: [],
|
|
84
80
|
}}
|
|
85
81
|
content={{
|
|
86
|
-
title:
|
|
82
|
+
title: "Use template slices",
|
|
87
83
|
}}
|
|
88
84
|
validate={(values) => {
|
|
89
85
|
if (values.sliceKeys.length === 0) {
|
|
@@ -101,29 +97,25 @@ export const SlicesTemplatesModal: FC<UpdateSliceModalProps> = ({
|
|
|
101
97
|
{({ values }) => (
|
|
102
98
|
<UpdateSliceZoneModalList
|
|
103
99
|
values={values}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}),
|
|
124
|
-
),
|
|
125
|
-
...sliceTemplatesComingSoon,
|
|
126
|
-
]}
|
|
100
|
+
availableSlices={availableSlicesTemplates.map(
|
|
101
|
+
(slice): ComponentUI => ({
|
|
102
|
+
extension: "",
|
|
103
|
+
fileName: "",
|
|
104
|
+
from: "",
|
|
105
|
+
href: "",
|
|
106
|
+
pathToSlice: "",
|
|
107
|
+
model: Slices.toSM(slice.model),
|
|
108
|
+
screenshots: Object.entries(slice.screenshots).reduce(
|
|
109
|
+
(acc, curr) => ({
|
|
110
|
+
...acc,
|
|
111
|
+
[curr[0]]: {
|
|
112
|
+
url: curr[1],
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
{},
|
|
116
|
+
),
|
|
117
|
+
}),
|
|
118
|
+
)}
|
|
127
119
|
/>
|
|
128
120
|
)}
|
|
129
121
|
</ModalFormCard>
|
|
@@ -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) => {
|
|
@@ -9,8 +9,7 @@ import { SliceZoneFormValues } from "./UpdateSliceZoneModal";
|
|
|
9
9
|
const UpdateSliceZoneModalList: React.FC<{
|
|
10
10
|
availableSlices: ReadonlyArray<ComponentUI>;
|
|
11
11
|
values: SliceZoneFormValues;
|
|
12
|
-
|
|
13
|
-
}> = ({ availableSlices, values, placeholderSlices }) => (
|
|
12
|
+
}> = ({ availableSlices, values }) => (
|
|
14
13
|
<FieldArray
|
|
15
14
|
name="sliceKeys"
|
|
16
15
|
render={(arrayHelpers) => (
|
|
@@ -19,14 +18,10 @@ const UpdateSliceZoneModalList: React.FC<{
|
|
|
19
18
|
elems={availableSlices}
|
|
20
19
|
defineElementKey={(slice) => `${slice.from}-${slice.model.name}`}
|
|
21
20
|
renderElem={(slice) => {
|
|
22
|
-
const isComingSoon =
|
|
23
|
-
placeholderSlices?.some((s) => s.model.id === slice.model.id) ??
|
|
24
|
-
false;
|
|
25
21
|
const isInSliceZone = values.sliceKeys.includes(slice.model.id);
|
|
26
22
|
return (
|
|
27
23
|
<SharedSliceCard
|
|
28
24
|
action={{ type: "checkbox" }}
|
|
29
|
-
isComingSoon={isComingSoon}
|
|
30
25
|
mode="selection"
|
|
31
26
|
onSelectedChange={(selected) => {
|
|
32
27
|
if (selected) {
|
|
@@ -15,8 +15,6 @@ import { BaseStyles } from "theme-ui";
|
|
|
15
15
|
|
|
16
16
|
import { telemetry } from "@/apiClient";
|
|
17
17
|
import { ListHeader } from "@/components/List";
|
|
18
|
-
import { useAiSliceGenerationExperiment } from "@/features/builder/useAiSliceGenerationExperiment";
|
|
19
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
20
18
|
import { CreateSliceFromImageModal } from "@/features/customTypes/customTypesBuilder/CreateSliceFromImageModal";
|
|
21
19
|
import { useCustomTypeState } from "@/features/customTypes/customTypesBuilder/CustomTypeProvider";
|
|
22
20
|
import { getSliceCreationOptions } from "@/features/customTypes/customTypesBuilder/sliceCreationOptions";
|
|
@@ -42,7 +40,6 @@ import {
|
|
|
42
40
|
} from "@/modules/slices";
|
|
43
41
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
44
42
|
import type { SliceMachineStoreType } from "@/redux/type";
|
|
45
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
46
43
|
|
|
47
44
|
import { DeleteSliceZoneModal } from "./DeleteSliceZoneModal";
|
|
48
45
|
import { SlicesList } from "./List";
|
|
@@ -116,7 +113,6 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
116
113
|
sliceZone,
|
|
117
114
|
tabId,
|
|
118
115
|
}) => {
|
|
119
|
-
const aiSliceGenerationExperiment = useAiSliceGenerationExperiment();
|
|
120
116
|
const availableSlicesTemplates = useSlicesTemplates();
|
|
121
117
|
const [isSlicesTemplatesModalOpen, setIsSlicesTemplatesModalOpen] =
|
|
122
118
|
useState(false);
|
|
@@ -135,10 +131,8 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
135
131
|
const { setCustomType } = useCustomTypeState();
|
|
136
132
|
const { completeStep } = useOnboarding();
|
|
137
133
|
const { openLoginModal } = useSliceMachineActions();
|
|
138
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
139
134
|
const sliceCreationOptions = getSliceCreationOptions({
|
|
140
135
|
menuType: "Dropdown",
|
|
141
|
-
sectionsNamingExperiment,
|
|
142
136
|
});
|
|
143
137
|
|
|
144
138
|
const localLibraries: readonly LibraryUI[] = libraries.filter(
|
|
@@ -236,17 +230,15 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
236
230
|
</DropdownMenuTrigger>
|
|
237
231
|
|
|
238
232
|
<DropdownMenuContent align="end">
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
</DropdownMenuItem>
|
|
249
|
-
)}
|
|
233
|
+
<DropdownMenuItem
|
|
234
|
+
renderStartIcon={() =>
|
|
235
|
+
sliceCreationOptions.fromImage.BackgroundIcon
|
|
236
|
+
}
|
|
237
|
+
onSelect={() => void openCreateSliceFromImageModal()}
|
|
238
|
+
description={sliceCreationOptions.fromImage.description}
|
|
239
|
+
>
|
|
240
|
+
{sliceCreationOptions.fromImage.title}
|
|
241
|
+
</DropdownMenuItem>
|
|
250
242
|
<DropdownMenuItem
|
|
251
243
|
renderStartIcon={() =>
|
|
252
244
|
sliceCreationOptions.fromScratch.BackgroundIcon
|
|
@@ -301,7 +293,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
301
293
|
) : undefined
|
|
302
294
|
}
|
|
303
295
|
>
|
|
304
|
-
|
|
296
|
+
Slices
|
|
305
297
|
</ListHeader>
|
|
306
298
|
|
|
307
299
|
{sliceZone ? (
|
|
@@ -378,11 +370,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
378
370
|
onSaveCallback: () => {
|
|
379
371
|
toast.success(
|
|
380
372
|
<ToastMessageWithPath
|
|
381
|
-
message=
|
|
382
|
-
sectionsNamingExperiment.value,
|
|
383
|
-
)} template(s) added to ${
|
|
384
|
-
sectionsNamingExperiment.value
|
|
385
|
-
} zone and created at: `}
|
|
373
|
+
message="Slice template(s) added to slice zone and created at: "
|
|
386
374
|
path={`${localLibraries[0].name}/`}
|
|
387
375
|
/>,
|
|
388
376
|
);
|
|
@@ -418,7 +406,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
418
406
|
onSaveCallback: () => {
|
|
419
407
|
toast.success(
|
|
420
408
|
<ToastMessageWithPath
|
|
421
|
-
message=
|
|
409
|
+
message="New slice added to slice zone and created at: "
|
|
422
410
|
path={`${localLibraries[0].name}/`}
|
|
423
411
|
/>,
|
|
424
412
|
);
|
|
@@ -446,11 +434,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
446
434
|
onSaveCallback: () => {
|
|
447
435
|
toast.success(
|
|
448
436
|
<ToastMessageWithPath
|
|
449
|
-
message=
|
|
450
|
-
sectionsNamingExperiment.value,
|
|
451
|
-
)}(s) added to ${
|
|
452
|
-
sectionsNamingExperiment.value
|
|
453
|
-
} zone and created at: `}
|
|
437
|
+
message="Slice(s) added to slice zone and created at: "
|
|
454
438
|
path={library}
|
|
455
439
|
/>,
|
|
456
440
|
);
|
|
@@ -3,7 +3,6 @@ import { type FC } from "react";
|
|
|
3
3
|
|
|
4
4
|
import { BreadcrumbItem } from "@/components/Breadcrumb";
|
|
5
5
|
import { AutoSaveStatusIndicator } from "@/features/autoSave/AutoSaveStatusIndicator";
|
|
6
|
-
import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
|
|
7
6
|
import { FloatingBackButton } from "@/features/slices/sliceBuilder/FloatingBackButton";
|
|
8
7
|
import { useSliceState } from "@/features/slices/sliceBuilder/SliceBuilderProvider";
|
|
9
8
|
import {
|
|
@@ -15,7 +14,6 @@ import {
|
|
|
15
14
|
AppLayoutHeader,
|
|
16
15
|
} from "@/legacy/components/AppLayout";
|
|
17
16
|
import SimulatorButton from "@/legacy/lib/builders/SliceBuilder/SimulatorButton";
|
|
18
|
-
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
19
17
|
|
|
20
18
|
import FieldZones from "./FieldZones";
|
|
21
19
|
import { VariationsList } from "./VariationsList";
|
|
@@ -23,7 +21,6 @@ import { VariationsList } from "./VariationsList";
|
|
|
23
21
|
export const SliceBuilder: FC = () => {
|
|
24
22
|
const { slice, actionQueueStatus } = useSliceState();
|
|
25
23
|
const horizontalScroll = useMediaQuery({ max: "large" });
|
|
26
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
27
24
|
|
|
28
25
|
const contentDisplayProps = horizontalScroll
|
|
29
26
|
? { gridTemplateRows: "304px 1fr" }
|
|
@@ -34,9 +31,7 @@ export const SliceBuilder: FC = () => {
|
|
|
34
31
|
<AppLayoutHeader>
|
|
35
32
|
<AppLayoutBackButton url="/slices" />
|
|
36
33
|
<AppLayoutBreadcrumb>
|
|
37
|
-
<BreadcrumbItem>
|
|
38
|
-
{pluralize(capitalizeFirstLetter(sectionsNamingExperiment.value))}
|
|
39
|
-
</BreadcrumbItem>
|
|
34
|
+
<BreadcrumbItem>Slices</BreadcrumbItem>
|
|
40
35
|
<BreadcrumbItem active>{slice.model.name}</BreadcrumbItem>
|
|
41
36
|
</AppLayoutBreadcrumb>
|
|
42
37
|
<AppLayoutActions>
|
|
@@ -60,6 +60,7 @@ const EditModal = ({ close, data, fields, onSave, zoneType }) => {
|
|
|
60
60
|
FormFields,
|
|
61
61
|
Form: CustomForm,
|
|
62
62
|
schema: widgetSchema,
|
|
63
|
+
label: widgetLabel,
|
|
63
64
|
} = maybeWidget;
|
|
64
65
|
|
|
65
66
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -163,15 +164,7 @@ const EditModal = ({ close, data, fields, onSave, zoneType }) => {
|
|
|
163
164
|
>
|
|
164
165
|
{(props) => {
|
|
165
166
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment
|
|
166
|
-
const {
|
|
167
|
-
values: {
|
|
168
|
-
id,
|
|
169
|
-
config: { label },
|
|
170
|
-
},
|
|
171
|
-
isValid,
|
|
172
|
-
isSubmitting,
|
|
173
|
-
initialValues,
|
|
174
|
-
} = props;
|
|
167
|
+
const { isValid, isSubmitting, initialValues } = props;
|
|
175
168
|
|
|
176
169
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
177
170
|
const fieldModelTabContent = CustomForm ? (
|
|
@@ -226,7 +219,7 @@ const EditModal = ({ close, data, fields, onSave, zoneType }) => {
|
|
|
226
219
|
<ItemHeader
|
|
227
220
|
theme={theme}
|
|
228
221
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/strict-boolean-expressions
|
|
229
|
-
text={
|
|
222
|
+
text={widgetLabel}
|
|
230
223
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
231
224
|
WidgetIcon={WidgetIcon}
|
|
232
225
|
/>
|