@blocklet/ui-react 2.9.77 → 2.9.79

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,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useContext, useState } from "react";
3
- import { List } from "@mui/material";
3
+ import { Box } from "@mui/material";
4
4
  import { useAsyncEffect, useCreation } from "ahooks";
5
5
  import { getConnectedAccounts, getSourceProvider } from "@arcblock/ux/lib/SessionUser/libs/utils";
6
6
  import { LOGIN_PROVIDER } from "@arcblock/ux/lib/Util/constant";
@@ -95,13 +95,12 @@ export default function ThirdPartyLogin({ user }) {
95
95
  return transformedProviders;
96
96
  }, [user?.connectedAccounts, availableProviders]);
97
97
  return /* @__PURE__ */ jsx(
98
- List,
98
+ Box,
99
99
  {
100
- dense: true,
101
100
  sx: {
102
101
  gap: 1,
103
- display: "flex",
104
- flexDirection: "column"
102
+ display: "grid",
103
+ gridTemplateColumns: "1fr min-content"
105
104
  },
106
105
  children: normalizedAccounts.map((account) => {
107
106
  return /* @__PURE__ */ jsx(ThirdPartyItem, { item: account }, account?.provider);
@@ -1,6 +1,6 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Icon } from "@iconify/react";
3
- import { Box, ListItem, Tooltip, Typography } from "@mui/material";
3
+ import { Box, Tooltip, Typography } from "@mui/material";
4
4
  import LinkRoundedIcon from "@iconify-icons/material-symbols/link-rounded";
5
5
  import { temp as colors } from "@arcblock/ux/lib/Colors";
6
6
  import Button from "@arcblock/ux/lib/Button";
@@ -98,130 +98,127 @@ export default function ThirdPartyItem({
98
98
  });
99
99
  return /* @__PURE__ */ jsxs(Fragment, { children: [
100
100
  /* @__PURE__ */ jsxs(
101
- ListItem,
101
+ Box,
102
102
  {
103
- disablePadding: true,
104
103
  sx: {
104
+ borderRadius: 2,
105
+ border: `1px solid ${colors.strokeBorderBase}`,
106
+ background: colors.backgroundsBgField,
105
107
  display: "flex",
106
108
  alignItems: "center",
107
- gap: 1
109
+ py: 1,
110
+ px: 1.5,
111
+ gap: 0.75,
112
+ fontSize: "14px",
113
+ lineHeight: 1,
114
+ overflow: "hidden"
108
115
  },
109
116
  children: [
117
+ /* @__PURE__ */ jsx(Box, { component: Icon, icon, width: "1em", height: "1em", sx: { flexShrink: 0, fontSize: 16 } }),
118
+ /* @__PURE__ */ jsx(
119
+ Box,
120
+ {
121
+ sx: {
122
+ flex: 1
123
+ },
124
+ children: title
125
+ }
126
+ ),
110
127
  /* @__PURE__ */ jsxs(
111
128
  Box,
112
129
  {
113
130
  sx: {
114
- flex: 1,
115
- borderRadius: 2,
116
- border: `1px solid ${colors.strokeBorderBase}`,
117
- background: colors.backgroundsBgField,
118
131
  display: "flex",
119
132
  alignItems: "center",
120
- py: 1,
121
- px: 1.5,
122
- gap: 0.75,
123
- fontSize: "14px",
124
- lineHeight: 1
133
+ gap: 0.5
125
134
  },
126
135
  children: [
127
- /* @__PURE__ */ jsx(Icon, { icon, fontSize: 16, width: "1em", height: "1em" }),
128
136
  /* @__PURE__ */ jsx(
129
137
  Box,
130
138
  {
131
139
  sx: {
132
- display: "flex",
133
- alignItems: "center",
134
- justifyContent: "space-between",
135
140
  flex: 1,
136
- gap: 1
141
+ textOverflow: "ellipsis",
142
+ overflow: "hidden",
143
+ lineHeight: "normal"
137
144
  },
138
- children: title
145
+ children: item.userInfo?.email || item.did
139
146
  }
140
147
  ),
141
- /* @__PURE__ */ jsxs(
142
- Box,
148
+ item.userInfo?.email ? /* @__PURE__ */ jsx(
149
+ Tooltip,
143
150
  {
144
- sx: {
145
- display: "flex",
146
- alignItems: "center",
147
- gap: 0.5
148
- },
149
- children: [
150
- item.userInfo?.email || item.did,
151
- item.userInfo?.email ? /* @__PURE__ */ jsx(
152
- Tooltip,
153
- {
154
- title: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
155
- /* @__PURE__ */ jsx(Avatar, { size: 36, variant: "circle", shape: "circle", src: item.userInfo?.picture, did: item.did }),
156
- /* @__PURE__ */ jsxs(Box, { children: [
157
- /* @__PURE__ */ jsx(
158
- Typography,
159
- {
160
- sx: {
161
- whiteSpace: "normal",
162
- wordBreak: "break-all",
163
- fontSize: "0.9rem"
164
- },
165
- children: item.userInfo?.name
166
- }
167
- ),
168
- /* @__PURE__ */ jsx(
169
- Typography,
170
- {
171
- sx: {
172
- whiteSpace: "normal",
173
- wordBreak: "break-all",
174
- fontSize: "0.9rem"
175
- },
176
- children: item.userInfo?.email
177
- }
178
- )
179
- ] })
180
- ] }) }),
181
- children: /* @__PURE__ */ jsx(
182
- Icon,
183
- {
184
- icon: InfoOutlineRoundedIcon,
185
- color: colors.textSubtitle,
186
- fontSize: 16,
187
- style: { cursor: "pointer" }
188
- }
189
- )
190
- }
191
- ) : null
192
- ]
151
+ title: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
152
+ /* @__PURE__ */ jsx(Avatar, { size: 36, variant: "circle", shape: "circle", src: item.userInfo?.picture, did: item.did }),
153
+ /* @__PURE__ */ jsxs(Box, { children: [
154
+ /* @__PURE__ */ jsx(
155
+ Typography,
156
+ {
157
+ sx: {
158
+ whiteSpace: "normal",
159
+ wordBreak: "break-all",
160
+ fontSize: "0.9rem"
161
+ },
162
+ children: item.userInfo?.name
163
+ }
164
+ ),
165
+ /* @__PURE__ */ jsx(
166
+ Typography,
167
+ {
168
+ sx: {
169
+ whiteSpace: "normal",
170
+ wordBreak: "break-all",
171
+ fontSize: "0.9rem"
172
+ },
173
+ children: item.userInfo?.email
174
+ }
175
+ )
176
+ ] })
177
+ ] }) }),
178
+ children: /* @__PURE__ */ jsx(
179
+ Box,
180
+ {
181
+ component: Icon,
182
+ icon: InfoOutlineRoundedIcon,
183
+ color: colors.textSubtitle,
184
+ fontSize: 16,
185
+ sx: { cursor: "pointer", flexShrink: 0 }
186
+ }
187
+ )
193
188
  }
194
- )
189
+ ) : null
195
190
  ]
196
191
  }
