@abtnode/ux 1.16.29-beta-87e06e1c → 1.16.29-beta-112566d5

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.
@@ -59,7 +59,7 @@ const StepContent = /*#__PURE__*/forwardRef(({
59
59
  }) : null,
60
60
  stepTip: t('blocklet.component.add'),
61
61
  children: /*#__PURE__*/_jsx(RightContent, {
62
- children: step?.body && typeof step.body === 'function' ? step.body() : step.body
62
+ children: typeof step?.body === 'function' ? step.body() : step?.body
63
63
  })
64
64
  })
65
65
  });
@@ -113,8 +113,6 @@ const ContentWrapper = styled(Box)`
113
113
  }
114
114
  }
115
115
 
116
-
117
-
118
116
  // content-panel
119
117
  .root-header + div{
120
118
  padding-top: 0;
@@ -320,6 +320,9 @@ export const StyledBadge = styled(Badge)`
320
320
  }
321
321
  `;
322
322
  export const StyledComponentRow = styled(Box)`
323
+ &:hover {
324
+ background-color: rgba(0, 0, 0, 0.05);
325
+ }
323
326
  .component-header {
324
327
  display: flex;
325
328
  align-items: center;
@@ -1,7 +1,8 @@
1
1
  import Button from '@arcblock/ux/lib/Button';
2
2
  import styled from '@emotion/styled';
3
3
  import PropTypes from 'prop-types';
4
- import React, { Fragment, useMemo, useState } from 'react';
4
+ import trim from 'lodash/trim';
5
+ import React, { Fragment, useCallback, useMemo, useState } from 'react';
5
6
  import AddIcon from '@mui/icons-material/Add';
6
7
  import DiamondIcon from '@mui/icons-material/Diamond';
7
8
  import ExpandLess from '@mui/icons-material/ExpandLess';
@@ -16,13 +17,14 @@ import Tooltip from '@mui/material/Tooltip';
16
17
  import Typography from '@mui/material/Typography';
17
18
  import useTheme from '@mui/material/styles/useTheme';
18
19
  import useMediaQuery from '@mui/material/useMediaQuery';
20
+ import Spinner from '@mui/material/CircularProgress';
19
21
  import { encode as encodeBase32 } from '@abtnode/util/lib/base32';
20
22
  import { isDidDomain } from '@abtnode/util/lib/url-evaluation';
21
23
  import LockIcon from '@arcblock/icons/lib/LockIcon';
22
24
  import Empty from '@arcblock/ux/lib/Empty';
23
25
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
24
26
  import { isAccessible, isInProgress } from '@blocklet/meta/lib/util';
25
- import Spinner from '@mui/material/CircularProgress';
27
+ import { CopyButton } from '@arcblock/ux/lib/ClickToCopy';
26
28
  import { useBlockletContext } from '../../contexts/blocklet';
27
29
  import { useNodeContext } from '../../contexts/node';
28
30
  import DidAddress from '../../did-address';
@@ -278,16 +280,30 @@ function DomainLink({
278
280
  ...rest
279
281
  }) {
280
282
  const {
281
- t
283
+ t,
284
+ locale
282
285
  } = useLocaleContext();
283
286
  const {
284
287
  href,
285
- accessibility
288
+ accessibility,
289
+ value: domainValue
286
290
  } = domain;
291
+ const renderCopyButton = useCallback(() => {
292
+ return /*#__PURE__*/_jsx(CopyButton, {
293
+ content: trim(domainValue),
294
+ locale: locale,
295
+ style: {
296
+ marginLeft: '4px',
297
+ color: '#999',
298
+ fontSize: '0.8em',
299
+ verticalAlign: 'bottom'
300
+ }
301
+ });
302
+ }, [domainValue, locale]);
287
303
  if (!accessibility || accessibility.loading) {
288
304
  return /*#__PURE__*/_jsxs(LinkDiv, {
289
305
  ...rest,
290
- children: [children, /*#__PURE__*/_jsx(Tooltip, {
306
+ children: [children, renderCopyButton(), /*#__PURE__*/_jsx(Tooltip, {
291
307
  title: t('blocklet.router.checkUrlAccessible'),
292
308
  placement: "top-end",
293
309
  children: /*#__PURE__*/_jsx("span", {
@@ -300,25 +316,26 @@ function DomainLink({
300
316
  });
301
317
  }
302
318
  if (!accessibility.accessible) {
303
- return /*#__PURE__*/_jsx(LinkDiv, {
319
+ return /*#__PURE__*/_jsxs(LinkDiv, {
304
320
  ...rest,
305
- children: /*#__PURE__*/_jsx(Tooltip, {
321
+ children: [/*#__PURE__*/_jsx(Tooltip, {
306
322
  title: t('blocklet.router.urlInaccessible'),
307
323
  placement: "top-end",
308
324
  children: /*#__PURE__*/_jsx("span", {
309
325
  children: children
310
326
  })
311
- })
327
+ }), renderCopyButton()]
312
328
  });
313
329
  }
314
- return /*#__PURE__*/_jsx(LinkDiv, {
330
+ return /*#__PURE__*/_jsxs(LinkDiv, {
315
331
  ...rest,
316
- children: /*#__PURE__*/_jsx("a", {
332
+ children: [/*#__PURE__*/_jsx(Box, {
333
+ component: "a",
317
334
  href: href,
318
335
  target: "_blank",
319
336
  rel: "noopener noreferrer",
320
337
  children: children
321
- })
338
+ }), renderCopyButton()]
322
339
  });
323
340
  }
324
341
  DomainLink.propTypes = {
@@ -330,6 +347,9 @@ const LinkDiv = styled.span`
330
347
  & > * {
331
348
  color: #222;
332
349
  font-size: 18px;
350
+ }
351
+
352
+ & > * {
333
353
  word-break: break-all;
334
354
  }
335
355
 
@@ -409,6 +429,7 @@ function InnerAddDomain({
409
429
  onMouseEnter: handlePopoverOpen,
410
430
  onMouseLeave: handlePopoverClose,
411
431
  style: {
432
+ marginTop: '0.2em',
412
433
  cursor: 'pointer',
413
434
  fill: theme.palette.primary.main
414
435
  }
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { ListItemIcon, ListItemText, MenuItem } from '@mui/material';
3
+ import { ListItemIcon, ListItemText, MenuItem, Typography } from '@mui/material';
4
4
  import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
5
5
  import Confirm from '@arcblock/ux/lib/Dialog/confirm';
6
6
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
@@ -73,8 +73,11 @@ function DeleteDIDSpacesGateWay({
73
73
  children: t('common.delete')
74
74
  })]
75
75
  }), /*#__PURE__*/_jsx(Confirm, {
76
- title: t('common.delConfirmDescription', {
77
- data: `${spaceGateway?.name}`
76
+ title: /*#__PURE__*/_jsx(Typography, {
77
+ variant: "h6",
78
+ children: t('common.delConfirmDescription', {
79
+ data: `${spaceGateway?.name}`
80
+ })
78
81
  }),
79
82
  open: open,
80
83
  confirmButton: {
@@ -219,7 +219,7 @@ function Disconnect() {
219
219
  alignContent: "center",
220
220
  children: [/*#__PURE__*/_jsx(EmptySpacesNFT, {
221
221
  style: {
222
- width: 200,
222
+ width: 250,
223
223
  height: 250
224
224
  }
225
225
  }), /*#__PURE__*/_jsx(Typography, {
@@ -1,16 +1,29 @@
1
1
  import React from 'react';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import Center from '@arcblock/ux/lib/Center';
4
+ import { CircularProgress } from '@mui/material';
2
5
  import Disconnect from './disconnect';
3
6
  import Connected from './connected';
4
- import { useBlockletStorageContext } from '../../contexts/blocklet-storage';
7
+ import { BlockletStorageProvider, useBlockletStorageContext } from '../../contexts/blocklet-storage';
5
8
  import { jsx as _jsx } from "react/jsx-runtime";
6
- function NewStorage() {
9
+ function StoragePage() {
7
10
  const {
8
- backupEndpoint
11
+ spaceGatewaysLoading,
12
+ spaceGateways
9
13
  } = useBlockletStorageContext();
10
- if (backupEndpoint) {
11
- return /*#__PURE__*/_jsx(Connected, {});
14
+ if (spaceGatewaysLoading) {
15
+ return /*#__PURE__*/_jsx(Center, {
16
+ relative: "parent",
17
+ children: /*#__PURE__*/_jsx(CircularProgress, {})
18
+ });
12
19
  }
13
- return /*#__PURE__*/_jsx(Disconnect, {});
20
+ if (isEmpty(spaceGateways)) {
21
+ return /*#__PURE__*/_jsx(Disconnect, {});
22
+ }
23
+ return /*#__PURE__*/_jsx(Connected, {});
14
24
  }
15
- NewStorage.propTypes = {};
16
- export default NewStorage;
25
+ export default function Storage() {
26
+ return /*#__PURE__*/_jsx(BlockletStorageProvider, {
27
+ children: /*#__PURE__*/_jsx(StoragePage, {})
28
+ });
29
+ }
@@ -104,6 +104,20 @@ function BlockletStorageProvider({
104
104
  setAutoCheckUpdateRefresh(x => !x);
105
105
  };
106
106
 
107
+ /**
108
+ * @description
109
+ * @param {AutoBackup} value
110
+ */
111
+ const updateAutoBackup = async value => {
112
+ await api.updateAutoBackup({
113
+ input: {
114
+ did: blocklet.meta.did,
115
+ autoBackup: value
116
+ }
117
+ });
118
+ refreshAutoBackup();
119
+ };
120
+
107
121
  /**
108
122
  * @description
109
123
  * @param {SpaceGateway} spaceGateway
@@ -144,6 +158,22 @@ function BlockletStorageProvider({
144
158
  if (!spaceGateway) {
145
159
  return;
146
160
  }
161
+ if (spaceGateway.endpoint === backupEndpoint) {
162
+ await api.configBlocklet({
163
+ input: {
164
+ did: [blocklet.meta.did],
165
+ configs: [{
166
+ key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,
167
+ value: ''
168
+ }]
169
+ }
170
+ });
171
+ if (autoBackup?.enabled) {
172
+ await updateAutoBackup({
173
+ enabled: false
174
+ });
175
+ }
176
+ }
147
177
  await api.deleteBlockletSpaceGateway({
148
178
  input: {
149
179
  did: blocklet.meta.did,
@@ -190,20 +220,6 @@ function BlockletStorageProvider({
190
220
  * @param {SpaceGateway} spaceGateway
191
221
  */
192
222
  const spaceGatewayIsSelected = spaceGateway => spaceGateway?.endpoint === backupEndpoint;
193
-
194
- /**
195
- * @description
196
- * @param {AutoBackup} value
197
- */
198
- const updateAutoBackup = async value => {
199
- await api.updateAutoBackup({
200
- input: {
201
- did: blocklet.meta.did,
202
- autoBackup: value
203
- }
204
- });
205
- refreshAutoBackup();
206
- };
207
223
  const updateAutoCheckUpdate = async value => {
208
224
  await api.updateAutoCheckUpdate({
209
225
  input: {
@@ -3,6 +3,13 @@ import { useAsyncEffect } from 'ahooks';
3
3
  import { useState } from 'react';
4
4
  import { useBlockletContext } from '../contexts/blocklet';
5
5
  import { useNodeContext } from '../contexts/node';
6
+
7
+ /**
8
+ * @description
9
+ * @export
10
+ * @param {*} [{ deps }={ deps: [] }]
11
+ * @return {import('@abtnode/client').AutoBackup | null}
12
+ */
6
13
  export function useAutoBackup({
7
14
  deps
8
15
  } = {
@@ -23,10 +23,7 @@ export default function useSpaceGateways({
23
23
  } = {}) {
24
24
  /** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
25
25
  const {
26
- blocklet,
27
- actions: {
28
- refreshBlocklet
29
- }
26
+ blocklet
30
27
  } = useBlockletContext();
31
28
  const blockletDid = blocklet?.meta?.did;
32
29
  const [spaceGateways, setSpaceGateways] = useState([]);
@@ -59,7 +56,7 @@ export default function useSpaceGateways({
59
56
  } finally {
60
57
  setLoading?.(false);
61
58
  }
62
- }, [blockletDid, refreshBlocklet, refresh]);
59
+ }, [blockletDid, refresh]);
63
60
  return {
64
61
  spaceGateways
65
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.29-beta-87e06e1c",
3
+ "version": "1.16.29-beta-112566d5",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,24 +25,24 @@
25
25
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
26
26
  "license": "Apache-2.0",
27
27
  "dependencies": {
28
- "@abtnode/auth": "1.16.29-beta-87e06e1c",
29
- "@abtnode/constant": "1.16.29-beta-87e06e1c",
30
- "@abtnode/util": "1.16.29-beta-87e06e1c",
28
+ "@abtnode/auth": "1.16.29-beta-112566d5",
29
+ "@abtnode/constant": "1.16.29-beta-112566d5",
30
+ "@abtnode/util": "1.16.29-beta-112566d5",
31
31
  "@ahooksjs/use-url-state": "^3.5.1",
32
32
  "@arcblock/did": "^1.18.126",
33
- "@arcblock/did-connect": "^2.10.3",
33
+ "@arcblock/did-connect": "^2.10.5",
34
34
  "@arcblock/did-motif": "^1.1.13",
35
- "@arcblock/icons": "^2.10.3",
36
- "@arcblock/nft-display": "2.10.3",
37
- "@arcblock/react-hooks": "^2.10.3",
38
- "@arcblock/terminal": "^2.10.3",
39
- "@arcblock/ux": "^2.10.3",
40
- "@blocklet/constant": "1.16.29-beta-87e06e1c",
41
- "@blocklet/js-sdk": "1.16.29-beta-87e06e1c",
42
- "@blocklet/launcher-layout": "2.3.28",
43
- "@blocklet/list": "^0.13.8",
44
- "@blocklet/meta": "1.16.29-beta-87e06e1c",
45
- "@blocklet/ui-react": "^2.10.3",
35
+ "@arcblock/icons": "^2.10.5",
36
+ "@arcblock/nft-display": "2.10.5",
37
+ "@arcblock/react-hooks": "^2.10.5",
38
+ "@arcblock/terminal": "^2.10.5",
39
+ "@arcblock/ux": "^2.10.5",
40
+ "@blocklet/constant": "1.16.29-beta-112566d5",
41
+ "@blocklet/js-sdk": "1.16.29-beta-112566d5",
42
+ "@blocklet/launcher-layout": "2.3.30",
43
+ "@blocklet/list": "^0.13.9",
44
+ "@blocklet/meta": "1.16.29-beta-112566d5",
45
+ "@blocklet/ui-react": "^2.10.5",
46
46
  "@blocklet/uploader": "0.1.19",
47
47
  "@emotion/react": "^11.10.4",
48
48
  "@emotion/styled": "^11.10.4",
@@ -108,5 +108,5 @@
108
108
  "jest": "^29.7.0",
109
109
  "jest-environment-jsdom": "^29.7.0"
110
110
  },
111
- "gitHead": "e6a32801bc392566448d4df00c2ae68717f39822"
111
+ "gitHead": "4c6213560b79dc862b0b5e48b50f65c39de54aef"
112
112
  }