slice-machine-ui 2.17.3-alpha.dani-git-integration.2 → 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.
- package/out/404.html +1 -1
- package/out/_next/static/QRJGmIoJFXeQ96FN-TwH5/_buildManifest.js +1 -0
- package/out/_next/static/chunks/248-03446cd9e9f13730.js +1 -0
- package/out/_next/static/chunks/489-dd74b228384df643.js +1 -0
- package/out/_next/static/chunks/{630-29c729ad2a291ef6.js → 630-799c128fd87fa645.js} +1 -1
- package/out/_next/static/chunks/903-04bef419234ad926.js +1 -0
- package/out/_next/static/chunks/pages/{_app-8c46096695410bd2.js → _app-abfff64c4bacad47.js} +1 -1
- package/out/_next/static/chunks/pages/changelog-063c5e11dfc8fd55.js +1 -0
- package/out/_next/static/chunks/pages/changes-b4b7d3047cf012a0.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-041985d94bb9649f.js → [customTypeId]-1958f229bf899036.js} +1 -1
- package/out/_next/static/chunks/pages/labs-9630bfb1005be02b.js +1 -0
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-338f685c0723043b.js → [pageTypeId]-1c048ceedced0df1.js} +1 -1
- package/out/_next/static/chunks/pages/settings-01f4aeb9112a1f87.js +1 -0
- 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-e057c5c9cb56b1ef.js +1 -0
- package/out/_next/static/css/e5f781f20e24a5ea.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/settings.html +1 -0
- 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/components/FieldSet/FieldSet.module.css +84 -0
- package/src/components/FieldSet/FieldSet.module.css.d.ts +16 -0
- package/src/components/FieldSet/FieldSet.stories.tsx +244 -0
- package/src/components/FieldSet/FieldSet.tsx +67 -0
- package/src/components/FieldSet/index.ts +9 -0
- package/src/features/changes/PushChangesButton.tsx +67 -4
- package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/CreateSliceFromImageModal.tsx +8 -21
- package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +52 -36
- package/src/features/navigation/Navigation.tsx +13 -7
- package/src/features/settings/SettingsPage.tsx +50 -0
- package/src/features/settings/git/ConnectGitRepository.tsx +112 -0
- package/src/features/settings/git/ConnectGitRepositoryBlankSlate.tsx +33 -0
- package/src/features/settings/git/GitOwnerSelect.tsx +71 -0
- package/src/features/settings/git/GitProvider.ts +40 -0
- package/src/features/settings/git/GitProviderConnectButtons.tsx +63 -0
- package/src/features/settings/git/GitRepositoriesList.tsx +76 -0
- package/src/features/settings/git/GitRepositoriesSearch.tsx +69 -0
- package/src/features/settings/git/GitRepositoryConnectDialog.tsx +97 -0
- package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +62 -0
- package/src/features/settings/git/useGitIntegrationExperiment.ts +8 -0
- package/src/features/settings/git/useGitOwners.ts +12 -0
- package/src/features/settings/git/useGitRepos.ts +24 -0
- package/src/features/settings/git/useLinkedGitRepos.ts +41 -0
- package/src/features/settings/git/useWriteAPIToken.ts +23 -0
- package/src/icons/BitbucketIcon.tsx +19 -0
- package/src/icons/GitHubIcon.tsx +17 -0
- package/src/icons/GitLabIcon.tsx +19 -0
- package/src/icons/SettingsIcon.tsx +19 -0
- 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/settings.tsx +1 -0
- package/src/pages/slices.tsx +36 -57
- package/out/_next/static/OERdRe23c5buVNy_8FtIU/_buildManifest.js +0 -1
- package/out/_next/static/chunks/248-6f20227ad4764216.js +0 -1
- package/out/_next/static/chunks/268-6a9214b97195af9c.js +0 -1
- package/out/_next/static/chunks/489-eaa4848c00e8986b.js +0 -1
- package/out/_next/static/chunks/pages/changelog-98836c22c6a40c5d.js +0 -1
- package/out/_next/static/chunks/pages/changes-db800bf4a08faa31.js +0 -1
- package/out/_next/static/chunks/pages/labs-ad7f36c6f544c1a8.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]-0bc862dd7bd99611.js +0 -1
- package/out/_next/static/chunks/pages/slices-6dbc3df2c4ef058a.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/{OERdRe23c5buVNy_8FtIU → QRJGmIoJFXeQ96FN-TwH5}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,244 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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,20 +1,83 @@
|
|
|
1
|
-
import { Button } from "@prismicio/editor-ui";
|
|
1
|
+
import { Button, Skeleton, Tooltip } from "@prismicio/editor-ui";
|
|
2
2
|
import {
|
|
3
3
|
type ComponentPropsWithoutRef,
|
|
4
4
|
type ElementRef,
|
|
5
|
+
type FC,
|
|
5
6
|
forwardRef,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
Suspense,
|
|
6
9
|
} from "react";
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
import { ErrorBoundary } from "@/ErrorBoundary";
|
|
12
|
+
import { gitProviderToConfig } from "@/features/settings/git/GitProvider";
|
|
13
|
+
import { useGitIntegrationExperiment } from "@/features/settings/git/useGitIntegrationExperiment";
|
|
14
|
+
import { useLinkedGitRepos } from "@/features/settings/git/useLinkedGitRepos";
|
|
15
|
+
|
|
16
|
+
type PushChangesButtonProps = Required<BarePushChangesButtonProps>;
|
|
17
|
+
|
|
18
|
+
export const PushChangesButton: FC<PushChangesButtonProps> = (props) => (
|
|
19
|
+
<ErrorBoundary renderError={renderError}>
|
|
20
|
+
<Suspense fallback={<PushChangesButtonSkeleton />}>
|
|
21
|
+
<PushChangesButtonUsingGitIntegrationExperiment {...props} />
|
|
22
|
+
</Suspense>
|
|
23
|
+
</ErrorBoundary>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const PushChangesButtonUsingGitIntegrationExperiment: FC<
|
|
27
|
+
PushChangesButtonProps
|
|
28
|
+
> = (props) => {
|
|
29
|
+
const gitIntegrationExperiment = useGitIntegrationExperiment();
|
|
30
|
+
return gitIntegrationExperiment.eligible ? (
|
|
31
|
+
<PushChangesButtonUsingLinkedGitRepos {...props} />
|
|
32
|
+
) : (
|
|
33
|
+
<BarePushChangesButton {...props} />
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const PushChangesButtonUsingLinkedGitRepos: FC<PushChangesButtonProps> = (
|
|
38
|
+
props,
|
|
39
|
+
) => {
|
|
40
|
+
const { linkedGitRepos } = useLinkedGitRepos();
|
|
41
|
+
if (linkedGitRepos.length > 0) {
|
|
42
|
+
const providerConfig = gitProviderToConfig[linkedGitRepos[0].provider];
|
|
43
|
+
return (
|
|
44
|
+
<Tooltip
|
|
45
|
+
content={`This project uses the Git workflow. Update Prismic by pushing your changes to ${providerConfig.name}.`}
|
|
46
|
+
side="bottom"
|
|
47
|
+
>
|
|
48
|
+
<BarePushChangesButton disabled />
|
|
49
|
+
</Tooltip>
|
|
50
|
+
);
|
|
51
|
+
} else {
|
|
52
|
+
return <BarePushChangesButton {...props} />;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type BarePushChangesButtonProps = Pick<
|
|
9
57
|
ComponentPropsWithoutRef<typeof Button>,
|
|
10
58
|
"disabled" | "loading" | "onClick"
|
|
11
59
|
>;
|
|
12
60
|
|
|
13
|
-
|
|
61
|
+
const BarePushChangesButton = forwardRef<
|
|
14
62
|
ElementRef<typeof Button>,
|
|
15
|
-
|
|
63
|
+
BarePushChangesButtonProps
|
|
16
64
|
>((props, ref) => (
|
|
17
65
|
<Button {...props} ref={ref} startIcon="upload">
|
|
18
66
|
Push
|
|
19
67
|
</Button>
|
|
20
68
|
));
|
|
69
|
+
|
|
70
|
+
function renderError(): ReactNode {
|
|
71
|
+
return (
|
|
72
|
+
<Tooltip
|
|
73
|
+
content="An error occurred while fetching the list of connected Git repositories."
|
|
74
|
+
side="bottom"
|
|
75
|
+
>
|
|
76
|
+
<BarePushChangesButton disabled />
|
|
77
|
+
</Tooltip>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const PushChangesButtonSkeleton: FC = () => (
|
|
82
|
+
<Skeleton height={32} width={71.32} />
|
|
83
|
+
);
|
|
@@ -22,15 +22,10 @@ import { toast } from "react-toastify";
|
|
|
22
22
|
|
|
23
23
|
import { getState, telemetry } from "@/apiClient";
|
|
24
24
|
import { addAiFeedback } from "@/features/aiFeedback";
|
|
25
|
-
import {
|
|
26
|
-
useSectionsNamingExperiment,
|
|
27
|
-
UseSectionsNamingExperimentReturnType,
|
|
28
|
-
} from "@/features/builder/useSectionsNamingExperiment";
|
|
29
25
|
import { useOnboarding } from "@/features/onboarding/useOnboarding";
|
|
30
26
|
import { useAutoSync } from "@/features/sync/AutoSyncProvider";
|
|
31
27
|
import { managerClient } from "@/managerClient";
|
|
32
28
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
33
|
-
import { pluralize } from "@/utils/textConversion";
|
|
34
29
|
|
|
35
30
|
import { Slice, SliceCard } from "./SliceCard";
|
|
36
31
|
|
|
@@ -58,7 +53,7 @@ export function CreateSliceFromImageModal(
|
|
|
58
53
|
const { syncChanges } = useAutoSync();
|
|
59
54
|
const { createSliceSuccess } = useSliceMachineActions();
|
|
60
55
|
const { completeStep } = useOnboarding();
|
|
61
|
-
|
|
56
|
+
|
|
62
57
|
/**
|
|
63
58
|
* Keeps track of the current instance id.
|
|
64
59
|
* When the modal is closed, the id is reset.
|
|
@@ -244,8 +239,7 @@ export function CreateSliceFromImageModal(
|
|
|
244
239
|
<DialogHeader title="Generate from image" />
|
|
245
240
|
<DialogContent gap={0}>
|
|
246
241
|
<DialogDescription hidden>
|
|
247
|
-
Upload images to generate
|
|
248
|
-
with AI
|
|
242
|
+
Upload images to generate slices with AI
|
|
249
243
|
</DialogDescription>
|
|
250
244
|
{slices.length === 0 ? (
|
|
251
245
|
<Box padding={16} height="100%">
|
|
@@ -285,8 +279,7 @@ export function CreateSliceFromImageModal(
|
|
|
285
279
|
loading={isCreatingSlices}
|
|
286
280
|
onClick={onSubmit}
|
|
287
281
|
>
|
|
288
|
-
{getSubmitButtonLabel(
|
|
289
|
-
{readySlices.length})
|
|
282
|
+
{getSubmitButtonLabel(location)} ({readySlices.length})
|
|
290
283
|
</DialogActionButton>
|
|
291
284
|
</DialogActions>
|
|
292
285
|
</DialogContent>
|
|
@@ -298,7 +291,6 @@ function UploadBlankSlate(props: {
|
|
|
298
291
|
droppingFiles?: boolean;
|
|
299
292
|
onFilesSelected: (files: File[]) => void;
|
|
300
293
|
}) {
|
|
301
|
-
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
302
294
|
const { droppingFiles = false, onFilesSelected } = props;
|
|
303
295
|
|
|
304
296
|
return (
|
|
@@ -320,8 +312,7 @@ function UploadBlankSlate(props: {
|
|
|
320
312
|
/>
|
|
321
313
|
<BlankSlateTitle>Upload your design images.</BlankSlateTitle>
|
|
322
314
|
<BlankSlateDescription>
|
|
323
|
-
Once uploaded, you can generate
|
|
324
|
-
{pluralize(sectionsNamingExperiment.value)} automatically using AI.
|
|
315
|
+
Once uploaded, you can generate slices automatically using AI.
|
|
325
316
|
</BlankSlateDescription>
|
|
326
317
|
<BlankSlateActions>
|
|
327
318
|
<FileUploadButton
|
|
@@ -469,19 +460,15 @@ async function addSlices(newSlices: NewSlice[]) {
|
|
|
469
460
|
return { library, slices };
|
|
470
461
|
}
|
|
471
462
|
|
|
472
|
-
const getSubmitButtonLabel = (
|
|
473
|
-
location,
|
|
474
|
-
|
|
475
|
-
}: {
|
|
476
|
-
location: "custom_type" | "page_type" | "slices";
|
|
477
|
-
sectionsNamingExperiment: UseSectionsNamingExperimentReturnType;
|
|
478
|
-
}) => {
|
|
463
|
+
const getSubmitButtonLabel = (
|
|
464
|
+
location: "custom_type" | "page_type" | "slices",
|
|
465
|
+
) => {
|
|
479
466
|
switch (location) {
|
|
480
467
|
case "custom_type":
|
|
481
468
|
return "Add to type";
|
|
482
469
|
case "page_type":
|
|
483
470
|
return "Add to page";
|
|
484
471
|
case "slices":
|
|
485
|
-
return
|
|
472
|
+
return "Add to slices";
|
|
486
473
|
}
|
|
487
474
|
};
|