@arcblock/ux 2.10.46 → 2.10.48

Sign up to get free protection for your applications and to get access to all the features.
@@ -90,7 +90,7 @@ const Div = styled('div')`
90
90
  padding-bottom: ${props => props.theme.spacing(2)};
91
91
  }
92
92
  .arcblock-blocklet__text {
93
- height: 57px;
93
+ height: 65px;
94
94
  overflow: hidden;
95
95
  }
96
96
  /* 设置多行文本溢出显示省略号 兼容fireFox、safari */
@@ -17,6 +17,7 @@ interface IDIDPropTypes extends IDidAddressWrapper {
17
17
  endChars?: number;
18
18
  locale?: 'en' | 'zh';
19
19
  chainId?: string;
20
+ roleType?: number;
20
21
  }
21
22
  export interface HTMLDIDElement extends HTMLDidAddressElement {
22
23
  openQRCode: () => void;
package/lib/DID/index.js CHANGED
@@ -15,7 +15,7 @@ import { translate } from '../Locale/util';
15
15
  import { getDIDColor, isEthereumDid } from '../Util';
16
16
  const translations = {
17
17
  en: {
18
- scanQrcode: 'Scan with DID Wallet to view this {role}',
18
+ scanQrcode: 'Scan with DID Wallet to view the {role}',
19
19
  download: 'Download',
20
20
  downloadTips: "Don't have DID Wallet ?"
21
21
  },
@@ -47,6 +47,9 @@ const isSquareMotif = roleType => {
47
47
  return !roles[roleType];
48
48
  };
49
49
  const getRoleName = roleType => {
50
+ if (roleType === types.RoleType.ROLE_ANY) {
51
+ return 'DID';
52
+ }
50
53
  const [roleName] = Object.entries(types.RoleType).find(item => item[1] === roleType) || [];
51
54
  if (roleName) {
52
55
  // UpperCase first word, example:
@@ -54,7 +57,7 @@ const getRoleName = roleType => {
54
57
  // ROLE_APPLICATION -> Application
55
58
  return roleName.toLowerCase().replace(/role_(\S)/g, (_, $1) => $1.toUpperCase());
56
59
  }
57
- return 'Address';
60
+ return 'DID';
58
61
  };
59
62
  const getAvatarSize = (didMotifInfo, isEthDid, size) => {
60
63
  if (isEthDid) {
@@ -223,7 +226,7 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
223
226
  fontSize: 18
224
227
  },
225
228
  children: t('scanQrcode', {
226
- role: getRoleName(didMotifInfo?.roleType)
229
+ role: getRoleName(props.roleType || didMotifInfo?.roleType)
227
230
  })
228
231
  }), /*#__PURE__*/_jsx(QRCode
229
232
  // eslint-disable-next-line max-len
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.10.46",
3
+ "version": "2.10.48",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -64,12 +64,12 @@
64
64
  "react": ">=18.2.0",
65
65
  "react-router-dom": ">=6.22.3"
66
66
  },
67
- "gitHead": "ae503a7f61a29ddfe9fdc5a1b0e040fa5890dc75",
67
+ "gitHead": "cf51a0c10a0db976cde5ea88c0c7f9bc9aad6895",
68
68
  "dependencies": {
69
69
  "@arcblock/did-motif": "^1.1.13",
70
- "@arcblock/icons": "^2.10.46",
71
- "@arcblock/nft-display": "^2.10.46",
72
- "@arcblock/react-hooks": "^2.10.46",
70
+ "@arcblock/icons": "^2.10.48",
71
+ "@arcblock/nft-display": "^2.10.48",
72
+ "@arcblock/react-hooks": "^2.10.48",
73
73
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
74
74
  "@fontsource/inter": "^5.0.16",
75
75
  "@fontsource/ubuntu-mono": "^5.0.18",
@@ -91,7 +91,7 @@ const Div = styled('div')`
91
91
  padding-bottom: ${(props) => props.theme.spacing(2)};
92
92
  }
93
93
  .arcblock-blocklet__text {
94
- height: 57px;
94
+ height: 65px;
95
95
  overflow: hidden;
96
96
  }
97
97
  /* 设置多行文本溢出显示省略号 兼容fireFox、safari */
package/src/DID/index.tsx CHANGED
@@ -18,7 +18,7 @@ import { getDIDColor, isEthereumDid } from '../Util';
18
18
 
19
19
  const translations = {
20
20
  en: {
21
- scanQrcode: 'Scan with DID Wallet to view this {role}',
21
+ scanQrcode: 'Scan with DID Wallet to view the {role}',
22
22
  download: 'Download',
23
23
  downloadTips: "Don't have DID Wallet ?",
24
24
  },
@@ -45,6 +45,7 @@ interface IDIDPropTypes extends IDidAddressWrapper {
45
45
  endChars?: number;
46
46
  locale?: 'en' | 'zh';
47
47
  chainId?: string;
48
+ roleType?: number;
48
49
  }
49
50
 
50
51
  const DEFAULT_CHAIN_ID = 'xenon-2020-01-15';
@@ -72,8 +73,11 @@ const isSquareMotif = (roleType: number) => {
72
73
  };
73
74
 
74
75
  const getRoleName = (roleType: number) => {
75
- const [roleName] = Object.entries(types.RoleType).find((item) => item[1] === roleType) || [];
76
+ if (roleType === types.RoleType.ROLE_ANY) {
77
+ return 'DID';
78
+ }
76
79
 
80
+ const [roleName] = Object.entries(types.RoleType).find((item) => item[1] === roleType) || [];
77
81
  if (roleName) {
78
82
  // UpperCase first word, example:
79
83
  // ROLE_ACCOUNT -> Account
@@ -81,7 +85,7 @@ const getRoleName = (roleType: number) => {
81
85
  return roleName.toLowerCase().replace(/role_(\S)/g, (_, $1) => $1.toUpperCase());
82
86
  }
83
87
 
84
- return 'Address';
88
+ return 'DID';
85
89
  };
86
90
 
87
91
  const getAvatarSize = (didMotifInfo: any, isEthDid: boolean, size: number) => {
@@ -268,7 +272,7 @@ const DID = forwardRef<HTMLDIDElement, IDIDPropTypes>((props, ref) => {
268
272
  {/* @ts-ignore */}
269
273
  <DialogContent align="center" sx={{ p: 3 }}>
270
274
  <Typography sx={{ mb: 2, fontWeight: 500, fontSize: 18 }}>
271
- {t('scanQrcode', { role: getRoleName(didMotifInfo?.roleType) })}
275
+ {t('scanQrcode', { role: getRoleName(props.roleType || didMotifInfo?.roleType) })}
272
276
  </Typography>
273
277
  <QRCode
274
278
  // eslint-disable-next-line max-len