@arcblock/ux 2.13.20 → 2.13.23

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.
Files changed (42) hide show
  1. package/lib/Config/config-provider.d.ts +6 -23
  2. package/lib/Config/config-provider.js +19 -80
  3. package/lib/Config/theme-mode-toggle.js +2 -2
  4. package/lib/DIDConnect/did-connect-container.d.ts +23 -0
  5. package/lib/DIDConnect/did-connect-container.js +270 -0
  6. package/lib/DIDConnect/did-connect-footer.d.ts +3 -1
  7. package/lib/DIDConnect/did-connect-footer.js +5 -3
  8. package/lib/DIDConnect/index.d.ts +1 -0
  9. package/lib/DIDConnect/index.js +2 -1
  10. package/lib/NavMenu/images/payment-kit.png +0 -0
  11. package/lib/NavMenu/products.js +30 -4
  12. package/lib/NavMenu/style.js +2 -1
  13. package/lib/PhoneInput/index.js +2 -1
  14. package/lib/SessionUser/components/quick-login-item.js +4 -4
  15. package/lib/SessionUser/components/un-login.js +6 -5
  16. package/lib/SharedBridge/index.js +8 -8
  17. package/lib/SharedBridge/need-storage-access-api-dialog.d.ts +1 -2
  18. package/lib/SharedBridge/need-storage-access-api-dialog.js +2 -23
  19. package/lib/Theme/index.d.ts +1 -0
  20. package/lib/Theme/index.js +1 -0
  21. package/lib/Theme/theme-provider.d.ts +27 -12
  22. package/lib/Theme/theme-provider.js +123 -16
  23. package/lib/Theme/theme.d.ts +5 -4
  24. package/lib/Theme/theme.js +6 -5
  25. package/package.json +6 -6
  26. package/src/Config/config-provider.tsx +21 -103
  27. package/src/Config/theme-mode-toggle.tsx +2 -2
  28. package/src/DIDConnect/did-connect-container.tsx +320 -0
  29. package/src/DIDConnect/did-connect-footer.tsx +25 -19
  30. package/src/DIDConnect/index.ts +1 -0
  31. package/src/NavMenu/images/payment-kit.png +0 -0
  32. package/src/NavMenu/products.tsx +21 -4
  33. package/src/NavMenu/style.ts +2 -1
  34. package/src/PhoneInput/index.tsx +2 -1
  35. package/src/SessionUser/components/quick-login-item.tsx +3 -3
  36. package/src/SessionUser/components/un-login.tsx +5 -4
  37. package/src/SessionUser/components/user-info.tsx +1 -1
  38. package/src/SharedBridge/index.tsx +4 -12
  39. package/src/SharedBridge/need-storage-access-api-dialog.tsx +1 -23
  40. package/src/Theme/index.ts +1 -0
  41. package/src/Theme/theme-provider.tsx +144 -16
  42. package/src/Theme/theme.ts +8 -9
