@arcblock/ux 3.4.15 → 3.5.1
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/package.json.js +1 -1
- package/package.json +10 -7
- package/src/ActionButton/ActionButton.stories.jsx +0 -61
- package/src/ActionButton/index.jsx +0 -106
- package/src/ActivityIndicator/ActivityIndicator.stories.jsx +0 -9
- package/src/ActivityIndicator/index.jsx +0 -140
- package/src/Address/Address.stories.jsx +0 -38
- package/src/Address/compact-text.jsx +0 -76
- package/src/Address/did-address.tsx +0 -223
- package/src/Address/index.tsx +0 -21
- package/src/Address/responsive-did-address.tsx +0 -154
- package/src/Alert/Alert.stories.jsx +0 -100
- package/src/Alert/index.jsx +0 -130
- package/src/AnimationWaiter/AnimationWaiter.stories.jsx +0 -35
- package/src/AnimationWaiter/dark-animation.json +0 -1
- package/src/AnimationWaiter/default-animation.json +0 -1
- package/src/AnimationWaiter/index.jsx +0 -296
- package/src/Async/index.tsx +0 -44
- package/src/Avatar/Avatar.stories.jsx +0 -11
- package/src/Avatar/did-motif.jsx +0 -38
- package/src/Avatar/etherscan-blockies.js +0 -81
- package/src/Avatar/index.jsx +0 -195
- package/src/Badge/Badge.stories.jsx +0 -41
- package/src/Badge/index.jsx +0 -101
- package/src/Blocklet/Blocklet.stories.jsx +0 -21
- package/src/Blocklet/blocklet.jsx +0 -276
- package/src/Blocklet/index.js +0 -5
- package/src/Blocklet/utils.jsx +0 -58
- package/src/BlockletContext/index.tsx +0 -72
- package/src/BlockletNFT/BlockletNFT.stories.jsx +0 -21
- package/src/BlockletNFT/index.jsx +0 -378
- package/src/BlockletV2/Blocklet.stories.jsx +0 -34
- package/src/BlockletV2/blocklet.tsx +0 -247
- package/src/BlockletV2/components/icon-text.tsx +0 -47
- package/src/BlockletV2/components/tooltip-icon.tsx +0 -52
- package/src/BlockletV2/index.ts +0 -6
- package/src/BlockletV2/utils.js +0 -75
- package/src/Button/Button.stories.jsx +0 -24
- package/src/Button/index.js +0 -9
- package/src/Button/wrap.jsx +0 -126
- package/src/ButtonGroup/index.js +0 -16
- package/src/CardSelector/index.tsx +0 -136
- package/src/Center/Center.stories.jsx +0 -20
- package/src/Center/index.tsx +0 -33
- package/src/ClickToCopy/ClickToCopy.stories.jsx +0 -24
- package/src/ClickToCopy/copy-button.tsx +0 -43
- package/src/ClickToCopy/hook.ts +0 -42
- package/src/ClickToCopy/index.tsx +0 -96
- package/src/CloseButton/index.tsx +0 -37
- package/src/CodeBlock/CodeBlock.stories.jsx +0 -22
- package/src/CodeBlock/LightBox.tsx +0 -87
- package/src/CodeBlock/index.tsx +0 -217
- package/src/Colors/Colors.stories.jsx +0 -211
- package/src/Colors/index.ts +0 -4
- package/src/Colors/themes/default.ts +0 -8
- package/src/Colors/themes/did-connect.ts +0 -64
- package/src/Colors/themes/temp.ts +0 -52
- package/src/Config/Config.stories.jsx +0 -16
- package/src/Config/config-provider.tsx +0 -62
- package/src/Config/index.ts +0 -2
- package/src/Config/theme-mode-toggle.tsx +0 -38
- package/src/ContactForm/ContactForm.stories.jsx +0 -32
- package/src/ContactForm/index.tsx +0 -264
- package/src/CookieConsent/CookieConsent.stories.jsx +0 -33
- package/src/CookieConsent/index.tsx +0 -104
- package/src/CountDown/CountDown.stories.jsx +0 -15
- package/src/CountDown/index.tsx +0 -170
- package/src/DID/DID.stories.jsx +0 -37
- package/src/DID/index.tsx +0 -393
- package/src/DIDConnect/app-icon.tsx +0 -37
- package/src/DIDConnect/app-info-item.tsx +0 -93
- package/src/DIDConnect/auth-apps/auth-apps-info.tsx +0 -77
- package/src/DIDConnect/auth-apps/index.tsx +0 -278
- package/src/DIDConnect/auth-apps/switch-role.tsx +0 -47
- package/src/DIDConnect/did-connect-container.tsx +0 -326
- package/src/DIDConnect/did-connect-footer.tsx +0 -76
- package/src/DIDConnect/did-connect-logo.tsx +0 -8
- package/src/DIDConnect/icons/did-wallet-logo.tsx +0 -18
- package/src/DIDConnect/icons/github-logo.tsx +0 -17
- package/src/DIDConnect/index.ts +0 -11
- package/src/DIDConnect/landing-page.tsx +0 -218
- package/src/DIDConnect/powered-by.tsx +0 -48
- package/src/DIDConnect/provider-icon.tsx +0 -62
- package/src/DIDConnect/request-storage-access-api-dialog.tsx +0 -304
- package/src/DIDConnect/with-container.tsx +0 -323
- package/src/DIDConnect/with-ux-theme.tsx +0 -22
- package/src/DIDLogo/Logo.stories.jsx +0 -11
- package/src/DIDLogo/index.tsx +0 -168
- package/src/Datatable/CustomToolbar.jsx +0 -415
- package/src/Datatable/Datatable.stories.jsx +0 -92
- package/src/Datatable/DatatableContext.jsx +0 -35
- package/src/Datatable/TableSearch.jsx +0 -166
- package/src/Datatable/index.jsx +0 -652
- package/src/Datatable/utils.js +0 -161
- package/src/Dialog/Dialog.stories.jsx +0 -21
- package/src/Dialog/confirm.jsx +0 -143
- package/src/Dialog/dialog.jsx +0 -199
- package/src/Dialog/index.js +0 -4
- package/src/Dialog/types.d.ts +0 -20
- package/src/Dialog/use-confirm.jsx +0 -188
- package/src/DriftBot/index.tsx +0 -81
- package/src/Earth/Earth.stories.jsx +0 -39
- package/src/Earth/countries.json +0 -8057
- package/src/Earth/index.tsx +0 -515
- package/src/Earth/util.ts +0 -72
- package/src/Empty/Empty.stories.jsx +0 -23
- package/src/Empty/index.jsx +0 -48
- package/src/ErrorBoundary/ErrorBoundary.stories.jsx +0 -13
- package/src/ErrorBoundary/fallback.tsx +0 -85
- package/src/ErrorBoundary/index.ts +0 -1
- package/src/Footer/Footer.stories.jsx +0 -13
- package/src/Footer/index.tsx +0 -130
- package/src/Header/Header.stories.jsx +0 -30
- package/src/Header/addon-button.tsx +0 -41
- package/src/Header/auto-hidden.tsx +0 -31
- package/src/Header/header-addons.tsx +0 -37
- package/src/Header/header.tsx +0 -214
- package/src/Header/index.ts +0 -3
- package/src/Header/responsive-header.tsx +0 -145
- package/src/Icon/Icon.stories.jsx +0 -45
- package/src/Icon/image.tsx +0 -53
- package/src/Icon/index.tsx +0 -63
- package/src/Img/Img.stories.jsx +0 -17
- package/src/Img/index.jsx +0 -258
- package/src/InfoRow/InfoRow.stories.jsx +0 -14
- package/src/InfoRow/index.tsx +0 -91
- package/src/Layout/Layout.stories.jsx +0 -24
- package/src/Layout/dashboard/external-link.tsx +0 -59
- package/src/Layout/dashboard/full-page.tsx +0 -58
- package/src/Layout/dashboard/index.tsx +0 -260
- package/src/Layout/dashboard/sidebar.tsx +0 -198
- package/src/Layout/dashboard-legacy/header.tsx +0 -156
- package/src/Layout/dashboard-legacy/index.tsx +0 -127
- package/src/Layout/dashboard-legacy/sidebar.tsx +0 -129
- package/src/Layout/index.tsx +0 -310
- package/src/LoadingMask/index.tsx +0 -108
- package/src/Locale/LocaleSelector.stories.jsx +0 -44
- package/src/Locale/browser-lang.ts +0 -65
- package/src/Locale/context.tsx +0 -162
- package/src/Locale/languages.ts +0 -58
- package/src/Locale/selector.tsx +0 -174
- package/src/Locale/util.ts +0 -38
- package/src/Logo/Logo.stories.jsx +0 -23
- package/src/Logo/images/logo-dark-text.svg +0 -3
- package/src/Logo/images/logo-dark-top.svg +0 -6
- package/src/Logo/images/logo-light-text.svg +0 -3
- package/src/Logo/images/logo-light-top.svg +0 -6
- package/src/Logo/index.tsx +0 -58
- package/src/Metric/Metric.stories.jsx +0 -29
- package/src/Metric/index.tsx +0 -130
- package/src/MuiWrap/index.tsx +0 -10
- package/src/NFTDisplay/NFTBroken.svg +0 -34
- package/src/NFTDisplay/NFTDisplay.stories.jsx +0 -30
- package/src/NFTDisplay/README.md +0 -59
- package/src/NFTDisplay/aspect-ratio-container.tsx +0 -36
- package/src/NFTDisplay/broken.tsx +0 -51
- package/src/NFTDisplay/displayApi.ts +0 -43
- package/src/NFTDisplay/index.tsx +0 -393
- package/src/NFTDisplay/loading.tsx +0 -16
- package/src/NFTDisplay/preview.tsx +0 -84
- package/src/NFTDisplay/render-svg.tsx +0 -21
- package/src/NFTDisplay/svg-embedder/img.tsx +0 -27
- package/src/NFTDisplay/svg-embedder/inline-svg.tsx +0 -36
- package/src/NavMenu/NavMenu.stories.jsx +0 -17
- package/src/NavMenu/images/OCAP.svg +0 -1
- package/src/NavMenu/images/abt-network.svg +0 -1
- package/src/NavMenu/images/ai-kit.svg +0 -1
- package/src/NavMenu/images/aigne-image-smith.svg +0 -1
- package/src/NavMenu/images/aigne.svg +0 -1
- package/src/NavMenu/images/aistro.png +0 -0
- package/src/NavMenu/images/arcsphere.svg +0 -1
- package/src/NavMenu/images/blocklet-framework.svg +0 -1
- package/src/NavMenu/images/blocklet-launcher.svg +0 -1
- package/src/NavMenu/images/blocklet-server.svg +0 -1
- package/src/NavMenu/images/blocklet-store.svg +0 -1
- package/src/NavMenu/images/creator-studio.svg +0 -1
- package/src/NavMenu/images/did-wallet.svg +0 -1
- package/src/NavMenu/images/did.svg +0 -1
- package/src/NavMenu/images/nft-studio.svg +0 -1
- package/src/NavMenu/images/payment-kit.png +0 -0
- package/src/NavMenu/images/vc.svg +0 -1
- package/src/NavMenu/images/web3-kit.svg +0 -1
- package/src/NavMenu/index.ts +0 -3
- package/src/NavMenu/nav-menu-context.tsx +0 -30
- package/src/NavMenu/nav-menu.tsx +0 -441
- package/src/NavMenu/products.tsx +0 -830
- package/src/NavMenu/style.ts +0 -258
- package/src/NavMenu/sub-container.tsx +0 -125
- package/src/NavMenu/sub-item-group.tsx +0 -42
- package/src/OrgTransfer/index.tsx +0 -53
- package/src/OrgTransfer/locales.ts +0 -25
- package/src/OrgTransfer/selector.tsx +0 -252
- package/src/OrgTransfer/type.ts +0 -31
- package/src/PageScroller/index.tsx +0 -316
- package/src/PageScroller/story/FifthComponent.jsx +0 -7
- package/src/PageScroller/story/FirstComponent.jsx +0 -7
- package/src/PageScroller/story/FourthComponent.jsx +0 -7
- package/src/PageScroller/story/FullPage.jsx +0 -55
- package/src/PageScroller/story/PageContain.jsx +0 -59
- package/src/PageScroller/story/PageScroller.stories.jsx +0 -18
- package/src/PageScroller/story/SecondComponent.jsx +0 -7
- package/src/PageScroller/story/ThirdComponent.jsx +0 -7
- package/src/PageScroller/story/index.css +0 -115
- package/src/PageScroller/usePrevValue.ts +0 -11
- package/src/Passport/index.ts +0 -3
- package/src/Passport/passport.tsx +0 -118
- package/src/PhoneInput/PhoneInput.stories.jsx +0 -12
- package/src/PhoneInput/country-select.tsx +0 -148
- package/src/PhoneInput/index.tsx +0 -269
- package/src/PoweredByArcBlock/index.tsx +0 -27
- package/src/PricingTable/PricingPlan.tsx +0 -120
- package/src/PricingTable/PricingTable.stories.jsx +0 -38
- package/src/PricingTable/index.tsx +0 -59
- package/src/QRCode/QRCode.stories.jsx +0 -13
- package/src/QRCode/index.tsx +0 -66
- package/src/RelativeTime/RelativeTime.stories.jsx +0 -20
- package/src/RelativeTime/index.tsx +0 -334
- package/src/Result/Result.stories.jsx +0 -61
- package/src/Result/common.tsx +0 -119
- package/src/Result/index.tsx +0 -30
- package/src/Result/result.tsx +0 -65
- package/src/Result/translations.ts +0 -57
- package/src/Screenshot/BaseScreenshot/index.tsx +0 -73
- package/src/Screenshot/BaseScreenshot/shells/Macbook.tsx +0 -38
- package/src/Screenshot/BaseScreenshot/shells/Phone.tsx +0 -35
- package/src/Screenshot/Screenshot.stories.jsx +0 -44
- package/src/Screenshot/devices.css +0 -1366
- package/src/Screenshot/index.tsx +0 -300
- package/src/SessionBlocklet/index.tsx +0 -178
- package/src/SessionManager/SessionManager.stories.jsx +0 -9
- package/src/SessionManager/index.tsx +0 -3
- package/src/SessionPermission/index.tsx +0 -26
- package/src/SessionUser/components/did-space.tsx +0 -68
- package/src/SessionUser/components/logged-in.tsx +0 -338
- package/src/SessionUser/components/quick-login-item.tsx +0 -132
- package/src/SessionUser/components/session-user-item.tsx +0 -93
- package/src/SessionUser/components/session-user-switch.tsx +0 -240
- package/src/SessionUser/components/un-login.tsx +0 -257
- package/src/SessionUser/components/user-info.tsx +0 -201
- package/src/SessionUser/index.tsx +0 -68
- package/src/SessionUser/libs/translation.ts +0 -30
- package/src/SessionUser/libs/utils.ts +0 -39
- package/src/SharedBridge/index.tsx +0 -126
- package/src/SocialShare/index.tsx +0 -194
- package/src/Sparkline/Sparkline.stories.jsx +0 -13
- package/src/Sparkline/index.tsx +0 -231
- package/src/Spinner/Spinner.stories.jsx +0 -98
- package/src/Spinner/index.tsx +0 -20
- package/src/SplitButton/SplitButton.stories.jsx +0 -32
- package/src/SplitButton/index.tsx +0 -116
- package/src/SplitButton/useClickAway.tsx +0 -24
- package/src/Success/index.tsx +0 -175
- package/src/Switch/Switch.stories.jsx +0 -16
- package/src/Switch/index.jsx +0 -79
- package/src/Tabs/Tabs.stories.jsx +0 -18
- package/src/Tabs/index.tsx +0 -255
- package/src/Tag/Tag.stories.jsx +0 -15
- package/src/Tag/index.jsx +0 -106
- package/src/TextCollapse/TextCollapse.stories.jsx +0 -73
- package/src/TextCollapse/index.tsx +0 -85
- package/src/Theme/Theme.stories.jsx +0 -11
- package/src/Theme/index.ts +0 -21
- package/src/Theme/theme-provider.tsx +0 -374
- package/src/Theme/theme.ts +0 -229
- package/src/Toast/Toast.stories.jsx +0 -28
- package/src/Toast/index.tsx +0 -80
- package/src/Typography/index.tsx +0 -124
- package/src/UserCard/Cards/avatar-only.tsx +0 -27
- package/src/UserCard/Cards/basic-info.tsx +0 -43
- package/src/UserCard/Cards/index.tsx +0 -16
- package/src/UserCard/Cards/social-actions.tsx +0 -196
- package/src/UserCard/Container/card.tsx +0 -63
- package/src/UserCard/Container/dialog.tsx +0 -37
- package/src/UserCard/Content/basic.tsx +0 -330
- package/src/UserCard/Content/clock.tsx +0 -82
- package/src/UserCard/Content/minimal.tsx +0 -113
- package/src/UserCard/Content/shorten-label.tsx +0 -32
- package/src/UserCard/Content/tooltip-avatar.tsx +0 -80
- package/src/UserCard/UserCard.stories.jsx +0 -19
- package/src/UserCard/components.tsx +0 -81
- package/src/UserCard/index.tsx +0 -132
- package/src/UserCard/types.ts +0 -165
- package/src/UserCard/use-follow.tsx +0 -111
- package/src/UserCard/utils.ts +0 -155
- package/src/Util/WebWalletOpener.stories.jsx +0 -5
- package/src/Util/client.ts +0 -4
- package/src/Util/constant.ts +0 -70
- package/src/Util/deprecate.tsx +0 -29
- package/src/Util/federated.ts +0 -125
- package/src/Util/iframe.ts +0 -19
- package/src/Util/index.ts +0 -760
- package/src/Util/logger.ts +0 -44
- package/src/Util/passport.ts +0 -127
- package/src/Util/security.ts +0 -72
- package/src/Util/style.ts +0 -17
- package/src/Util/wallet.ts +0 -35
- package/src/VerificationCode/index.tsx +0 -83
- package/src/Video/Video.stories.jsx +0 -6
- package/src/Video/index.tsx +0 -70
- package/src/Wallet/Action.stories.jsx +0 -8
- package/src/Wallet/Action.tsx +0 -118
- package/src/Wallet/Download.stories.jsx +0 -9
- package/src/Wallet/Download.tsx +0 -157
- package/src/Wallet/Open.tsx +0 -47
- package/src/Wallet/OpenInWallet.stories.jsx +0 -5
- package/src/Wallet/images/abtwallet.png +0 -0
- package/src/Wallet/images/android_download.svg +0 -22
- package/src/Wallet/images/app-store.svg +0 -30
- package/src/Wallet/images/google-play.svg +0 -69
- package/src/WalletOSIcon/index.tsx +0 -47
- package/src/WebWalletSWKeeper/index.tsx +0 -117
- package/src/WechatPrompt/images/android.png +0 -0
- package/src/WechatPrompt/images/ios.png +0 -0
- package/src/WechatPrompt/index.tsx +0 -75
- package/src/global.d.ts +0 -28
- package/src/hooks/use-blocklet-logo.tsx +0 -32
- package/src/hooks/use-clock.tsx +0 -62
- package/src/hooks/use-location-state.tsx +0 -117
- package/src/hooks/use-mobile.tsx +0 -6
- package/src/index.ts +0 -79
- package/src/type.d.ts +0 -44
- package/src/withTheme/index.tsx +0 -72
- package/src/withTracker/README.md +0 -37
- package/src/withTracker/action/bind-wallet.tsx +0 -17
- package/src/withTracker/action/login.tsx +0 -18
- package/src/withTracker/action/pay.tsx +0 -14
- package/src/withTracker/action/switch-passport.tsx +0 -20
- package/src/withTracker/constant/index.tsx +0 -3
- package/src/withTracker/env.tsx +0 -1
- package/src/withTracker/error_boundary.jsx +0 -34
- package/src/withTracker/index.tsx +0 -50
- package/src/withTracker/libs/utm.ts +0 -46
- package/vite.config.mjs +0 -37
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
import { Typography, Box, Grid, useTheme } from '@mui/material';
|
|
2
|
-
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
3
|
-
import styled from '@emotion/styled';
|
|
4
|
-
import isArray from 'lodash/isArray';
|
|
5
|
-
import { Icon as IconifyIcon } from '@iconify/react';
|
|
6
|
-
import infoCircleIcon from '@iconify-icons/tabler/info-circle';
|
|
7
|
-
import LinkIcon from '@arcblock/icons/lib/Link';
|
|
8
|
-
import PhoneIcon from '@arcblock/icons/lib/Phone';
|
|
9
|
-
import LocationIcon from '@arcblock/icons/lib/Location';
|
|
10
|
-
import EmailIcon from '@arcblock/icons/lib/Email';
|
|
11
|
-
import TimezoneIcon from '@arcblock/icons/lib/Timezone';
|
|
12
|
-
import { withoutProtocol } from 'ufo';
|
|
13
|
-
import { useMemo, useCallback } from 'react';
|
|
14
|
-
|
|
15
|
-
import { User } from '../types';
|
|
16
|
-
import Clock from './clock';
|
|
17
|
-
|
|
18
|
-
const IconMap = {
|
|
19
|
-
timezone: TimezoneIcon,
|
|
20
|
-
email: EmailIcon,
|
|
21
|
-
phone: PhoneIcon,
|
|
22
|
-
location: LocationIcon,
|
|
23
|
-
link: LinkIcon,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 格式化链接显示
|
|
28
|
-
* 对于 http/https 协议只显示域名,其他协议显示完整链接
|
|
29
|
-
*/
|
|
30
|
-
function formatLinkDisplay(link: string): string {
|
|
31
|
-
return withoutProtocol(link);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* dark mode 下,转换 icon 颜色
|
|
36
|
-
*/
|
|
37
|
-
function convertIconColor(isDark: boolean) {
|
|
38
|
-
return isDark
|
|
39
|
-
? {
|
|
40
|
-
filter: 'brightness(0) saturate(100%) invert(1)',
|
|
41
|
-
}
|
|
42
|
-
: {};
|
|
43
|
-
}
|
|
44
|
-
const iconSize = {
|
|
45
|
-
width: 16,
|
|
46
|
-
height: 16,
|
|
47
|
-
};
|
|
48
|
-
interface BasicContentProps {
|
|
49
|
-
user: User;
|
|
50
|
-
renderFields?: string[];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// 定义渲染项的类型
|
|
54
|
-
interface RenderItem {
|
|
55
|
-
field: string;
|
|
56
|
-
value: string | any;
|
|
57
|
-
key: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function TimeZoneField({ value }: { value: string }) {
|
|
61
|
-
const theme = useTheme();
|
|
62
|
-
const isDark = theme.palette.mode === 'dark';
|
|
63
|
-
return (
|
|
64
|
-
<Box
|
|
65
|
-
className="user-card__timezone-field"
|
|
66
|
-
sx={{
|
|
67
|
-
display: 'flex',
|
|
68
|
-
alignItems: 'center',
|
|
69
|
-
gap: 1,
|
|
70
|
-
}}>
|
|
71
|
-
<TimezoneIcon {...iconSize} style={convertIconColor(isDark)} />
|
|
72
|
-
<Clock value={value} variant="body2" color="grey.800" />
|
|
73
|
-
</Box>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function LinkField({ value }: { value: string }) {
|
|
78
|
-
const theme = useTheme();
|
|
79
|
-
const isDark = theme.palette.mode === 'dark';
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<Box display="flex" alignItems="center" gap={1} className="user-card__link-field">
|
|
83
|
-
<LinkIcon {...iconSize} style={convertIconColor(isDark)} />
|
|
84
|
-
<LineText variant="body2" color="grey.800">
|
|
85
|
-
<Typography
|
|
86
|
-
component="a"
|
|
87
|
-
href={value}
|
|
88
|
-
style={{ textDecoration: 'none', color: 'inherit', fontSize: 'inherit' }}
|
|
89
|
-
target="_blank"
|
|
90
|
-
variant="body2"
|
|
91
|
-
rel="noopener noreferrer"
|
|
92
|
-
sx={{
|
|
93
|
-
color: 'grey.800',
|
|
94
|
-
}}>
|
|
95
|
-
{formatLinkDisplay(value)}
|
|
96
|
-
</Typography>
|
|
97
|
-
</LineText>
|
|
98
|
-
</Box>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function BasicField({ field, value, children = null }: { field: string; value: string; children?: React.ReactNode }) {
|
|
103
|
-
const Icon = IconMap[field as keyof typeof IconMap];
|
|
104
|
-
const theme = useTheme();
|
|
105
|
-
const isDark = theme.palette.mode === 'dark';
|
|
106
|
-
const iconColor = convertIconColor(isDark);
|
|
107
|
-
return (
|
|
108
|
-
<Box
|
|
109
|
-
key={field}
|
|
110
|
-
className={`user-card__${field}-field`}
|
|
111
|
-
sx={{
|
|
112
|
-
display: 'flex',
|
|
113
|
-
alignItems: 'center',
|
|
114
|
-
gap: 1,
|
|
115
|
-
}}>
|
|
116
|
-
{Icon ? (
|
|
117
|
-
<Icon {...iconSize} style={iconColor} />
|
|
118
|
-
) : (
|
|
119
|
-
<IconifyIcon icon={infoCircleIcon} {...iconSize} {...iconColor} />
|
|
120
|
-
)}
|
|
121
|
-
<LineText variant="body2" color="grey.800">
|
|
122
|
-
{children ?? value}
|
|
123
|
-
</LineText>
|
|
124
|
-
</Box>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function BasicContent({ user, renderFields = undefined }: BasicContentProps) {
|
|
129
|
-
const fields = useCreation(() => {
|
|
130
|
-
return renderFields ?? ['bio', 'email', 'phone', 'location', 'timezone', 'link'];
|
|
131
|
-
}, [renderFields]);
|
|
132
|
-
|
|
133
|
-
const includeBio = useCreation(() => {
|
|
134
|
-
return fields.includes('bio');
|
|
135
|
-
}, [fields]);
|
|
136
|
-
|
|
137
|
-
const metadata = useCreation(() => {
|
|
138
|
-
return (
|
|
139
|
-
user.metadata ?? {
|
|
140
|
-
joinedAt: user?.createdAt,
|
|
141
|
-
email: user?.email,
|
|
142
|
-
phone: {
|
|
143
|
-
country: 'cn',
|
|
144
|
-
phoneNumber: user?.phone ?? '',
|
|
145
|
-
},
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
}, [user]);
|
|
149
|
-
|
|
150
|
-
const address = useCreation(() => {
|
|
151
|
-
return user.address;
|
|
152
|
-
}, [user.address]);
|
|
153
|
-
|
|
154
|
-
const getFieldValue = useCallback(
|
|
155
|
-
(field: string) => {
|
|
156
|
-
if (!field) return '';
|
|
157
|
-
switch (field) {
|
|
158
|
-
case 'bio':
|
|
159
|
-
return user.metadata?.bio || '';
|
|
160
|
-
case 'email':
|
|
161
|
-
return metadata.email || user.email || '';
|
|
162
|
-
case 'phone':
|
|
163
|
-
return metadata.phone?.phoneNumber || user.phone || '';
|
|
164
|
-
case 'location':
|
|
165
|
-
return address?.city || metadata.location || '';
|
|
166
|
-
case 'timezone':
|
|
167
|
-
return metadata.timezone || '';
|
|
168
|
-
case 'link':
|
|
169
|
-
return metadata.links?.map((link) => link.url).filter(Boolean) || [];
|
|
170
|
-
default:
|
|
171
|
-
return user[field as keyof User] || '';
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
[user, metadata, address]
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
// 计算实际可见的字段数量和渲染元素数量
|
|
178
|
-
const { effectiveRenderCount } = useMemo(() => {
|
|
179
|
-
const visible = fields.filter((field) => {
|
|
180
|
-
if (field === 'bio') return false; // bio field is handled separately
|
|
181
|
-
const value = getFieldValue(field);
|
|
182
|
-
|
|
183
|
-
if (value === undefined || value === null || value === '') return false;
|
|
184
|
-
|
|
185
|
-
if (isArray(value)) {
|
|
186
|
-
return value.length > 0;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return String(value).trim().length > 0;
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
// 计算实际渲染数量
|
|
193
|
-
const renderCount = visible.reduce((count, field) => {
|
|
194
|
-
const value = getFieldValue(field);
|
|
195
|
-
return count + (Array.isArray(value) ? value.filter((item) => item && String(item).trim()).length : 1);
|
|
196
|
-
}, 0);
|
|
197
|
-
|
|
198
|
-
return { visibleFields: visible, effectiveRenderCount: renderCount };
|
|
199
|
-
}, [fields, getFieldValue]);
|
|
200
|
-
|
|
201
|
-
// 判断是否需要使用两列布局
|
|
202
|
-
const useDoubleColumn = effectiveRenderCount > 4;
|
|
203
|
-
|
|
204
|
-
const isValidValue = useMemoizedFn(
|
|
205
|
-
(value: any) => value !== undefined && value !== null && String(value).trim().length > 0
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
// 准备要渲染的所有元素项
|
|
209
|
-
const renderItems = useMemo(() => {
|
|
210
|
-
const items: RenderItem[] = [];
|
|
211
|
-
|
|
212
|
-
// 遍历有效字段,展开数组字段为单独的渲染项
|
|
213
|
-
fields.forEach((field) => {
|
|
214
|
-
if (field === 'bio') return; // bio field is handled separately
|
|
215
|
-
const value = getFieldValue(field);
|
|
216
|
-
|
|
217
|
-
if (!value) return;
|
|
218
|
-
|
|
219
|
-
if (isArray(value)) {
|
|
220
|
-
// 数组类型字段,每个有效项生成一个渲染元素
|
|
221
|
-
value.forEach((item, index) => {
|
|
222
|
-
if (isValidValue(item)) {
|
|
223
|
-
items.push({
|
|
224
|
-
field,
|
|
225
|
-
value: item,
|
|
226
|
-
key: `${field}-${index}`,
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
} else if (isValidValue(value)) {
|
|
231
|
-
// 非数组类型字段,生成一个渲染元素
|
|
232
|
-
items.push({
|
|
233
|
-
field,
|
|
234
|
-
value,
|
|
235
|
-
key: field,
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
return items;
|
|
241
|
-
}, [fields, getFieldValue, isValidValue]);
|
|
242
|
-
|
|
243
|
-
if (fields.length === 0) {
|
|
244
|
-
return null;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const renderItem = (item: RenderItem) => {
|
|
248
|
-
const { field, value, key } = item;
|
|
249
|
-
|
|
250
|
-
switch (field) {
|
|
251
|
-
case 'link':
|
|
252
|
-
return <LinkField key={key} value={value as string} />;
|
|
253
|
-
case 'timezone':
|
|
254
|
-
return <TimeZoneField key={key} value={value as string} />;
|
|
255
|
-
case 'email':
|
|
256
|
-
return (
|
|
257
|
-
<BasicField
|
|
258
|
-
field={field}
|
|
259
|
-
value={value as string}
|
|
260
|
-
// eslint-disable-next-line react/no-children-prop
|
|
261
|
-
children={
|
|
262
|
-
<Typography
|
|
263
|
-
component="a"
|
|
264
|
-
href={`mailto:${value}`}
|
|
265
|
-
rel="noopener noreferrer"
|
|
266
|
-
referrerPolicy="no-referrer"
|
|
267
|
-
style={{
|
|
268
|
-
color: 'inherit',
|
|
269
|
-
textDecoration: 'none',
|
|
270
|
-
fontSize: 'inherit',
|
|
271
|
-
}}>
|
|
272
|
-
{value}
|
|
273
|
-
</Typography>
|
|
274
|
-
}
|
|
275
|
-
/>
|
|
276
|
-
);
|
|
277
|
-
default:
|
|
278
|
-
return <BasicField key={key} field={field} value={value as string} />;
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
return (
|
|
283
|
-
<Box
|
|
284
|
-
className="user-card__basic-content"
|
|
285
|
-
sx={{
|
|
286
|
-
mt: 1,
|
|
287
|
-
display: 'flex',
|
|
288
|
-
flexDirection: 'column',
|
|
289
|
-
gap: 1.5,
|
|
290
|
-
}}>
|
|
291
|
-
{includeBio && user.metadata?.bio && (
|
|
292
|
-
<LineText variant="body2" color="grey.800" className="user-card__bio-field">
|
|
293
|
-
{user.metadata.bio}
|
|
294
|
-
</LineText>
|
|
295
|
-
)}
|
|
296
|
-
{/* 其他字段 */}
|
|
297
|
-
{useDoubleColumn ? (
|
|
298
|
-
<Grid container spacing={0.5}>
|
|
299
|
-
{renderItems.map((item) => (
|
|
300
|
-
<Grid key={item.key} size={6}>
|
|
301
|
-
{renderItem(item)}
|
|
302
|
-
</Grid>
|
|
303
|
-
))}
|
|
304
|
-
</Grid>
|
|
305
|
-
) : (
|
|
306
|
-
<Box
|
|
307
|
-
sx={{
|
|
308
|
-
display: 'flex',
|
|
309
|
-
flexDirection: 'column',
|
|
310
|
-
gap: 0.5,
|
|
311
|
-
}}>
|
|
312
|
-
{renderItems.map((item) => renderItem(item))}
|
|
313
|
-
</Box>
|
|
314
|
-
)}
|
|
315
|
-
</Box>
|
|
316
|
-
);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export default BasicContent;
|
|
320
|
-
|
|
321
|
-
const LineText = styled(Typography)`
|
|
322
|
-
flex: 1;
|
|
323
|
-
display: -webkit-box;
|
|
324
|
-
line-height: 1.5;
|
|
325
|
-
-webkit-line-clamp: 1;
|
|
326
|
-
-webkit-box-orient: vertical;
|
|
327
|
-
overflow: hidden;
|
|
328
|
-
text-overflow: ellipsis;
|
|
329
|
-
word-break: break-word;
|
|
330
|
-
`;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Tooltip, Typography, Box, type SxProps } from '@mui/material';
|
|
2
|
-
import { useMemoizedFn } from 'ahooks';
|
|
3
|
-
import useClock from '../../hooks/use-clock';
|
|
4
|
-
import { translate } from '../../Locale/util';
|
|
5
|
-
import { useLocaleContext } from '../../Locale/context';
|
|
6
|
-
|
|
7
|
-
const translations = {
|
|
8
|
-
en: {
|
|
9
|
-
localTime: 'Local Time',
|
|
10
|
-
timezonePhase: {
|
|
11
|
-
dawn: 'AM',
|
|
12
|
-
morning: 'AM',
|
|
13
|
-
afternoon: 'PM',
|
|
14
|
-
night: 'PM',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
zh: {
|
|
18
|
-
localTime: '本地时间',
|
|
19
|
-
timezonePhase: {
|
|
20
|
-
dawn: '凌晨',
|
|
21
|
-
morning: '上午',
|
|
22
|
-
afternoon: '下午',
|
|
23
|
-
night: '晚上',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
export default function Clock({ value, ...props }: { value: string; sx?: SxProps; [key: string]: any }) {
|
|
28
|
-
const { locale } = useLocaleContext() || { locale: 'en' };
|
|
29
|
-
const t = useMemoizedFn((key, data = {}) => {
|
|
30
|
-
return translate(translations, key, locale, 'en', data);
|
|
31
|
-
});
|
|
32
|
-
const timeInfo = useClock(value, locale);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Box
|
|
36
|
-
sx={{
|
|
37
|
-
display: 'flex',
|
|
38
|
-
alignItems: 'center',
|
|
39
|
-
gap: 1,
|
|
40
|
-
flex: 1,
|
|
41
|
-
justifyContent: 'flex-start',
|
|
42
|
-
overflow: 'hidden',
|
|
43
|
-
width: '100%',
|
|
44
|
-
}}>
|
|
45
|
-
<Typography
|
|
46
|
-
{...props}
|
|
47
|
-
noWrap
|
|
48
|
-
component="span"
|
|
49
|
-
sx={{
|
|
50
|
-
flex: '0 1 auto',
|
|
51
|
-
minWidth: 0,
|
|
52
|
-
...props.sx,
|
|
53
|
-
}}>
|
|
54
|
-
{value}
|
|
55
|
-
</Typography>
|
|
56
|
-
<Tooltip
|
|
57
|
-
enterDelay={200}
|
|
58
|
-
title={
|
|
59
|
-
<span>
|
|
60
|
-
{t('localTime')} {timeInfo.fullDateTime}
|
|
61
|
-
</span>
|
|
62
|
-
}
|
|
63
|
-
placement="top"
|
|
64
|
-
arrow>
|
|
65
|
-
<Typography
|
|
66
|
-
component="span"
|
|
67
|
-
noWrap
|
|
68
|
-
sx={{
|
|
69
|
-
fontSize: 14,
|
|
70
|
-
whiteSpace: 'nowrap',
|
|
71
|
-
overflow: 'hidden',
|
|
72
|
-
textOverflow: 'ellipsis',
|
|
73
|
-
flex: '0 0 auto',
|
|
74
|
-
maxWidth: '100%',
|
|
75
|
-
}}>
|
|
76
|
-
({locale === 'zh' ? `${t(`timezonePhase.${timeInfo.phase}`)} ` : ''}
|
|
77
|
-
{timeInfo.formattedTime})
|
|
78
|
-
</Typography>
|
|
79
|
-
</Tooltip>
|
|
80
|
-
</Box>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import React, { memo } from 'react';
|
|
2
|
-
import { Typography, Box, useMediaQuery, Divider } from '@mui/material';
|
|
3
|
-
import { DID } from '../../DID';
|
|
4
|
-
import { User, UserCardProps } from '../types';
|
|
5
|
-
import TooltipAvatar from './tooltip-avatar';
|
|
6
|
-
import { renderTopRight } from '../components';
|
|
7
|
-
import ShortenLabel from './shorten-label';
|
|
8
|
-
import SocialActions from '../Cards/social-actions';
|
|
9
|
-
|
|
10
|
-
interface MinimalContentProps extends UserCardProps {
|
|
11
|
-
user: User;
|
|
12
|
-
avatarSize: number;
|
|
13
|
-
shouldShowHoverCard: boolean;
|
|
14
|
-
renderCardContent?: () => React.ReactNode | null;
|
|
15
|
-
avatarProps?: UserCardProps['avatarProps'];
|
|
16
|
-
shortenLabelProps?: UserCardProps['shortenLabelProps'];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function MinimalContent({ ...props }: MinimalContentProps) {
|
|
20
|
-
const {
|
|
21
|
-
user,
|
|
22
|
-
showDid,
|
|
23
|
-
didProps,
|
|
24
|
-
avatarSize,
|
|
25
|
-
shouldShowHoverCard,
|
|
26
|
-
renderCardContent,
|
|
27
|
-
renderTopRightContent,
|
|
28
|
-
topRightMaxWidth,
|
|
29
|
-
avatarProps,
|
|
30
|
-
shortenLabelProps,
|
|
31
|
-
renderName,
|
|
32
|
-
...rest
|
|
33
|
-
} = props;
|
|
34
|
-
const isSmallScreen = useMediaQuery('(max-width:500px)');
|
|
35
|
-
return (
|
|
36
|
-
<Box
|
|
37
|
-
className="user-card__avatar-content"
|
|
38
|
-
sx={{
|
|
39
|
-
display: 'flex',
|
|
40
|
-
justifyContent: 'space-between',
|
|
41
|
-
alignItems: 'center',
|
|
42
|
-
}}>
|
|
43
|
-
<Box
|
|
44
|
-
sx={{
|
|
45
|
-
display: 'flex',
|
|
46
|
-
justifyContent: 'space-between',
|
|
47
|
-
flexDirection: isSmallScreen ? 'column' : 'row',
|
|
48
|
-
alignItems: isSmallScreen ? 'flex-start' : 'center',
|
|
49
|
-
gap: isSmallScreen ? 2 : 1,
|
|
50
|
-
flex: 1,
|
|
51
|
-
minWidth: 0,
|
|
52
|
-
flexWrap: 'wrap',
|
|
53
|
-
}}>
|
|
54
|
-
<Box
|
|
55
|
-
sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', gap: 1, flex: 1, width: '100%' }}>
|
|
56
|
-
<TooltipAvatar
|
|
57
|
-
user={user}
|
|
58
|
-
avatarSize={avatarSize}
|
|
59
|
-
shouldShowHoverCard={shouldShowHoverCard}
|
|
60
|
-
renderCardContent={renderCardContent}
|
|
61
|
-
avatarProps={avatarProps}
|
|
62
|
-
{...rest}
|
|
63
|
-
/>
|
|
64
|
-
<Box sx={{ width: '100%' }}>
|
|
65
|
-
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 1, width: '100%' }}>
|
|
66
|
-
<Typography
|
|
67
|
-
variant="subtitle1"
|
|
68
|
-
className="user-card__full-name-label"
|
|
69
|
-
noWrap
|
|
70
|
-
sx={{
|
|
71
|
-
fontWeight: 500,
|
|
72
|
-
color: 'text.primary',
|
|
73
|
-
fontSize: 18,
|
|
74
|
-
lineHeight: 1.1,
|
|
75
|
-
}}>
|
|
76
|
-
{renderName ? (
|
|
77
|
-
renderName(user)
|
|
78
|
-
) : (
|
|
79
|
-
<ShortenLabel sx={{ fontWeight: 500 }} {...shortenLabelProps}>
|
|
80
|
-
{user.fullName || user.email || user.did}
|
|
81
|
-
</ShortenLabel>
|
|
82
|
-
)}
|
|
83
|
-
</Typography>
|
|
84
|
-
{renderTopRight(renderTopRightContent, topRightMaxWidth)}
|
|
85
|
-
</Box>
|
|
86
|
-
|
|
87
|
-
{showDid && user.did ? (
|
|
88
|
-
<DID
|
|
89
|
-
did={user.did}
|
|
90
|
-
size={14}
|
|
91
|
-
copyable
|
|
92
|
-
compact
|
|
93
|
-
locale="en"
|
|
94
|
-
sx={{ lineHeight: 1.5 }}
|
|
95
|
-
{...(didProps ?? {})}
|
|
96
|
-
/>
|
|
97
|
-
) : null}
|
|
98
|
-
</Box>
|
|
99
|
-
</Box>
|
|
100
|
-
{isSmallScreen && !renderTopRightContent && rest.showSocialActions ? <Divider sx={{ width: '100%' }} /> : null}
|
|
101
|
-
{!renderTopRightContent ? (
|
|
102
|
-
<SocialActions
|
|
103
|
-
onFollowClick={rest.onFollowClick}
|
|
104
|
-
showSocialActions={rest.showSocialActions}
|
|
105
|
-
user={user!}
|
|
106
|
-
session={rest.session}
|
|
107
|
-
/>
|
|
108
|
-
) : null}
|
|
109
|
-
</Box>
|
|
110
|
-
</Box>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
export default memo(MinimalContent);
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Tooltip, Typography, TypographyProps } from '@mui/material';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
|
|
4
|
-
function shortenString(str: string | undefined, maxLength: number = 10): string {
|
|
5
|
-
if (!str) return '';
|
|
6
|
-
if (str.length <= maxLength) return str;
|
|
7
|
-
return `${str.slice(0, maxLength - 1)}...${str.slice(-2)}`;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ShortenLabelProps {
|
|
11
|
-
children: string;
|
|
12
|
-
maxLength?: number;
|
|
13
|
-
sx?: TypographyProps['sx'];
|
|
14
|
-
hiddenTip?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function ShortenLabel({ children, maxLength = 10, sx = undefined, hiddenTip = false }: ShortenLabelProps) {
|
|
18
|
-
const shortenedText = useMemo(() => shortenString(children, maxLength), [children, maxLength]);
|
|
19
|
-
if (children?.length <= maxLength) {
|
|
20
|
-
return <Typography sx={sx}>{children}</Typography>;
|
|
21
|
-
}
|
|
22
|
-
if (hiddenTip) {
|
|
23
|
-
return <Typography sx={sx}>{shortenedText}</Typography>;
|
|
24
|
-
}
|
|
25
|
-
return (
|
|
26
|
-
<Tooltip title={children} placement="top">
|
|
27
|
-
<Typography sx={sx}>{shortenedText}</Typography>
|
|
28
|
-
</Tooltip>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default ShortenLabel;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Zoom, Tooltip } from '@mui/material';
|
|
3
|
-
|
|
4
|
-
import { User, UserCardProps } from '../types';
|
|
5
|
-
import { renderAvatar } from '../components';
|
|
6
|
-
|
|
7
|
-
interface TooltipAvatarProps extends UserCardProps {
|
|
8
|
-
user: User;
|
|
9
|
-
avatarSize: number;
|
|
10
|
-
shouldShowHoverCard: boolean;
|
|
11
|
-
renderCardContent?: () => React.ReactNode | null;
|
|
12
|
-
tooltipTitle?: string;
|
|
13
|
-
tooltipProps?: UserCardProps['tooltipProps'];
|
|
14
|
-
avatarProps?: UserCardProps['avatarProps'];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 统一处理头像的Tooltip显示组件
|
|
19
|
-
* 根据条件显示普通Tooltip、自定义Tooltip内容或无Tooltip的头像
|
|
20
|
-
*/
|
|
21
|
-
function TooltipAvatar({
|
|
22
|
-
user,
|
|
23
|
-
avatarSize,
|
|
24
|
-
shouldShowHoverCard,
|
|
25
|
-
renderCardContent = undefined,
|
|
26
|
-
tooltipTitle = undefined,
|
|
27
|
-
tooltipProps = undefined,
|
|
28
|
-
avatarProps = undefined,
|
|
29
|
-
onAvatarClick,
|
|
30
|
-
}: TooltipAvatarProps) {
|
|
31
|
-
const avatarElement = renderAvatar(
|
|
32
|
-
user,
|
|
33
|
-
avatarSize,
|
|
34
|
-
avatarProps,
|
|
35
|
-
onAvatarClick,
|
|
36
|
-
shouldShowHoverCard || !!tooltipTitle
|
|
37
|
-
);
|
|
38
|
-
// 使用普通文本Tooltip
|
|
39
|
-
if (tooltipTitle) {
|
|
40
|
-
return (
|
|
41
|
-
<Tooltip enterDelay={200} title={tooltipTitle} placement="bottom" {...(tooltipProps ?? {})}>
|
|
42
|
-
{avatarElement}
|
|
43
|
-
</Tooltip>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// 使用自定义内容Tooltip
|
|
48
|
-
if (shouldShowHoverCard) {
|
|
49
|
-
return (
|
|
50
|
-
<Tooltip
|
|
51
|
-
enterDelay={200}
|
|
52
|
-
title={renderCardContent ? renderCardContent() : null}
|
|
53
|
-
placement="bottom"
|
|
54
|
-
arrow={false}
|
|
55
|
-
{...(tooltipProps ?? {})}
|
|
56
|
-
slotProps={{
|
|
57
|
-
popper: {
|
|
58
|
-
sx: {
|
|
59
|
-
'& .MuiTooltip-tooltip': {
|
|
60
|
-
backgroundColor: 'transparent',
|
|
61
|
-
p: 0,
|
|
62
|
-
maxWidth: 500,
|
|
63
|
-
zIndex: 1000,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
}}
|
|
68
|
-
slots={{
|
|
69
|
-
transition: Zoom,
|
|
70
|
-
}}>
|
|
71
|
-
{avatarElement}
|
|
72
|
-
</Tooltip>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// 无Tooltip
|
|
77
|
-
return avatarElement;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default TooltipAvatar;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export { default as Basic } from './demo/basic';
|
|
2
|
-
export { default as AvatarWithHover } from './demo/avatarWithHover';
|
|
3
|
-
export { default as DetailedCard } from './demo/detailedCard';
|
|
4
|
-
export { default as DidControl } from './demo/didControl';
|
|
5
|
-
export { default as TopRightContent } from './demo/topRightContent';
|
|
6
|
-
export { default as CustomFooter } from './demo/customFooter';
|
|
7
|
-
export { default as DidOnlyAvatar } from './demo/did-only-avatar';
|
|
8
|
-
export { default as SocialActions } from './demo/socialActions';
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
title: 'Data Display/UserCard',
|
|
12
|
-
parameters: {
|
|
13
|
-
docs: {
|
|
14
|
-
description: {
|
|
15
|
-
component: 'Used to display user information.',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|