slice-machine-ui 2.17.3-alpha.jp-cli-auth-localhost.1 → 2.17.3-alpha.jp-revert-section-naming-experiment.1

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 (57) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/{bN9WdKH5rRFhzJlLrXyZC → QRJGmIoJFXeQ96FN-TwH5}/_buildManifest.js +1 -1
  3. package/out/_next/static/chunks/34-6c3125e6f01c62c7.js +1 -0
  4. package/out/_next/static/chunks/489-dd74b228384df643.js +1 -0
  5. package/out/_next/static/chunks/{630-29c729ad2a291ef6.js → 630-799c128fd87fa645.js} +1 -1
  6. package/out/_next/static/chunks/903-04bef419234ad926.js +1 -0
  7. package/out/_next/static/chunks/pages/{_app-24f6a9b6cc9a29c2.js → _app-abfff64c4bacad47.js} +1 -1
  8. package/out/_next/static/chunks/pages/changes-b4b7d3047cf012a0.js +1 -0
  9. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-a408f5a660e096a6.js → [customTypeId]-1958f229bf899036.js} +1 -1
  10. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-f5e851ebe35049a8.js → [pageTypeId]-1c048ceedced0df1.js} +1 -1
  11. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-0ecd552897e61e29.js +1 -0
  12. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-0a51da2e35d6e62f.js +1 -0
  13. package/out/_next/static/chunks/pages/slices-e057c5c9cb56b1ef.js +1 -0
  14. package/out/changelog.html +1 -1
  15. package/out/changes.html +1 -1
  16. package/out/custom-types/[customTypeId].html +1 -1
  17. package/out/custom-types.html +1 -1
  18. package/out/index.html +1 -1
  19. package/out/labs.html +1 -1
  20. package/out/page-types/[pageTypeId].html +1 -1
  21. package/out/settings.html +1 -1
  22. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  23. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  24. package/out/slices.html +1 -1
  25. package/package.json +3 -3
  26. package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/CreateSliceFromImageModal.tsx +8 -21
  27. package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +52 -36
  28. package/src/features/environments/actions/getActiveEnvironment.ts +20 -5
  29. package/src/features/navigation/Navigation.tsx +4 -12
  30. package/src/features/slices/sliceCards/SharedSliceCard.tsx +2 -10
  31. package/src/legacy/components/AppLayout/index.tsx +34 -2
  32. package/src/legacy/components/ChangesItems/ChangesItems.tsx +1 -8
  33. package/src/legacy/components/Forms/CreateSliceModal/CreateSliceModal.tsx +3 -8
  34. package/src/legacy/components/Navigation/Environment.tsx +11 -3
  35. package/src/legacy/components/Simulator/components/FailedConnect/index.tsx +51 -56
  36. package/src/legacy/components/ToasterContainer/index.tsx +3 -14
  37. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +20 -28
  38. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +1 -5
  39. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +1 -6
  40. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +53 -40
  41. package/src/legacy/lib/builders/SliceBuilder/index.tsx +1 -6
  42. package/src/legacy/lib/builders/common/Zone/components/ZoneEmptyState/ZoneEmptyState.tsx +5 -10
  43. package/src/pages/slices.tsx +36 -57
  44. package/out/_next/static/chunks/268-6a9214b97195af9c.js +0 -1
  45. package/out/_next/static/chunks/34-e684c5fd75cc9dd0.js +0 -1
  46. package/out/_next/static/chunks/882-151468121d542ed6.js +0 -1
  47. package/out/_next/static/chunks/pages/changes-564336edb0ed18b0.js +0 -1
  48. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5008e29008aa04f4.js +0 -1
  49. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-bd5e45632c419567.js +0 -1
  50. package/out/_next/static/chunks/pages/slices-4a60cd5f2c71327e.js +0 -1
  51. package/out/videoHighlights.png +0 -0
  52. package/public/videoHighlights.png +0 -0
  53. package/src/features/builder/useSectionsNamingExperiment.ts +0 -15
  54. package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +0 -74
  55. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/sliceTemplatesComingSoon.ts +0 -30
  56. package/src/utils/textConversion.ts +0 -11
  57. /package/out/_next/static/{bN9WdKH5rRFhzJlLrXyZC → QRJGmIoJFXeQ96FN-TwH5}/_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,