@@ -0,0 +1,320 @@
1
+ import { forwardRef, memo, useRef } from 'react';
2
+ import { useBrowser } from '@arcblock/react-hooks';
3
+ import { Backdrop, Box, Dialog, DialogContent, Drawer, SwipeableDrawer, SxProps, useMediaQuery } from '@mui/material';
4
+ import { useCreation, useDebounce } from 'ahooks';
5
+ import colorConvert from 'color-convert';
6
+ import { getDIDMotifInfo } from '@arcblock/did-motif';
7
+ import noop from 'lodash/noop';
8
+
9
+ import { useTheme } from '../Theme';
10
+ import { mergeSx } from '../Util/style';
11
+ import { getDIDColor, hexToRgba, isEthereumDid } from '../Util';
12
+ import DIDConnectFooter from './did-connect-footer';
13
+
14
+ const BackdropWrap = memo(
15
+ forwardRef((backdropProps, ref) => {
16
+ return (
17
+ <Backdrop
18
+ open
19
+ ref={ref}
20
+ style={{
21
+ backgroundColor: 'rgba(0, 0, 0, 0.6)',
22
+ backdropFilter: 'blur(3px)',
23
+ touchAction: 'none',
24
+ }}
25
+ {...backdropProps}
26
+ key="background"
27
+ />
28
+ );
29
+ })
30
+ );
31
+
32
+ export default function DIDConnectContainer({
33
+ open = false,
34
+ popup = false,
35
+ hideCloseButton = false,
36
+ children,
37
+ appPid,
38
+ slotProps,
39
+ onClose = noop,
40
+ }: {
41
+ // 是否弹出显示, true 表示在 Dialog 中渲染, 并可以通过 open/onClose 控制 dialog 的显示/隐藏, false 表示直接渲染原内容
42
+ popup?: boolean;
43
+ open?: boolean;
44
+ hideCloseButton?: boolean;
45
+ children: React.ReactNode;
46
+ onClose?: () => void;
47
+ appPid?: string;
48
+ slotProps?: {
49
+ footer?: {
50
+ sx?: SxProps;
51
+ };
52
+ containerPage?: {
53
+ sx?: SxProps;
54
+ };
55
+ containerDrawer?: {
56
+ sx?: SxProps;
57
+ };
58
+ containerDialog?: {
59
+ sx?: SxProps;
60
+ };
61
+ };
62
+ }) {
63
+ const color = useCreation(() => {
64
+ const did = appPid || window.blocklet.appPid;
65
+ const isEthDid = isEthereumDid(did);
66
+ const didMotifInfo = isEthDid ? undefined : getDIDMotifInfo(did);
67
+ if (isEthDid) {
68
+ return getDIDColor(did);
69
+ }
70
+
71
+ return didMotifInfo.color;
72
+ }, []);
73
+
74
+ const drawerDragger = useRef(null);
75
+ const browser = useBrowser();
76
+ // 屏宽小于 sm 且在 mobile 设备中全屏显示 dialog (PC 端屏宽小于 sm 的情况正常弹窗, 不全屏显示)
77
+ const matchSm = useMediaQuery('(max-width:640px)');
78
+ let openVariant = 'page';
79
+ if (popup) {
80
+ openVariant = 'dialog';
81
+ if (matchSm && browser.mobile.any) {
82
+ openVariant = 'drawer';
83
+ }
84
+ }
85
+
86
+ const theme = useTheme();
87
+
88
+ const leavingScreenDelay = theme?.transitions?.duration?.leavingScreen || 500; // 默认值是 195
89
+ const debouncedOpen = useDebounce(open, {
90
+ wait: leavingScreenDelay,
91
+ });
92
+
93
+ // eslint-disable-next-line no-unused-vars
94
+ const handleOnClose = (e: React.MouseEvent<HTMLElement>, reason: string) => {
95
+ if (['backdropClick', 'escapeKeyDown'].includes(reason)) return;
96
+ onClose();
97
+ };
98
+
99
+ const showModal = debouncedOpen || open;
100
+
101
+ const DrawerComponent = hideCloseButton ? Drawer : SwipeableDrawer;
102
+
103
+ const hslColor = colorConvert.hex.hsl(color);
104
+
105
+ const [h, s, l] = hslColor;
106
+ const percentageList = [0, 30, 60, 30, 0, 30, 60, 30];
107
+ const maxPercentage = Math.max(...percentageList);
108
+ const minPercentage = Math.min(...percentageList);
109
+ let useAlpha = false;
110
+ if ((l * (100 + maxPercentage)) / 100 > 100 || (l * (100 + minPercentage)) / 100 < 0) {
111
+ // 超出范围,使用 alpha 通道变化
112
+ useAlpha = true;
113
+ }
114
+ const colorList = percentageList.map((percentageItem) => {
115
+ let finalL = (l * (100 + percentageItem)) / 100;
116
+ let finalAlpha = 0.6;
117
+ if (useAlpha) {
118
+ finalAlpha = (0.5 * (100 + percentageItem)) / 100;
119
+ } else {
120
+ finalL = (l * (100 + percentageItem)) / 100;
121
+ }
122
+ return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
123
+ });
124
+ const background = `linear-gradient(45deg, ${colorList.join(', ')})`;
125
+ const colorListGlow = percentageList.map((percentageItem) => {
126
+ let finalL = (l * (100 + percentageItem)) / 100;
127
+ let finalAlpha = 0.2;
128
+ if (useAlpha) {
129
+ finalAlpha = (0.3 * (100 + percentageItem)) / 100;
130
+ } else {
131
+ finalL = (l * (100 + percentageItem)) / 100;
132
+ }
133
+ return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
134
+ });
135
+
136
+ const backgroundGlow = `linear-gradient(45deg, ${colorListGlow.join(', ')})`;
137
+
138
+ const glowStyle = {
139
+ overflow: 'visible',
140
+ '&::before, &::after': {
141
+ content: '""',
142
+ position: 'absolute',
143
+ top: '-3px',
144
+ right: '-3px',
145
+ bottom: '-3px',
146
+ left: '-3px',
147
+ background,
148
+ backgroundSize: '300% 300%',
149
+ backgroundRepeat: 'no-repeat',
150
+ animation: 'glowRotate 10s linear infinite',
151
+ borderRadius: '14px !important',
152
+ zIndex: 0,
153
+ },
154
+ '&::after': {
155
+ background: backgroundGlow,
156
+ filter: 'blur(15px)',
157
+ },
158
+
159
+ '@keyframes glowRotate': {
160
+ '0%': {
161
+ backgroundPosition: '0 0',
162
+ },
163
+ '50%': {
164
+ backgroundPosition: '100% 0',
165
+ },
166
+ '100%': {
167
+ backgroundPosition: '0 0',
168
+ },
169
+ },
170
+ };
171
+
172
+ if (openVariant === 'page') {
173
+ return (
174
+ <Box
175
+ className="did-connect__container-page"
176
+ sx={mergeSx(
177
+ {
178
+ borderRadius: 1,
179
+ position: 'relative',
180
+ zIndex: 1,
181
+ backgroundColor: 'background.default',
182
+ },
183
+ glowStyle,
184
+ slotProps?.containerPage?.sx
185
+ )}>
186
+ <Box
187
+ sx={{
188
+ border: `1px solid ${hexToRgba(color, 0.1)}`,
189
+ m: '-1px',
190
+ position: 'relative',
191
+ borderRadius: '12px',
192
+ zIndex: 2,
193
+ overflow: 'hidden',
194
+ backgroundColor: 'background.default',
195
+ }}>
196
+ {children}
197
+ <DIDConnectFooter currentAppColor={color} sx={mergeSx({ mx: 0 }, slotProps?.footer?.sx)} />
198
+ </Box>
199
+ </Box>
200
+ );
201
+ }
202
+
203
+ if (openVariant === 'drawer') {
204
+ return (
205
+ <DrawerComponent
206
+ className="did-connect__container-drawer"
207
+ disableSwipeToOpen
208
+ open={open}
209
+ anchor="bottom"
210
+ drawerDragger={drawerDragger.current}
211
+ // @ts-ignore
212
+ onClose={handleOnClose}
213
+ slots={{
214
+ backdrop: BackdropWrap,
215
+ }}
216
+ PaperProps={{
217
+ sx: mergeSx(
218
+ {
219
+ backgroundColor: 'background.default',
220
+ borderRadius: 3, // 保持跟 DID Wallet 一致
221
+ borderBottomLeftRadius: 0,
222
+ borderBottomRightRadius: 0,
223
+ p: '2px',
224
+ animation: 'glowBreathe 7s linear infinite',
225
+ '.did-connect__root': {
226
+ backgroundColor: 'transparent',
227
+ },
228
+ overflow: 'hidden',
229
+ '@keyframes glowBreathe': {
230
+ '0%, 100%': {
231
+ boxShadow: `
232
+ inset 0 0 7px ${hexToRgba(color, 0.3)},
233
+ inset 0 0 12px ${hexToRgba(color, 0.3)}`,
234
+ },
235
+ '50%': {
236
+ boxShadow: `
237
+ inset 0 0 18px ${hexToRgba(color, 0.7)},
238
+ inset 0 0 24px ${hexToRgba(color, 0.5)}`,
239
+ },
240
+ },
241
+ },
242
+ slotProps?.containerDrawer?.sx
243
+ ),
244
+ }}>
245
+ {hideCloseButton ? null : (
246
+ <Box
247
+ ref={drawerDragger}
248
+ sx={{
249
+ px: 1,
250
+ pt: 2,
251
+ m: 'auto',
252
+ mt: -1,
253
+ mb: -2,
254
+ zIndex: 2,
255
+ }}>
256
+ <Box
257
+ sx={{
258
+ width: '48px',
259
+ height: '4px',
260
+ borderRadius: '100vw',
261
+ backgroundColor: 'rgba(0, 0, 0, 0.2)',
262
+ }}
263
+ />
264
+ </Box>
265
+ )}
266
+ <Box
267
+ sx={{
268
+ touchAction: 'none',
269
+ maxWidth: '100%',
270
+ width: 500,
271
+ height: 'auto',
272
+ backgroundColor: 'background.default',
273
+ }}>
274
+ {/* HACK: 由于 MUI 文档中描述 使用 keepMounted: false 可能会造成问题,所以采用下面的方案进行 HACK */}
275
+ {/* https://mui.com/material-ui/react-drawer/#keep-mounted */}
276
+ {showModal ? children : null}
277
+ <DIDConnectFooter currentAppColor={color} sx={mergeSx({ mx: 0 }, slotProps?.footer?.sx)} />
278
+ </Box>
279
+ </DrawerComponent>
280
+ );
281
+ }
282
+
283
+ return (
284
+ <Dialog
285
+ open={open}
286
+ slots={{
287
+ backdrop: BackdropWrap,
288
+ }}
289
+ className="did-connect__container-dialog"
290
+ onClose={handleOnClose}
291
+ PaperProps={{
292
+ sx: mergeSx(
293
+ {
294
+ // 避免样式被 server 中的定义覆盖
295
+ '&.MuiPaper-rounded': {
296
+ borderRadius: '12px !important',
297
+ },
298
+ position: 'relative',
299
+ backgroundColor: 'background.default',
300
+ },
301
+ glowStyle,
302
+ slotProps?.containerDialog?.sx
303
+ ),
304
+ }}>
305
+ <DialogContent
306
+ sx={{
307
+ maxWidth: 'calc(100vw - 18px)',
308
+ maxHeight: 'calc(100vh - 18px)',
309
+ p: '0px !important',
310
+ height: 'auto',
311
+ borderRadius: '12px !important',
312
+ zIndex: 1,
313
+ backgroundColor: 'background.default',
314
+ }}>
315
+ {showModal ? children : null}
316
+ <DIDConnectFooter currentAppColor={color} sx={mergeSx({ mx: 0 }, slotProps?.footer?.sx)} />
317
+ </DialogContent>
318
+ </Dialog>
319
+ );
320
+ }
@@ -1,40 +1,46 @@
1
- import { Box, useMediaQuery } from '@mui/material';
1
+ import { Box, SxProps, useMediaQuery } from '@mui/material';
2
2
 
