slice-machine-ui 2.17.3-beta.6 → 2.17.3-beta.8

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 (68) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/KBrx-cAqXdE6ViRC7yyKz/_buildManifest.js +1 -0
  3. package/out/_next/static/chunks/248-6f20227ad4764216.js +1 -0
  4. package/out/_next/static/chunks/489-6578dbeec3dcdace.js +1 -0
  5. package/out/_next/static/chunks/907-590c914f55547b96.js +1 -0
  6. package/out/_next/static/chunks/pages/{_app-9bd805183e832369.js → _app-87bfdef015dea569.js} +1 -1
  7. package/out/_next/static/chunks/pages/changelog-98836c22c6a40c5d.js +1 -0
  8. package/out/_next/static/chunks/pages/changes-db800bf4a08faa31.js +1 -0
  9. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-041985d94bb9649f.js → [customTypeId]-4024560ca59ad2be.js} +1 -1
  10. package/out/_next/static/chunks/pages/labs-ad7f36c6f544c1a8.js +1 -0
  11. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-338f685c0723043b.js → [pageTypeId]-0d2416da0958eb40.js} +1 -1
  12. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-0bc862dd7bd99611.js +1 -0
  13. package/out/_next/static/chunks/pages/slices-4b229ae47d0a37e2.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/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  22. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  23. package/out/slices.html +1 -1
  24. package/package.json +3 -3
  25. package/src/features/changes/PushChangesButton.tsx +4 -67
  26. package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +9 -13
  27. package/src/features/navigation/Navigation.tsx +0 -12
  28. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +9 -13
  29. package/src/pages/slices.tsx +9 -13
  30. package/out/_next/static/chunks/248-03446cd9e9f13730.js +0 -1
  31. package/out/_next/static/chunks/268-6a9214b97195af9c.js +0 -1
  32. package/out/_next/static/chunks/489-7e73874528df7603.js +0 -1
  33. package/out/_next/static/chunks/pages/changelog-063c5e11dfc8fd55.js +0 -1
  34. package/out/_next/static/chunks/pages/changes-564336edb0ed18b0.js +0 -1
  35. package/out/_next/static/chunks/pages/labs-9630bfb1005be02b.js +0 -1
  36. package/out/_next/static/chunks/pages/settings-01f4aeb9112a1f87.js +0 -1
  37. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-bd5e45632c419567.js +0 -1
  38. package/out/_next/static/chunks/pages/slices-4a60cd5f2c71327e.js +0 -1
  39. package/out/_next/static/css/e5f781f20e24a5ea.css +0 -1
  40. package/out/_next/static/ycrZ72RsSEIu0t0h6roCF/_buildManifest.js +0 -1
  41. package/out/settings.html +0 -1
  42. package/src/components/FieldSet/FieldSet.module.css +0 -84
  43. package/src/components/FieldSet/FieldSet.module.css.d.ts +0 -16
  44. package/src/components/FieldSet/FieldSet.stories.tsx +0 -244
  45. package/src/components/FieldSet/FieldSet.tsx +0 -67
  46. package/src/components/FieldSet/index.ts +0 -9
  47. package/src/features/builder/useAiSliceGenerationExperiment.ts +0 -8
  48. package/src/features/settings/SettingsPage.tsx +0 -50
  49. package/src/features/settings/git/ConnectGitRepository.tsx +0 -112
  50. package/src/features/settings/git/ConnectGitRepositoryBlankSlate.tsx +0 -33
  51. package/src/features/settings/git/GitOwnerSelect.tsx +0 -71
  52. package/src/features/settings/git/GitProvider.ts +0 -40
  53. package/src/features/settings/git/GitProviderConnectButtons.tsx +0 -63
  54. package/src/features/settings/git/GitRepositoriesList.tsx +0 -76
  55. package/src/features/settings/git/GitRepositoriesSearch.tsx +0 -69
  56. package/src/features/settings/git/GitRepositoryConnectDialog.tsx +0 -97
  57. package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +0 -62
  58. package/src/features/settings/git/useGitIntegrationExperiment.ts +0 -8
  59. package/src/features/settings/git/useGitOwners.ts +0 -12
  60. package/src/features/settings/git/useGitRepos.ts +0 -24
  61. package/src/features/settings/git/useLinkedGitRepos.ts +0 -41
  62. package/src/features/settings/git/useWriteAPIToken.ts +0 -23
  63. package/src/icons/BitbucketIcon.tsx +0 -19
  64. package/src/icons/GitHubIcon.tsx +0 -17
  65. package/src/icons/GitLabIcon.tsx +0 -19
  66. package/src/icons/SettingsIcon.tsx +0 -19
  67. package/src/pages/settings.tsx +0 -1
  68. /package/out/_next/static/{ycrZ72RsSEIu0t0h6roCF → KBrx-cAqXdE6ViRC7yyKz}/_ssgManifest.js +0 -0