@@ -10,10 +11,6 @@ import {
10
11
  import { FC } from "react";
11
12
 
12
13
  import { useAiSliceGenerationExperiment } from "@/features/builder/useAiSliceGenerationExperiment";
13
- import { useSectionsNamingExperiment } from "@/features/builder/useSectionsNamingExperiment";
14
- import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
15
-
16
- import { getSliceCreationOptions } from "./sliceCreationOptions";
17
14
 
18
15
  export type SliceZoneBlankSlateProps = {
19
16
  openUpdateSliceZoneModal: () => void;
@@ -33,11 +30,6 @@ export const SliceZoneBlankSlate: FC<SliceZoneBlankSlateProps> = ({
33
30
  isSlicesTemplatesSupported,
34
31
  }) => {
35
32
  const aiSliceGenerationExperiment = useAiSliceGenerationExperiment();
36
- const sectionsNamingExperiment = useSectionsNamingExperiment();
37
- const sliceCreationOptions = getSliceCreationOptions({
38
- menuType: "ActionList",
39
- sectionsNamingExperiment,
40
- });
41
33
 
42
34
  return (
43
35
  <BlankSlate data-testid="slice-zone-blank-slate" sx={{ width: 648 }}>
@@ -47,57 +39,81 @@ export const SliceZoneBlankSlate: FC<SliceZoneBlankSlateProps> = ({
47
39
  name="add"
48
40
  size="large"
49
41
  />
50
- <BlankSlateTitle size="big">
51
- Add {pluralize(sectionsNamingExperiment.value)}
52
- </BlankSlateTitle>
42
+ <BlankSlateTitle size="big">Add slices</BlankSlateTitle>
53
43
  <BlankSlateDescription>
54
- {pluralize(capitalizeFirstLetter(sectionsNamingExperiment.value))} are
55
- website sections that you can reuse on different pages with different
56
- content. Each on different pages with different content. Each{" "}
57
- {sectionsNamingExperiment.value} has its own component in your code.
44
+ Slices are website sections that you can reuse on different pages with
45
+ different content. Each slice has its own component in your code.
58
46
  </BlankSlateDescription>
59
47
  <BlankSlateActions>
60
48
  <ActionList>
61
49
  {aiSliceGenerationExperiment.eligible && (
62
50
  <ActionListItem
63
- renderStartIcon={() =>
64
- sliceCreationOptions.fromImage.BackgroundIcon
65
- }
51
+ renderStartIcon={() => (
52
+ <BackgroundIcon
53
+ name="autoFixHigh"
54
+ size="small"
55
+ iconSize="medium"
56
+ color="purple"
57
+ variant="solid"
58
+ radius={6}
59
+ />
60
+ )}
66
61
  onClick={openCreateSliceFromImageModal}
67
- description={sliceCreationOptions.fromImage.description}
62
+ description="Build a slice based on your design image."
68
63
  >
69
- {sliceCreationOptions.fromImage.title}
64
+ Generate from image
70
65
  </ActionListItem>
71
66
  )}
72
67
  <ActionListItem
73
- renderStartIcon={() =>
74
- sliceCreationOptions.fromScratch.BackgroundIcon
75
- }
68
+ renderStartIcon={() => (
69
+ <BackgroundIcon
70
+ name="add"
71
+ size="small"
72
+ iconSize="medium"
73
+ color="white"
74
+ variant="solid"
75
+ radius={6}
76
+ />
77
+ )}
76
78
  onClick={openCreateSliceModal}
77
- description={sliceCreationOptions.fromScratch.description}
79
+ description="Build a custom slice your way."
78
80
  >
79
- {sliceCreationOptions.fromScratch.title}
81
+ Start from scratch
80
82
  </ActionListItem>
81
83
  {isSlicesTemplatesSupported && (
82
84
  <ActionListItem
83
- renderStartIcon={() =>
84
- sliceCreationOptions.fromTemplate.BackgroundIcon
85
- }
85
+ renderStartIcon={() => (
86
+ <BackgroundIcon
87
+ name="contentCopy"
88
+ size="small"
89
+ iconSize="medium"
90
+ color="white"
91
+ variant="solid"
92
+ radius={6}
93
+ />
94
+ )}
86
95
  onClick={openSlicesTemplatesModal}
87
- description={sliceCreationOptions.fromTemplate.description}
96
+ description="Choose from ready-made examples."
88
97
  >
89
- {sliceCreationOptions.fromTemplate.title}
98
+ Use a template
90
99
  </ActionListItem>
91
100
  )}
92
101
  {projectHasAvailableSlices && (
93
102
  <ActionListItem
94
- renderStartIcon={() =>
95
- sliceCreationOptions.fromExisting.BackgroundIcon
96
- }
103
+ renderStartIcon={() => (
104
+ <BackgroundIcon
105
+ name="folder"
106
+ size="small"
107
+ iconSize="medium"
108
+ color="white"
109
+ variant="solid"
110
+ radius={6}
111
+ />
112
+ )}
97
113
  onClick={openUpdateSliceZoneModal}
98
- description={sliceCreationOptions.fromExisting.description}
114
+ description="Select from your created slices."
99
115
  >
100
- {sliceCreationOptions.fromExisting.title}
116
+ Reuse an existing slice
101
117
  </ActionListItem>
102
118
  )}
103
119
  </ActionList>
@@ -5,6 +5,10 @@ import {
5
5
 
6
6
  import { managerClient } from "@/managerClient";
7
7
 
8
+ type GetActiveEnvironmentArgs = {
9
+ retried?: boolean;
10
+ };
11
+
8
12
  type GetActiveEnvironmentReturnType =
9
13
  | {
10
14
  activeEnvironment: Environment;
@@ -15,18 +19,29 @@ type GetActiveEnvironmentReturnType =
15
19
  error: unknown;
16
20
  };
17
21
 
18
- export async function getActiveEnvironment(): Promise<GetActiveEnvironmentReturnType> {
22
+ export async function getActiveEnvironment(
23
+ args?: GetActiveEnvironmentArgs,
24
+ ): Promise<GetActiveEnvironmentReturnType> {
25
+ const { retried = false } = args ?? {};
26
+
19
27
  try {
20
- const { activeEnvironment } =
28
+ const activeEnvironmentResult =
21
29
  await managerClient.project.fetchActiveEnvironment();
22
30
 
23
- return { activeEnvironment };
31
+ if (activeEnvironmentResult.type === "error") {
32
+ const errorInstance = new Error(activeEnvironmentResult.error.message);
33
+ errorInstance.name = activeEnvironmentResult.error.name;
34
+ throw errorInstance;
35
+ }
36
+
37
+ return { activeEnvironment: activeEnvironmentResult.activeEnvironment };
24
38
  } catch (error) {
25
- if (isInvalidActiveEnvironmentError(error)) {
39
+ if (isInvalidActiveEnvironmentError(error) && !retried) {
26
40
  // Reset to the production environment.
27
41
  await managerClient.project.updateEnvironment({ environment: undefined });
28
42
 
29
- return await getActiveEnvironment();
43
+ // Call recursively with isRetry=true to prevent infinite loop if it fails again and again.
44
+ return await getActiveEnvironment({ retried: true });
30
45
  }
31
46
 
32
47
  return { error };
@@ -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 {
@@ -60,11 +57,9 @@ export function Navigation() {
60
57
  minWidth={0}
61
58
  >
62
59
  <Box flexDirection="column" gap={16}>
63
- <ErrorBoundary>
64
- <Suspense fallback={<Skeleton height={40} />}>
65
- <Environment />
66
- </Suspense>
67
- </ErrorBoundary>
60
+ <Suspense fallback={<Skeleton height={40} />}>
61
+ <Environment />
62
+ </Suspense>
68
63
 
69
64
  <Separator style="dashed" />
70
65
 
@@ -80,9 +75,7 @@ export function Navigation() {
80
75
  <CustomTypeNavigationItem type="custom" />
81
76
 
82
77
  <NavigationItem
83
- title={pluralize(
84
- capitalizeFirstLetter(sectionsNamingExperiment.value),
85
- )}
78
+ title="Slices"
86
79
  href="/slices"
87
80
  Icon={FolderIcon}
88
81
  active={router.asPath.startsWith("/slices")}
@@ -103,7 +96,6 @@ export function Navigation() {
103
96
  <OnboardingGuide />
104
97
  </Suspense>
105
98
  </ErrorBoundary>
106
-
107
99
  <NavigationItem
108
100
  title="Documentation"
109
101
  href={documentationLink}
@@ -27,7 +27,6 @@ import { AddPhotoAlternateIcon } from "@/icons/AddPhotoAlternateIcon";
27
27
  import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
28
28
 
29
29
  type SharedSliceCardProps = {
30
- isComingSoon?: boolean;
31
30
  isDeleted?: boolean;
32
31
  onUpdateScreenshot?: () => void;
33
32
  slice: ComponentUI;
@@ -36,7 +35,7 @@ type SharedSliceCardProps = {
36
35
  } & (
37
36
  | /*
38
37
  * Props for rendering a `Card` with a Next.js `Link` component (or with a
39
- * non-interactive element if either `isComingSoon` or `isDeleted` is true).
38
+ * non-interactive element if `isDeleted` is true).
40
39
  */
41
40
  {
42
41
  mode: "navigation";
@@ -66,7 +65,6 @@ type Action =
66
65
  export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
67
66
  const {
68
67
  action,
69
- isComingSoon = false,
70
68
  isDeleted = false,
71
69
  onUpdateScreenshot,
72
70
  selected = false,
@@ -79,7 +77,7 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
79
77
  if (!variation) return null;
80
78
  const src = getScreenshotUrl(slice, variation);
81
79
 
82
- const disabled = isComingSoon || isDeleted;
80
+ const disabled = isDeleted;
83
81
  const canUpdateScreenshot = !disabled && !!onUpdateScreenshot;
84
82
  const disableOverlay = variant === "outlined";
85
83
  const hasVariationId = variationId !== undefined;
@@ -224,12 +222,6 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
224
222
  : `${slice.model.variations.length} variation${
225
223
  slice.model.variations.length > 1 ? "s" : ""
226
224
  }`}
227
- {isComingSoon ? (
228
- <Text color="purple11" component="span" variant="small">
229
- {" "}
230
- • (coming soon)
231
- </Text>
232
- ) : undefined}
233
225
  </>
234
226
  }
235
227
  title={hasVariationId ? variation.name : slice.model.name}
@@ -1,4 +1,12 @@
1
- import { Box, Button, ButtonGroup } from "@prismicio/editor-ui";
1
+ import {
2
+ BlankSlate,
3
+ BlankSlateDescription,
4
+ BlankSlateIcon,
5
+ BlankSlateTitle,
6
+ Box,
7
+ Button,
8
+ ButtonGroup,
9
+ } from "@prismicio/editor-ui";
2
10
  import { useRouter } from "next/router";
3
11
  import { FC, PropsWithChildren, Suspense } from "react";
4
12
 
@@ -18,7 +26,31 @@ export const AppLayout: FC<PropsWithChildren> = ({
18
26
  ...otherProps
19
27
  }) => {
20
28
  return (
21
- <ErrorBoundary>
29
+ <ErrorBoundary
30
+ renderError={(error) => {
31
+ return (
32
+ <Box
33
+ position="absolute"
34
+ top={64}
35
+ width="100%"
36
+ justifyContent="center"
37
+ flexDirection="column"
38
+ >
39
+ <BlankSlate>
40
+ <BlankSlateIcon
41
+ lineColor="tomato11"
42
+ backgroundColor="tomato3"
43
+ name="alert"
44
+ />
45
+ <BlankSlateTitle>Failed to load Slice Machine</BlankSlateTitle>
46
+ <BlankSlateDescription>
47
+ {JSON.stringify(error)}
48
+ </BlankSlateDescription>
49
+ </BlankSlate>
50
+ </Box>
51
+ );
52
+ }}
53
+ >
22
54
  <Suspense>
23
55
  <PageLayoutWithActiveEnvironment {...otherProps}>
24
56
  <PageLayoutPane>
@@ -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: `Create a new ${sectionsNamingExperiment.value}`,
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={`${capitalizeFirstLetter(
93
- sectionsNamingExperiment.value,
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"
@@ -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 } = useActiveEnvironment();
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 (useEnvironmentsError === undefined) {
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
- throw useEnvironmentsError;
117
+ if (useEnvironmentsError !== undefined) {
118
+ throw useEnvironmentsError;
119
+ }
120
+
121
+ throw activeEnvironmentError;
114
122
  }
@@ -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
- const sectionsNamingExperiment = useSectionsNamingExperiment();
11
-
12
- return (
13
- <FullPage>
14
- <Image src="/iframe-not-running.png" sx={{ width: "320px" }} />
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
- sx={{
17
- color: "textClear",
18
- mb: 2,
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
- Slice Machine can't render your {sectionsNamingExperiment.value}
38
+ npm run dev
25
39
  </Text>
26
- <Text
40
+ &nbsp; in your terminal at the root of your website directory.
41
+ <br /> If that doesn't work, see the&nbsp;
42
+ <Link
43
+ target="_blank"
44
+ href="https://prismic.io/docs/slice-machine#simulate-slices"
27
45
  sx={{
28
- color: "failedConnectText",
29
- maxWidth: "400px",
30
- textAlign: "center",
31
- fontSize: "12px",
32
- lineHeight: "22px",
46
+ color: "link",
33
47
  }}
34
48
  >
35
- Ensure your website's development server is running by typing
36
- <br />
37
- <Text
38
- as="code"
39
- variant="styles.inlineCode"
40
- sx={{ padding: "4px", borderRadius: "6px" }}
41
- >
42
- npm run dev
43
- </Text>
44
- &nbsp; in your terminal at the root of your website directory.
45
- <br /> If that doesn't work, see the&nbsp;
46
- <Link
47
- target="_blank"
48
- href="https://prismic.io/docs/slice-machine#simulate-slices"
49
- sx={{
50
- color: "link",
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
- sectionsNamingExperiment: UseSectionsNamingExperimentReturnType;
74
- }> = (props) => {
75
- return (
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
+ );