@abtnode/ux 1.16.27-beta-74c4e335 → 1.16.27-beta-4022dde0
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/lib/blocklet/component/add-component/add-component-core.js +4 -5
- package/lib/blocklet/component/add-component/step-connect.js +8 -0
- package/lib/blocklet/publish/{select-components.js → create-release/blocklets.js} +41 -20
- package/lib/blocklet/publish/create-release/branding.js +390 -0
- package/lib/blocklet/publish/{connect-store-list.js → create-release/connect-store-list.js} +2 -2
- package/lib/blocklet/publish/create-release/header.js +407 -0
- package/lib/blocklet/publish/create-release/index.js +575 -0
- package/lib/blocklet/publish/create-release/introduction-preview.js +28 -0
- package/lib/blocklet/publish/create-release/introduction.js +109 -0
- package/lib/blocklet/publish/create-release/release-stepper.js +161 -0
- package/lib/blocklet/publish/{resource.js → create-release/resources.js} +37 -21
- package/lib/blocklet/publish/create-release/step-icon.js +63 -0
- package/lib/blocklet/publish/{stop-box.js → create-release/stop-box.js} +13 -6
- package/lib/blocklet/publish/{tree.js → create-release/tree.js} +1 -1
- package/lib/blocklet/publish/create-release/version.js +93 -0
- package/lib/blocklet/publish/index.js +1 -1
- package/lib/blocklet/publish/project-list.js +3 -3
- package/lib/blocklet/publish/release-list.js +2 -2
- package/lib/blocklet/publish/utils/validate-params.js +92 -0
- package/lib/blocklet/router/add-domain.js +3 -2
- package/lib/hooks/use-bundle-logo.js +3 -2
- package/lib/layout/addon.js +3 -17
- package/lib/locales/ar.js +16 -2
- package/lib/locales/de.js +16 -2
- package/lib/locales/en.js +13 -0
- package/lib/locales/es.js +16 -2
- package/lib/locales/fr.js +16 -2
- package/lib/locales/hi.js +16 -2
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +16 -2
- package/lib/locales/ja.js +16 -2
- package/lib/locales/ko.js +16 -2
- package/lib/locales/pt.js +16 -2
- package/lib/locales/ru.js +16 -2
- package/lib/locales/th.js +16 -2
- package/lib/locales/vi.js +16 -2
- package/lib/locales/zh-tw.js +16 -2
- package/lib/locales/zh.js +16 -2
- package/lib/util/index.js +7 -5
- package/package.json +18 -18
- package/lib/blocklet/publish/create-release.js +0 -1207
- /package/lib/blocklet/publish/{connect-store-button.js → create-release/connect-store-button.js} +0 -0
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useParams } from 'react-router-dom';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import useSetState from 'react-use/lib/useSetState';
|
|
6
|
+
import pick from 'lodash/pick';
|
|
7
|
+
import semver from 'semver';
|
|
8
|
+
import { Box, Typography, useMediaQuery, Tooltip } from '@mui/material';
|
|
9
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
10
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
11
|
+
import Tabs from '@arcblock/ux/lib/Tabs';
|
|
12
|
+
import { UNOWNED_DID } from '@abtnode/constant';
|
|
13
|
+
import QuestionMarkIcon from '@arcblock/icons/lib/QuestionMarkCircle';
|
|
14
|
+
import BlockletBundleAvatar from '../../bundle-avatar';
|
|
15
|
+
import { useNodeContext } from '../../../contexts/node';
|
|
16
|
+
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
17
|
+
import EmptySpinner from '../../../empty-spinner';
|
|
18
|
+
import { formatError } from '../../../util';
|
|
19
|
+
import Resources from './resources';
|
|
20
|
+
import Blocklets from './blocklets';
|
|
21
|
+
import StopBox from './stop-box';
|
|
22
|
+
import Branding from './branding';
|
|
23
|
+
import Version from './version';
|
|
24
|
+
import Header from './header';
|
|
25
|
+
import ReleaseStepper from './release-stepper';
|
|
26
|
+
import Introduction from './introduction';
|
|
27
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
|
+
const addComponentTabs = ({
|
|
29
|
+
tabs,
|
|
30
|
+
blocklet,
|
|
31
|
+
ancestors = []
|
|
32
|
+
}) => {
|
|
33
|
+
const key = blocklet.meta.did;
|
|
34
|
+
tabs.push({
|
|
35
|
+
label: /*#__PURE__*/_jsxs(Box, {
|
|
36
|
+
display: "flex",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
justifyContent: "flex-start",
|
|
39
|
+
children: [/*#__PURE__*/_jsx(BlockletBundleAvatar, {
|
|
40
|
+
size: 24,
|
|
41
|
+
blocklet: blocklet,
|
|
42
|
+
ancestors: ancestors
|
|
43
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
44
|
+
ml: "4px",
|
|
45
|
+
className: "text",
|
|
46
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
47
|
+
children: blocklet.meta.title
|
|
48
|
+
})
|
|
49
|
+
})]
|
|
50
|
+
}, key),
|
|
51
|
+
value: key
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const pickParams = (baseParams, app) => {
|
|
55
|
+
const params = pick(baseParams, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'connectedStores', 'blockletComponents', 'lastReleaseId', 'note']);
|
|
56
|
+
if (!params.blockletComponents) {
|
|
57
|
+
params.blockletComponents = (app.children || []).map(x => ({
|
|
58
|
+
did: x.meta.did,
|
|
59
|
+
included: false,
|
|
60
|
+
required: false
|
|
61
|
+
}));
|
|
62
|
+
} else {
|
|
63
|
+
params.blockletComponents = params.blockletComponents.map(x => ({
|
|
64
|
+
...x,
|
|
65
|
+
included: true
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
return params;
|
|
69
|
+
};
|
|
70
|
+
const stepsToLabel = {
|
|
71
|
+
0: 'branding',
|
|
72
|
+
1: 'introduction',
|
|
73
|
+
2: 'resources',
|
|
74
|
+
3: 'blocklets',
|
|
75
|
+
4: 'version'
|
|
76
|
+
};
|
|
77
|
+
const labelToStep = {
|
|
78
|
+
branding: 0,
|
|
79
|
+
introduction: 1,
|
|
80
|
+
resources: 2,
|
|
81
|
+
blocklets: 3,
|
|
82
|
+
version: 4
|
|
83
|
+
};
|
|
84
|
+
export default function CreateRelease({
|
|
85
|
+
initUrl,
|
|
86
|
+
...rest
|
|
87
|
+
}) {
|
|
88
|
+
const {
|
|
89
|
+
projectId,
|
|
90
|
+
mode,
|
|
91
|
+
releaseId: inputReleaseId,
|
|
92
|
+
componentDid = ''
|
|
93
|
+
} = useParams();
|
|
94
|
+
const {
|
|
95
|
+
t
|
|
96
|
+
} = useLocaleContext();
|
|
97
|
+
const {
|
|
98
|
+
blocklet
|
|
99
|
+
} = useBlockletContext();
|
|
100
|
+
const [params, setParams] = useSetState({
|
|
101
|
+
blockletScreenshots: [],
|
|
102
|
+
publishedStoreIds: [],
|
|
103
|
+
connectedStores: []
|
|
104
|
+
});
|
|
105
|
+
const [paramsErrTip, setParamsErrTip] = useSetState({});
|
|
106
|
+
const [loading, setLoading] = useState(false);
|
|
107
|
+
const [release, setRelease] = useSetState(null);
|
|
108
|
+
const {
|
|
109
|
+
api
|
|
110
|
+
} = useNodeContext();
|
|
111
|
+
const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
|
|
112
|
+
const [initialResources, setInitialResources] = useState({});
|
|
113
|
+
const [releaseUsedLast, setReleaseUsedLast] = useState(false);
|
|
114
|
+
const saveSelectedEventsRef = useRef({});
|
|
115
|
+
const [selectedResourceIds, _setSelectedResourceIds] = useSetState({});
|
|
116
|
+
const [initLogoUrl, setInitLogoUrl] = useState('');
|
|
117
|
+
const [resourceComponentsMap, _setResourceComponentsMap] = useSetState({});
|
|
118
|
+
const dependentComponentsMode = initUrl?.searchParams.get('dependentComponentsMode');
|
|
119
|
+
const disabledSelectComponents = dependentComponentsMode === 'readonly';
|
|
120
|
+
const setResourceComponentsMap = useCallback(setter => {
|
|
121
|
+
if (disabledSelectComponents) {
|
|
122
|
+
setParams({
|
|
123
|
+
blockletComponents: []
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
_setResourceComponentsMap(setter);
|
|
127
|
+
}, [disabledSelectComponents, _setResourceComponentsMap, setParams]);
|
|
128
|
+
const setSelectedResourceIds = useCallback((...args) => {
|
|
129
|
+
_setSelectedResourceIds(...args);
|
|
130
|
+
setParamsErrTip({
|
|
131
|
+
blockletResources: ''
|
|
132
|
+
});
|
|
133
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
|
+
}, []);
|
|
135
|
+
const releaseId = inputReleaseId === 'none' ? params?.lastReleaseId || '' : inputReleaseId;
|
|
136
|
+
const [activeStep, setActiveStep] = useState(mode === 'new-release' ? 4 : 0);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (projectId) {
|
|
139
|
+
setParamsErrTip({
|
|
140
|
+
projectId: ''
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}, [projectId, setParamsErrTip]);
|
|
144
|
+
const projectType = useMemo(() => params?.blockletComponents?.some(x => x.included) ? 'pack' : 'resource', [params?.blockletComponents]);
|
|
145
|
+
const tabs = [];
|
|
146
|
+
const resourceComponents = (blocklet?.children || []).filter(x => x.meta.resource?.exportApi).filter(x => !componentDid || x.meta.did === componentDid);
|
|
147
|
+
resourceComponents.forEach(item => {
|
|
148
|
+
addComponentTabs({
|
|
149
|
+
tabs,
|
|
150
|
+
blocklet: item,
|
|
151
|
+
t,
|
|
152
|
+
ancestors: [blocklet]
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
const [tab, setTab] = useState(tabs[0]?.value);
|
|
156
|
+
const isPublished = !releaseUsedLast && release?.status === 'published';
|
|
157
|
+
const readOnly = isPublished;
|
|
158
|
+
const resourceRelateComponents = useMemo(() => {
|
|
159
|
+
const result = {};
|
|
160
|
+
Object.keys(resourceComponentsMap).forEach(key => {
|
|
161
|
+
const item = resourceComponentsMap[key];
|
|
162
|
+
if (item) {
|
|
163
|
+
item.forEach(k => {
|
|
164
|
+
result[k] = true;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return result;
|
|
169
|
+
}, [resourceComponentsMap]);
|
|
170
|
+
const getRelease = async () => {
|
|
171
|
+
if (!releaseId) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
const res = await api.getRelease({
|
|
176
|
+
input: {
|
|
177
|
+
did: blocklet.meta.did,
|
|
178
|
+
projectId,
|
|
179
|
+
releaseId
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
setLoading(false);
|
|
183
|
+
if (!res.release) {
|
|
184
|
+
Toast.error('Release not found');
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
setParams(lastParams => pickParams({
|
|
188
|
+
...lastParams,
|
|
189
|
+
...res.release,
|
|
190
|
+
blockletVersion: mode === 'create' || mode === 'new-release' ? semver.inc(res.release.blockletVersion, 'patch') : res.release.blockletVersion
|
|
191
|
+
}, blocklet));
|
|
192
|
+
setRelease(res.release);
|
|
193
|
+
} catch (err) {
|
|
194
|
+
setLoading(false);
|
|
195
|
+
Toast.error(formatError(err));
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
const getProject = async () => {
|
|
199
|
+
if (projectId === UNOWNED_DID) {
|
|
200
|
+
setParams({
|
|
201
|
+
blockletVersion: '1.0.0',
|
|
202
|
+
blockletTitle: ''
|
|
203
|
+
});
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (!projectId) {
|
|
207
|
+
Toast.error(t('blocklet.publish.errorTip.noDid'));
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
const res = await api.getProject({
|
|
212
|
+
input: {
|
|
213
|
+
did: blocklet.meta.did,
|
|
214
|
+
projectId
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
setLoading(false);
|
|
218
|
+
const data = res.project || {};
|
|
219
|
+
if (!data.blockletVersion) {
|
|
220
|
+
data.blockletVersion = '1.0.0';
|
|
221
|
+
} else if ((mode === 'create' || mode === 'new-release') && semver.valid(data.blockletVersion)) {
|
|
222
|
+
data.blockletVersion = semver.inc(data.blockletVersion, 'patch');
|
|
223
|
+
}
|
|
224
|
+
const theParams = pickParams(data, blocklet);
|
|
225
|
+
setParams(theParams);
|
|
226
|
+
} catch (err) {
|
|
227
|
+
setLoading(false);
|
|
228
|
+
Toast.error(formatError(err));
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const getData = useCallback(async () => {
|
|
232
|
+
if (mode === 'view') {
|
|
233
|
+
if (!releaseId) {
|
|
234
|
+
Toast.error('Empty release id');
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
await getProject();
|
|
238
|
+
await getRelease();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
await getProject();
|
|
242
|
+
if (releaseId) {
|
|
243
|
+
setReleaseUsedLast(true);
|
|
244
|
+
await getRelease();
|
|
245
|
+
}
|
|
246
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
247
|
+
}, [mode, releaseId]);
|
|
248
|
+
const handleChangeSelectedComponents = data => {
|
|
249
|
+
setParams({
|
|
250
|
+
blockletComponents: data
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
useEffect(() => {
|
|
254
|
+
getData();
|
|
255
|
+
}, [getData]);
|
|
256
|
+
useEffect(() => {
|
|
257
|
+
if (projectId === UNOWNED_DID && (mode === 'create' || mode === 'new-release') && initUrl) {
|
|
258
|
+
setInitLogoUrl(initUrl.searchParams.get('logo'));
|
|
259
|
+
setParams({
|
|
260
|
+
blockletTitle: initUrl.searchParams.get('title'),
|
|
261
|
+
blockletDescription: initUrl.searchParams.get('description'),
|
|
262
|
+
blockletIntroduction: initUrl.searchParams.get('introduction') || initUrl.searchParams.get('description'),
|
|
263
|
+
blockletComponents: JSON.parse(initUrl.searchParams.get('components') || '[]'),
|
|
264
|
+
note: initUrl.searchParams.get('note') || 'No note'
|
|
265
|
+
});
|
|
266
|
+
const resourcesString = initUrl.searchParams.get('resources');
|
|
267
|
+
try {
|
|
268
|
+
const resources = JSON.parse(resourcesString);
|
|
269
|
+
setInitialResources(resources);
|
|
270
|
+
} catch (_) {
|
|
271
|
+
//
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}, [setParams, projectId, initUrl, mode]);
|
|
275
|
+
const isSelectedResources = useMemo(() => {
|
|
276
|
+
return !!Object.keys(selectedResourceIds).find(key => {
|
|
277
|
+
if (selectedResourceIds[key].length) {
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
return false;
|
|
281
|
+
});
|
|
282
|
+
}, [selectedResourceIds]);
|
|
283
|
+
if (!params && loading) {
|
|
284
|
+
return /*#__PURE__*/_jsx(EmptySpinner, {});
|
|
285
|
+
}
|
|
286
|
+
if (!params) {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
const resourceItem = resourceComponents.find(x => x.meta.did === tab);
|
|
290
|
+
const allResourceComponentsStop = resourceComponents.every(x => x.status !== 'running');
|
|
291
|
+
if (allResourceComponentsStop) {
|
|
292
|
+
return /*#__PURE__*/_jsx(StopBox, {
|
|
293
|
+
children: t('blocklet.publish.allComponentsNotRunning')
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
const onTabChange = x => {
|
|
297
|
+
setTab(x);
|
|
298
|
+
};
|
|
299
|
+
const resourcesUrlTitle = initUrl?.searchParams.get('resourcesTitle');
|
|
300
|
+
const componentsUrlTitle = initUrl?.searchParams.get('componentsTitle');
|
|
301
|
+
const steps = [{
|
|
302
|
+
label: t('blocklet.publish.branding'),
|
|
303
|
+
description: t('blocklet.publish.steps.branding')
|
|
304
|
+
}, {
|
|
305
|
+
label: t('common.introduction'),
|
|
306
|
+
description: t('blocklet.publish.steps.introduction')
|
|
307
|
+
}, {
|
|
308
|
+
label: resourcesUrlTitle || t('blocklet.publish.resourceTitle'),
|
|
309
|
+
description: t('blocklet.publish.steps.resources')
|
|
310
|
+
}, {
|
|
311
|
+
label: componentsUrlTitle || t('common.components'),
|
|
312
|
+
description: t('blocklet.publish.steps.blocklets')
|
|
313
|
+
}, {
|
|
314
|
+
label: mode === 'create' || mode === 'new-version' ? t('blocklet.publish.newVersionTitle') : t('blocklet.publish.versionTitle'),
|
|
315
|
+
description: t('blocklet.publish.steps.version')
|
|
316
|
+
}];
|
|
317
|
+
const nowStep = steps[activeStep] || steps[steps.length - 1];
|
|
318
|
+
const nowStepLabel = stepsToLabel[activeStep];
|
|
319
|
+
return /*#__PURE__*/_jsxs(Main, {
|
|
320
|
+
...rest,
|
|
321
|
+
children: [/*#__PURE__*/_jsx(Header, {
|
|
322
|
+
blocklet: blocklet,
|
|
323
|
+
release: release,
|
|
324
|
+
getRelease: getRelease,
|
|
325
|
+
mode: mode,
|
|
326
|
+
params: params,
|
|
327
|
+
setParams: setParams,
|
|
328
|
+
setParamsErrTip: setParamsErrTip,
|
|
329
|
+
readOnly: readOnly,
|
|
330
|
+
isPublished: isPublished,
|
|
331
|
+
loading: loading,
|
|
332
|
+
setLoading: setLoading,
|
|
333
|
+
releaseId: releaseId,
|
|
334
|
+
projectId: projectId,
|
|
335
|
+
resourceComponents: resourceComponents,
|
|
336
|
+
resourceComponentsMap: resourceComponentsMap,
|
|
337
|
+
resourceRelateComponents: resourceRelateComponents,
|
|
338
|
+
resourceItem: resourceItem,
|
|
339
|
+
saveSelectedEventsRef: saveSelectedEventsRef,
|
|
340
|
+
isSelectedResources: isSelectedResources,
|
|
341
|
+
releaseUsedLast: releaseUsedLast,
|
|
342
|
+
setReleaseUsedLast: setReleaseUsedLast,
|
|
343
|
+
setRelease: setRelease
|
|
344
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
345
|
+
display: "flex",
|
|
346
|
+
flexDirection: "column",
|
|
347
|
+
sx: {
|
|
348
|
+
width: '100%'
|
|
349
|
+
},
|
|
350
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
351
|
+
pt: 3
|
|
352
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
353
|
+
sx: {
|
|
354
|
+
gap: 3
|
|
355
|
+
},
|
|
356
|
+
display: "flex",
|
|
357
|
+
flexDirection: isMobile ? 'column' : 'row',
|
|
358
|
+
children: [!isMobile && /*#__PURE__*/_jsx(ReleaseStepper, {
|
|
359
|
+
steps: steps,
|
|
360
|
+
viewMode: mode === 'view',
|
|
361
|
+
params: params,
|
|
362
|
+
isSelectedResources: isSelectedResources,
|
|
363
|
+
paramsErrTip: paramsErrTip,
|
|
364
|
+
activeStep: activeStep,
|
|
365
|
+
setActiveStep: setActiveStep,
|
|
366
|
+
projectId: projectId,
|
|
367
|
+
resourcesUrlTitle: resourcesUrlTitle,
|
|
368
|
+
componentsUrlTitle: componentsUrlTitle
|
|
369
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
370
|
+
flex: "1",
|
|
371
|
+
maxWidth: "720px",
|
|
372
|
+
children: [!isMobile && nowStepLabel !== 'introduction' && /*#__PURE__*/_jsxs(Typography, {
|
|
373
|
+
variant: "h6",
|
|
374
|
+
fontWeight: "bold",
|
|
375
|
+
display: "flex",
|
|
376
|
+
flexDirection: "row",
|
|
377
|
+
alignItems: "center",
|
|
378
|
+
children: [nowStep.label, nowStepLabel === 'branding' && /*#__PURE__*/_jsx(Tooltip, {
|
|
379
|
+
title: t('blocklet.publish.brandingHelp'),
|
|
380
|
+
placement: "right",
|
|
381
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
382
|
+
component: "a",
|
|
383
|
+
target: "_blank",
|
|
384
|
+
href: "https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",
|
|
385
|
+
sx: {
|
|
386
|
+
paddingTop: 1,
|
|
387
|
+
marginLeft: 1
|
|
388
|
+
},
|
|
389
|
+
style: {
|
|
390
|
+
color: 'gray'
|
|
391
|
+
},
|
|
392
|
+
children: /*#__PURE__*/_jsx(QuestionMarkIcon, {})
|
|
393
|
+
})
|
|
394
|
+
})]
|
|
395
|
+
}), (isMobile || nowStepLabel === 'branding') && /*#__PURE__*/_jsx(Box, {
|
|
396
|
+
flexDirection: "column",
|
|
397
|
+
children: /*#__PURE__*/_jsx(Branding, {
|
|
398
|
+
projectId: projectId,
|
|
399
|
+
setParams: setParams,
|
|
400
|
+
setParamsErrTip: setParamsErrTip,
|
|
401
|
+
params: params,
|
|
402
|
+
componentDid: componentDid,
|
|
403
|
+
blocklet: blocklet,
|
|
404
|
+
initUrl: initUrl,
|
|
405
|
+
loading: loading,
|
|
406
|
+
setLoading: setLoading,
|
|
407
|
+
paramsErrTip: paramsErrTip,
|
|
408
|
+
readOnly: readOnly,
|
|
409
|
+
initLogoUrl: initLogoUrl,
|
|
410
|
+
setInitLogoUrl: setInitLogoUrl
|
|
411
|
+
})
|
|
412
|
+
}), isMobile && /*#__PURE__*/_jsx(Box, {
|
|
413
|
+
flexDirection: "column",
|
|
414
|
+
children: /*#__PURE__*/_jsx(Version, {
|
|
415
|
+
loading: loading,
|
|
416
|
+
params: params,
|
|
417
|
+
paramsErrTip: paramsErrTip,
|
|
418
|
+
setParams: setParams,
|
|
419
|
+
setParamsErrTip: setParamsErrTip,
|
|
420
|
+
readOnly: readOnly
|
|
421
|
+
})
|
|
422
|
+
}), (isMobile || nowStepLabel === 'introduction') && /*#__PURE__*/_jsx(Box, {
|
|
423
|
+
display: "flex",
|
|
424
|
+
flexDirection: "column",
|
|
425
|
+
sx: {
|
|
426
|
+
mt: isMobile ? 5 : 0,
|
|
427
|
+
width: '100%'
|
|
428
|
+
},
|
|
429
|
+
children: /*#__PURE__*/_jsx(Introduction, {
|
|
430
|
+
loading: loading,
|
|
431
|
+
readOnly: readOnly,
|
|
432
|
+
params: params,
|
|
433
|
+
setParams: setParams,
|
|
434
|
+
paramsErrTip: paramsErrTip,
|
|
435
|
+
setParamsErrTip: setParamsErrTip
|
|
436
|
+
})
|
|
437
|
+
}), isMobile && /*#__PURE__*/_jsx(Typography, {
|
|
438
|
+
variant: "h6",
|
|
439
|
+
fontWeight: "bold",
|
|
440
|
+
mt: 5,
|
|
441
|
+
children: steps[labelToStep.resources].label
|
|
442
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
443
|
+
display: isMobile || nowStepLabel === 'resources' ? 'flex' : 'none',
|
|
444
|
+
sx: {
|
|
445
|
+
maxWidth: 720
|
|
446
|
+
},
|
|
447
|
+
flexDirection: "column",
|
|
448
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
449
|
+
display: "flex",
|
|
450
|
+
mt: 3,
|
|
451
|
+
className: "section full-width",
|
|
452
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
453
|
+
sx: {
|
|
454
|
+
flex: 1
|
|
455
|
+
},
|
|
456
|
+
children: [!componentDid && /*#__PURE__*/_jsx(Tabs, {
|
|
457
|
+
tabs: tabs,
|
|
458
|
+
current: tab,
|
|
459
|
+
onChange: onTabChange,
|
|
460
|
+
sx: {
|
|
461
|
+
ml: -2,
|
|
462
|
+
mt: -1.5
|
|
463
|
+
}
|
|
464
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
465
|
+
children: /*#__PURE__*/_jsx(Resources, {
|
|
466
|
+
loading: loading,
|
|
467
|
+
initialResources: initialResources,
|
|
468
|
+
saveSelectedEventsRef: saveSelectedEventsRef,
|
|
469
|
+
selectedResourceIds: selectedResourceIds,
|
|
470
|
+
setSelectedResourceIds: setSelectedResourceIds,
|
|
471
|
+
setResourceComponentsMap: setResourceComponentsMap,
|
|
472
|
+
error: paramsErrTip.blockletResource,
|
|
473
|
+
app: blocklet,
|
|
474
|
+
readOnly: readOnly,
|
|
475
|
+
component: resourceItem,
|
|
476
|
+
componentDid: componentDid,
|
|
477
|
+
initUrl: initUrl,
|
|
478
|
+
projectId: projectId === UNOWNED_DID ? '' : projectId,
|
|
479
|
+
releaseUsedLast: releaseUsedLast,
|
|
480
|
+
release: {
|
|
481
|
+
...release,
|
|
482
|
+
id: releaseId
|
|
483
|
+
}
|
|
484
|
+
})
|
|
485
|
+
})]
|
|
486
|
+
})
|
|
487
|
+
})
|
|
488
|
+
}), isMobile && /*#__PURE__*/_jsx(Typography, {
|
|
489
|
+
variant: "h6",
|
|
490
|
+
fontWeight: "bold",
|
|
491
|
+
mt: 5,
|
|
492
|
+
children: steps[labelToStep.blocklets].label
|
|
493
|
+
}), (isMobile || nowStepLabel === 'blocklets') && /*#__PURE__*/_jsx(Box, {
|
|
494
|
+
flexDirection: "column",
|
|
495
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
496
|
+
display: "flex",
|
|
497
|
+
mt: 3,
|
|
498
|
+
className: "section full-width",
|
|
499
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
500
|
+
sx: {
|
|
501
|
+
flex: 1
|
|
502
|
+
},
|
|
503
|
+
children: /*#__PURE__*/_jsx(Blocklets, {
|
|
504
|
+
projectType: projectType,
|
|
505
|
+
disabled: loading || readOnly,
|
|
506
|
+
app: blocklet,
|
|
507
|
+
value: params?.blockletComponents || [],
|
|
508
|
+
onChange: handleChangeSelectedComponents,
|
|
509
|
+
resourceRelateComponents: resourceRelateComponents,
|
|
510
|
+
dependentComponentsMode: dependentComponentsMode
|
|
511
|
+
})
|
|
512
|
+
})
|
|
513
|
+
})
|
|
514
|
+
}), !isMobile && nowStepLabel === 'version' && /*#__PURE__*/_jsx(Box, {
|
|
515
|
+
flexDirection: "column",
|
|
516
|
+
children: /*#__PURE__*/_jsx(Version, {
|
|
517
|
+
loading: loading,
|
|
518
|
+
params: params,
|
|
519
|
+
paramsErrTip: paramsErrTip,
|
|
520
|
+
setParams: setParams,
|
|
521
|
+
setParamsErrTip: setParamsErrTip,
|
|
522
|
+
readOnly: readOnly
|
|
523
|
+
})
|
|
524
|
+
})]
|
|
525
|
+
})]
|
|
526
|
+
})]
|
|
527
|
+
})]
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
CreateRelease.propTypes = {
|
|
531
|
+
initUrl: PropTypes.object
|
|
532
|
+
};
|
|
533
|
+
CreateRelease.defaultProps = {
|
|
534
|
+
initUrl: null
|
|
535
|
+
};
|
|
536
|
+
const Main = styled.div`
|
|
537
|
+
.section {
|
|
538
|
+
&.full-width {
|
|
539
|
+
max-width: 100%;
|
|
540
|
+
}
|
|
541
|
+
.MuiTypography-h3 {
|
|
542
|
+
font-size: 1.1rem;
|
|
543
|
+
font-weight: 700;
|
|
544
|
+
}
|
|
545
|
+
.left {
|
|
546
|
+
flex-shrink: 0;
|
|
547
|
+
width: 140px;
|
|
548
|
+
}
|
|
549
|
+
.MuiTabs-indicator {
|
|
550
|
+
display: none;
|
|
551
|
+
}
|
|
552
|
+
.MuiTypography-subtitle1 {
|
|
553
|
+
width: 120px;
|
|
554
|
+
font-weight: 700;
|
|
555
|
+
font-size: 1rem;
|
|
556
|
+
${({
|
|
557
|
+
theme
|
|
558
|
+
}) => theme.breakpoints.down('sm')} {
|
|
559
|
+
width: 80px;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
.MuiButtonBase-root {
|
|
564
|
+
a {
|
|
565
|
+
color: inherit;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
.MuiInputBase-multiline .MuiInputAdornment-positionEnd {
|
|
569
|
+
align-self: flex-end;
|
|
570
|
+
.MuiTypography-root {
|
|
571
|
+
font-size: 0.8rem;
|
|
572
|
+
}
|
|
573
|
+
font-size: 0.8rem;
|
|
574
|
+
}
|
|
575
|
+
`;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import rehypeExternalLinks from 'rehype-external-links';
|
|
4
|
+
import { EmptyIcon } from '@arcblock/icons';
|
|
5
|
+
import StopBox from './stop-box';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
function IntroductionPreview({
|
|
8
|
+
text
|
|
9
|
+
}) {
|
|
10
|
+
if (!text) {
|
|
11
|
+
return /*#__PURE__*/_jsx(StopBox, {
|
|
12
|
+
Icon: EmptyIcon
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/_jsx(MarkdownPreview, {
|
|
16
|
+
wrapperElement: {
|
|
17
|
+
'data-color-mode': 'light'
|
|
18
|
+
},
|
|
19
|
+
source: text,
|
|
20
|
+
rehypePlugins: [[rehypeExternalLinks, {
|
|
21
|
+
target: '_blank'
|
|
22
|
+
}]]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
IntroductionPreview.propTypes = {
|
|
26
|
+
text: PropTypes.string.isRequired
|
|
27
|
+
};
|
|
28
|
+
export default IntroductionPreview;
|