@arcblock/ux 3.4.9 → 3.4.10
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,32 +1,32 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Box as
|
|
3
|
-
import { Icon as
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import { Box as o, Typography as C, Chip as v, alpha as I } from "@mui/material";
|
|
3
|
+
import { Icon as p } from "@iconify/react";
|
|
4
4
|
import S from "@iconify-icons/material-symbols/swap-horiz-rounded";
|
|
5
|
-
import
|
|
6
|
-
import { useMemoizedFn as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { getUserAvatar as
|
|
10
|
-
import
|
|
11
|
-
import { getWallet as
|
|
12
|
-
import { translations as
|
|
13
|
-
import { translate as
|
|
14
|
-
import
|
|
15
|
-
function
|
|
5
|
+
import _ from "@iconify-icons/material-symbols/arrow-right-alt-rounded";
|
|
6
|
+
import { useMemoizedFn as z, useCreation as d } from "ahooks";
|
|
7
|
+
import m from "lodash/noop";
|
|
8
|
+
import R from "../../Avatar/index.js";
|
|
9
|
+
import { getUserAvatar as D } from "../../Util/index.js";
|
|
10
|
+
import k from "./session-user-switch.js";
|
|
11
|
+
import { getWallet as N } from "../libs/utils.js";
|
|
12
|
+
import { translations as A } from "../libs/translation.js";
|
|
13
|
+
import { translate as U } from "../../Locale/util.js";
|
|
14
|
+
import W from "../../Tag/index.js";
|
|
15
|
+
function Q({
|
|
16
16
|
session: r,
|
|
17
17
|
onSwitchPassport: l,
|
|
18
18
|
onSwitchAccount: u,
|
|
19
19
|
onBindWallet: f,
|
|
20
|
-
onSwitchProfile: h =
|
|
20
|
+
onSwitchProfile: h = m,
|
|
21
21
|
locale: c = "en",
|
|
22
|
-
isBlocklet:
|
|
23
|
-
mode:
|
|
22
|
+
isBlocklet: a = !0,
|
|
23
|
+
mode: i = "normal"
|
|
24
24
|
}) {
|
|
25
|
-
const
|
|
26
|
-
(
|
|
27
|
-
), [r?.user?.passports, r?.user?.role]), y =
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
|
|
25
|
+
const s = z((t, b = {}) => U(A, t, c, "en", b)), g = D(r.user?.avatar?.replace(/\s/g, encodeURIComponent(" ")), 64), x = d(() => r.user?.passports?.find(
|
|
26
|
+
(t) => t.name === r.user.role || t.role === r.user.role
|
|
27
|
+
), [r?.user?.passports, r?.user?.role]), y = d(() => N(r?.user), [r?.user]);
|
|
28
|
+
return /* @__PURE__ */ n(
|
|
29
|
+
o,
|
|
30
30
|
{
|
|
31
31
|
sx: {
|
|
32
32
|
py: 2,
|
|
@@ -37,8 +37,8 @@ function V({
|
|
|
37
37
|
gap: 1.5
|
|
38
38
|
},
|
|
39
39
|
children: [
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
40
|
+
/* @__PURE__ */ n(
|
|
41
|
+
o,
|
|
42
42
|
{
|
|
43
43
|
sx: {
|
|
44
44
|
display: "flex",
|
|
@@ -48,8 +48,8 @@ function V({
|
|
|
48
48
|
px: 2
|
|
49
49
|
},
|
|
50
50
|
children: [
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
|
|
51
|
+
/* @__PURE__ */ n(
|
|
52
|
+
o,
|
|
53
53
|
{
|
|
54
54
|
sx: {
|
|
55
55
|
display: "flex",
|
|
@@ -57,21 +57,21 @@ function V({
|
|
|
57
57
|
gap: 1.5
|
|
58
58
|
},
|
|
59
59
|
children: [
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
i === "normal" ? /* @__PURE__ */ e(
|
|
61
|
+
o,
|
|
62
62
|
{
|
|
63
|
-
onClick:
|
|
63
|
+
onClick: a ? m : h,
|
|
64
64
|
"data-cy": "sessionManager-switch-profile-trigger",
|
|
65
65
|
sx: {
|
|
66
|
-
cursor:
|
|
66
|
+
cursor: a ? "default" : "pointer",
|
|
67
67
|
position: "relative",
|
|
68
68
|
borderRadius: "100%",
|
|
69
69
|
overflow: "hidden",
|
|
70
70
|
fontSize: 0,
|
|
71
71
|
flexShrink: 0,
|
|
72
|
-
"&:hover":
|
|
72
|
+
"&:hover": a ? {} : {
|
|
73
73
|
"&::after": {
|
|
74
|
-
content: `"${
|
|
74
|
+
content: `"${s("switch")}"`,
|
|
75
75
|
position: "absolute",
|
|
76
76
|
bottom: 0,
|
|
77
77
|
background: "rgba(0, 0, 0, 0.2)",
|
|
@@ -86,7 +86,7 @@ function V({
|
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
children: /* @__PURE__ */ e(
|
|
89
|
-
|
|
89
|
+
R,
|
|
90
90
|
{
|
|
91
91
|
variant: "circle",
|
|
92
92
|
did: r.user.did,
|
|
@@ -94,39 +94,40 @@ function V({
|
|
|
94
94
|
size: 48,
|
|
95
95
|
shape: "circle",
|
|
96
96
|
sx: {
|
|
97
|
-
cursor:
|
|
97
|
+
cursor: a ? "unset" : "pointer"
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
)
|
|
101
101
|
}
|
|
102
102
|
) : null,
|
|
103
|
-
/* @__PURE__ */ o
|
|
104
|
-
/* @__PURE__ */ e(C, { variant:
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
/* @__PURE__ */ n(o, { children: [
|
|
104
|
+
/* @__PURE__ */ e(C, { variant: i === "normal" ? "h6" : "h4", sx: { wordBreak: "break-word" }, children: r.user.fullName }),
|
|
105
|
+
i === "normal" ? null : /* @__PURE__ */ n(
|
|
106
|
+
W,
|
|
107
107
|
{
|
|
108
|
+
className: "user-info__connected-tag",
|
|
108
109
|
type: "primary",
|
|
109
110
|
sx: {
|
|
110
111
|
transform: "scale(0.85)",
|
|
111
112
|
transformOrigin: "left",
|
|
112
|
-
color: "white !important",
|
|
113
113
|
display: "flex",
|
|
114
114
|
alignItems: "center"
|
|
115
115
|
},
|
|
116
116
|
children: [
|
|
117
117
|
/* @__PURE__ */ e(
|
|
118
|
-
|
|
118
|
+
o,
|
|
119
119
|
{
|
|
120
|
+
className: "user-info__connected-tag__dot",
|
|
120
121
|
sx: {
|
|
121
122
|
mr: 0.75,
|
|
122
123
|
width: 6,
|
|
123
124
|
height: 6,
|
|
124
|
-
backgroundColor:
|
|
125
|
+
backgroundColor: (t) => t.palette.text.contrast,
|
|
125
126
|
borderRadius: "100vw"
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
),
|
|
129
|
-
/* @__PURE__ */ e(
|
|
130
|
+
/* @__PURE__ */ e(o, { className: "user-info__connected-tag__text", children: "DID CONNECTED" })
|
|
130
131
|
]
|
|
131
132
|
}
|
|
132
133
|
)
|
|
@@ -134,7 +135,7 @@ function V({
|
|
|
134
135
|
]
|
|
135
136
|
}
|
|
136
137
|
),
|
|
137
|
-
|
|
138
|
+
i === "normal" ? /* @__PURE__ */ e(
|
|
138
139
|
v,
|
|
139
140
|
{
|
|
140
141
|
label: x?.title || r.user?.role.toUpperCase(),
|
|
@@ -153,7 +154,7 @@ function V({
|
|
|
153
154
|
boxShadow: "none"
|
|
154
155
|
}
|
|
155
156
|
},
|
|
156
|
-
deleteIcon: /* @__PURE__ */ e(
|
|
157
|
+
deleteIcon: /* @__PURE__ */ e(p, { icon: S, color: "inherit" }),
|
|
157
158
|
onDelete: l,
|
|
158
159
|
onClick: l,
|
|
159
160
|
"data-cy": "sessionManager-switch-passport-trigger"
|
|
@@ -162,14 +163,14 @@ function V({
|
|
|
162
163
|
]
|
|
163
164
|
}
|
|
164
165
|
),
|
|
165
|
-
|
|
166
|
-
/* @__PURE__ */ e(
|
|
167
|
-
y ? null : /* @__PURE__ */
|
|
168
|
-
|
|
166
|
+
i === "normal" ? /* @__PURE__ */ n(w, { children: [
|
|
167
|
+
/* @__PURE__ */ e(k, { session: r, onSwitch: u, isBlocklet: a, locale: c }),
|
|
168
|
+
y ? null : /* @__PURE__ */ n(
|
|
169
|
+
o,
|
|
169
170
|
{
|
|
170
171
|
sx: {
|
|
171
172
|
color: "secondary.main",
|
|
172
|
-
bgcolor: ({ palette:
|
|
173
|
+
bgcolor: ({ palette: t }) => I(t.secondary.main, 0.05),
|
|
173
174
|
borderRadius: 1,
|
|
174
175
|
display: "flex",
|
|
175
176
|
justifyContent: "space-between",
|
|
@@ -183,8 +184,8 @@ function V({
|
|
|
183
184
|
onClick: f,
|
|
184
185
|
"data-cy": "sessionManager-bind-trigger",
|
|
185
186
|
children: [
|
|
186
|
-
|
|
187
|
-
/* @__PURE__ */ e(
|
|
187
|
+
s("connectDIDWallet"),
|
|
188
|
+
/* @__PURE__ */ e(p, { icon: _, color: "inherit", fontSize: 16 })
|
|
188
189
|
]
|
|
189
190
|
}
|
|
190
191
|
)
|
|
@@ -194,5 +195,5 @@ function V({
|
|
|
194
195
|
);
|
|
195
196
|
}
|
|
196
197
|
export {
|
|
197
|
-
|
|
198
|
+
Q as default
|
|
198
199
|
};
|
package/lib/package.json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.10",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -74,16 +74,16 @@
|
|
|
74
74
|
"react": "^19.0.0",
|
|
75
75
|
"react-router-dom": "^6.22.3"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "162768378bf0a1d1e0984d1f01235eafa5bd9bdb",
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@arcblock/bridge": "3.4.
|
|
79
|
+
"@arcblock/bridge": "3.4.10",
|
|
80
80
|
"@arcblock/did": "^1.28.6",
|
|
81
81
|
"@arcblock/did-motif": "^1.1.14",
|
|
82
|
-
"@arcblock/icons": "3.4.
|
|
83
|
-
"@arcblock/nft-display": "3.4.
|
|
84
|
-
"@arcblock/react-hooks": "3.4.
|
|
82
|
+
"@arcblock/icons": "3.4.10",
|
|
83
|
+
"@arcblock/nft-display": "3.4.10",
|
|
84
|
+
"@arcblock/react-hooks": "3.4.10",
|
|
85
85
|
"@blocklet/js-sdk": "^1.17.7",
|
|
86
|
-
"@blocklet/theme": "3.4.
|
|
86
|
+
"@blocklet/theme": "3.4.10",
|
|
87
87
|
"@fontsource/roboto": "~5.1.1",
|
|
88
88
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
|
89
89
|
"@iconify-icons/logos": "^1.2.36",
|
|
@@ -122,24 +122,25 @@ export default function UserInfo({
|
|
|
122
122
|
</Typography>
|
|
123
123
|
{mode === 'normal' ? null : (
|
|
124
124
|
<Tag
|
|
125
|
+
className="user-info__connected-tag"
|
|
125
126
|
type="primary"
|
|
126
127
|
sx={{
|
|
127
128
|
transform: 'scale(0.85)',
|
|
128
129
|
transformOrigin: 'left',
|
|
129
|
-
color: 'white !important',
|
|
130
130
|
display: 'flex',
|
|
131
131
|
alignItems: 'center',
|
|
132
132
|
}}>
|
|
133
133
|
<Box
|
|
134
|
+
className="user-info__connected-tag__dot"
|
|
134
135
|
sx={{
|
|
135
136
|
mr: 0.75,
|
|
136
137
|
width: 6,
|
|
137
138
|
height: 6,
|
|
138
|
-
backgroundColor:
|
|
139
|
+
backgroundColor: (theme) => theme.palette.text.contrast,
|
|
139
140
|
borderRadius: '100vw',
|
|
140
141
|
}}
|
|
141
142
|
/>
|
|
142
|
-
<Box>DID CONNECTED</Box>
|
|
143
|
+
<Box className="user-info__connected-tag__text">DID CONNECTED</Box>
|
|
143
144
|
</Tag>
|
|
144
145
|
)}
|
|
145
146
|
</Box>
|