@blocklet/ui-react 2.12.10 → 2.12.11
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.
- package/lib/UserCenter/components/editable-field.js +1 -1
- package/lib/UserCenter/components/user-info/metadata.d.ts +0 -1
- package/lib/UserCenter/components/user-info/metadata.js +7 -2
- package/lib/UserCenter/components/user-info/user-basic-info.d.ts +1 -1
- package/lib/UserCenter/components/user-info/user-basic-info.js +6 -5
- package/lib/UserCenter/components/user-info/user-status.js +1 -2
- package/package.json +4 -4
- package/src/UserCenter/components/editable-field.tsx +1 -1
- package/src/UserCenter/components/user-info/metadata.tsx +8 -4
- package/src/UserCenter/components/user-info/user-basic-info.tsx +6 -5
- package/src/UserCenter/components/user-info/user-status.tsx +1 -2
|
@@ -17,17 +17,18 @@ import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
|
17
17
|
import isEmail from "validator/lib/isEmail";
|
|
18
18
|
import isMobilePhone from "validator/lib/isMobilePhone";
|
|
19
19
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
20
|
+
import ArrowDownwardIcon from "@arcblock/icons/lib/ArrowDown";
|
|
20
21
|
import { useBrowser } from "@arcblock/react-hooks";
|
|
21
22
|
import { translations } from "../../libs/locales.js";
|
|
22
23
|
import EditableField from "../editable-field.js";
|
|
23
24
|
import { LinkPreviewInput } from "./link-preview-input.js";
|
|
24
25
|
import { getTimezones } from "./utils.js";
|
|
25
26
|
import Clock from "./clock.js";
|
|
27
|
+
const timezones = getTimezones();
|
|
26
28
|
const LocationIcon = lazy(() => import("@arcblock/icons/lib/Location"));
|
|
27
29
|
const TimezoneIcon = lazy(() => import("@arcblock/icons/lib/Timezone"));
|
|
28
30
|
const EmailIcon = lazy(() => import("@arcblock/icons/lib/Email"));
|
|
29
31
|
const PhoneIcon = lazy(() => import("@arcblock/icons/lib/Phone"));
|
|
30
|
-
const ArrowDownwardIcon = lazy(() => import("@arcblock/icons/lib/ArrowDown"));
|
|
31
32
|
const defaultButtonStyle = {
|
|
32
33
|
color: colors.foregroundsFgBase,
|
|
33
34
|
borderColor: colors.strokeBorderBase,
|
|
@@ -113,7 +114,6 @@ export default function UserMetadataComponent({
|
|
|
113
114
|
const onChange = (v, field) => {
|
|
114
115
|
metadata[field] = v;
|
|
115
116
|
};
|
|
116
|
-
const timezones = getTimezones();
|
|
117
117
|
const onEdit = () => {
|
|
118
118
|
if (!isMobileView) {
|
|
119
119
|
setEditable(true);
|
|
@@ -247,6 +247,11 @@ export default function UserMetadataComponent({
|
|
|
247
247
|
placeholder: "Timezone",
|
|
248
248
|
IconComponent: (props) => /* @__PURE__ */ jsx(ArrowDownwardIcon, { ...props, width: 20, height: 20 }),
|
|
249
249
|
MenuProps: {
|
|
250
|
+
PaperProps: {
|
|
251
|
+
style: {
|
|
252
|
+
maxHeight: "400px"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
250
255
|
style: {
|
|
251
256
|
zIndex: mode === "drawer" ? 9999 : 1300
|
|
252
257
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BoxProps } from '@mui/material';
|
|
2
2
|
import type { User } from '../../../@types';
|
|
3
|
-
export default function UserBasicInfo({ user, isMyself, showFullDid, switchPassport, switchProfile, ...rest }: {
|
|
3
|
+
export default function UserBasicInfo({ user, isMyself, showFullDid, switchPassport, switchProfile, isMobile, ...rest }: {
|
|
4
4
|
user: User;
|
|
5
5
|
isMyself?: boolean;
|
|
6
6
|
showFullDid?: boolean;
|
|
@@ -24,6 +24,7 @@ export default function UserBasicInfo({
|
|
|
24
24
|
showFullDid = true,
|
|
25
25
|
switchPassport,
|
|
26
26
|
switchProfile,
|
|
27
|
+
isMobile = false,
|
|
27
28
|
...rest
|
|
28
29
|
}) {
|
|
29
30
|
const { locale } = useLocaleContext();
|
|
@@ -94,7 +95,7 @@ export default function UserBasicInfo({
|
|
|
94
95
|
...rest.sx ?? {}
|
|
95
96
|
},
|
|
96
97
|
children: [
|
|
97
|
-
/* @__PURE__ */ jsxs(Box, { className: "user-info", display: "flex", flexDirection:
|
|
98
|
+
/* @__PURE__ */ jsxs(Box, { className: "user-info", display: "flex", flexDirection: isMobile ? "row" : "column", gap: 2, children: [
|
|
98
99
|
/* @__PURE__ */ jsxs(
|
|
99
100
|
Box,
|
|
100
101
|
{
|
|
@@ -109,7 +110,7 @@ export default function UserBasicInfo({
|
|
|
109
110
|
{
|
|
110
111
|
src: user?.avatar,
|
|
111
112
|
did: user?.did,
|
|
112
|
-
size: rest.size || (
|
|
113
|
+
size: rest.size || (isMobile ? 64 : 100),
|
|
113
114
|
variant: "circle",
|
|
114
115
|
shape: "circle",
|
|
115
116
|
sx: {
|
|
@@ -142,8 +143,8 @@ export default function UserBasicInfo({
|
|
|
142
143
|
/* @__PURE__ */ jsx(
|
|
143
144
|
UserStatus,
|
|
144
145
|
{
|
|
145
|
-
isMobile
|
|
146
|
-
size: rest.size || (
|
|
146
|
+
isMobile,
|
|
147
|
+
size: rest.size || (isMobile ? 64 : 100),
|
|
147
148
|
isMyself,
|
|
148
149
|
status: userStatus,
|
|
149
150
|
onChange: onUpdateUserStatus
|
|
@@ -193,7 +194,7 @@ export default function UserBasicInfo({
|
|
|
193
194
|
}
|
|
194
195
|
)
|
|
195
196
|
] }),
|
|
196
|
-
/* @__PURE__ */ jsx(UserMetadataComponent, {
|
|
197
|
+
/* @__PURE__ */ jsx(UserMetadataComponent, { isMyself, user, onSave }),
|
|
197
198
|
isMyself ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
198
199
|
/* @__PURE__ */ jsx(Divider, { sx: { my: 3, borderColor: colors.dividerColor } }),
|
|
199
200
|
/* @__PURE__ */ jsx(Typography, { component: "p", color: "text.secondary", fontSize: "14px", mb: 2, children: t("profile.justForYou") }),
|
|
@@ -127,7 +127,7 @@ export default function UserStatus({
|
|
|
127
127
|
/* @__PURE__ */ jsx(StatusSelector, { selected: status, data: statusData, open, onSelect: onStatusChange, anchorEl })
|
|
128
128
|
] });
|
|
129
129
|
}
|
|
130
|
-
const StatusDiv = styled(
|
|
130
|
+
const StatusDiv = styled("div")`
|
|
131
131
|
position: absolute;
|
|
132
132
|
left: ${({ size }) => `${size * 3 / 4}px`};
|
|
133
133
|
top: ${({ size }) => `${size * 0.65}px`};
|
|
@@ -148,6 +148,5 @@ const StatusDiv = styled(Box)`
|
|
|
148
148
|
height: ${({ isMobile }) => isMobile ? "16px" : "26px"};
|
|
149
149
|
border-radius: ${({ isMobile }) => isMobile ? "8px" : "13px"};
|
|
150
150
|
background-color: #eff1f5;
|
|
151
|
-
// background-color: #39b380;
|
|
152
151
|
}
|
|
153
152
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.11",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@abtnode/constant": "^1.16.39",
|
|
36
|
-
"@arcblock/bridge": "^2.12.
|
|
37
|
-
"@arcblock/react-hooks": "^2.12.
|
|
36
|
+
"@arcblock/bridge": "^2.12.11",
|
|
37
|
+
"@arcblock/react-hooks": "^2.12.11",
|
|
38
38
|
"@arcblock/ws": "^1.19.15",
|
|
39
39
|
"@blocklet/did-space-react": "^1.0.26",
|
|
40
40
|
"@iconify-icons/logos": "^1.2.36",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"jest": "^29.7.0",
|
|
88
88
|
"unbuild": "^2.0.0"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "5da393fc86f84a367e809b75d55fa27be2350c6c"
|
|
91
91
|
}
|
|
@@ -19,6 +19,7 @@ import isEmail from 'validator/lib/isEmail';
|
|
|
19
19
|
import isMobilePhone from 'validator/lib/isMobilePhone';
|
|
20
20
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
21
21
|
|
|
22
|
+
import ArrowDownwardIcon from '@arcblock/icons/lib/ArrowDown';
|
|
22
23
|
import { useBrowser } from '@arcblock/react-hooks';
|
|
23
24
|
import { translations } from '../../libs/locales';
|
|
24
25
|
import type { User, UserMetadata } from '../../../@types';
|
|
@@ -27,11 +28,12 @@ import { LinkPreviewInput } from './link-preview-input';
|
|
|
27
28
|
import { getTimezones } from './utils';
|
|
28
29
|
import Clock from './clock';
|
|
29
30
|
|
|
31
|
+
const timezones = getTimezones();
|
|
32
|
+
|
|
30
33
|
const LocationIcon = lazy(() => import('@arcblock/icons/lib/Location'));
|
|
31
34
|
const TimezoneIcon = lazy(() => import('@arcblock/icons/lib/Timezone'));
|
|
32
35
|
const EmailIcon = lazy(() => import('@arcblock/icons/lib/Email'));
|
|
33
36
|
const PhoneIcon = lazy(() => import('@arcblock/icons/lib/Phone'));
|
|
34
|
-
const ArrowDownwardIcon = lazy(() => import('@arcblock/icons/lib/ArrowDown'));
|
|
35
37
|
|
|
36
38
|
const defaultButtonStyle = {
|
|
37
39
|
color: colors.foregroundsFgBase,
|
|
@@ -93,7 +95,6 @@ export default function UserMetadataComponent({
|
|
|
93
95
|
isMyself: boolean;
|
|
94
96
|
user: User;
|
|
95
97
|
onSave: (v: UserMetadata) => void;
|
|
96
|
-
isMobile?: boolean;
|
|
97
98
|
}) {
|
|
98
99
|
const [editable, setEditable] = useState(false);
|
|
99
100
|
const [visible, setVisible] = useState(false);
|
|
@@ -138,8 +139,6 @@ export default function UserMetadataComponent({
|
|
|
138
139
|
metadata[field] = v;
|
|
139
140
|
};
|
|
140
141
|
|
|
141
|
-
const timezones = getTimezones();
|
|
142
|
-
|
|
143
142
|
const onEdit = () => {
|
|
144
143
|
if (!isMobileView) {
|
|
145
144
|
setEditable(true);
|
|
@@ -272,6 +271,11 @@ export default function UserMetadataComponent({
|
|
|
272
271
|
placeholder="Timezone"
|
|
273
272
|
IconComponent={(props) => <ArrowDownwardIcon {...props} width={20} height={20} />}
|
|
274
273
|
MenuProps={{
|
|
274
|
+
PaperProps: {
|
|
275
|
+
style: {
|
|
276
|
+
maxHeight: '400px',
|
|
277
|
+
},
|
|
278
|
+
},
|
|
275
279
|
style: {
|
|
276
280
|
zIndex: mode === 'drawer' ? 9999 : 1300,
|
|
277
281
|
},
|
|
@@ -28,6 +28,7 @@ export default function UserBasicInfo({
|
|
|
28
28
|
showFullDid = true,
|
|
29
29
|
switchPassport,
|
|
30
30
|
switchProfile,
|
|
31
|
+
isMobile = false,
|
|
31
32
|
...rest
|
|
32
33
|
}: {
|
|
33
34
|
user: User;
|
|
@@ -115,7 +116,7 @@ export default function UserBasicInfo({
|
|
|
115
116
|
position: 'relative',
|
|
116
117
|
...(rest.sx ?? {}),
|
|
117
118
|
}}>
|
|
118
|
-
<Box className="user-info" display="flex" flexDirection={
|
|
119
|
+
<Box className="user-info" display="flex" flexDirection={isMobile ? 'row' : 'column'} gap={2}>
|
|
119
120
|
<Box
|
|
120
121
|
className="user-avatar"
|
|
121
122
|
position="relative"
|
|
@@ -126,7 +127,7 @@ export default function UserBasicInfo({
|
|
|
126
127
|
// @ts-ignore
|
|
127
128
|
src={user?.avatar}
|
|
128
129
|
did={user?.did}
|
|
129
|
-
size={rest.size || (
|
|
130
|
+
size={rest.size || (isMobile ? 64 : 100)}
|
|
130
131
|
variant="circle"
|
|
131
132
|
shape="circle"
|
|
132
133
|
sx={{
|
|
@@ -158,8 +159,8 @@ export default function UserBasicInfo({
|
|
|
158
159
|
onClick={isMyself ? switchProfile : noop}
|
|
159
160
|
/>
|
|
160
161
|
<UserStatus
|
|
161
|
-
isMobile={
|
|
162
|
-
size={rest.size || (
|
|
162
|
+
isMobile={isMobile}
|
|
163
|
+
size={rest.size || (isMobile ? 64 : 100)}
|
|
163
164
|
isMyself={isMyself}
|
|
164
165
|
status={userStatus}
|
|
165
166
|
onChange={onUpdateUserStatus}
|
|
@@ -193,7 +194,7 @@ export default function UserBasicInfo({
|
|
|
193
194
|
/>
|
|
194
195
|
</Box>
|
|
195
196
|
</Box>
|
|
196
|
-
<UserMetadataComponent
|
|
197
|
+
<UserMetadataComponent isMyself={isMyself} user={user} onSave={onSave} />
|
|
197
198
|
{isMyself ? (
|
|
198
199
|
<>
|
|
199
200
|
<Divider sx={{ my: 3, borderColor: colors.dividerColor }} />
|
|
@@ -156,7 +156,7 @@ export default function UserStatus({
|
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const StatusDiv = styled(
|
|
159
|
+
const StatusDiv = styled('div')<{ size: number; isMobile?: boolean }>`
|
|
160
160
|
position: absolute;
|
|
161
161
|
left: ${({ size }) => `${(size * 3) / 4}px`};
|
|
162
162
|
top: ${({ size }) => `${size * 0.65}px`};
|
|
@@ -177,6 +177,5 @@ const StatusDiv = styled(Box)<{ size: number; isMobile?: boolean }>`
|
|
|
177
177
|
height: ${({ isMobile }) => (isMobile ? '16px' : '26px')};
|
|
178
178
|
border-radius: ${({ isMobile }) => (isMobile ? '8px' : '13px')};
|
|
179
179
|
background-color: #eff1f5;
|
|
180
|
-
// background-color: #39b380;
|
|
181
180
|
}
|
|
182
181
|
`;
|