3
3
  import PoweredBy from './powered-by';
4
4
  import AppInfoItem from './app-info-item';
5
5
  import AppIcon from './app-icon';
6
6
  import { getDIDColor, hexToRgba } from '../Util';
7
+ import { mergeSx } from '../Util/style';
7
8
 
8
9
  export default function DIDConnectFooter({
9
10
  currentAppInfo = globalThis.blocklet,
10
11
  currentAppColor = globalThis.blocklet?.appPid ? getDIDColor(globalThis.blocklet?.appPid) : '#fff',
12
+ sx,
11
13
  }: {
12
14
  currentAppInfo?: any;
13
15
  currentAppColor?: string;
16
+ sx?: SxProps;
14
17
  }) {
15
18
  const isSmallView = useMediaQuery('(max-width:640px)');
16
19
 
17
20
  return (
18
21
  <Box
19
- sx={{
20
- display: 'flex',
21
- justifyContent: 'space-between',
22
- alignItems: 'center',
23
- gap: 1,
24
- fontSize: 12,
25
- backgroundColor: hexToRgba(currentAppColor, 0.08),
26
- // 需要保持跟 .did-connect__root 的规则一样
27
- mx: isSmallView ? -2 : -3,
28
- px: isSmallView ? 2 : 3,
29
- py: 1.5,
30
- // HACK: 极限条件下,footer 会溢出,使用隐藏的滚动条来处理这种情况(屏幕宽度小于 360 时会出现)
31
- overflow: 'auto',
32
- '&::-webkit-scrollbar': {
33
- display: 'none', // 隐藏滚动条 (Webkit 浏览器)
22
+ sx={mergeSx(
23
+ {
24
+ display: 'flex',
25
+ justifyContent: 'space-between',
26
+ alignItems: 'center',
27
+ gap: 1,
28
+ fontSize: 12,
29
+ backgroundColor: hexToRgba(currentAppColor, 0.08),
30
+ // 需要保持跟 .did-connect__root 的规则一样
31
+ mx: isSmallView ? -2 : -3,
32
+ px: isSmallView ? 2 : 3,
33
+ py: 1.5,
34
+ // HACK: 极限条件下,footer 会溢出,使用隐藏的滚动条来处理这种情况(屏幕宽度小于 360 时会出现)
35
+ overflow: 'auto',
36
+ '&::-webkit-scrollbar': {
37
+ display: 'none', // 隐藏滚动条 (Webkit 浏览器)
38
+ },
39
+ '-ms-overflow-style': 'none', // 隐藏滚动条 (IE 浏览器)
40
+ 'scrollbar-width': 'none', // 隐藏滚动条 (Firefox)
34
41
  },
35
- '-ms-overflow-style': 'none', // 隐藏滚动条 (IE 浏览器)
36
- 'scrollbar-width': 'none', // 隐藏滚动条 (Firefox)
37
- }}
42
+ sx
43
+ )}
38
44
  className="did-connect__footer">
39
45
  <AppInfoItem
40
46
  appInfo={currentAppInfo}
@@ -5,3 +5,4 @@ export { default as PoweredBy } from './powered-by';
5
5
  export { default as withContainer } from './with-container';
6
6
  export { default as withUxTheme } from './with-ux-theme';
7
7
  export { default as DIDConnectLogo } from './did-connect-logo';
8
+ export { default as DIDConnectContainer } from './did-connect-container';
@@ -1,7 +1,7 @@
1
1
  import { useRef } from 'react';
2
2
  import { Link } from 'react-router-dom';
3
3
  import { useCreation, useMemoizedFn } from 'ahooks';
4
- import { Box, BoxProps, Grid } from '@mui/material';
4
+ import { Box, BoxProps, Grid, useTheme } from '@mui/material';
5
5
  import SubItemGroup from './sub-item-group';
6
6
  import { Item } from './nav-menu';
7
7
  import { styled } from '../Theme';
@@ -26,6 +26,7 @@ import DidWalletSvg from './images/did-wallet.svg?react';
26
26
  import DidNameServiceSvg from './images/did-name-service.svg?react';
27
27
  import VCSvg from './images/vc.svg?react';
28
28
  import DidConnectSvg from './images/did-connect.svg?react';
29
+ import PaymentKitPng from './images/payment-kit.png';
29
30
 
30
31
  const translations = {
31
32
  en: {
@@ -54,6 +55,9 @@ const translations = {
54
55
  alKit: {
55
56
  description: 'Boost apps with AI',
56
57
  },
58
+ paymentKit: {
59
+ description: 'Effortless Crypto & Card Payments',
60
+ },
57
61
  blockletStore: {
58
62
  description: 'Discover & deploy apps',
59
63
  },
@@ -118,6 +122,9 @@ const translations = {
118
122
  alKit: {
119
123
  description: 'AI 赋能应用',
120
124
  },
125
+ paymentKit: {
126
+ description: '便捷的加密货币和银行卡支付',
127
+ },
121
128
  blockletStore: {
122
129
  description: '发现和部署应用程序',
123
130
  },
@@ -189,6 +196,7 @@ export interface ProductsProps extends BoxProps {
189
196
 
190
197
  export default function Products({ className, isOpen, ...rest }: ProductsProps) {
191
198
  const { mode } = useNavMenuContext();
199
+ const { palette } = useTheme();
192
200
  const wrapperRef = useRef<HTMLDivElement>(null);
193
201
  const { locale = 'en' } = useLocaleContext() || {};
194
202
  const t = useMemoizedFn((key, data = {}) => translate(translations, key, locale, 'en', data));
@@ -229,7 +237,7 @@ export default function Products({ className, isOpen, ...rest }: ProductsProps)
229
237
  </Link>
230
238
  ),
231
239
  description: t('products.aigne.description'),
232
- icon: <AigneSvg />,
240
+ icon: <AigneSvg style={{ filter: palette.mode === 'dark' ? 'invert(1)' : 'none' }} />,
233
241
  },
234
242
  {
235
243
  label: (
@@ -269,6 +277,15 @@ export default function Products({ className, isOpen, ...rest }: ProductsProps)
269
277
  description: t('products.alKit.description'),
270
278
  icon: <AIKitSvg />,
271
279
  },
280
+ {
281
+ label: (
282
+ <Link to={`https://www.blocklet.io/${locale}`} target="_blank" rel="noreferrer noopener">
283
+ Payment Kit
284
+ </Link>
285
+ ),
286
+ description: t('products.paymentKit.description'),
287
+ icon: <img src={PaymentKitPng} alt="Payment Kit" />,
288
+ },
272
289
  ],
273
290
  [
274
291
  {
@@ -332,7 +349,7 @@ export default function Products({ className, isOpen, ...rest }: ProductsProps)
332
349
  {
333
350
  label: (
334
351
  <Link
335
- to={`https://www.arcblock.io/content/collections/${locale}/blocklet-server`}
352
+ to={`https://www.blocklet.io/${locale}/blocklet-server`}
336
353
  target="_blank"
337
354
  rel="noreferrer noopener">
338
355
  Blocklet Server
@@ -418,7 +435,7 @@ export default function Products({ className, isOpen, ...rest }: ProductsProps)
418
435
  ],
419
436
  },
420
437
  ];
421
- }, [t, locale]);
438
+ }, [t, locale, palette]);
422
439
 
423
440
  return (
424
441
  <Wrapper ref={wrapperRef} className={`is-${mode} ${className}`} {...rest}>
@@ -128,7 +128,8 @@ export const NavMenuItem = styled('li', {
128
128
  width: '32px',
129
129
  height: '32px',
130
130
  marginRight: '16px',
131
- border: '1px solid #eff1f5',
131
+ border: '1px solid',
132
+ borderColor: theme.palette.grey[200],
132
133
  borderRadius: '4px',
133
134
  color: theme.palette.grey[500],
134
135
  },
@@ -200,7 +200,8 @@ export default function PhoneInput({
200
200
 
201
201
  // 预览模式
202
202
  if (preview) {
203
- const isValid = phone && validatePhoneNumber(phone, country);
203
+ const phoneWithCode = addCountryCodeToPhone(phone, getDialCodeByCountry(country));
204
+ const isValid = phone && validatePhoneNumber(phoneWithCode, country);
204
205
  const canDial = allowDial && isValid;
205
206
 
206
207
  return (
@@ -41,18 +41,18 @@ export default function QuickLoginItem({
41
41
  borderRadius: 1,
42
42
  p: 2,
43
43
  transition: 'background-color 0.5s',
44
+ bgcolor: 'background.paper',
44
45
  '&:hover, &:active': {
45
- backgroundColor: 'grey.100',
46
+ backgroundColor: 'action.hover',
46
47
  },
47
48
  display: 'flex',
48
49
  justifyContent: 'space-between',
49
50
  alignItems: 'center',
50
51
  cursor: 'pointer',
51
52
  '&:hover': {
52
- backgroundColor: 'grey.200',
53
+ backgroundColor: 'action.hover',
53
54
  },
54
55
  width: '100%',
55
- backgroundColor: 'white',
56
56
  }}
57
57
  onClick={onClick}>
58
58
  <Box
@@ -159,7 +159,7 @@ export default function UnLogin({ session, onLogin = noop, size = 24, dark = fal
159
159
  maxWidth: '90vw',
160
160
  borderColor: 'divider',
161
161
  border: '0 !important',
162
- boxShadow: `0px 8px 16px 0px ${palette.grey[200]}, 0px 0px 0px 1px ${palette.grey[200]}`,
162
+ boxShadow: 4,
163
163
  }}>
164
164
  <Box
165
165
  sx={{
@@ -167,7 +167,8 @@ export default function UnLogin({ session, onLogin = noop, size = 24, dark = fal
167
167
  alignItems: 'center',
168
168
  gap: 1,
169
169
  p: 2,
170
- borderBottom: '1px solid #eee',
170
+ borderBottom: '1px solid',
171
+ borderColor: 'divider',
171
172
  }}>
172
173
  {loginAppLogo && !currentState.loadAppLogoError ? (
173
174
  <img
@@ -213,8 +214,9 @@ export default function UnLogin({ session, onLogin = noop, size = 24, dark = fal
213
214
  overflow: 'hidden',
214
215
  position: 'relative',
215
216
  p: 0,
217
+ bgcolor: 'background.paper',
216
218
  '&:hover': {
217
- backgroundColor: `${palette.grey[200]} !important`,
219
+ bgcolor: `${palette.action.hover} !important`,
218
220
  },
219
221
  }}
220
222
  onClick={() => {
@@ -239,7 +241,6 @@ export default function UnLogin({ session, onLogin = noop, size = 24, dark = fal
239
241
  sx={{
240
242
  mx: 2,
241
243
  my: '0px !important',
242
- borderColor: '#e4e4e7',
243
244
  }}
244
245
  />
245
246
  ) : null}
@@ -1,4 +1,4 @@
1
- import { alpha, Box, Chip, Typography, useTheme } from '@mui/material';
1
+ import { alpha, Box, Chip, Typography } from '@mui/material';
2
2
  import { Icon } from '@iconify/react';
3
3
  import SwapHorizRoundedIcon from '@iconify-icons/material-symbols/swap-horiz-rounded';
4
4
  import ArrowRightAltRoundedIcon from '@iconify-icons/material-symbols/arrow-right-alt-rounded';
@@ -8,7 +8,7 @@ import { mergeSx } from '../Util/style';
8
8
  import { callIframe, getCallbackAction } from '../Util/iframe';
9
9
  import { Locale } from '../type';
10
10
  import NeedStorageAccessApiDialog from './need-storage-access-api-dialog';
11
- import { withContainer, withUxTheme } from '../DIDConnect';
11
+ import { DIDConnectContainer } from '../DIDConnect';
12
12
 
13
13
  const SharedBridge = memo(function SharedBridge({
14
14
  src,
@@ -82,8 +82,6 @@ const SharedBridge = memo(function SharedBridge({
82
82
  // eslint-disable-next-line react-hooks/exhaustive-deps
83
83
  }, [onClick, dataId, targetIframeRef?.current]);
84
84
 
85
- const DialogComponent = withUxTheme(withContainer(NeedStorageAccessApiDialog));
86
-
87
85
  const handleLoad = useMemoizedFn(() => {
88
86
  callIframe(targetIframeRef.current as HTMLIFrameElement, 'hasStorageAccess').then(({ value }) => {
89
87
  currentState.hasStorageAccess = value;
@@ -107,15 +105,9 @@ const SharedBridge = memo(function SharedBridge({
107
105
 
108
106
  return (
109
107
  <>
110
- <DialogComponent
111
- popup
112
- locale={locale}
113
- blocklet={window.blocklet}
114
- open={currentState.open}
115
- origin={currentState.origin}
116
- host={currentState.host}
117
- onClose={() => {}}
118
- />
108
+ <DIDConnectContainer popup hideCloseButton open={currentState.open}>
109
+ <NeedStorageAccessApiDialog locale={locale} origin={currentState.origin} host={currentState.host} />
110
+ </DIDConnectContainer>
119
111
  <Box
120
112
  {...rest}
121
113
  component="iframe"
@@ -4,13 +4,10 @@ import externalLinkIcon from '@iconify-icons/tabler/external-link';
4
4
  import lockOutlineIcon from '@iconify-icons/material-symbols/lock-outline';
5
5
  import checkCircleIcon from '@iconify-icons/material-symbols/check-circle';
6
6
  import rocketLaunchRoundedIcon from '@iconify-icons/material-symbols/rocket-launch-rounded';
7
- import { useCreation, useMemoizedFn } from 'ahooks';
8
- import { useEffect } from 'react';
9
- import { getDIDMotifInfo } from '@arcblock/did-motif';
7
+ import { useMemoizedFn } from 'ahooks';
10
8
 
11
9
  import { Locale } from '../type';
12
10
  import { translate } from '../Locale/util';
13
- import { getDIDColor, isEthereumDid } from '../Util';
14
11
  import { DIDConnectFooter } from '../DIDConnect';
15
12
 
16
13
  const translations: Record<
@@ -67,31 +64,14 @@ export default function NeedStorageAccessApiDialog({
67
64
  locale = 'en',
68
65
  origin,
69
66
  host,
70
- setColor,
71
67
  }: {
72
68
  locale?: Locale;
73
69
  origin: string;
74
70
  host: string;
75
- setColor: (color: string) => void;
76
71
  }) {
77
72
  const t = useMemoizedFn((key, data = {}) => {
78
73
  return translate(translations, key, locale, 'en', data);
79
74
  });
80
- const currentAppColor = useCreation(() => {
81
- const did = window.blocklet.appPid;
82
- const isEthDid = isEthereumDid(did);
83
- const didMotifInfo = isEthDid ? undefined : getDIDMotifInfo(did);
84
- if (isEthDid) {
85
- return getDIDColor(did);
86
- }
87
-
88
- return didMotifInfo.color;
89
- }, []);
90
-
91
- useEffect(() => {
92
- setColor(currentAppColor);
93
- // eslint-disable-next-line react-hooks/exhaustive-deps
94
- }, [currentAppColor]);
95
75
 
96
76
  return (
97
77
  <Box
@@ -105,7 +85,6 @@ export default function NeedStorageAccessApiDialog({
105
85
  transition: 'width 0.2s ease-in-out',
106
86
  margin: 'auto',
107
87
  p: 3,
108
- pb: 0,
109
88
  gap: 2,
110
89
  }}>
111
90
  <Typography
@@ -165,7 +144,6 @@ export default function NeedStorageAccessApiDialog({
165
144
  {t('dataUsage')}
166
145
  </Typography>
167
146
  </Box>
168
- <DIDConnectFooter currentAppColor={currentAppColor} />
169
147
  </Box>
170
148
  );
171
149
  }
@@ -2,6 +2,7 @@ import type { CreateMUIStyled, Theme } from '@mui/material';
2
2
  import { styled as muiStyled, useTheme } from '@mui/material';
3
3
 
4
4
  export * from './theme';
5
+ export * from './theme-provider';
5
6
  export { default as ThemeProvider } from './theme-provider';
6
7
  export { useTheme };
7
8