package/out/settings.html DELETED
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/cc9b10286400c2b9.css" as="style"/><link rel="stylesheet" href="/_next/static/css/cc9b10286400c2b9.css" data-n-g=""/><link rel="preload" href="/_next/static/css/e5f781f20e24a5ea.css" as="style"/><link rel="stylesheet" href="/_next/static/css/e5f781f20e24a5ea.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-b3522fdebabf510a.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-c46f4dcf6e3174bd.js" defer=""></script><script src="/_next/static/chunks/pages/_app-9bd805183e832369.js" defer=""></script><script src="/_next/static/chunks/397-e6c340070a3bcb41.js" defer=""></script><script src="/_next/static/chunks/pages/settings-01f4aeb9112a1f87.js" defer=""></script><script src="/_next/static/ycrZ72RsSEIu0t0h6roCF/_buildManifest.js" defer=""></script><script src="/_next/static/ycrZ72RsSEIu0t0h6roCF/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/settings","query":{},"buildId":"ycrZ72RsSEIu0t0h6roCF","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
@@ -1,84 +0,0 @@
1
- .flex {
2
- all: unset;
3
- display: flex;
4
- }
5
-
6
- .column {
7
- composes: flex;
8
- flex-direction: column;
9
- }
10
-
11
- .root {
12
- composes: column;
13
- border-color: var(--grey6);
14
- border-radius: 6px;
15
- border-style: solid;
16
- border-width: 1px;
17
- box-shadow: var(--box-shadow-1);
18
- overflow-x: hidden;
19
- }
20
-
21
- .row {
22
- composes: flex;
23
- align-items: center;
24
- flex-direction: row;
25
- gap: 8px;
26
- padding-inline: 16px;
27
- }
28
-
29
- .borderBottom {
30
- box-sizing: border-box;
31
- &:not(:last-child) {
32
- border-bottom-color: var(--grey6);
33
- border-bottom-style: solid;
34
- border-bottom-width: 1px;
35
- }
36
- }
37
-
38
- .legend {
39
- composes: row borderBottom;
40
- background-color: var(--grey2);
41
- height: 48px;
42
- order: 0;
43
- }
44
-
45
- .header {
46
- composes: row borderBottom;
47
- background-color: var(--grey2);
48
- height: 72px;
49
- order: 1;
50
- }
51
-
52
- .content {
53
- composes: column;
54
- background-color: var(--grey1);
55
- order: 2;
56
- padding: 16px;
57
- }
58
-
59
- .list {
60
- composes: column;
61
- max-height: 256px;
62
- order: 2;
63
- overflow-y: auto;
64
- }
65
-
66
- .listItem {
67
- composes: row borderBottom;
68
- background-color: var(--grey1);
69
- flex-shrink: 0;
70
- height: 64px;
71
- }
72
-
73
- .borderTop:not(:first-child) {
74
- /* stylelint-disable-next-line declaration-property-value-allowed-list -- Displays a 1 px top border outside the element. */
75
- box-shadow: 0 -1px 0 0 var(--grey6);
76
- }
77
-
78
- .footer {
79
- composes: row borderTop;
80
- background-color: var(--grey1);
81
- height: 48px;
82
- order: 3;
83
- padding-right: 8px;
84
- }
@@ -1,16 +0,0 @@
1
- declare const styles: {
2
- readonly "borderBottom": string;
3
- readonly "borderTop": string;
4
- readonly "column": string;
5
- readonly "content": string;
6
- readonly "flex": string;
7
- readonly "footer": string;
8
- readonly "header": string;
9
- readonly "legend": string;
10
- readonly "list": string;
11
- readonly "listItem": string;
12
- readonly "root": string;
13
- readonly "row": string;
14
- };
15
- export = styles;
16
-
@@ -1,244 +0,0 @@
1
- import {
2
- Box,
3
- Button,
4
- ButtonGroup,
5
- IconButton,
6
- Select,
7
- SelectItem,
8
- Skeleton,
9
- Text,
10
- theme,
11
- } from "@prismicio/editor-ui";
12
- import type { Meta, StoryObj } from "@storybook/react";
13
-
14
- import { BitbucketIcon } from "../../icons/BitbucketIcon";
15
- import { GitHubIcon } from "../../icons/GitHubIcon";
16
- import { GitLabIcon } from "../../icons/GitLabIcon";
17
- import {
18
- FieldSet,
19
- FieldSetContent,
20
- FieldSetFooter,
21
- FieldSetHeader,
22
- FieldSetLegend,
23
- FieldSetList,
24
- FieldSetListItem,
25
- } from "./FieldSet";
26
-
27
- type Story = StoryObj<typeof meta>;
28
-
29
- const meta = {
30
- component: FieldSet,
31
- argTypes: {
32
- children: { control: { disable: true } },
33
- },
34
- } satisfies Meta<typeof FieldSet>;
35
-
36
- export default meta;
37
-
38
- export const Default = {
39
- args: {
40
- children: (
41
- <>
42
- <FieldSetLegend />
43
- <FieldSetHeader />
44
- <FieldSetList>
45
- <FieldSetListItem action={<Button color="grey">Action</Button>} />
46
- </FieldSetList>
47
- <FieldSetFooter action={<IconButton icon="openInNew" />} />
48
- </>
49
- ),
50
- },
51
- } satisfies Story;
52
-
53
- export const WithButtonGroupContent = {
54
- args: {
55
- ...Default.args,
56
- children: (
57
- <>
58
- <FieldSetLegend>Connected Git Repository</FieldSetLegend>
59
- <FieldSetContent>
60
- <ButtonGroup color="grey">
61
- <Button
62
- renderStartIcon={() => <GitHubIcon color={theme.color.grey11} />}
63
- sx={{ flexBasis: 0, flexGrow: 1 }}
64
- >
65
- GitHub
66
- </Button>
67
- <Button
68
- disabled
69
- renderStartIcon={() => (
70
- <BitbucketIcon color={theme.color.grey11} />
71
- )}
72
- sx={{ flexBasis: 0, flexGrow: 1 }}
73
- >
74
- Bitbucket{" "}
75
- <Text color="inherit" variant="small">
76
- (soon)
77
- </Text>
78
- </Button>
79
- <Button
80
- disabled
81
- renderStartIcon={() => <GitLabIcon color={theme.color.grey11} />}
82
- sx={{ flexBasis: 0, flexGrow: 1 }}
83
- >
84
- GitLab{" "}
85
- <Text color="inherit" variant="small">
86
- (soon)
87
- </Text>
88
- </Button>
89
- </ButtonGroup>
90
- </FieldSetContent>
91
- <FieldSetFooter action={<IconButton icon="openInNew" />}>
92
- Learn more about Prismic for Git
93
- </FieldSetFooter>
94
- </>
95
- ),
96
- },
97
- parameters: { controls: { hideNoControlsWarning: true, include: [] } },
98
- } satisfies Story;
99
-
100
- export const LoadingWithHeaderAndList = {
101
- args: {
102
- ...Default.args,
103
- children: (
104
- <>
105
- <FieldSetLegend>Connected Git Repository</FieldSetLegend>
106
- <FieldSetHeader>
107
- <OwnerSelect disabled />
108
- </FieldSetHeader>
109
- <FieldSetList>
110
- {[...Array(4).keys()].map((index) => (
111
- <FieldSetListItem
112
- action={<Skeleton height={32} width={67.59} />}
113
- key={index}
114
- >
115
- <Skeleton
116
- height={24}
117
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
118
- // @ts-ignore TODO(DT-1918): add `verticalAlign: "middle"` to the `sx` prop.
119
- sx={{ verticalAlign: "middle" }}
120
- width={129.92}
121
- />
122
- </FieldSetListItem>
123
- ))}
124
- </FieldSetList>
125
- <FieldSetFooter action={<IconButton icon="openInNew" />}>
126
- Learn more about Prismic for Git
127
- </FieldSetFooter>
128
- </>
129
- ),
130
- },
131
- parameters: { controls: { hideNoControlsWarning: true, include: [] } },
132
- };
133
-
134
- export const WithHeaderAndListOverflow = {
135
- args: {
136
- ...Default.args,
137
- children: (
138
- <>
139
- <FieldSetLegend>Connected Git Repository</FieldSetLegend>
140
- <FieldSetHeader>
141
- <OwnerSelect />
142
- </FieldSetHeader>
143
- <FieldSetList>
144
- {[...Array(100).keys()].map((index) => (
145
- <FieldSetListItem
146
- action={<Button color="grey">Connect</Button>}
147
- key={index}
148
- >
149
- Repository <Text color="grey11">• xd ago</Text>
150
- </FieldSetListItem>
151
- ))}
152
- </FieldSetList>
153
- <FieldSetFooter action={<IconButton icon="openInNew" />}>
154
- Learn more about Prismic for Git
155
- </FieldSetFooter>
156
- </>
157
- ),
158
- },
159
- parameters: { controls: { hideNoControlsWarning: true, include: [] } },
160
- };
161
-
162
- export const WithSingleListItem = {
163
- args: {
164
- ...Default.args,
165
- children: (
166
- <>
167
- <FieldSetLegend>Connected Git Repository</FieldSetLegend>
168
- <FieldSetList>
169
- <FieldSetListItem action={<Button color="grey">Disconnect</Button>}>
170
- Repository <Text color="grey11">• xd ago</Text>
171
- </FieldSetListItem>
172
- </FieldSetList>
173
- <FieldSetFooter action={<IconButton icon="openInNew" />}>
174
- Learn more about Prismic for Git
175
- </FieldSetFooter>
176
- </>
177
- ),
178
- },
179
- parameters: { controls: { hideNoControlsWarning: true, include: [] } },
180
- };
181
-
182
- export const WithHeaderAndBoxContent = {
183
- args: {
184
- ...Default.args,
185
- children: (
186
- <>
187
- <FieldSetLegend>Connected Git Repository</FieldSetLegend>
188
- <FieldSetHeader>
189
- <OwnerSelect />
190
- </FieldSetHeader>
191
- <FieldSetContent>
192
- <Box
193
- flexDirection="column"
194
- /*
195
- * TODO: these `padding` values actually don't match Figma, but they
196
- * are the closest allowed by the `Box` component.
197
- */
198
- padding={{ block: 72, inline: 100 }}
199
- >
200
- <Text align="center" variant="emphasized">
201
- No Results Found
202
- </Text>
203
- <Text align="center" color="grey11">
204
- Try selecting a different Git account or organization on the top
205
- left.
206
- </Text>
207
- </Box>
208
- </FieldSetContent>
209
- <FieldSetFooter action={<IconButton icon="openInNew" />}>
210
- Learn more about Prismic for Git
211
- </FieldSetFooter>
212
- </>
213
- ),
214
- },
215
- parameters: { controls: { hideNoControlsWarning: true, include: [] } },
216
- };
217
-
218
- type OwnerSelectProps = { disabled?: boolean };
219
-
220
- function OwnerSelect(props: OwnerSelectProps) {
221
- return (
222
- <Select
223
- {...props}
224
- color="grey"
225
- constrainContentWidth
226
- flexContent
227
- placeholder="Owner"
228
- renderStartIcon={() => <GitHubIcon color={theme.color.grey11} />}
229
- size="large"
230
- sx={{ width: "calc(50% - 8px)" }}
231
- >
232
- {[...Array(2).keys()].map((index) => (
233
- <SelectItem
234
- key={index}
235
- renderStartIcon={() => <GitHubIcon color={theme.color.grey11} />}
236
- size="large"
237
- value={`owner-${index}`}
238
- >
239
- Owner
240
- </SelectItem>
241
- ))}
242
- </Select>
243
- );
244
- }
@@ -1,67 +0,0 @@
1
- import { Text } from "@prismicio/editor-ui";
2
- import type { FC, PropsWithChildren, ReactNode } from "react";
3
-
4
- import styles from "./FieldSet.module.css";
5
-
6
- export const FieldSet: FC<PropsWithChildren> = (props) => (
7
- <div {...props} className={styles.root} />
8
- );
9
-
10
- export const FieldSetLegend: FC<PropsWithChildren> = ({
11
- children,
12
- ...otherProps
13
- }) => (
14
- <div {...otherProps} className={styles.legend}>
15
- <Text color="grey11" component="span" noWrap variant="smallBold">
16
- {children}
17
- </Text>
18
- </div>
19
- );
20
-
21
- export const FieldSetHeader: FC<PropsWithChildren> = (props) => (
22
- <div {...props} className={styles.header} />
23
- );
24
-
25
- export const FieldSetContent: FC<PropsWithChildren> = (props) => (
26
- <div {...props} className={styles.content} />
27
- );
28
-
29
- export const FieldSetList: FC<PropsWithChildren> = (props) => (
30
- <ul {...props} className={styles.list} />
31
- );
32
-
33
- type FieldSetListItemProps = PropsWithChildren<{ action?: ReactNode }>;
34
-
35
- export const FieldSetListItem: FC<FieldSetListItemProps> = ({
36
- action,
37
- children,
38
- ...otherProps
39
- }) => (
40
- <li {...otherProps} className={styles.listItem}>
41
- <Text component="span" noWrap variant="bold" sx={{ flexGrow: 1 }}>
42
- {children}
43
- </Text>
44
- {action}
45
- </li>
46
- );
47
-
48
- type FieldSetFooterProps = PropsWithChildren<{ action?: ReactNode }>;
49
-
50
- export const FieldSetFooter: FC<FieldSetFooterProps> = ({
51
- action,
52
- children,
53
- ...otherProps
54
- }) => (
55
- <div {...otherProps} className={styles.footer}>
56
- <Text
57
- color="grey11"
58
- component="span"
59
- noWrap
60
- variant="small"
61
- sx={{ flexGrow: 1 }}
62
- >
63
- {children}
64
- </Text>
65
- {action}
66
- </div>
67
- );
@@ -1,9 +0,0 @@
1
- export {
2
- FieldSet,
3
- FieldSetContent,
4
- FieldSetFooter,
5
- FieldSetHeader,
6
- FieldSetLegend,
7
- FieldSetList,
8
- FieldSetListItem,
9
- } from "./FieldSet";
@@ -1,8 +0,0 @@
1
- import { useExperimentVariant } from "@/hooks/useExperimentVariant";
2
-
3
- type useAiSliceGenerationExperimentReturnType = { eligible: boolean };
4
-
5
- export function useAiSliceGenerationExperiment(): useAiSliceGenerationExperimentReturnType {
6
- const variant = useExperimentVariant("slicemachine-image-to-slice");
7
- return { eligible: variant?.value === "on" };
8
- }
@@ -1,50 +0,0 @@
1
- import { Box } from "@prismicio/editor-ui";
2
- import Head from "next/head";
3
- import { useRouter } from "next/router";
4
- import { type FC, useEffect } from "react";
5
-
6
- import { BreadcrumbItem } from "@/components/Breadcrumb";
7
- import { ConnectGitRepository } from "@/features/settings/git/ConnectGitRepository";
8
- import { useGitIntegrationExperiment } from "@/features/settings/git/useGitIntegrationExperiment";
9
- import {
10
- AppLayout,
11
- AppLayoutBreadcrumb,
12
- AppLayoutContent,
13
- AppLayoutHeader,
14
- } from "@/legacy/components/AppLayout";
15
-
16
- export const SettingsPage: FC = () => {
17
- const gitIntegrationExperiment = useGitIntegrationExperiment();
18
- const router = useRouter();
19
-
20
- // TODO(DT-1801): implement a 404 page.
21
- useEffect(() => {
22
- if (!gitIntegrationExperiment.eligible) {
23
- void router.replace("/");
24
- }
25
- }, [gitIntegrationExperiment.eligible, router]);
26
-
27
- if (!gitIntegrationExperiment.eligible) {
28
- return null;
29
- }
30
-
31
- return (
32
- <>
33
- <Head>
34
- <title>Settings - Slice Machine</title>
35
- </Head>
36
- <AppLayout>
37
- <AppLayoutHeader>
38
- <AppLayoutBreadcrumb>
39
- <BreadcrumbItem>Settings</BreadcrumbItem>
40
- </AppLayoutBreadcrumb>
41
- </AppLayoutHeader>
42
- <AppLayoutContent>
43
- <Box flexDirection="column" maxWidth={600}>
44
- <ConnectGitRepository />
45
- </Box>
46
- </AppLayoutContent>
47
- </AppLayout>
48
- </>
49
- );
50
- };
@@ -1,112 +0,0 @@
1
- import { Button, IconButton, Tooltip } from "@prismicio/editor-ui";
2
- import {
3
- isUnauthenticatedError,
4
- isUnauthorizedError,
5
- } from "@slicemachine/manager/client";
6
- import { type FC, type ReactNode, Suspense } from "react";
7
-
8
- import {
9
- FieldSet,
10
- FieldSetContent,
11
- FieldSetFooter,
12
- FieldSetLegend,
13
- } from "@/components/FieldSet";
14
- import { ErrorBoundary } from "@/ErrorBoundary";
15
- import { ConnectGitRepositoryBlankSlate } from "@/features/settings/git/ConnectGitRepositoryBlankSlate";
16
- import { GitProviderConnectButtons } from "@/features/settings/git/GitProviderConnectButtons";
17
- import { GitRepositoriesList } from "@/features/settings/git/GitRepositoriesList";
18
- import {
19
- GitRepositoriesSearch,
20
- GitRepositoriesSearchSkeleton,
21
- } from "@/features/settings/git/GitRepositoriesSearch";
22
- import { useGitOwners } from "@/features/settings/git/useGitOwners";
23
- import { useLinkedGitRepos } from "@/features/settings/git/useLinkedGitRepos";
24
- import useSliceMachineActions from "@/modules/useSliceMachineActions";
25
-
26
- export const ConnectGitRepository: FC = () => (
27
- <FieldSet>
28
- <FieldSetLegend>Connected Git Repository</FieldSetLegend>
29
- <ErrorBoundary renderError={renderError}>
30
- <Suspense fallback={<GitRepositoriesSearchSkeleton gitOwnerSelect />}>
31
- <Content />
32
- </Suspense>
33
- </ErrorBoundary>
34
- <FieldSetFooter
35
- action={
36
- <Tooltip content="Documentation is coming soon." side="bottom">
37
- <IconButton disabled icon="openInNew" />
38
- </Tooltip>
39
- }
40
- >
41
- Learn more about Prismic for Git
42
- </FieldSetFooter>
43
- </FieldSet>
44
- );
45
-
46
- const Content: FC = () => {
47
- const { linkedGitRepos } = useLinkedGitRepos();
48
- return linkedGitRepos.length > 0 ? (
49
- <GitRepositoriesList mode="unlink" repos={linkedGitRepos} />
50
- ) : (
51
- <UnlinkedRepositoryContent />
52
- );
53
- };
54
-
55
- const UnlinkedRepositoryContent: FC = () => {
56
- const owners = useGitOwners();
57
- return owners.length > 0 ? (
58
- <GitRepositoriesSearch owners={owners} />
59
- ) : (
60
- <FieldSetContent>
61
- <GitProviderConnectButtons />
62
- </FieldSetContent>
63
- );
64
- };
65
-
66
- function renderError(error: unknown, reset: () => void): ReactNode {
67
- if (isUnauthenticatedError(error)) {
68
- return <UnauthenticatedErrorContent />;
69
- } else if (isUnauthorizedError(error)) {
70
- return <UnauthorizedErrorContent />;
71
- } else {
72
- return <UnknownErrorContent reset={reset} />;
73
- }
74
- }
75
-
76
- const UnauthenticatedErrorContent: FC = () => {
77
- const { openLoginModal } = useSliceMachineActions();
78
- return (
79
- <FieldSetContent>
80
- <ConnectGitRepositoryBlankSlate
81
- title="It seems like you are logged out"
82
- description="Log in to connect a Git repository."
83
- action={<Button onClick={openLoginModal}>Log in to Prismic</Button>}
84
- />
85
- </FieldSetContent>
86
- );
87
- };
88
-
89
- const UnauthorizedErrorContent: FC = () => (
90
- <FieldSetContent>
91
- <ConnectGitRepositoryBlankSlate
92
- title="It seems like you do not have permission"
93
- description="An owner or admin is required to connect a Git repository."
94
- />
95
- </FieldSetContent>
96
- );
97
-
98
- type UnknownErrorContentProps = { reset: () => void };
99
-
100
- const UnknownErrorContent: FC<UnknownErrorContentProps> = ({ reset }) => (
101
- <FieldSetContent>
102
- <ConnectGitRepositoryBlankSlate
103
- title="Unable to fetch data"
104
- description="An error occurred while fetching the list of connected Git repositories."
105
- action={
106
- <Button color="grey" onClick={reset}>
107
- Retry
108
- </Button>
109
- }
110
- />
111
- </FieldSetContent>
112
- );
@@ -1,33 +0,0 @@
1
- import { Box, ButtonGroup, Text } from "@prismicio/editor-ui";
2
- import type { FC, ReactNode } from "react";
3
-
4
- type ConnectGitRepositoryBlankSlateProps = {
5
- title: string;
6
- description: string;
7
- action?: ReactNode;
8
- };
9
-
10
- export const ConnectGitRepositoryBlankSlate: FC<
11
- ConnectGitRepositoryBlankSlateProps
12
- > = ({ title, description, action }) => (
13
- <Box
14
- flexDirection="column"
15
- /*
16
- * TODO: these `padding` values actually don't match Figma, but they are the
17
- * closest allowed by the `Box` component.
18
- */
19
- padding={{ block: 72, inline: 100 }}
20
- >
21
- <Text align="center" variant="emphasized">
22
- {title}
23
- </Text>
24
- <Text align="center" color="grey11">
25
- {description}
26
- </Text>
27
- {Boolean(action) ? (
28
- <ButtonGroup sx={{ alignSelf: "center", marginTop: 8 }}>
29
- {action}
30
- </ButtonGroup>
31
- ) : undefined}
32
- </Box>
33
- );