@blocklet/launcher-layout 2.3.19 → 2.3.21

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.
@@ -1,238 +0,0 @@
1
- import { createElement } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { getDisplayName } from '@blocklet/meta/lib/util';
4
- import get from 'lodash/get';
5
- import styled from '@emotion/styled';
6
- import RehypeReact from 'rehype-react';
7
- import Table from '@mui/material/Table';
8
- import TableBody from '@mui/material/TableBody';
9
- import TableCell from '@mui/material/TableCell';
10
- import TableContainer from '@mui/material/TableContainer';
11
- import TableRow from '@mui/material/TableRow';
12
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
- const isFreeBlocklet = meta => {
14
- if (!meta.payment) {
15
- return true;
16
- }
17
- const priceList = (meta.payment.price || []).map(x => x.value || 0);
18
- return priceList.every(x => x === 0);
19
- };
20
- const renderAst = new RehypeReact({
21
- createElement
22
- }).Compiler;
23
- const localeData = {
24
- zh: {
25
- appinfo: {
26
- name: '应用名',
27
- version: '版本号',
28
- author: '开发者',
29
- description: '描述',
30
- community: '社区地址',
31
- documentation: '文档手册',
32
- support: '服务支持',
33
- overview: '概述',
34
- requirements: '节点版本要求'
35
- }
36
- },
37
- en: {
38
- appinfo: {
39
- name: 'Name',
40
- version: 'Version',
41
- author: 'Author',
42
- description: 'Description',
43
- community: 'Community',
44
- documentation: 'Documentation',
45
- support: 'Support',
46
- overview: 'Overview',
47
- requirements: 'Server requirements'
48
- }
49
- }
50
- };
51
- function WizardDesc({
52
- blockletMeta,
53
- locale,
54
- handleDescEle
55
- }) {
56
- const {
57
- data
58
- } = blockletMeta;
59
- const name = getDisplayName({
60
- meta: data
61
- });
62
- const blockletDesc = data && data.htmlAst ? renderAst(data.htmlAst) : '';
63
- const isFree = isFreeBlocklet(data);
64
- const infos = [{
65
- key: get(localeData[locale], 'appinfo.name'),
66
- value: getDisplayName({
67
- meta: data
68
- })
69
- }, {
70
- key: get(localeData[locale], 'appinfo.version'),
71
- value: data.version
72
- }, {
73
- key: get(localeData[locale], 'appinfo.author'),
74
- value: get(data, 'author.name')
75
- }, {
76
- type: 'description',
77
- key: get(localeData[locale], 'appinfo.description'),
78
- value: data.description
79
- }];
80
- if (data.requirements) {
81
- infos.push({
82
- key: get(localeData[locale], 'appinfo.requirements'),
83
- value: data.requirements.server
84
- });
85
- }
86
- if (data.community) {
87
- infos.push({
88
- key: get(localeData[locale], 'appinfo.community'),
89
- value: /*#__PURE__*/_jsx("a", {
90
- href: data.community,
91
- target: "_blank",
92
- rel: "noreferrer",
93
- children: data.community
94
- })
95
- });
96
- }
97
- if (data.documentation) {
98
- infos.push({
99
- key: get(localeData[locale], 'appinfo.documentation'),
100
- value: /*#__PURE__*/_jsx("a", {
101
- href: data.documentation,
102
- target: "_blank",
103
- rel: "noreferrer",
104
- children: data.documentation
105
- })
106
- });
107
- }
108
- if (data.support) {
109
- infos.push({
110
- key: get(localeData[locale], 'appinfo.support'),
111
- value: /*#__PURE__*/_jsx("a", {
112
- href: `mailto:${data.support}`,
113
- target: "_blank",
114
- rel: "noreferrer",
115
- children: data.support
116
- })
117
- });
118
- }
119
- if (blockletDesc) {
120
- infos.push({
121
- key: get(localeData[locale], 'appinfo.overview'),
122
- value: ''
123
- });
124
- }
125
- let descEle;
126
- if (locale === 'zh') {
127
- descEle = /*#__PURE__*/_jsxs(_Fragment, {
128
- children: [isFree ? /*#__PURE__*/_jsxs("p", {
129
- children: ["\u60A8\u53EF\u4EE5\u514D\u8D39\u4F7F\u7528 ", /*#__PURE__*/_jsx("b", {
130
- children: name
131
- }), "\uFF1B"]
132
- }) : /*#__PURE__*/_jsxs("p", {
133
- children: ["\u60A8\u9700\u8981\u8D2D\u4E70\u624D\u80FD\u4F7F\u7528 ", /*#__PURE__*/_jsx("b", {
134
- children: name
135
- }), "\uFF1B"]
136
- }), /*#__PURE__*/_jsx("p", {
137
- children: "\u5728\u5E94\u7528\u542F\u52A8\u524D\uFF0C\u9700\u8981\u9009\u62E9\u60A8\u7684\u8282\u70B9\uFF1B"
138
- }), /*#__PURE__*/_jsx("p", {
139
- children: "\u5982\u679C\u60A8\u6CA1\u6709\u8282\u70B9\uFF0C\u6211\u4EEC\u4F1A\u5F15\u5BFC\u60A8\u521B\u5EFA\u65B0\u7684\u8282\u70B9\uFF1B"
140
- }), /*#__PURE__*/_jsx("p", {
141
- children: "\u4E0B\u9762\u4E3A\u8BE5\u5E94\u7528\u7684\u4FE1\u606F\uFF1A"
142
- })]
143
- });
144
- } else {
145
- descEle = /*#__PURE__*/_jsxs(_Fragment, {
146
- children: [isFree ? /*#__PURE__*/_jsxs("p", {
147
- children: ["You can use ", /*#__PURE__*/_jsx("b", {
148
- children: name
149
- }), " for free;"]
150
- }) : /*#__PURE__*/_jsxs("p", {
151
- children: ["You need to purchase before launch ", /*#__PURE__*/_jsx("b", {
152
- children: name
153
- }), ";"]
154
- }), /*#__PURE__*/_jsx("p", {
155
- children: "Before the blocklet starts, you need to select your Blocklet Server; "
156
- }), /*#__PURE__*/_jsx("p", {
157
- children: "If you do not have any Blocklet Server, we will guide you to create a new one; "
158
- }), /*#__PURE__*/_jsx("p", {
159
- children: "Below is the information for the blocklet: "
160
- })]
161
- });
162
- }
163
- return /*#__PURE__*/_jsxs(Container, {
164
- children: [handleDescEle || descEle, /*#__PURE__*/_jsx("div", {
165
- className: "info-table",
166
- children: /*#__PURE__*/_jsx(TableContainer, {
167
- children: /*#__PURE__*/_jsx(Table, {
168
- size: "small",
169
- children: /*#__PURE__*/_jsx(TableBody, {
170
- children: infos.map(e => {
171
- return /*#__PURE__*/_jsxs(TableRow, {
172
- children: [/*#__PURE__*/_jsx(TableCell, {
173
- component: "th",
174
- scope: "row",
175
- style: {
176
- width: 100
177
- },
178
- children: /*#__PURE__*/_jsx("div", {
179
- style: {
180
- fontWeight: 'bold',
181
- whiteSpace: 'nowrap'
182
- },
183
- children: e.key
184
- })
185
- }), /*#__PURE__*/_jsx(TableCell, {
186
- children: e.value
187
- })]
188
- }, e.key);
189
- })
190
- })
191
- })
192
- })
193
- }), /*#__PURE__*/_jsx("div", {
194
- className: "app-overview",
195
- children: blockletDesc
196
- })]
197
- });
198
- }
199
- const Container = styled.div`
200
- .info-table {
201
- a {
202
- word-break: break-all;
203
- }
204
- }
205
- .app-overview {
206
- font-size: 16px;
207
- margin: 16px 0 0 16px;
208
- h1 {
209
- margin: 8px 0;
210
- font-size: 20px;
211
- }
212
- h2 {
213
- margin: 8px 0;
214
- font-size: 18px;
215
- }
216
- ul {
217
- display: block;
218
- list-style-type: disc;
219
- padding-left: 2em;
220
- li {
221
- display: list-item;
222
- list-style: disc;
223
- }
224
- }
225
- blockquote {
226
- margin-left: 2em;
227
- }
228
- }
229
- `;
230
- WizardDesc.propTypes = {
231
- blockletMeta: PropTypes.object.isRequired,
232
- locale: PropTypes.string.isRequired,
233
- handleDescEle: PropTypes.node
234
- };
235
- WizardDesc.defaultProps = {
236
- handleDescEle: ''
237
- };
238
- export default WizardDesc;