@abtnode/ux 1.16.17-beta-952ef53d → 1.16.17-beta-d81014f4

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.
@@ -62,7 +62,6 @@ export default function DomainStatus({
62
62
  style: {
63
63
  color: '#D0021B',
64
64
  fontSize: 20,
65
- marginLeft: 8,
66
65
  cursor: 'pointer'
67
66
  }
68
67
  })
package/es/certificate.js CHANGED
@@ -36,7 +36,6 @@ export default function Certificate({
36
36
  style: {
37
37
  color: '#44cdc6',
38
38
  fontSize: 20,
39
- marginLeft: 8,
40
39
  cursor: 'pointer'
41
40
  }
42
41
  }), /*#__PURE__*/_jsx(Popover, {
package/es/dot.js CHANGED
@@ -6,8 +6,8 @@ const color = {
6
6
  const defaultSize = '10px';
7
7
  const Dot = styled.div`
8
8
  display: inline-block;
9
- width: ${props => props.size || defaultSize};
10
- height: ${props => props.size || defaultSize};
9
+ min-width: ${props => props.size || defaultSize};
10
+ min-height: ${props => props.size || defaultSize};
11
11
  background: ${props => color[props.color] || props.color || color.success};
12
12
  border-radius: 100%;
13
13
  `;
package/es/locales/en.js CHANGED
@@ -231,6 +231,7 @@ module.exports = {
231
231
  port: 'Port',
232
232
  pre: 'Previous',
233
233
  preferences: 'Preferences',
234
+ preview: 'Preview',
234
235
  protected: 'Protected',
235
236
  protocol: 'Protocol',
236
237
  publish: 'Publish',
@@ -1430,9 +1431,14 @@ module.exports = {
1430
1431
  hide: 'Hide navigation',
1431
1432
  show: 'Show navigation',
1432
1433
  del: 'Delete navigation',
1434
+ new: 'New',
1433
1435
  noAddSub: "Uninstalled component can't add sub navigation",
1434
1436
  noEdit: "Uninstalled component can't edit",
1435
- noDel: 'Not allowed delete built-in navigation'
1437
+ noDel: 'Not allowed delete built-in navigation',
1438
+ reset: 'Reset',
1439
+ restConfirmTitle: 'Do you want to clear all custom navigation?',
1440
+ restConfirmDesc: "After clearing, the navigation will be restored to Blocklet's original default configuration.",
1441
+ resetSuccessful: 'Reset successful'
1436
1442
  }
1437
1443
  },
1438
1444
  storage: {
package/es/locales/zh.js CHANGED
@@ -236,6 +236,7 @@ module.exports = {
236
236
  port: '端口',
237
237
  pre: '上一步',
238
238
  preferences: '偏好',
239
+ preview: '预览',
239
240
  protected: '受保护',
240
241
  protocol: '协议',
241
242
  publish: '发布',
@@ -1407,8 +1408,8 @@ module.exports = {
1407
1408
  }
1408
1409
  },
1409
1410
  navigation: {
1410
- navigation: '导航',
1411
1411
  actionFailed: '操作失败',
1412
+ navigation: '导航',
1412
1413
  form: {
1413
1414
  title: '标题',
1414
1415
  titlePlaceholder: '请输入导航标题',
@@ -1435,9 +1436,14 @@ module.exports = {
1435
1436
  hide: '隐藏导航',
1436
1437
  show: '显示导航',
1437
1438
  del: '删除导航',
1439
+ new: '新建',
1438
1440
  noAddSub: '未安装组件无法添加子导航',
1439
1441
  noEdit: '未安装组件的导航无法编辑',
1440
- noDel: '内置的导航无法删除'
1442
+ noDel: '内置的导航无法删除',
1443
+ reset: '重置',
1444
+ restConfirmTitle: '是否清空所有自定义导航?',
1445
+ restConfirmDesc: '清空后,导航会恢复到 Blocklet 原有默认的配置.',
1446
+ resetSuccessful: '重置成功'
1441
1447
  }
1442
1448
  },
1443
1449
  storage: {
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable react/no-unstable-nested-components */
2
- /* eslint-disable react/jsx-one-expression-per-line */
3
- import { useState, useContext } from 'react';
2
+ import { useContext } from 'react';
4
3
  import styled from '@emotion/styled';
5
4
  import { useNavigate, Link } from 'react-router-dom';
6
5
  import Typography from '@mui/material/Typography';
@@ -19,6 +18,7 @@ import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
19
18
  import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
20
19
  import DidConnect from '@arcblock/did-connect/lib/Connect';
21
20
  import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
21
+ import { useReactive } from 'ahooks';
22
22
  import CardSelector from './card-selector';
23
23
  import DidAddress from './did-address';
24
24
  import wrapLocale from './wrap-locale';
@@ -73,18 +73,21 @@ function LostPassport({
73
73
  api,
74
74
  session
75
75
  } = useContext(SessionContext);
76
+ const pageState = useReactive({
77
+ user: null,
78
+ passport: null,
79
+ success: false,
80
+ activeStep: 0
81
+ });
82
+ const {
83
+ setPassportId,
84
+ clearPassportId
85
+ } = usePassportId();
76
86
  const {
77
87
  t,
78
88
  locale
79
89
  } = useContext(LocaleContext);
80
- const [user, setUser] = useState(false);
81
- const [passport, setPassport] = useState(false);
82
- const [success, setSuccess] = useState(false);
83
90
  const navigate = useNavigate();
84
- const [activeStep, setActiveStep] = useState(0);
85
- const {
86
- setPassportId
87
- } = usePassportId();
88
91
  const {
89
92
  wallet: isWalletWebview
90
93
  } = useBrowser();
@@ -94,10 +97,10 @@ function LostPassport({
94
97
  searchParams
95
98
  } = new URL(window.location.href);
96
99
  const onNext = () => {
97
- setActiveStep(activeStep + 1);
100
+ pageState.activeStep++;
98
101
  };
99
102
  const onGetUser = result => {
100
- setUser(result.user);
103
+ pageState.user = result.user;
101
104
  };
102
105
  const onSelectPassport = () => {
103
106
  onNext();
@@ -106,7 +109,7 @@ function LostPassport({
106
109
  if (result?.passportId) {
107
110
  setPassportId(result.passportId);
108
111
  }
109
- setSuccess(true);
112
+ pageState.success = true;
110
113
  onNext();
111
114
  };
112
115
  const onUsePassport = () => {
@@ -123,28 +126,27 @@ function LostPassport({
123
126
  }
124
127
  const redirect = searchParams.get('redirect');
125
128
  if (redirect) {
126
- navigate(redirect, {
127
- replace: true
128
- });
129
+ window.location.replace(redirect);
129
130
  return;
130
131
  }
131
132
  if ((window.env?.apiPrefix || '').startsWith(WELLKNOWN_SERVICE_PATH_PREFIX)) {
132
- navigate(`${WELLKNOWN_SERVICE_PATH_PREFIX}/login`, {
133
+ navigate(`${WELLKNOWN_SERVICE_PATH_PREFIX}/connect`, {
133
134
  replace: true
134
135
  });
135
136
  return;
136
137
  }
137
- navigate('/', {
138
- replace: true
139
- });
138
+
139
+ // HACK: 因为默认页面不会处理 passportId 的逻辑,所以需要清除存储的信息
140
+ clearPassportId();
141
+ window.location.replace('/');
140
142
  };
141
- const handleChange = event => {
142
- setPassport(event.target.value);
143
+ const handleChangePassport = event => {
144
+ pageState.passport = event.target.value;
143
145
  };
144
146
  const steps = [{
145
147
  label: t('lostPassport.selectPassport'),
146
148
  content: () => {
147
- if (!user) {
149
+ if (!pageState.user) {
148
150
  return /*#__PURE__*/_jsx(DidConnect, {
149
151
  popup: true,
150
152
  open: true,
@@ -174,7 +176,7 @@ function LostPassport({
174
176
  alignItems: "center",
175
177
  className: "user-info",
176
178
  children: [/*#__PURE__*/_jsx(Avatar, {
177
- src: user.avatar,
179
+ src: pageState.user.avatar,
178
180
  style: {
179
181
  width: 48,
180
182
  height: 48,
@@ -184,12 +186,12 @@ function LostPassport({
184
186
  }), /*#__PURE__*/_jsxs(Box, {
185
187
  children: [/*#__PURE__*/_jsx(Box, {
186
188
  className: "name",
187
- children: user.fullName
189
+ children: pageState.user.fullName
188
190
  }), /*#__PURE__*/_jsx(Box, {
189
191
  className: "did",
190
192
  mt: 1,
191
193
  children: /*#__PURE__*/_jsx(DidAddress, {
192
- did: user.did
194
+ did: pageState.user.did
193
195
  })
194
196
  })]
195
197
  })]
@@ -198,24 +200,24 @@ function LostPassport({
198
200
  width: 230,
199
201
  height: 306,
200
202
  cardSpace: 24,
201
- list: user.passportTypes.map(x => {
203
+ list: pageState.user.passportTypes.map(x => {
202
204
  return {
203
205
  src: createPassportSvg({
204
206
  title: x.title,
205
207
  issuer: x.issuer.name,
206
208
  issuerDid: x.issuer.id,
207
- ownerDid: user.did,
208
- ownerName: user.fullName,
209
- ownerAvatarUrl: user.avatar,
209
+ ownerDid: pageState.user.did,
210
+ ownerName: pageState.user.fullName,
211
+ ownerAvatarUrl: pageState.user.avatar,
210
212
  preferredColor: passportColor || 'auto'
211
213
  }),
212
214
  name: x.title,
213
215
  id: x.id
214
216
  };
215
217
  }),
216
- onSelect: index => handleChange({
218
+ onSelect: index => handleChangePassport({
217
219
  target: {
218
- value: user.passportTypes[index].name
220
+ value: pageState.user.passportTypes[index].name
219
221
  }
220
222
  }),
221
223
  defaultIndex: 0
@@ -226,7 +228,7 @@ function LostPassport({
226
228
  variant: "contained",
227
229
  color: "primary",
228
230
  onClick: () => onSelectPassport(),
229
- disabled: !passport,
231
+ disabled: !pageState.passport,
230
232
  children: t('common.next')
231
233
  })
232
234
  })]
@@ -236,8 +238,8 @@ function LostPassport({
236
238
  label: t('lostPassport.receivePassport'),
237
239
  content: () => {
238
240
  const extraParams = {
239
- receiverDid: user.did,
240
- passportName: passport,
241
+ receiverDid: pageState.user.did,
242
+ passportName: pageState.passport,
241
243
  teamDid: window?.blocklet?.did || ''
242
244
  };
243
245
  return /*#__PURE__*/_jsx(DidConnect, {
@@ -294,7 +296,7 @@ function LostPassport({
294
296
  children: [/*#__PURE__*/_jsx(Stepper, {
295
297
  className: "stepper-progress",
296
298
  alternativeLabel: true,
297
- activeStep: activeStep,
299
+ activeStep: pageState.activeStep,
298
300
  children: steps.map(({
299
301
  label
300
302
  }) => /*#__PURE__*/_jsx(Step, {
@@ -305,8 +307,8 @@ function LostPassport({
305
307
  }, label))
306
308
  }), /*#__PURE__*/_jsx("div", {
307
309
  className: "stepper-content",
308
- children: steps[activeStep].content()
309
- }), !success && /*#__PURE__*/_jsx(Box, {
310
+ children: steps[pageState.activeStep].content()
311
+ }), !pageState.success && /*#__PURE__*/_jsx(Box, {
310
312
  textAlign: "center",
311
313
  fontSize: 12,
312
314
  children: /*#__PURE__*/_jsx(Link, {
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import styled from '@emotion/styled';
4
4
  import AddIcon from '@mui/icons-material/Add';
5
5
  import Box from '@mui/material/Box';
6
+ import Toast from '@arcblock/ux/lib/Toast';
6
7
  import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
7
8
  import Button from '@arcblock/ux/lib/Button';
8
9
  import SplitButton from '@arcblock/ux/lib/SplitButton';
@@ -10,7 +11,7 @@ import Spinner from '@mui/material/CircularProgress';
10
11
  import EditIcon from '@arcblock/icons/lib/EditIcon';
11
12
  import LockIcon from '@arcblock/icons/lib/LockIcon';
12
13
  import ExternalIssuerIcon from '@arcblock/icons/lib/ExternalIssuerIcon';
13
- import Toast from '@arcblock/ux/lib/Toast';
14
+ import useMediaQuery from '@mui/material/useMediaQuery';
14
15
  import { useNodeContext } from '../../contexts/node';
15
16
  import { useTeamContext } from '../../contexts/team';
16
17
  import { sleep, isProtectedRole, BlockletAdminRoles } from '../../util';
@@ -52,6 +53,7 @@ export default function PassportList({
52
53
  const [showTrustedFactories, setShowTrustedFactories] = useState(false);
53
54
  const [search, setSearch] = useState('');
54
55
  const [loading, setLoading] = useState(false);
56
+ const isMobile = useMediaQuery(x => x.breakpoints.down('md'));
55
57
  const toggleShowIssue = async e => {
56
58
  e.stopPropagation();
57
59
  if (loading) {
@@ -176,6 +178,10 @@ export default function PassportList({
176
178
  className: "list",
177
179
  children: filteredRoles.map(role => /*#__PURE__*/_jsxs(Box, {
178
180
  "data-cy": `passport-${role.name}`,
181
+ sx: {
182
+ display: 'flex',
183
+ justifyContent: 'space-between'
184
+ },
179
185
  className: "item",
180
186
  display: "flex",
181
187
  alignItems: "center",
@@ -205,7 +211,7 @@ export default function PassportList({
205
211
  className: "title",
206
212
  children: role.title
207
213
  })]
208
- }), /*#__PURE__*/_jsx(Box, {
214
+ }), !isMobile && /*#__PURE__*/_jsx(Box, {
209
215
  className: "description",
210
216
  children: role.description
211
217
  }), /*#__PURE__*/_jsx(Permission, {
@@ -27,7 +27,6 @@ var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
27
27
  var _util = require("@blocklet/meta/lib/util");
28
28
  var _context = require("@arcblock/ux/lib/Locale/context");
29
29
  var _constant = require("@blocklet/constant");
30
- var _constant2 = require("@abtnode/constant");
31
30
  var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
32
31
  var _util2 = require("../util");
33
32
  var _util3 = require("./util");
@@ -291,7 +290,7 @@ function BlockletActions(_ref) {
291
290
  }
292
291
  }
293
292
  };
294
- const removeAction = !inService && (0, _util.isDeletableBlocklet)(blocklet) && blocklet.structVersion === _constant2.APP_STRUCT_VERSION ? {
293
+ const removeAction = !inService && (0, _util.isDeletableBlocklet)(blocklet) ? {
295
294
  action: 'remove',
296
295
  icon: _icons.default.Remove,
297
296
  name: t('common.remove'),
@@ -587,7 +587,7 @@ function AddComponent(_ref2) {
587
587
  } else {
588
588
  var _component$current$me, _component$current$me2;
589
589
  doc = _objectSpread(_objectSpread({}, doc), {}, {
590
- pathPrefix: hasRootPath ? "/".concat((0, _urlPathFriendly.default)(name)) : '/',
590
+ pathPrefix: hasRootPath ? "/".concat((0, _urlPathFriendly.default)(title) || (0, _urlPathFriendly.default)(name)) : '/',
591
591
  title: title || '',
592
592
  componentName: '',
593
593
  hasEnvironmentsStep: ((_component$current$me = component.current.meta) === null || _component$current$me === void 0 ? void 0 : (_component$current$me2 = _component$current$me.environments) === null || _component$current$me2 === void 0 ? void 0 : _component$current$me2.length) > 0