197
- ),
198
- /* @__PURE__ */ jsx(Tooltip, { title: item._mainProvider ? t("thirdPartyLogin.mainProviderCantRemove") : "", children: /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
199
- Button,
200
- {
201
- variant: "outlined",
202
- size: "small",
203
- sx: {
204
- color: item?._bind ? colors.red : colors.foregroundsFgBase,
205
- borderColor: item?._bind ? colors.red : colors.strokeBorderBase,
206
- backgroundColor: colors.buttonsButtonNeutral,
207
- "&:hover": {
208
- borderColor: item?._bind ? colors.red : colors.strokeBorderBase,
209
- backgroundColor: colors.buttonsButtonNeutralHover
210
- },
211
- py: 0.5,
212
- borderRadius: 2,
213
- fontWeight: 500
214
- },
215
- startIcon: currentState.loading ? null : /* @__PURE__ */ jsx(Icon, { icon: LinkRoundedIcon }),
216
- onClick: toggleBind,
217
- disabled: item._mainProvider,
218
- loading: currentState.loading,
219
- children: item?._bind ? t("thirdPartyLogin.disconnect") : t("thirdPartyLogin.connect")
220
- }
221
- ) }) })
192
+ )
222
193
  ]
223
194
  }
224
195
  ),
196
+ /* @__PURE__ */ jsx(Tooltip, { title: item._mainProvider ? t("thirdPartyLogin.mainProviderCantRemove") : "", children: /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
197
+ Button,
198
+ {
199
+ variant: "outlined",
200
+ size: "small",
201
+ sx: {
202
+ color: item?._bind ? colors.red : colors.foregroundsFgBase,
203
+ borderColor: item?._bind ? colors.red : colors.strokeBorderBase,
204
+ backgroundColor: colors.buttonsButtonNeutral,
205
+ "&:hover": {
206
+ borderColor: item?._bind ? colors.red : colors.strokeBorderBase,
207
+ backgroundColor: colors.buttonsButtonNeutralHover
208
+ },
209
+ py: 0.5,
210
+ borderRadius: 2,
211
+ fontWeight: 500,
212
+ whiteSpace: "nowrap"
213
+ },
214
+ fullWidth: true,
215
+ startIcon: currentState.loading ? null : /* @__PURE__ */ jsx(Icon, { icon: LinkRoundedIcon }),
216
+ onClick: toggleBind,
217
+ disabled: item._mainProvider,
218
+ loading: currentState.loading,
219
+ children: item?._bind ? t("thirdPartyLogin.disconnect") : t("thirdPartyLogin.connect")
220
+ }
221
+ ) }) }),
225
222
  confirmHolder
