@arcblock/ux 2.13.12 → 2.13.14
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/ActivityIndicator/index.js +9 -5
- package/lib/Address/did-address.js +14 -7
- package/lib/Address/responsive-did-address.js +3 -1
- package/lib/BlockletV2/blocklet.js +1 -1
- package/lib/CloseButton/index.js +1 -2
- package/lib/Colors/index.d.ts +1 -3
- package/lib/Colors/index.js +2 -4
- package/lib/Colors/themes/default.d.ts +3 -66
- package/lib/Colors/themes/default.js +4 -74
- package/lib/Colors/themes/did-connect.d.ts +11 -6
- package/lib/Colors/themes/did-connect.js +17 -12
- package/lib/Colors/themes/temp.d.ts +3 -0
- package/lib/Colors/themes/temp.js +3 -0
- package/lib/Config/config-provider.d.ts +4 -5
- package/lib/Config/config-provider.js +7 -26
- package/lib/Config/theme-mode-toggle.js +0 -1
- package/lib/DID/index.js +3 -4
- package/lib/DIDConnect/app-icon.d.ts +8 -0
- package/lib/DIDConnect/app-icon.js +31 -0
- package/lib/DIDConnect/app-info-item.d.ts +7 -0
- package/lib/DIDConnect/app-info-item.js +73 -0
- package/lib/DIDConnect/did-connect-footer.d.ts +4 -0
- package/lib/DIDConnect/did-connect-footer.js +54 -0
- package/lib/DIDConnect/did-connect-logo.d.ts +1 -0
- package/lib/DIDConnect/did-connect-logo.js +11 -0
- package/lib/DIDConnect/index.d.ts +7 -0
- package/lib/DIDConnect/index.js +7 -0
- package/lib/DIDConnect/powered-by.d.ts +3 -0
- package/lib/DIDConnect/powered-by.js +46 -0
- package/lib/DIDConnect/with-container.d.ts +11 -0
- package/lib/DIDConnect/with-container.js +273 -0
- package/lib/DIDConnect/with-ux-theme.d.ts +1 -0
- package/lib/DIDConnect/with-ux-theme.js +23 -0
- package/lib/Datatable/CustomToolbar.js +3 -0
- package/lib/Datatable/index.js +105 -71
- package/lib/Dialog/confirm.d.ts +6 -1
- package/lib/Dialog/confirm.js +7 -3
- package/lib/Dialog/use-confirm.js +6 -0
- package/lib/Footer/index.js +2 -5
- package/lib/Header/header.js +3 -1
- package/lib/Header/responsive-header.js +3 -1
- package/lib/Layout/dashboard/index.js +14 -2
- package/lib/Layout/dashboard/sidebar.js +1 -2
- package/lib/LoadingMask/index.js +4 -3
- package/lib/Locale/selector.js +3 -3
- package/lib/Locale/util.d.ts +3 -3
- package/lib/Locale/util.js +6 -1
- package/lib/LoginButton/index.d.ts +12 -0
- package/lib/LoginButton/index.js +74 -0
- package/lib/NavMenu/nav-menu.js +14 -9
- package/lib/NavMenu/products.js +3 -1
- package/lib/NavMenu/style.js +7 -3
- package/lib/NavMenu/sub-item-group.js +1 -1
- package/lib/PhoneInput/country-select.js +2 -3
- package/lib/SessionBlocklet/index.js +3 -3
- package/lib/SessionUser/components/did-space.js +14 -28
- package/lib/SessionUser/components/logged-in.js +2 -2
- package/lib/SessionUser/components/quick-login-item.js +13 -11
- package/lib/SessionUser/components/session-user-item.js +5 -6
- package/lib/SessionUser/components/session-user-switch.js +15 -13
- package/lib/SessionUser/components/un-login.js +51 -38
- package/lib/SessionUser/components/user-info.js +9 -8
- package/lib/SessionUser/images/did-spaces.svg +7 -13
- package/lib/SharedBridge/index.d.ts +16 -0
- package/lib/SharedBridge/index.js +109 -0
- package/lib/SharedBridge/need-storage-access-api-dialog.d.ts +7 -0
- package/lib/SharedBridge/need-storage-access-api-dialog.js +212 -0
- package/lib/Success/index.js +8 -4
- package/lib/Switch/index.js +3 -3
- package/lib/Tabs/index.js +8 -9
- package/lib/Theme/index.d.ts +2 -2
- package/lib/Theme/index.js +1 -1
- package/lib/Theme/theme-provider.d.ts +5 -1
- package/lib/Theme/theme-provider.js +60 -5
- package/lib/Theme/theme.d.ts +6 -3
- package/lib/Theme/theme.js +55 -19
- package/lib/UserCard/Container/card.js +1 -1
- package/lib/UserCard/Container/dialog.js +1 -1
- package/lib/Util/iframe.d.ts +5 -0
- package/lib/Util/iframe.js +24 -0
- package/lib/Util/index.d.ts +18 -1
- package/lib/Util/index.js +90 -5
- package/lib/type.d.ts +5 -1
- package/package.json +8 -6
- package/src/ActivityIndicator/index.jsx +4 -4
- package/src/Address/did-address.tsx +5 -5
- package/src/Address/responsive-did-address.tsx +11 -1
- package/src/BlockletV2/blocklet.tsx +1 -1
- package/src/CloseButton/index.tsx +1 -2
- package/src/Colors/index.ts +2 -7
- package/src/Colors/themes/default.ts +4 -50
- package/src/Colors/themes/did-connect.ts +13 -6
- package/src/Colors/themes/temp.ts +3 -0
- package/src/Config/config-provider.tsx +17 -30
- package/src/Config/theme-mode-toggle.tsx +1 -1
- package/src/DID/index.tsx +3 -4
- package/src/DIDConnect/app-icon.tsx +36 -0
- package/src/DIDConnect/app-info-item.tsx +82 -0
- package/src/DIDConnect/did-connect-footer.tsx +51 -0
- package/src/DIDConnect/did-connect-logo.tsx +8 -0
- package/src/DIDConnect/index.ts +7 -0
- package/src/DIDConnect/powered-by.tsx +48 -0
- package/src/DIDConnect/with-container.tsx +307 -0
- package/src/DIDConnect/with-ux-theme.tsx +22 -0
- package/src/Datatable/CustomToolbar.jsx +1 -0
- package/src/Datatable/index.jsx +107 -70
- package/src/Dialog/confirm.jsx +31 -23
- package/src/Dialog/use-confirm.jsx +6 -0
- package/src/Footer/index.tsx +2 -2
- package/src/Header/header.tsx +1 -1
- package/src/Header/responsive-header.tsx +2 -0
- package/src/Layout/dashboard/index.tsx +8 -4
- package/src/Layout/dashboard/sidebar.tsx +1 -2
- package/src/LoadingMask/index.tsx +3 -4
- package/src/Locale/selector.tsx +3 -4
- package/src/Locale/util.ts +7 -2
- package/src/LoginButton/index.tsx +73 -0
- package/src/NavMenu/nav-menu.tsx +15 -10
- package/src/NavMenu/products.tsx +1 -1
- package/src/NavMenu/style.ts +5 -2
- package/src/NavMenu/sub-item-group.tsx +1 -1
- package/src/PhoneInput/country-select.tsx +2 -3
- package/src/SessionBlocklet/index.tsx +3 -3
- package/src/SessionUser/components/did-space.tsx +14 -10
- package/src/SessionUser/components/logged-in.tsx +2 -2
- package/src/SessionUser/components/quick-login-item.tsx +11 -12
- package/src/SessionUser/components/session-user-item.tsx +3 -6
- package/src/SessionUser/components/session-user-switch.tsx +13 -12
- package/src/SessionUser/components/un-login.tsx +41 -33
- package/src/SessionUser/components/user-info.tsx +7 -8
- package/src/SessionUser/images/did-spaces.svg +7 -13
- package/src/SharedBridge/index.tsx +123 -0
- package/src/SharedBridge/need-storage-access-api-dialog.tsx +171 -0
- package/src/Success/index.tsx +6 -4
- package/src/Switch/index.jsx +3 -3
- package/src/Tabs/index.tsx +8 -9
- package/src/Theme/index.ts +2 -2
- package/src/Theme/theme-provider.tsx +73 -2
- package/src/Theme/theme.ts +73 -22
- package/src/UserCard/Container/card.tsx +1 -1
- package/src/UserCard/Container/dialog.tsx +1 -1
- package/src/Util/iframe.ts +19 -0
- package/src/Util/index.ts +102 -4
- package/src/type.d.ts +5 -1
@@ -1,54 +1,8 @@
|
|
1
|
+
import { BLOCKLET_THEME_LIGHT, type Theme } from '@blocklet/theme';
|
2
|
+
|
1
3
|
/**
|
2
|
-
*
|
3
|
-
*
|
4
|
-
* - colors object 结构是在 mui theme#palette object 基础上调整后的结构
|
5
|
-
* - 色值在 mui default theme 基础上将 figma 中常用的 colors 进行覆盖
|
6
|
-
* - 扩展一些常用色值 (如 DID 系列)
|
7
|
-
* - figma: https://www.figma.com/file/1qHyMF137EXOQpSFVByszG/UX-Library?node-id=295%3A1518
|
4
|
+
* @deprecated 请使用 MUI theme 对象替代
|
8
5
|
*/
|
9
|
-
const colors =
|
10
|
-
common: {
|
11
|
-
black: '#000',
|
12
|
-
white: '#fff',
|
13
|
-
},
|
14
|
-
primary: { main: '#3773F2', contrastText: '#fff' }, // override
|
15
|
-
secondary: { main: '#16CED1', contrastText: '#fff' }, // override
|
16
|
-
error: { main: '#F16E6E', contrastText: '#fff' }, // override
|
17
|
-
warning: { main: '#DE9E37', contrastText: '#fff' }, // override
|
18
|
-
info: { main: '#0775F8', contrastText: '#fff' }, // override
|
19
|
-
success: { main: '#34BE74', contrastText: '#fff' }, // override
|
20
|
-
grey: {
|
21
|
-
50: '#fafafa',
|
22
|
-
100: '#f5f5f5',
|
23
|
-
200: '#eeeeee',
|
24
|
-
300: '#e0e0e0',
|
25
|
-
400: '#bdbdbd',
|
26
|
-
500: '#9e9e9e',
|
27
|
-
600: '#757575',
|
28
|
-
700: '#616161',
|
29
|
-
800: '#424242',
|
30
|
-
900: '#212121',
|
31
|
-
A100: '#d5d5d5',
|
32
|
-
A200: '#aaaaaa',
|
33
|
-
A400: '#303030',
|
34
|
-
A700: '#616161',
|
35
|
-
},
|
36
|
-
text: {
|
37
|
-
primary: 'rgba(0, 0, 0, 0.87)',
|
38
|
-
secondary: 'rgba(0, 0, 0, 0.54)',
|
39
|
-
disabled: 'rgba(0, 0, 0, 0.38)',
|
40
|
-
hint: 'rgba(0, 0, 0, 0.38)',
|
41
|
-
},
|
42
|
-
divider: 'rgba(0, 0, 0, 0.12)',
|
43
|
-
background: {
|
44
|
-
default: '#fff',
|
45
|
-
},
|
46
|
-
// 扩展色值, 适用于 did 相关的组件, 如果某些产品整体风格是 did 系列, 可以扩展出一个 did 系列的 theme
|
47
|
-
did: {
|
48
|
-
primary: '#4598FA',
|
49
|
-
secondary: '#49C3AD',
|
50
|
-
},
|
51
|
-
// TODO: 等设计规范稳定后, 考虑扩展 trade 相关的常用颜色 (send/receive/exchange/transfer)
|
52
|
-
};
|
6
|
+
const colors = BLOCKLET_THEME_LIGHT.palette as Theme['palette'];
|
53
7
|
|
54
8
|
export default colors;
|
@@ -1,3 +1,8 @@
|
|
1
|
+
import type { Theme } from '@mui/material';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @deprecated 请使用 MUI theme 对象替代
|
5
|
+
*/
|
1
6
|
const colors = {
|
2
7
|
background: {
|
3
8
|
overlay: 'rgba(15, 23, 42, 0.5)',
|
@@ -10,7 +15,7 @@ const colors = {
|
|
10
15
|
text: {
|
11
16
|
primary: '#18181B',
|
12
17
|
secondary: '#71717B',
|
13
|
-
|
18
|
+
disabled: '#D4D4D8',
|
14
19
|
hint: '#D4D4D8',
|
15
20
|
},
|
16
21
|
state: {
|
@@ -23,37 +28,39 @@ const colors = {
|
|
23
28
|
main: '#2B7FFF',
|
24
29
|
light: '#51A2FF',
|
25
30
|
dark: '#155DFC',
|
31
|
+
contrastText: '#fff',
|
26
32
|
},
|
27
33
|
secondary: {
|
28
34
|
main: '#615FFF',
|
29
35
|
light: '#7C86FF',
|
30
36
|
dark: '#4F39F6',
|
37
|
+
contrastText: '#fff',
|
31
38
|
},
|
32
39
|
error: {
|
33
40
|
main: '#FB2C36',
|
34
41
|
light: '#FF6467',
|
35
42
|
dark: '#E7000B',
|
43
|
+
contrastText: '#fff',
|
36
44
|
},
|
37
45
|
warning: {
|
38
46
|
main: '#FF6900',
|
39
47
|
light: '#FF8904',
|
40
48
|
dark: '#F54900',
|
49
|
+
contrastText: '#fff',
|
41
50
|
},
|
42
51
|
info: {
|
43
52
|
main: '#2B7FFF',
|
44
53
|
light: '#51A2FF',
|
45
54
|
dark: '#155DFC',
|
55
|
+
contrastText: '#fff',
|
46
56
|
},
|
47
57
|
success: {
|
48
58
|
main: '#00C950',
|
49
59
|
light: '#05DF72',
|
50
60
|
dark: '#00A63E',
|
61
|
+
contrastText: '#fff',
|
51
62
|
},
|
52
|
-
divider:
|
53
|
-
main: 'rgba(18, 22, 24, 0.06)',
|
54
|
-
light: '#F4F4F5',
|
55
|
-
dark: '#D4D4D5',
|
56
|
-
},
|
63
|
+
divider: 'rgba(18, 22, 24, 0.06)',
|
57
64
|
};
|
58
65
|
|
59
66
|
export default colors;
|
@@ -1,34 +1,33 @@
|
|
1
1
|
import { createContext, useContext, ReactNode, useMemo, useState, useCallback, useEffect } from 'react';
|
2
|
-
import { type PaletteMode } from '@mui/material';
|
3
|
-
import
|
4
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
2
|
+
import { ThemeOptions, type PaletteMode } from '@mui/material';
|
3
|
+
import { BLOCKLET_THEME_PREFER_KEY } from '@blocklet/theme';
|
5
4
|
import set from 'lodash/set';
|
6
5
|
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
7
6
|
import { LocaleProvider, LocaleProviderProps, useLocaleContext } from '../Locale/context';
|
8
7
|
import ThemeProvider, { ThemeProviderProps } from '../Theme/theme-provider';
|
9
|
-
import {
|
8
|
+
import {
|
9
|
+
createTheme,
|
10
|
+
getDefaultThemePrefer,
|
11
|
+
lazyThemeConfig,
|
12
|
+
useTheme,
|
13
|
+
type UserThemeOptions,
|
14
|
+
type ThemeConfig,
|
15
|
+
} from '../Theme';
|
10
16
|
|
11
17
|
export interface ConfigContextType {
|
12
18
|
mode: PaletteMode;
|
13
|
-
themeOptions:
|
19
|
+
themeOptions: UserThemeOptions;
|
14
20
|
toggleMode: () => void;
|
15
21
|
}
|
16
22
|
|
17
23
|
const ConfigContext = createContext<ConfigContextType>({} as ConfigContextType);
|
18
|
-
const preferThemeModeKey = 'blocklet_theme_prefer';
|
19
|
-
|
20
|
-
export function isThemeRecord(
|
21
|
-
theme: ThemeOptions | Record<PaletteMode, ThemeOptions>
|
22
|
-
): theme is Record<PaletteMode, ThemeOptions> {
|
23
|
-
return 'light' in theme || 'dark' in theme;
|
24
|
-
}
|
25
24
|
|
26
25
|
export interface ConfigProviderProps
|
27
26
|
extends Omit<LocaleProviderProps, 'translations'>,
|
28
27
|
Omit<ThemeProviderProps, 'theme'> {
|
29
28
|
children: ReactNode;
|
30
29
|
prefer?: PaletteMode;
|
31
|
-
theme?:
|
30
|
+
theme?: UserThemeOptions | ((config: ThemeConfig) => UserThemeOptions);
|
32
31
|
disableBlockletTheme?: boolean;
|
33
32
|
translations?: Record<string, any>;
|
34
33
|
}
|
@@ -50,33 +49,21 @@ export function ConfigProvider({
|
|
50
49
|
languages,
|
51
50
|
onLoadingTranslation,
|
52
51
|
}: ConfigProviderProps) {
|
53
|
-
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
|
54
52
|
const [mode, setMode] = useState<PaletteMode>(() => {
|
55
53
|
if (prefer) {
|
56
54
|
return prefer;
|
57
55
|
}
|
58
56
|
|
59
|
-
|
60
|
-
if (['1', 'true'].includes(window.blocklet?.USE_DARK_THEME) === false) {
|
61
|
-
return 'light';
|
62
|
-
}
|
63
|
-
|
64
|
-
// 本地缓存
|
65
|
-
const localPrefer = localStorage.getItem(preferThemeModeKey) as PaletteMode;
|
66
|
-
if (localPrefer && (localPrefer === 'light' || localPrefer === 'dark')) {
|
67
|
-
return localPrefer;
|
68
|
-
}
|
69
|
-
|
70
|
-
// 系统偏好
|
71
|
-
return prefersDarkMode ? 'dark' : 'light';
|
57
|
+
return getDefaultThemePrefer();
|
72
58
|
});
|
73
59
|
|
74
60
|
const _themeOptions = useMemo(() => {
|
75
61
|
let result: ThemeOptions = {};
|
62
|
+
const getThemeConfig = lazyThemeConfig(mode);
|
76
63
|
|
77
64
|
if (themeOptions) {
|
78
|
-
if (
|
79
|
-
result = themeOptions
|
65
|
+
if (typeof themeOptions === 'function') {
|
66
|
+
result = themeOptions(getThemeConfig());
|
80
67
|
} else {
|
81
68
|
result = { ...themeOptions };
|
82
69
|
}
|
@@ -95,7 +82,7 @@ export function ConfigProvider({
|
|
95
82
|
const toggleMode = useCallback(() => {
|
96
83
|
const newMode = mode === 'light' ? 'dark' : 'light';
|
97
84
|
setMode(newMode);
|
98
|
-
localStorage.setItem(
|
85
|
+
localStorage.setItem(BLOCKLET_THEME_PREFER_KEY, newMode);
|
99
86
|
}, [mode, setMode]);
|
100
87
|
|
101
88
|
const config = useMemo(
|
package/src/DID/index.tsx
CHANGED
@@ -9,7 +9,6 @@ import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
9
9
|
|
10
10
|
import Address, { IDidAddressWrapper } from '../Address';
|
11
11
|
import Avatar from '../Avatar';
|
12
|
-
import { temp as colors } from '../Colors';
|
13
12
|
import { DID_PREFIX } from '../Util/constant';
|
14
13
|
|
15
14
|
import { HTMLDidAddressElement } from '../Address/did-address';
|
@@ -222,7 +221,7 @@ export const DID = forwardRef<HTMLDIDElement, DIDProps>((props, ref) => {
|
|
222
221
|
flexShrink: 0,
|
223
222
|
cursor: 'pointer',
|
224
223
|
ml: 0.5,
|
225
|
-
color: '
|
224
|
+
color: 'text.secondary',
|
226
225
|
}}
|
227
226
|
/>
|
228
227
|
) : null}
|
@@ -290,7 +289,7 @@ export function DIDDialog({
|
|
290
289
|
target="_blank"
|
291
290
|
rel="noreferrer"
|
292
291
|
sx={{
|
293
|
-
color:
|
292
|
+
color: 'secondary.main',
|
294
293
|
textDecoration: 'none',
|
295
294
|
'&:hover': {
|
296
295
|
textDecoration: 'underline',
|
@@ -371,7 +370,7 @@ export function DIDDialog({
|
|
371
370
|
<Typography
|
372
371
|
variant="body2"
|
373
372
|
sx={{
|
374
|
-
color:
|
373
|
+
color: 'text.secondary',
|
375
374
|
fontSize: '12px',
|
376
375
|
mt: 1,
|
377
376
|
}}>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { useState } from 'react';
|
2
|
+
import { joinURL } from 'ufo';
|
3
|
+
import { SxProps } from '@mui/material';
|
4
|
+
|
5
|
+
import Img from '../Img';
|
6
|
+
import { isUrl } from '../Util';
|
7
|
+
import DidAvatar from '../Avatar';
|
8
|
+
|
9
|
+
type AppIconProps = {
|
10
|
+
appInfo: any;
|
11
|
+
size?: number;
|
12
|
+
sx?: SxProps;
|
13
|
+
};
|
14
|
+
|
15
|
+
export default function AppIcon({ appInfo, size = 32, ...rest }: AppIconProps) {
|
16
|
+
const [error, setError] = useState(false);
|
17
|
+
if (error || !(appInfo.appUrl || appInfo.appLogo)) {
|
18
|
+
return <DidAvatar did={appInfo.appPid} size={size} />;
|
19
|
+
}
|
20
|
+
|
21
|
+
let logoUrl = appInfo.appLogo || '';
|
22
|
+
if (!isUrl(logoUrl)) {
|
23
|
+
logoUrl = joinURL(appInfo.appUrl || '', logoUrl);
|
24
|
+
}
|
25
|
+
|
26
|
+
return (
|
27
|
+
<Img
|
28
|
+
src={logoUrl}
|
29
|
+
alt={appInfo.appName || 'Blocklet Icon'}
|
30
|
+
width={size}
|
31
|
+
height={size}
|
32
|
+
{...rest}
|
33
|
+
onError={() => setError(true)}
|
34
|
+
/>
|
35
|
+
);
|
36
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import { Box, IconButton, SxProps, Tooltip, useMediaQuery } from '@mui/material';
|
2
|
+
import CheckIcon from '@iconify-icons/material-symbols/check';
|
3
|
+
import { Icon } from '@iconify/react';
|
4
|
+
|
5
|
+
import DID from '../DID';
|
6
|
+
import { mergeSx } from '../Util/style';
|
7
|
+
import AppIcon from './app-icon';
|
8
|
+
|
9
|
+
export default function AppInfoItem({
|
10
|
+
appInfo,
|
11
|
+
active = false,
|
12
|
+
appLogo = null,
|
13
|
+
sx,
|
14
|
+
}: {
|
15
|
+
appInfo: any;
|
16
|
+
active?: boolean;
|
17
|
+
appLogo?: React.ReactNode;
|
18
|
+
sx?: SxProps;
|
19
|
+
}) {
|
20
|
+
const isTinyView = useMediaQuery('(max-width:400px)');
|
21
|
+
|
22
|
+
return (
|
23
|
+
<Box
|
24
|
+
sx={mergeSx(
|
25
|
+
{
|
26
|
+
display: 'flex',
|
27
|
+
alignItems: 'center',
|
28
|
+
fontWeight: 600,
|
29
|
+
color: 'text.primary',
|
30
|
+
|
31
|
+
'& .app-info-content': {
|
32
|
+
paddingLeft: '8px',
|
33
|
+
overflow: 'hidden',
|
34
|
+
},
|
35
|
+
|
36
|
+
'& .app-info-name': {
|
37
|
+
maxWidth: '100%',
|
38
|
+
lineHeight: 'normal',
|
39
|
+
whiteSpace: 'nowrap',
|
40
|
+
overflow: 'hidden',
|
41
|
+
textOverflow: 'ellipsis',
|
42
|
+
fontSize: '12px',
|
43
|
+
color: 'text.primary',
|
44
|
+
},
|
45
|
+
},
|
46
|
+
sx
|
47
|
+
)}>
|
48
|
+
{appLogo || (
|
49
|
+
<Box
|
50
|
+
sx={{
|
51
|
+
borderRadius: 1,
|
52
|
+
overflow: 'hidden',
|
53
|
+
fontSize: 0,
|
54
|
+
}}>
|
55
|
+
<AppIcon appInfo={appInfo} />
|
56
|
+
</Box>
|
57
|
+
)}
|
58
|
+
|
59
|
+
<Box className="app-info-content">
|
60
|
+
<Tooltip title={appInfo.appName} placement="top">
|
61
|
+
<Box className="app-info-name">{appInfo.appName}</Box>
|
62
|
+
</Tooltip>
|
63
|
+
{appInfo.appPid && (
|
64
|
+
<DID
|
65
|
+
className="app-info-did"
|
66
|
+
did={appInfo.appPid}
|
67
|
+
sx={{ fontSize: '10px !important' }}
|
68
|
+
copyable={false}
|
69
|
+
startChars={isTinyView ? 6 : 8}
|
70
|
+
endChars={isTinyView ? 6 : 8}
|
71
|
+
size={12}
|
72
|
+
/>
|
73
|
+
)}
|
74
|
+
</Box>
|
75
|
+
{active ? (
|
76
|
+
<IconButton size="small" color="success">
|
77
|
+
<Icon icon={CheckIcon} color="success" />
|
78
|
+
</IconButton>
|
79
|
+
) : null}
|
80
|
+
</Box>
|
81
|
+
);
|
82
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { Box, useMediaQuery } from '@mui/material';
|
2
|
+
|
3
|
+
import PoweredBy from './powered-by';
|
4
|
+
import AppInfoItem from './app-info-item';
|
5
|
+
import AppIcon from './app-icon';
|
6
|
+
import { getDIDColor, hexToRgba } from '../Util';
|
7
|
+
|
8
|
+
export default function DIDConnectFooter({
|
9
|
+
currentAppInfo = globalThis.blocklet,
|
10
|
+
currentAppColor = globalThis.blocklet?.appPid ? getDIDColor(globalThis.blocklet?.appPid) : '#fff',
|
11
|
+
}: {
|
12
|
+
currentAppInfo?: any;
|
13
|
+
currentAppColor?: string;
|
14
|
+
}) {
|
15
|
+
const isSmallView = useMediaQuery('(max-width:640px)');
|
16
|
+
|
17
|
+
return (
|
18
|
+
<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 浏览器)
|
34
|
+
},
|
35
|
+
'-ms-overflow-style': 'none', // 隐藏滚动条 (IE 浏览器)
|
36
|
+
'scrollbar-width': 'none', // 隐藏滚动条 (Firefox)
|
37
|
+
}}
|
38
|
+
className="did-connect__footer">
|
39
|
+
<AppInfoItem
|
40
|
+
appInfo={currentAppInfo}
|
41
|
+
appLogo={<AppIcon appInfo={currentAppInfo} size={24} sx={{ flexShrink: 0 }} />}
|
42
|
+
sx={{
|
43
|
+
flex: 1,
|
44
|
+
overflow: 'hidden',
|
45
|
+
}}
|
46
|
+
/>
|
47
|
+
|
48
|
+
<PoweredBy sx={{ maxWidth: '100%', justifyContent: 'end' }} />
|
49
|
+
</Box>
|
50
|
+
);
|
51
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import DidBrandConnect from '@arcblock/icons/lib/DidBrandConnect';
|
2
|
+
import { useTheme } from '@mui/material';
|
3
|
+
|
4
|
+
export default function DidConnectLogo() {
|
5
|
+
const theme = useTheme();
|
6
|
+
|
7
|
+
return <DidBrandConnect style={{ filter: theme.palette.mode === 'dark' ? 'invert(1)' : 'none' }} />;
|
8
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export { default as DIDConnectFooter } from './did-connect-footer';
|
2
|
+
export { default as AppInfoItem } from './app-info-item';
|
3
|
+
export { default as AppIcon } from './app-icon';
|
4
|
+
export { default as PoweredBy } from './powered-by';
|
5
|
+
export { default as withContainer } from './with-container';
|
6
|
+
export { default as withUxTheme } from './with-ux-theme';
|
7
|
+
export { default as DIDConnectLogo } from './did-connect-logo';
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { Box, useTheme } from '@mui/material';
|
2
|
+
import { Icon } from '@iconify/react';
|
3
|
+
import shieldCheckIcon from '@iconify-icons/mdi/shield-check';
|
4
|
+
|
5
|
+
import DidConnectLogo from './did-connect-logo';
|
6
|
+
import { mergeSx } from '../Util/style';
|
7
|
+
|
8
|
+
export default function PoweredBy({ ...rest }) {
|
9
|
+
const { palette } = useTheme();
|
10
|
+
|
11
|
+
return (
|
12
|
+
<Box
|
13
|
+
{...rest}
|
14
|
+
sx={mergeSx(
|
15
|
+
{
|
16
|
+
display: 'flex',
|
17
|
+
alignItems: 'center',
|
18
|
+
justifyContent: 'center',
|
19
|
+
color: 'text.secondary',
|
20
|
+
gap: 0.5,
|
21
|
+
fontSize: 12,
|
22
|
+
fontFamily: 'Lexend',
|
23
|
+
whiteSpace: 'nowrap',
|
24
|
+
},
|
25
|
+
rest?.sx
|
26
|
+
)}>
|
27
|
+
<Icon icon={shieldCheckIcon} color={palette.success.main} />
|
28
|
+
Secured by
|
29
|
+
<Box
|
30
|
+
component="a"
|
31
|
+
href="https://www.didconnect.io/"
|
32
|
+
target="_blank"
|
33
|
+
rel="noopener"
|
34
|
+
sx={{
|
35
|
+
color: 'initial',
|
36
|
+
display: 'flex',
|
37
|
+
alignItems: 'center',
|
38
|
+
gap: 0.5,
|
39
|
+
textDecoration: 'none',
|
40
|
+
'&:hover': {
|
41
|
+
textDecoration: 'underline',
|
42
|
+
},
|
43
|
+
}}>
|
44
|
+
<DidConnectLogo />
|
45
|
+
</Box>
|
46
|
+
</Box>
|
47
|
+
);
|
48
|
+
}
|