226
223
  ] });
227
224
  }
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import type { BoxProps } from '@mui/material';
3
- export default function UserCenter({ children, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, userDid, stickySidebar, }: {
3
+ export default function UserCenter({ children, notLoginContent, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, userDid, stickySidebar, }: {
4
4
  readonly children: any;
5
+ readonly notLoginContent: any;
5
6
  readonly currentTab: string;
6
7
  readonly contentProps?: BoxProps;
7
8
  readonly disableAutoRedirect?: boolean;
@@ -24,6 +24,7 @@ import Settings from "./settings.js";
24
24
  import { client } from "../../libs/client.js";
25
25
  export default function UserCenter({
26
26
  children,
27
+ notLoginContent = null,
27
28
  currentTab,
28
29
  contentProps = {},
29
30
  disableAutoRedirect = false,
@@ -186,6 +187,9 @@ export default function UserCenter({
186
187
  return /* @__PURE__ */ jsx(Box, { sx: { width: "100%" }, children: /* @__PURE__ */ jsx(ErrorFallback, { error: formatError }) });
187
188
  }
188
189
  if (!currentDid && !userState.data) {
190
+ if (notLoginContent) {
191
+ return notLoginContent;
192
+ }
189
193
  return /* @__PURE__ */ jsx(Box, { sx: { width: "100%" }, children: /* @__PURE__ */ jsxs(
190
194
  Box,
191
195
  {
@@ -107,12 +107,11 @@ function ThirdPartyLogin({
107
107
  });
108
108
  return transformedProviders;
109
109
  }, [user?.connectedAccounts, availableProviders]);
110
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.List, {
111
- dense: true,
110
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
112
111
  sx: {
113
112
  gap: 1,
114
- display: "flex",
115
- flexDirection: "column"
113
+ display: "grid",
114
+ gridTemplateColumns: "1fr min-content"
116
115
  },
117
116
  children: normalizedAccounts.map(account => {
118
117
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_thirdPartyItem.default, {
@@ -120,118 +120,122 @@ function ThirdPartyItem({
120
120
  }
121
121
  });
122
122
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
123
- children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.ListItem, {
124
- disablePadding: true,
123
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
125
124
  sx: {
125
+ borderRadius: 2,
126
+ border: `1px solid ${_Colors.temp.strokeBorderBase}`,
127
+ background: _Colors.temp.backgroundsBgField,
126
128
  display: "flex",
127
129
  alignItems: "center",
128
- gap: 1
130
+ py: 1,
131
+ px: 1.5,
132
+ gap: 0.75,
133
+ fontSize: "14px",
134
+ lineHeight: 1,
135
+ overflow: "hidden"
129
136
  },
130
- children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
137
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
138
+ component: _react.Icon,
139
+ icon,
140
+ width: "1em",
141
+ height: "1em",
142
+ sx: {
143
+ flexShrink: 0,
144
+ fontSize: 16
145
+ }
146
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
147
+ sx: {
148
+ flex: 1
149
+ },
150
+ children: title
151
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
131
152
  sx: {
132
- flex: 1,
133
- borderRadius: 2,
134
- border: `1px solid ${_Colors.temp.strokeBorderBase}`,
135
- background: _Colors.temp.backgroundsBgField,
136
153
  display: "flex",
137
154
  alignItems: "center",
138
- py: 1,
139
- px: 1.5,
140
- gap: 0.75,
141
- fontSize: "14px",
142
- lineHeight: 1
155
+ gap: 0.5
143
156
  },
144
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_react.Icon, {
145
- icon,
146
- fontSize: 16,
147
- width: "1em",
148
- height: "1em"
149
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
157
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
150
158
  sx: {
151
- display: "flex",
152
- alignItems: "center",
153
- justifyContent: "space-between",
154
159
  flex: 1,
155
- gap: 1
160
+ textOverflow: "ellipsis",
161
+ overflow: "hidden",
162
+ lineHeight: "normal"
156
163
  },
157
- children: title
158
- }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
159
- sx: {
160
- display: "flex",
161
- alignItems: "center",
162
- gap: 0.5
163
- },
164
- children: [item.userInfo?.email || item.did, item.userInfo?.email ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Tooltip, {
165
- title: /* @__PURE__ */(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
166
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
167
- sx: {
168
- display: "flex",
169
- alignItems: "center",
170
- gap: 1
171
- },
172
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Avatar.default, {
173
- size: 36,
174
- variant: "circle",
175
- shape: "circle",
176
- src: item.userInfo?.picture,
177
- did: item.did
178
- }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
179
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
180
- sx: {
181
- whiteSpace: "normal",
182
- wordBreak: "break-all",
183
- fontSize: "0.9rem"
184
- },
185
- children: item.userInfo?.name
186
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
187
- sx: {
188
- whiteSpace: "normal",
189
- wordBreak: "break-all",
190
- fontSize: "0.9rem"
191
- },
192
- children: item.userInfo?.email
193
- })]
164
+ children: item.userInfo?.email || item.did
165
+ }), item.userInfo?.email ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Tooltip, {
166
+ title: /* @__PURE__ */(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
167
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
168
+ sx: {
169
+ display: "flex",
170
+ alignItems: "center",
171
+ gap: 1
172
+ },
173
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Avatar.default, {
174
+ size: 36,
175
+ variant: "circle",
176
+ shape: "circle",
177
+ src: item.userInfo?.picture,
178
+ did: item.did
179
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
180
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
181
+ sx: {
182
+ whiteSpace: "normal",
183
+ wordBreak: "break-all",
184
+ fontSize: "0.9rem"
185
+ },
186
+ children: item.userInfo?.name
187
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
188
+ sx: {
189
+ whiteSpace: "normal",
190
+ wordBreak: "break-all",
191
+ fontSize: "0.9rem"
192
+ },
193
+ children: item.userInfo?.email
194
194
  })]
195
- })
196
- }),
197
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_react.Icon, {
198
- icon: _infoOutlineRounded.default,
199
- color: _Colors.temp.textSubtitle,
200
- fontSize: 16,
201
- style: {
202
- cursor: "pointer"
203
- }
195
+ })]
204
196
  })
205
- }) : null]
206
- })]
207
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Tooltip, {
208
- title: item._mainProvider ? t("thirdPartyLogin.mainProviderCantRemove") : "",
209
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
210
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Button.default, {
211
- variant: "outlined",
212
- size: "small",
197
+ }),
198
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
199
+ component: _react.Icon,
200
+ icon: _infoOutlineRounded.default,
201
+ color: _Colors.temp.textSubtitle,
202
+ fontSize: 16,
213
203
  sx: {
214
- color: item?._bind ? _Colors.temp.red : _Colors.temp.foregroundsFgBase,
204
+ cursor: "pointer",
205
+ flexShrink: 0
206
+ }
207
+ })
208
+ }) : null]
209
+ })]
210
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Tooltip, {
211
+ title: item._mainProvider ? t("thirdPartyLogin.mainProviderCantRemove") : "",
212
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
213
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Button.default, {
214
+ variant: "outlined",
215
+ size: "small",
216
+ sx: {
217
+ color: item?._bind ? _Colors.temp.red : _Colors.temp.foregroundsFgBase,
218
+ borderColor: item?._bind ? _Colors.temp.red : _Colors.temp.strokeBorderBase,
219
+ backgroundColor: _Colors.temp.buttonsButtonNeutral,
220
+ "&:hover": {
215
221
  borderColor: item?._bind ? _Colors.temp.red : _Colors.temp.strokeBorderBase,
216
- backgroundColor: _Colors.temp.buttonsButtonNeutral,
217
- "&:hover": {
218
- borderColor: item?._bind ? _Colors.temp.red : _Colors.temp.strokeBorderBase,
219
- backgroundColor: _Colors.temp.buttonsButtonNeutralHover
220
- },
221
- py: 0.5,
222
- borderRadius: 2,
223
- fontWeight: 500
222
+ backgroundColor: _Colors.temp.buttonsButtonNeutralHover
224
223
  },
225
- startIcon: currentState.loading ? null : /* @__PURE__ */(0, _jsxRuntime.jsx)(_react.Icon, {
226
- icon: _linkRounded.default
227
- }),
228
- onClick: toggleBind,
229
- disabled: item._mainProvider,
230
- loading: currentState.loading,
231
- children: item?._bind ? t("thirdPartyLogin.disconnect") : t("thirdPartyLogin.connect")
232
- })
224
+ py: 0.5,
225
+ borderRadius: 2,
226
+ fontWeight: 500,
227
+ whiteSpace: "nowrap"
228
+ },
229
+ fullWidth: true,
230
+ startIcon: currentState.loading ? null : /* @__PURE__ */(0, _jsxRuntime.jsx)(_react.Icon, {
231
+ icon: _linkRounded.default
232
+ }),
233
+ onClick: toggleBind,
234
+ disabled: item._mainProvider,
235
+ loading: currentState.loading,
236
+ children: item?._bind ? t("thirdPartyLogin.disconnect") : t("thirdPartyLogin.connect")
233
237
  })
234
- })]
238
+ })
235
239
  }), confirmHolder]
236
240
  });
237
241
  }
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import type { BoxProps } from '@mui/material';
3
- export default function UserCenter({ children, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, userDid, stickySidebar, }: {
3
+ export default function UserCenter({ children, notLoginContent, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, userDid, stickySidebar, }: {
4
4
  readonly children: any;
5
+ readonly notLoginContent: any;
5
6
  readonly currentTab: string;
6
7
  readonly contentProps?: BoxProps;
7
8
  readonly disableAutoRedirect?: boolean;
@@ -31,6 +31,7 @@ var _client = require("../../libs/client");
31
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
32
  function UserCenter({
33
33
  children,
34
+ notLoginContent = null,
34
35
  currentTab,
35
36
  contentProps = {},
36
37
  disableAutoRedirect = false,
@@ -203,6 +204,9 @@ function UserCenter({
203
204
  });
204
205
  }
205
206
  if (!currentDid && !userState.data) {
207
+ if (notLoginContent) {
208
+ return notLoginContent;
209
+ }
206
210
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
207
211
  sx: {
208
212
  width: "100%"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.9.77",
3
+ "version": "2.9.79",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -62,10 +62,10 @@
62
62
  }
63
63
  },
64
64
  "dependencies": {
65
- "@arcblock/bridge": "^2.9.77",
66
- "@arcblock/did-connect": "^2.9.77",
67
- "@arcblock/react-hooks": "^2.9.77",
68
- "@arcblock/ux": "^2.9.77",
65
+ "@arcblock/bridge": "^2.9.79",
66
+ "@arcblock/did-connect": "^2.9.79",
67
+ "@arcblock/react-hooks": "^2.9.79",
68
+ "@arcblock/ux": "^2.9.79",
69
69
  "@blocklet/js-sdk": "^1.16.26",
70
70
  "@emotion/react": "^11.10.4",
71
71
  "@emotion/styled": "^11.10.4",
@@ -109,5 +109,5 @@
109
109
  "jest": "^28.1.3",
110
110
  "unbuild": "^2.0.0"
111
111
  },
112
- "gitHead": "24ef8a1319fae952d5aedb57f2030d1553dfdd8e"
112
+ "gitHead": "4cb71ea9e86341cb263ab127a831b3ca2db9571a"
113
113
  }
@@ -1,5 +1,5 @@
1
1
  import { useContext, useState } from 'react';
2
- import { List } from '@mui/material';
2
+ import { Box } from '@mui/material';
3
3
  import { useAsyncEffect, useCreation } from 'ahooks';
4
4
  import { getConnectedAccounts, getSourceProvider } from '@arcblock/ux/lib/SessionUser/libs/utils';
5
5
  import { LOGIN_PROVIDER } from '@arcblock/ux/lib/Util/constant';
@@ -118,16 +118,15 @@ export default function ThirdPartyLogin({ user }: { user: User }) {
118
118
  }, [user?.connectedAccounts, availableProviders]);
119
119
 
120
120
  return (
121
- <List
122
- dense
121
+ <Box
123
122
  sx={{
124
123
  gap: 1,
125
- display: 'flex',
126
- flexDirection: 'column',
124
+ display: 'grid',
125
+ gridTemplateColumns: '1fr min-content',
127
126
  }}>
128
127
  {normalizedAccounts.map((account) => {
129
128
  return <ThirdPartyItem key={account?.provider} item={account as OAuthAccount} />;
130
129
  })}
131
- </List>
130
+ </Box>
132
131
  );
133
132
  }
@@ -1,5 +1,5 @@
1
1
  import { Icon } from '@iconify/react';
2
- import { Box, ListItem, Tooltip, Typography } from '@mui/material';
2
+ import { Box, Tooltip, Typography } from '@mui/material';
3
3
  import LinkRoundedIcon from '@iconify-icons/material-symbols/link-rounded';
4
4
  import { temp as colors } from '@arcblock/ux/lib/Colors';
5
5
  import Button from '@arcblock/ux/lib/Button';
@@ -120,72 +120,69 @@ export default function ThirdPartyItem({
120
120
 
121
121
  return (
122
122
  <>
123
- <ListItem
124
- disablePadding
123
+ <Box
125
124
  sx={{
125
+ borderRadius: 2,
126
+ border: `1px solid ${colors.strokeBorderBase}`,
127
+ background: colors.backgroundsBgField,
126
128
  display: 'flex',
127
129
  alignItems: 'center',
128
- gap: 1,
130
+ py: 1,
131
+ px: 1.5,
132
+ gap: 0.75,
133
+ fontSize: '14px',
134
+ lineHeight: 1,
135
+ overflow: 'hidden',
129
136
  }}>
137
+ <Box component={Icon} icon={icon} width="1em" height="1em" sx={{ flexShrink: 0, fontSize: 16 }} />
130
138
  <Box
131
139
  sx={{
132
140
  flex: 1,
133
- borderRadius: 2,
134
- border: `1px solid ${colors.strokeBorderBase}`,
135
- background: colors.backgroundsBgField,
141
+ }}>
142
+ {title}
143
+ </Box>
144
+ <Box
145
+ sx={{
136
146
  display: 'flex',
137
147
  alignItems: 'center',
138
- py: 1,
139
- px: 1.5,
140
- gap: 0.75,
141
- fontSize: '14px',
142
- lineHeight: 1,
148
+ gap: 0.5,
143
149
  }}>
144
- <Icon icon={icon} fontSize={16} width="1em" height="1em" />
145
150
  <Box
146
151
  sx={{
147
- display: 'flex',
148
- alignItems: 'center',
149
- justifyContent: 'space-between',
150
152
  flex: 1,
151
- gap: 1,
152
- }}>
153
- {title}
154
- </Box>
155
- <Box
156
- sx={{
157
- display: 'flex',
158
- alignItems: 'center',
159
- gap: 0.5,
153
+ textOverflow: 'ellipsis',
154
+ overflow: 'hidden',
155
+ lineHeight: 'normal',
160
156
  }}>
161
157
  {item.userInfo?.email || item.did}
162
- {item.userInfo?.email ? (
163
- <Tooltip
164
- title={
165
- <>
166
- <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
167
- <Avatar size={36} variant="circle" shape="circle" src={item.userInfo?.picture} did={item.did} />
168
- <Box>
169
- <Typography
170
- sx={{
171
- whiteSpace: 'normal',
172
- wordBreak: 'break-all',
173
- fontSize: '0.9rem',
174
- }}>
175
- {item.userInfo?.name}
176
- </Typography>
177
- <Typography
178
- sx={{
179
- whiteSpace: 'normal',
180
- wordBreak: 'break-all',
181
- fontSize: '0.9rem',
182
- }}>
183
- {item.userInfo?.email}
184
- </Typography>
185
- </Box>
158
+ </Box>
159
+ {item.userInfo?.email ? (
160
+ <Tooltip
161
+ title={
162
+ <>
163
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
164
+ <Avatar size={36} variant="circle" shape="circle" src={item.userInfo?.picture} did={item.did} />
165
+ <Box>
166
+ <Typography
167
+ sx={{
168
+ whiteSpace: 'normal',
169
+ wordBreak: 'break-all',
170
+ fontSize: '0.9rem',
171
+ }}>
172
+ {item.userInfo?.name}
173
+ </Typography>
174
+ <Typography
175
+ sx={{
176
+ whiteSpace: 'normal',
177
+ wordBreak: 'break-all',
178
+ fontSize: '0.9rem',
179
+ }}>
180
+ {item.userInfo?.email}
181
+ </Typography>
186
182
  </Box>
187
- {/* 暂不显示 oauth 账户的 did */}
188
- {/* <Box
183
+ </Box>
184
+ {/* 暂不显示 oauth 账户的 did */}
185
+ {/* <Box
189
186
  component={DID}
190
187
  did={item.did}
191
188
  sx={{
@@ -194,45 +191,47 @@ export default function ThirdPartyItem({
194
191
  },
195
192
  }}
196
193
  /> */}
197
- </>
198
- }>
199
- <Icon
200
- icon={InfoOutlineRoundedIcon}
201
- color={colors.textSubtitle}
202
- fontSize={16}
203
- style={{ cursor: 'pointer' }}
204
- />
205
- </Tooltip>
206
- ) : null}
207
- </Box>
194
+ </>
195
+ }>
196
+ <Box
197
+ component={Icon}
198
+ icon={InfoOutlineRoundedIcon}
199
+ color={colors.textSubtitle}
200
+ fontSize={16}
201
+ sx={{ cursor: 'pointer', flexShrink: 0 }}
202
+ />
203
+ </Tooltip>
204
+ ) : null}
208
205
  </Box>
209
- <Tooltip title={item._mainProvider ? t('thirdPartyLogin.mainProviderCantRemove') : ''}>
210
- {/* HACK: 结合下面的 button disable 使用,必须增加这一层 */}
211
- <Box>
212
- <Button
213
- variant="outlined"
214
- size="small"
215
- sx={{
216
- color: item?._bind ? colors.red : colors.foregroundsFgBase,
206
+ </Box>
207
+ <Tooltip title={item._mainProvider ? t('thirdPartyLogin.mainProviderCantRemove') : ''}>
208
+ {/* HACK: 结合下面的 button disable 使用,必须增加这一层 */}
209
+ <Box>
210
+ <Button
211
+ variant="outlined"
212
+ size="small"
213
+ sx={{
214
+ color: item?._bind ? colors.red : colors.foregroundsFgBase,
215
+ borderColor: item?._bind ? colors.red : colors.strokeBorderBase,
216
+ backgroundColor: colors.buttonsButtonNeutral,
217
+ '&:hover': {
217
218
  borderColor: item?._bind ? colors.red : colors.strokeBorderBase,
218
- backgroundColor: colors.buttonsButtonNeutral,
219
- '&:hover': {
220
- borderColor: item?._bind ? colors.red : colors.strokeBorderBase,
221
- backgroundColor: colors.buttonsButtonNeutralHover,
222
- },
223
- py: 0.5,
224
- borderRadius: 2,
225
- fontWeight: 500,
226
- }}
227
- startIcon={currentState.loading ? null : <Icon icon={LinkRoundedIcon} />}
228
- onClick={toggleBind}
229
- disabled={item._mainProvider}
230
- loading={currentState.loading}>
231
- {item?._bind ? t('thirdPartyLogin.disconnect') : t('thirdPartyLogin.connect')}
232
- </Button>
233
- </Box>
234
- </Tooltip>
235
- </ListItem>
219
+ backgroundColor: colors.buttonsButtonNeutralHover,
220
+ },
221
+ py: 0.5,
222
+ borderRadius: 2,
223
+ fontWeight: 500,
224
+ whiteSpace: 'nowrap',
225
+ }}
226
+ fullWidth
227
+ startIcon={currentState.loading ? null : <Icon icon={LinkRoundedIcon} />}
228
+ onClick={toggleBind}
229
+ disabled={item._mainProvider}
230
+ loading={currentState.loading}>
231
+ {item?._bind ? t('thirdPartyLogin.disconnect') : t('thirdPartyLogin.connect')}
232
+ </Button>
233
+ </Box>
234
+ </Tooltip>
236
235
  {confirmHolder}
237
236
  </>
238
237
  );
@@ -31,6 +31,7 @@ import { client } from '../../libs/client';
31
31
 
32
32
  export default function UserCenter({
33
33
  children,
34
+ notLoginContent = null,
34
35
  currentTab,
35
36
  contentProps = {},
36
37
  disableAutoRedirect = false,
@@ -42,6 +43,7 @@ export default function UserCenter({
42
43
  stickySidebar = false,
43
44
  }: {
44
45
  readonly children: any;
46
+ readonly notLoginContent: any;
45
47
  readonly currentTab: string;
46
48
  readonly contentProps?: BoxProps;
47
49
  readonly disableAutoRedirect?: boolean;
@@ -229,6 +231,9 @@ export default function UserCenter({
229
231
  }
230
232
 
231
233
  if (!currentDid && !userState.data) {
234
+ if (notLoginContent) {
235
+ return notLoginContent;
236
+ }
232
237
  return (
233
238
  <Box sx={{ width: '100%' }}>
234
239
  <Box