@blocklet/ui-react 3.4.14 → 3.5.0
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/common/org-switch/use-org.d.ts +4 -4
- package/lib/common/ws.d.ts +22 -1
- package/package.json +10 -7
- package/.aigne/doc-smith/.local/afs-storage.sqlite3 +0 -0
- package/.aigne/doc-smith/config.yaml +0 -78
- package/.aigne/doc-smith/history.yaml +0 -14
- package/.aigne/doc-smith/media-description.yaml +0 -11
- package/.aigne/doc-smith/output/structure-plan.json +0 -255
- package/.aigne/doc-smith/translation-cache.yaml +0 -11
- package/.aigne/doc-smith/upload-cache.yaml +0 -528
- package/build.config.ts +0 -24
- package/docs/_sidebar.md +0 -19
- package/docs/assets/diagram/component-installer-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh.jpg +0 -0
- package/docs/components-component-management-blocklet-studio.ja.md +0 -194
- package/docs/components-component-management-blocklet-studio.md +0 -194
- package/docs/components-component-management-blocklet-studio.zh-TW.md +0 -194
- package/docs/components-component-management-blocklet-studio.zh.md +0 -194
- package/docs/components-component-management-component-installer.ja.md +0 -182
- package/docs/components-component-management-component-installer.md +0 -182
- package/docs/components-component-management-component-installer.zh-TW.md +0 -182
- package/docs/components-component-management-component-installer.zh.md +0 -182
- package/docs/components-component-management.ja.md +0 -30
- package/docs/components-component-management.md +0 -30
- package/docs/components-component-management.zh-TW.md +0 -30
- package/docs/components-component-management.zh.md +0 -30
- package/docs/components-layout-dashboard.ja.md +0 -185
- package/docs/components-layout-dashboard.md +0 -187
- package/docs/components-layout-dashboard.zh-TW.md +0 -185
- package/docs/components-layout-dashboard.zh.md +0 -185
- package/docs/components-layout-footer.ja.md +0 -165
- package/docs/components-layout-footer.md +0 -165
- package/docs/components-layout-footer.zh-TW.md +0 -165
- package/docs/components-layout-footer.zh.md +0 -165
- package/docs/components-layout-header.ja.md +0 -183
- package/docs/components-layout-header.md +0 -183
- package/docs/components-layout-header.zh-TW.md +0 -183
- package/docs/components-layout-header.zh.md +0 -183
- package/docs/components-layout.ja.md +0 -31
- package/docs/components-layout.md +0 -31
- package/docs/components-layout.zh-TW.md +0 -31
- package/docs/components-layout.zh.md +0 -31
- package/docs/components-notifications.ja.md +0 -125
- package/docs/components-notifications.md +0 -125
- package/docs/components-notifications.zh-TW.md +0 -125
- package/docs/components-notifications.zh.md +0 -125
- package/docs/components-user-management-user-center.ja.md +0 -148
- package/docs/components-user-management-user-center.md +0 -147
- package/docs/components-user-management-user-center.zh-TW.md +0 -148
- package/docs/components-user-management-user-center.zh.md +0 -148
- package/docs/components-user-management-user-sessions.ja.md +0 -121
- package/docs/components-user-management-user-sessions.md +0 -123
- package/docs/components-user-management-user-sessions.zh-TW.md +0 -121
- package/docs/components-user-management-user-sessions.zh.md +0 -121
- package/docs/components-user-management.ja.md +0 -49
- package/docs/components-user-management.md +0 -51
- package/docs/components-user-management.zh-TW.md +0 -49
- package/docs/components-user-management.zh.md +0 -49
- package/docs/components-utilities-icon.ja.md +0 -106
- package/docs/components-utilities-icon.md +0 -106
- package/docs/components-utilities-icon.zh-TW.md +0 -106
- package/docs/components-utilities-icon.zh.md +0 -106
- package/docs/components-utilities.ja.md +0 -136
- package/docs/components-utilities.md +0 -136
- package/docs/components-utilities.zh-TW.md +0 -136
- package/docs/components-utilities.zh.md +0 -136
- package/docs/components.ja.md +0 -27
- package/docs/components.md +0 -27
- package/docs/components.zh-TW.md +0 -27
- package/docs/components.zh.md +0 -27
- package/docs/core-concepts.ja.md +0 -134
- package/docs/core-concepts.md +0 -135
- package/docs/core-concepts.zh-TW.md +0 -134
- package/docs/core-concepts.zh.md +0 -134
- package/docs/getting-started.ja.md +0 -132
- package/docs/getting-started.md +0 -132
- package/docs/getting-started.zh-TW.md +0 -132
- package/docs/getting-started.zh.md +0 -132
- package/docs/hooks-api.ja.md +0 -214
- package/docs/hooks-api.md +0 -214
- package/docs/hooks-api.zh-TW.md +0 -214
- package/docs/hooks-api.zh.md +0 -214
- package/docs/how-to-guides.ja.md +0 -413
- package/docs/how-to-guides.md +0 -413
- package/docs/how-to-guides.zh-TW.md +0 -413
- package/docs/how-to-guides.zh.md +0 -413
- package/docs/overview.ja.md +0 -51
- package/docs/overview.md +0 -51
- package/docs/overview.zh-TW.md +0 -51
- package/docs/overview.zh.md +0 -51
- package/glossary.md +0 -12
- package/src/@types/index.ts +0 -230
- package/src/@types/shims.d.ts +0 -18
- package/src/BlockletStudio/README.md +0 -116
- package/src/BlockletStudio/index.tsx +0 -145
- package/src/ComponentInstaller/ComponentInstaller.stories.jsx +0 -16
- package/src/ComponentInstaller/index.jsx +0 -207
- package/src/ComponentInstaller/installer-item.jsx +0 -129
- package/src/ComponentInstaller/locales.js +0 -22
- package/src/ComponentInstaller/use-component-installed.js +0 -88
- package/src/ComponentManager/components/add-component.tsx +0 -136
- package/src/ComponentManager/components/check-component.tsx +0 -3
- package/src/ComponentManager/components/publish-component.tsx +0 -90
- package/src/ComponentManager/components/resource-dialog.tsx +0 -91
- package/src/ComponentManager/index.tsx +0 -3
- package/src/ComponentManager/libs/locales.ts +0 -15
- package/src/Dashboard/Dashboard.stories.jsx +0 -20
- package/src/Dashboard/app-shell/app-badge.stories.tsx +0 -64
- package/src/Dashboard/app-shell/app-badge.tsx +0 -94
- package/src/Dashboard/app-shell/app-header.tsx +0 -104
- package/src/Dashboard/app-shell/app-info-context.tsx +0 -182
- package/src/Dashboard/app-shell/badges/app-badge-default.tsx +0 -130
- package/src/Dashboard/app-shell/badges/app-badge-did.tsx +0 -28
- package/src/Dashboard/app-shell/badges/app-badge-state.tsx +0 -40
- package/src/Dashboard/app-shell/badges/app-badge-switch.tsx +0 -72
- package/src/Dashboard/app-shell/badges/app-badge-version.tsx +0 -60
- package/src/Dashboard/app-shell/index.ts +0 -5
- package/src/Dashboard/index.jsx +0 -184
- package/src/Footer/Footer.stories.jsx +0 -33
- package/src/Footer/brand.jsx +0 -81
- package/src/Footer/copyright.jsx +0 -22
- package/src/Footer/index.jsx +0 -111
- package/src/Footer/internal-footer.jsx +0 -139
- package/src/Footer/layout/plain.jsx +0 -55
- package/src/Footer/layout/row.jsx +0 -43
- package/src/Footer/layout/standard.jsx +0 -114
- package/src/Footer/links.jsx +0 -321
- package/src/Footer/social-media.jsx +0 -55
- package/src/Header/Header.stories.jsx +0 -30
- package/src/Header/index.tsx +0 -259
- package/src/Icon/Icon.stories.jsx +0 -12
- package/src/Icon/index.tsx +0 -87
- package/src/Notifications/Snackbar.tsx +0 -261
- package/src/Notifications/hooks/use-title.tsx +0 -254
- package/src/Notifications/hooks/use-width.tsx +0 -16
- package/src/Notifications/utils.ts +0 -246
- package/src/UserCenter/assets/banner.png +0 -0
- package/src/UserCenter/components/config-inviter.tsx +0 -48
- package/src/UserCenter/components/config-profile.tsx +0 -99
- package/src/UserCenter/components/danger-zone.tsx +0 -82
- package/src/UserCenter/components/editable-field.tsx +0 -273
- package/src/UserCenter/components/fallback.tsx +0 -57
- package/src/UserCenter/components/nft-preview.tsx +0 -84
- package/src/UserCenter/components/nft.tsx +0 -279
- package/src/UserCenter/components/notification.tsx +0 -319
- package/src/UserCenter/components/passport.tsx +0 -107
- package/src/UserCenter/components/privacy.tsx +0 -120
- package/src/UserCenter/components/settings.tsx +0 -170
- package/src/UserCenter/components/status-dialog/date-picker.tsx +0 -77
- package/src/UserCenter/components/status-dialog/index.tsx +0 -293
- package/src/UserCenter/components/status-selector/duration-menu.tsx +0 -90
- package/src/UserCenter/components/status-selector/index.tsx +0 -58
- package/src/UserCenter/components/status-selector/menu-item.tsx +0 -56
- package/src/UserCenter/components/storage/action.tsx +0 -49
- package/src/UserCenter/components/storage/connected.tsx +0 -61
- package/src/UserCenter/components/storage/delete.tsx +0 -72
- package/src/UserCenter/components/storage/disconnect.tsx +0 -40
- package/src/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -1
- package/src/UserCenter/components/storage/icons/long-arrow.svg +0 -5
- package/src/UserCenter/components/storage/icons/space-connected.svg +0 -3
- package/src/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
- package/src/UserCenter/components/storage/index.tsx +0 -41
- package/src/UserCenter/components/storage/preview-nft.tsx +0 -72
- package/src/UserCenter/components/third-party-login/index.tsx +0 -199
- package/src/UserCenter/components/third-party-login/third-party-item.tsx +0 -296
- package/src/UserCenter/components/user-center.tsx +0 -787
- package/src/UserCenter/components/user-info/address.tsx +0 -143
- package/src/UserCenter/components/user-info/index.tsx +0 -4
- package/src/UserCenter/components/user-info/link-preview-input.tsx +0 -274
- package/src/UserCenter/components/user-info/metadata.tsx +0 -658
- package/src/UserCenter/components/user-info/social-actions/chat.tsx +0 -43
- package/src/UserCenter/components/user-info/social-actions/follow.tsx +0 -23
- package/src/UserCenter/components/user-info/social-actions/index.tsx +0 -17
- package/src/UserCenter/components/user-info/switch-role.tsx +0 -42
- package/src/UserCenter/components/user-info/timezone-select.tsx +0 -119
- package/src/UserCenter/components/user-info/user-basic-info.tsx +0 -292
- package/src/UserCenter/components/user-info/user-info-item.tsx +0 -54
- package/src/UserCenter/components/user-info/user-info.tsx +0 -91
- package/src/UserCenter/components/user-info/user-status.tsx +0 -234
- package/src/UserCenter/components/user-info/utils.ts +0 -320
- package/src/UserCenter/components/webhook-item.tsx +0 -248
- package/src/UserCenter/index.tsx +0 -1
- package/src/UserCenter/libs/locales.ts +0 -378
- package/src/UserCenter/libs/utils.ts +0 -30
- package/src/UserSessions/components/user-session-info.tsx +0 -78
- package/src/UserSessions/components/user-sessions.tsx +0 -545
- package/src/UserSessions/index.tsx +0 -1
- package/src/UserSessions/libs/locales.ts +0 -60
- package/src/UserSessions/libs/utils.ts +0 -82
- package/src/blocklets.js +0 -195
- package/src/common/domain-warning.jsx +0 -178
- package/src/common/header-addons.jsx +0 -119
- package/src/common/link-blocker.jsx +0 -20
- package/src/common/notification-addon.jsx +0 -135
- package/src/common/org-switch/avatar-uploader.jsx +0 -271
- package/src/common/org-switch/create.jsx +0 -267
- package/src/common/org-switch/index.jsx +0 -407
- package/src/common/org-switch/locales.js +0 -52
- package/src/common/org-switch/use-org.jsx +0 -79
- package/src/common/overridable-theme-provider.jsx +0 -17
- package/src/common/wallet-hidden-topbar.js +0 -14
- package/src/common/wizard-modal.jsx +0 -200
- package/src/common/ws.js +0 -68
- package/src/contexts/config-user-space.tsx +0 -88
- package/src/contexts/user-followers.tsx +0 -54
- package/src/hooks/use-follow.tsx +0 -75
- package/src/hooks/use-mobile.tsx +0 -6
- package/src/index.ts +0 -16
- package/src/libs/constant.ts +0 -1
- package/src/libs/spaces.tsx +0 -18
- package/src/libs/with-hide-when-embed.tsx +0 -24
- package/src/types.js +0 -45
- package/src/utils.js +0 -161
- package/vite.config.mjs +0 -34
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { Box, Typography } from '@mui/material';
|
|
3
|
-
import type { BoxProps } from '@mui/material';
|
|
4
|
-
import { ROLES } from '@abtnode/constant';
|
|
5
|
-
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
6
|
-
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
7
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
8
|
-
import { mergeSx } from '@arcblock/ux/lib/Util/style';
|
|
9
|
-
import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
|
|
10
|
-
import { getBlockletSDK } from '@blocklet/js-sdk';
|
|
11
|
-
|
|
12
|
-
import { translations } from '../libs/locales';
|
|
13
|
-
import Notification from './notification';
|
|
14
|
-
import Privacy from './privacy';
|
|
15
|
-
import { User, UserCenterTab } from '../../@types';
|
|
16
|
-
import { UserSessions } from '../../UserSessions';
|
|
17
|
-
import ThirdPartyLogin from './third-party-login';
|
|
18
|
-
import ConfigProfile from './config-profile';
|
|
19
|
-
import DangerZone from './danger-zone';
|
|
20
|
-
|
|
21
|
-
export default function Settings({
|
|
22
|
-
user,
|
|
23
|
-
settings,
|
|
24
|
-
onSave,
|
|
25
|
-
isMobile,
|
|
26
|
-
...rest
|
|
27
|
-
}: {
|
|
28
|
-
user: User;
|
|
29
|
-
onSave: (type: 'privacy' | 'profile') => void;
|
|
30
|
-
settings: {
|
|
31
|
-
userCenterTabs: UserCenterTab[];
|
|
32
|
-
};
|
|
33
|
-
isMobile: boolean;
|
|
34
|
-
onDestroySelf?: () => void;
|
|
35
|
-
} & BoxProps) {
|
|
36
|
-
const client = getBlockletSDK();
|
|
37
|
-
const { locale } = useLocaleContext();
|
|
38
|
-
const browser = useBrowser();
|
|
39
|
-
const isArcSphere = browser.arcSphere;
|
|
40
|
-
const t = useMemoizedFn((key, data = {}) => {
|
|
41
|
-
return translate(translations, key, locale, 'en', data);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const isOwner = useCreation(() => {
|
|
45
|
-
return user.passports?.some((x) => x.role === ROLES.OWNER);
|
|
46
|
-
}, [user]);
|
|
47
|
-
|
|
48
|
-
const privacyConfigList = useCreation(() => {
|
|
49
|
-
const userCenterTabs = settings?.userCenterTabs || [];
|
|
50
|
-
return userCenterTabs.map((item) => {
|
|
51
|
-
return {
|
|
52
|
-
key: item.value,
|
|
53
|
-
name: item.label,
|
|
54
|
-
value: item.protected,
|
|
55
|
-
isPrivate: item.isPrivate,
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
}, [settings?.userCenterTabs]);
|
|
59
|
-
const tabs = useCreation(() => {
|
|
60
|
-
return [
|
|
61
|
-
!isArcSphere
|
|
62
|
-
? {
|
|
63
|
-
label: t('commonSetting.title'),
|
|
64
|
-
value: 'common',
|
|
65
|
-
content: <ConfigProfile user={user} onSave={onSave} />,
|
|
66
|
-
}
|
|
67
|
-
: undefined,
|
|
68
|
-
{
|
|
69
|
-
label: t('notificationManagement'),
|
|
70
|
-
value: 'notification',
|
|
71
|
-
content: <Notification user={user} isMobile={isMobile} />,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
label: t('thirdPartyLogin.title'),
|
|
75
|
-
value: 'thirdPartyLogin',
|
|
76
|
-
content: <ThirdPartyLogin user={user} />,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
label: t('privacyManagement'),
|
|
80
|
-
value: 'privacy',
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
content: <Privacy configList={privacyConfigList} onSave={onSave} />,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
label: t('sessionManagement'),
|
|
86
|
-
value: 'session',
|
|
87
|
-
content: (
|
|
88
|
-
<UserSessions
|
|
89
|
-
user={user}
|
|
90
|
-
showUser={false}
|
|
91
|
-
getUserSessions={(params) => {
|
|
92
|
-
return client.userSession.getMyLoginSessions({}, params);
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
|
-
),
|
|
96
|
-
},
|
|
97
|
-
!isOwner && rest.onDestroySelf && typeof rest.onDestroySelf === 'function'
|
|
98
|
-
? {
|
|
99
|
-
label: t('dangerZone.title'),
|
|
100
|
-
value: 'dangerZone',
|
|
101
|
-
content: <DangerZone onDestroySelf={rest.onDestroySelf} />,
|
|
102
|
-
sx: {
|
|
103
|
-
borderColor: 'error.main',
|
|
104
|
-
},
|
|
105
|
-
}
|
|
106
|
-
: null,
|
|
107
|
-
].filter(Boolean);
|
|
108
|
-
}, [user, privacyConfigList, isMobile]);
|
|
109
|
-
|
|
110
|
-
// 支持 hash 锚点定位
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
const id = window.location.hash.slice(1);
|
|
113
|
-
if (id) {
|
|
114
|
-
const element = document.getElementById(id);
|
|
115
|
-
element?.scrollIntoView({ behavior: 'smooth' });
|
|
116
|
-
}
|
|
117
|
-
}, []);
|
|
118
|
-
|
|
119
|
-
return (
|
|
120
|
-
<Box
|
|
121
|
-
{...rest}
|
|
122
|
-
sx={{
|
|
123
|
-
...rest?.sx,
|
|
124
|
-
display: 'flex',
|
|
125
|
-
flexDirection: 'column',
|
|
126
|
-
gap: 2.5,
|
|
127
|
-
minWidth: {
|
|
128
|
-
md: 500,
|
|
129
|
-
},
|
|
130
|
-
maxWidth: '100%',
|
|
131
|
-
}}>
|
|
132
|
-
{tabs.map((tab) => {
|
|
133
|
-
if (!tab) {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
return (
|
|
137
|
-
<Box
|
|
138
|
-
id={tab.value}
|
|
139
|
-
key={tab.value}
|
|
140
|
-
sx={mergeSx(
|
|
141
|
-
{
|
|
142
|
-
border: '1px solid',
|
|
143
|
-
borderColor: 'divider',
|
|
144
|
-
borderRadius: 1,
|
|
145
|
-
p: 2,
|
|
146
|
-
'&:last-child': {
|
|
147
|
-
mb: 5,
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
tab.sx
|
|
151
|
-
)}>
|
|
152
|
-
<Typography
|
|
153
|
-
sx={{
|
|
154
|
-
color: 'text.primary',
|
|
155
|
-
fontWeight: 600,
|
|
156
|
-
}}>
|
|
157
|
-
{tab.label}
|
|
158
|
-
</Typography>
|
|
159
|
-
<Box
|
|
160
|
-
sx={{
|
|
161
|
-
mt: 2.5,
|
|
162
|
-
}}>
|
|
163
|
-
{tab.content}
|
|
164
|
-
</Box>
|
|
165
|
-
</Box>
|
|
166
|
-
);
|
|
167
|
-
})}
|
|
168
|
-
</Box>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
2
|
-
import { TextField, FormControl, FormHelperText } from '@mui/material';
|
|
3
|
-
import dayjs from 'dayjs';
|
|
4
|
-
import { useCreation } from 'ahooks';
|
|
5
|
-
|
|
6
|
-
interface DateTimeInputProps {
|
|
7
|
-
value: Date;
|
|
8
|
-
onChange: (value: Date) => void;
|
|
9
|
-
error?: boolean;
|
|
10
|
-
helperText?: string;
|
|
11
|
-
label?: string;
|
|
12
|
-
timezone?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function DateTimeInput({
|
|
16
|
-
value,
|
|
17
|
-
onChange,
|
|
18
|
-
error = undefined,
|
|
19
|
-
helperText = undefined,
|
|
20
|
-
label = undefined,
|
|
21
|
-
timezone = undefined,
|
|
22
|
-
}: DateTimeInputProps) {
|
|
23
|
-
const inputRef = useRef<HTMLInputElement>(null);
|
|
24
|
-
const minDateTime = dayjs().format('YYYY-MM-DDTHH:mm');
|
|
25
|
-
|
|
26
|
-
const formatValue = useCreation(() => {
|
|
27
|
-
let date = dayjs();
|
|
28
|
-
if (value) {
|
|
29
|
-
date = timezone ? dayjs(value).tz(timezone) : dayjs(value);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return date.format('YYYY-MM-DD HH:mm');
|
|
33
|
-
}, [value, timezone]);
|
|
34
|
-
|
|
35
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
36
|
-
onChange(new Date(e.target.value));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// 处理点击事件
|
|
40
|
-
const handleClick = () => {
|
|
41
|
-
// 通过编程方式触发原生日期选择器
|
|
42
|
-
inputRef.current?.showPicker();
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<FormControl fullWidth error={error}>
|
|
47
|
-
<TextField
|
|
48
|
-
inputRef={inputRef}
|
|
49
|
-
type="datetime-local"
|
|
50
|
-
value={formatValue}
|
|
51
|
-
onChange={handleChange}
|
|
52
|
-
label={label}
|
|
53
|
-
error={error}
|
|
54
|
-
onClick={handleClick}
|
|
55
|
-
sx={{
|
|
56
|
-
'& .MuiInputBase-root': {
|
|
57
|
-
cursor: 'pointer',
|
|
58
|
-
},
|
|
59
|
-
'& .MuiOutlinedInput-notchedOutline': {
|
|
60
|
-
cursor: 'pointer',
|
|
61
|
-
},
|
|
62
|
-
}}
|
|
63
|
-
slotProps={{
|
|
64
|
-
htmlInput: {
|
|
65
|
-
min: minDateTime,
|
|
66
|
-
style: { cursor: 'pointer' },
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
inputLabel: {
|
|
70
|
-
shrink: true,
|
|
71
|
-
},
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
{helperText && <FormHelperText>{helperText}</FormHelperText>}
|
|
75
|
-
</FormControl>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState, createElement, Suspense, useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Dialog,
|
|
4
|
-
DialogTitle,
|
|
5
|
-
DialogContent,
|
|
6
|
-
DialogActions,
|
|
7
|
-
Button,
|
|
8
|
-
FormControl,
|
|
9
|
-
InputLabel,
|
|
10
|
-
Select,
|
|
11
|
-
MenuItem,
|
|
12
|
-
ListItemIcon,
|
|
13
|
-
Box,
|
|
14
|
-
Typography,
|
|
15
|
-
IconButton,
|
|
16
|
-
} from '@mui/material';
|
|
17
|
-
import dayjs from 'dayjs';
|
|
18
|
-
import { Close as CloseIcon } from '@mui/icons-material';
|
|
19
|
-
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
20
|
-
import { useMemoizedFn } from 'ahooks';
|
|
21
|
-
import ArrowDownwardIcon from '@arcblock/icons/lib/ArrowDown';
|
|
22
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
23
|
-
import { DurationEnum, UserMetadata } from '../../../@types';
|
|
24
|
-
import { StatusItem } from '../status-selector/menu-item';
|
|
25
|
-
import { translations } from '../../libs/locales';
|
|
26
|
-
import DateTimeInput from './date-picker';
|
|
27
|
-
import { defaultButtonStyle, primaryButtonStyle } from '../user-info/utils';
|
|
28
|
-
|
|
29
|
-
const selectStyle = {
|
|
30
|
-
padding: '8px 16px',
|
|
31
|
-
borderRadius: '8px',
|
|
32
|
-
'&:hover': {
|
|
33
|
-
'fieldset.MuiOutlinedInput-notchedOutline': {
|
|
34
|
-
borderColor: 'divider',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
'fieldset.MuiOutlinedInput-notchedOutline': {
|
|
38
|
-
borderColor: 'divider',
|
|
39
|
-
borderRadius: '8px',
|
|
40
|
-
},
|
|
41
|
-
'.MuiSelect-select': {
|
|
42
|
-
padding: '0 !important',
|
|
43
|
-
display: 'flex',
|
|
44
|
-
alignItems: 'center',
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
interface StatusDialogProps {
|
|
48
|
-
open: boolean;
|
|
49
|
-
onClose: () => void;
|
|
50
|
-
data: Array<StatusItem>;
|
|
51
|
-
selected: UserMetadata['status'];
|
|
52
|
-
onSelect: (v: UserMetadata['status']) => void;
|
|
53
|
-
timezone?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default function StatusDialog({
|
|
57
|
-
open,
|
|
58
|
-
onClose,
|
|
59
|
-
data,
|
|
60
|
-
selected,
|
|
61
|
-
onSelect,
|
|
62
|
-
timezone = undefined,
|
|
63
|
-
}: StatusDialogProps) {
|
|
64
|
-
const { locale } = useLocaleContext();
|
|
65
|
-
const t = useMemoizedFn((key, _data = {}) => {
|
|
66
|
-
return translate(translations, key, locale, 'en', _data);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const [status, setStatus] = useState(selected?.value || '');
|
|
70
|
-
const [duration, setDuration] = useState(selected?.duration || '');
|
|
71
|
-
const [customDate, setCustomDate] = useState(selected?.dateRange?.[1] || '');
|
|
72
|
-
const [changed, setChanged] = useState(false);
|
|
73
|
-
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
setStatus(selected?.value || '');
|
|
76
|
-
setDuration(selected?.duration || '');
|
|
77
|
-
setCustomDate(selected?.dateRange?.[1] || '');
|
|
78
|
-
}, [selected]);
|
|
79
|
-
|
|
80
|
-
const isValid = useMemo(() => {
|
|
81
|
-
return status && duration;
|
|
82
|
-
}, [status, duration]);
|
|
83
|
-
|
|
84
|
-
const selectedStatus = data.find((item) => item.id === status);
|
|
85
|
-
|
|
86
|
-
const handleQuickSettingClick = (item: StatusItem) => {
|
|
87
|
-
onSelect({
|
|
88
|
-
value: item.id,
|
|
89
|
-
...(item.duration ? { duration: item.duration as DurationEnum } : {}),
|
|
90
|
-
});
|
|
91
|
-
onClose();
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const handleSubmit = (clean = false) => {
|
|
95
|
-
if (clean) {
|
|
96
|
-
onSelect(undefined);
|
|
97
|
-
} else {
|
|
98
|
-
const current = dayjs();
|
|
99
|
-
onSelect({
|
|
100
|
-
value: status,
|
|
101
|
-
...(duration ? { duration: duration as DurationEnum } : {}),
|
|
102
|
-
...(duration === DurationEnum.Custom && customDate
|
|
103
|
-
? { dateRange: [current.toDate(), dayjs(customDate).toDate()] }
|
|
104
|
-
: {}),
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
onClose();
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<Dialog
|
|
112
|
-
open={open}
|
|
113
|
-
onClose={onClose}
|
|
114
|
-
maxWidth="xs"
|
|
115
|
-
fullWidth
|
|
116
|
-
PaperProps={{
|
|
117
|
-
sx: {
|
|
118
|
-
borderRadius: '8px',
|
|
119
|
-
},
|
|
120
|
-
}}>
|
|
121
|
-
<DialogTitle sx={{ borderBottom: '1px solid', borderColor: 'divider' }}>
|
|
122
|
-
<Typography variant="body1" sx={{ fontSize: '16px !important', mb: 0 }}>
|
|
123
|
-
{t('profile.setStatus')}
|
|
124
|
-
</Typography>
|
|
125
|
-
<IconButton
|
|
126
|
-
aria-label="close"
|
|
127
|
-
onClick={onClose}
|
|
128
|
-
sx={{
|
|
129
|
-
position: 'absolute',
|
|
130
|
-
right: 8,
|
|
131
|
-
top: 8,
|
|
132
|
-
color: (theme) => theme.palette.grey[500],
|
|
133
|
-
}}>
|
|
134
|
-
<CloseIcon />
|
|
135
|
-
</IconButton>
|
|
136
|
-
</DialogTitle>
|
|
137
|
-
<DialogContent>
|
|
138
|
-
<FormControl fullWidth sx={{ mt: 2 }}>
|
|
139
|
-
<InputLabel size="small" sx={{ fontSize: '14px' }}>
|
|
140
|
-
{t('profile.setStatus')}
|
|
141
|
-
</InputLabel>
|
|
142
|
-
<Select
|
|
143
|
-
value={status}
|
|
144
|
-
label={t('profile.setStatus')}
|
|
145
|
-
onChange={(e) => {
|
|
146
|
-
setStatus(e.target.value);
|
|
147
|
-
setChanged(true);
|
|
148
|
-
}}
|
|
149
|
-
variant="outlined"
|
|
150
|
-
// eslint-disable-next-line react/no-unstable-nested-components
|
|
151
|
-
IconComponent={(props) => <ArrowDownwardIcon {...props} width={20} height={20} />}
|
|
152
|
-
sx={selectStyle}>
|
|
153
|
-
{data.map((item) => (
|
|
154
|
-
<MenuItem key={item.id} value={item.id}>
|
|
155
|
-
<Suspense fallback={null}>
|
|
156
|
-
{item.icon && (
|
|
157
|
-
<ListItemIcon style={{ minWidth: '24px' }}>
|
|
158
|
-
{createElement(item.icon, {
|
|
159
|
-
style: { fontSize: '16px', width: '16px', height: '16px' },
|
|
160
|
-
})}
|
|
161
|
-
</ListItemIcon>
|
|
162
|
-
)}
|
|
163
|
-
{item.name}
|
|
164
|
-
</Suspense>
|
|
165
|
-
</MenuItem>
|
|
166
|
-
))}
|
|
167
|
-
</Select>
|
|
168
|
-
</FormControl>
|
|
169
|
-
|
|
170
|
-
{!status ? (
|
|
171
|
-
<Box sx={{ mt: '24px' }}>
|
|
172
|
-
<Typography
|
|
173
|
-
variant="body2"
|
|
174
|
-
sx={{
|
|
175
|
-
color: 'text.secondary',
|
|
176
|
-
}}>
|
|
177
|
-
{t('profile.quickSettings')}
|
|
178
|
-
</Typography>
|
|
179
|
-
{data.map((item) => (
|
|
180
|
-
<Box
|
|
181
|
-
key={item.id}
|
|
182
|
-
onClick={() => handleQuickSettingClick(item)}
|
|
183
|
-
sx={{
|
|
184
|
-
display: 'flex',
|
|
185
|
-
alignItems: 'center',
|
|
186
|
-
gap: '4px',
|
|
187
|
-
p: '4px',
|
|
188
|
-
cursor: 'pointer',
|
|
189
|
-
borderRadius: '8px',
|
|
190
|
-
'&:hover': {
|
|
191
|
-
bgcolor: 'action.hover',
|
|
192
|
-
},
|
|
193
|
-
}}>
|
|
194
|
-
<Suspense fallback={null}>
|
|
195
|
-
{item.icon && (
|
|
196
|
-
<ListItemIcon style={{ minWidth: '24px' }}>
|
|
197
|
-
{createElement(item.icon, {
|
|
198
|
-
style: { fontSize: '16px', width: '16px', height: '16px' },
|
|
199
|
-
})}
|
|
200
|
-
</ListItemIcon>
|
|
201
|
-
)}
|
|
202
|
-
{item.name}
|
|
203
|
-
{item.durationName && (
|
|
204
|
-
<Typography
|
|
205
|
-
variant="body2"
|
|
206
|
-
sx={{
|
|
207
|
-
color: 'text.secondary',
|
|
208
|
-
}}>
|
|
209
|
-
- {item.durationName}
|
|
210
|
-
</Typography>
|
|
211
|
-
)}
|
|
212
|
-
</Suspense>
|
|
213
|
-
</Box>
|
|
214
|
-
))}
|
|
215
|
-
</Box>
|
|
216
|
-
) : (
|
|
217
|
-
<FormControl fullWidth sx={{ mt: '24px' }}>
|
|
218
|
-
<InputLabel size="small" sx={{ fontSize: '14px' }}>
|
|
219
|
-
{t('profile.removeStatusAfter')}
|
|
220
|
-
</InputLabel>
|
|
221
|
-
<Select
|
|
222
|
-
value={duration}
|
|
223
|
-
label={t('profile.removeStatusAfter')}
|
|
224
|
-
onChange={(e) => {
|
|
225
|
-
const { value } = e.target;
|
|
226
|
-
setDuration(value);
|
|
227
|
-
if (value === DurationEnum.Custom) {
|
|
228
|
-
setCustomDate(dayjs().toDate());
|
|
229
|
-
}
|
|
230
|
-
setChanged(true);
|
|
231
|
-
}}
|
|
232
|
-
variant="outlined"
|
|
233
|
-
// eslint-disable-next-line react/no-unstable-nested-components
|
|
234
|
-
IconComponent={(props) => <ArrowDownwardIcon {...props} width={20} height={20} />}
|
|
235
|
-
sx={selectStyle}>
|
|
236
|
-
{selectedStatus?.children?.map((item) => (
|
|
237
|
-
<MenuItem key={item.id} value={item.id}>
|
|
238
|
-
{item.name}
|
|
239
|
-
</MenuItem>
|
|
240
|
-
))}
|
|
241
|
-
</Select>
|
|
242
|
-
</FormControl>
|
|
243
|
-
)}
|
|
244
|
-
{duration === DurationEnum.Custom && (
|
|
245
|
-
<Box sx={{ mt: '24px' }}>
|
|
246
|
-
<DateTimeInput
|
|
247
|
-
value={customDate as Date}
|
|
248
|
-
onChange={(e) => {
|
|
249
|
-
setCustomDate(e);
|
|
250
|
-
setChanged(true);
|
|
251
|
-
}}
|
|
252
|
-
label={t('profile.selectEndTime')}
|
|
253
|
-
timezone={timezone}
|
|
254
|
-
error={duration === DurationEnum.Custom && !customDate}
|
|
255
|
-
helperText={duration === DurationEnum.Custom && !customDate ? t('profile.pleaseSelectTime') : undefined}
|
|
256
|
-
/>
|
|
257
|
-
</Box>
|
|
258
|
-
)}
|
|
259
|
-
</DialogContent>
|
|
260
|
-
<DialogActions sx={{ p: '16px 24px', borderTop: '1px solid', borderColor: 'divider' }}>
|
|
261
|
-
{selected?.value && !changed ? (
|
|
262
|
-
<Button
|
|
263
|
-
sx={{ ...defaultButtonStyle, minWidth: '54px' }}
|
|
264
|
-
size="small"
|
|
265
|
-
variant="outlined"
|
|
266
|
-
onClick={() => handleSubmit(true)}>
|
|
267
|
-
{t('profile.cleanStatus')}
|
|
268
|
-
</Button>
|
|
269
|
-
) : (
|
|
270
|
-
<>
|
|
271
|
-
<Button size="small" variant="outlined" sx={{ ...defaultButtonStyle, minWidth: '54px' }} onClick={onClose}>
|
|
272
|
-
{t('common.cancel')}
|
|
273
|
-
</Button>
|
|
274
|
-
<Button
|
|
275
|
-
sx={{
|
|
276
|
-
...primaryButtonStyle,
|
|
277
|
-
minWidth: '54px',
|
|
278
|
-
'&.Mui-disabled': {
|
|
279
|
-
backgroundColor: 'rgba(0, 0, 0, 0.12)',
|
|
280
|
-
},
|
|
281
|
-
}}
|
|
282
|
-
disabled={!isValid}
|
|
283
|
-
onClick={() => handleSubmit(false)}
|
|
284
|
-
size="small"
|
|
285
|
-
variant="outlined">
|
|
286
|
-
{t('common.confirm')}
|
|
287
|
-
</Button>
|
|
288
|
-
</>
|
|
289
|
-
)}
|
|
290
|
-
</DialogActions>
|
|
291
|
-
</Dialog>
|
|
292
|
-
);
|
|
293
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Menu, styled, Typography } from '@mui/material';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
-
import { useMemoizedFn } from 'ahooks';
|
|
5
|
-
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
6
|
-
import { translations } from '../../libs/locales';
|
|
7
|
-
import { DurationEnum } from '../../../@types';
|
|
8
|
-
import StatusMenuItem, { BaseStatusProps, StatusItem, StyledMenu } from './menu-item';
|
|
9
|
-
|
|
10
|
-
interface StatusDurationMenuProps extends BaseStatusProps {
|
|
11
|
-
data: StatusItem;
|
|
12
|
-
}
|
|
13
|
-
function DurationMenu({ data, selected, onSelect }: StatusDurationMenuProps) {
|
|
14
|
-
const { locale } = useLocaleContext();
|
|
15
|
-
const t = useMemoizedFn((key, _data = {}) => {
|
|
16
|
-
return translate(translations, key, locale, 'en', _data);
|
|
17
|
-
});
|
|
18
|
-
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
19
|
-
|
|
20
|
-
const open = Boolean(anchorEl);
|
|
21
|
-
|
|
22
|
-
const openSubMenu = (e: React.MouseEvent<HTMLElement>) => {
|
|
23
|
-
setAnchorEl(e.currentTarget);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const closeSubMenu = () => {
|
|
27
|
-
setAnchorEl(null);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const onSelectStatus = (e: React.MouseEvent<HTMLElement>) => {
|
|
31
|
-
openSubMenu(e);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const onSelectDuration = (e: React.MouseEvent<HTMLElement>, item: StatusItem) => {
|
|
35
|
-
onSelect({
|
|
36
|
-
...(selected ?? {}),
|
|
37
|
-
value: data.id,
|
|
38
|
-
duration: item.id as DurationEnum,
|
|
39
|
-
});
|
|
40
|
-
closeSubMenu();
|
|
41
|
-
};
|
|
42
|
-
return (
|
|
43
|
-
<>
|
|
44
|
-
<StatusMenuItem icon={data.icon} selected={selected?.value === data.id} onClick={onSelectStatus}>
|
|
45
|
-
{data.name}
|
|
46
|
-
</StatusMenuItem>
|
|
47
|
-
<StyledMenu
|
|
48
|
-
anchorOrigin={{
|
|
49
|
-
vertical: 'top',
|
|
50
|
-
horizontal: 'right',
|
|
51
|
-
}}
|
|
52
|
-
transformOrigin={{
|
|
53
|
-
vertical: 'top',
|
|
54
|
-
horizontal: 'left',
|
|
55
|
-
}}
|
|
56
|
-
open={open}
|
|
57
|
-
onClose={closeSubMenu}
|
|
58
|
-
anchorEl={anchorEl}>
|
|
59
|
-
<Typography
|
|
60
|
-
component="span"
|
|
61
|
-
sx={{
|
|
62
|
-
color: 'text.secondary',
|
|
63
|
-
pl: 2,
|
|
64
|
-
fontSize: '14px',
|
|
65
|
-
}}>
|
|
66
|
-
{t('profile.removeStatusAfter')}
|
|
67
|
-
</Typography>
|
|
68
|
-
{data.children?.map((item) => (
|
|
69
|
-
<StatusMenuItem
|
|
70
|
-
key={item.id}
|
|
71
|
-
selected={selected?.duration === item.id}
|
|
72
|
-
onClick={(e) => onSelectDuration(e, item)}>
|
|
73
|
-
{item.name}
|
|
74
|
-
</StatusMenuItem>
|
|
75
|
-
))}
|
|
76
|
-
</StyledMenu>
|
|
77
|
-
</>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default DurationMenu;
|
|
82
|
-
|
|
83
|
-
export const MenuDiv = styled(Menu)`
|
|
84
|
-
.MuiList-root {
|
|
85
|
-
min-width: 160px;
|
|
86
|
-
}
|
|
87
|
-
.selected {
|
|
88
|
-
background-color: ${({ theme }) => theme.palette.grey[50]};
|
|
89
|
-
}
|
|
90
|
-
`;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { PopoverProps, Typography } from '@mui/material';
|
|
2
|
-
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
3
|
-
import { useMemoizedFn } from 'ahooks';
|
|
4
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
|
-
import { UserMetadata } from '../../../@types';
|
|
6
|
-
import StatusDurationMenu from './duration-menu';
|
|
7
|
-
import StatusMenuItem, { BaseStatusProps, StatusItem, StyledMenu } from './menu-item';
|
|
8
|
-
import { translations } from '../../libs/locales';
|
|
9
|
-
|
|
10
|
-
interface StatusSelectorProps extends BaseStatusProps {
|
|
11
|
-
data: Array<StatusItem>;
|
|
12
|
-
open: boolean;
|
|
13
|
-
anchorEl?: PopoverProps['anchorEl'];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function StatusSelector({ data, open, onSelect, anchorEl = undefined, selected }: StatusSelectorProps) {
|
|
17
|
-
const { locale } = useLocaleContext();
|
|
18
|
-
const t = useMemoizedFn((key, _data = {}) => {
|
|
19
|
-
return translate(translations, key, locale, 'en', _data);
|
|
20
|
-
});
|
|
21
|
-
const onSelectStatus = (v?: UserMetadata['status']) => {
|
|
22
|
-
onSelect(v);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const renderMenuItems = () => {
|
|
26
|
-
return data.map((item) => {
|
|
27
|
-
if (item.children) {
|
|
28
|
-
return <StatusDurationMenu key={item.id} data={item} selected={selected} onSelect={onSelectStatus} />;
|
|
29
|
-
}
|
|
30
|
-
return (
|
|
31
|
-
<StatusMenuItem
|
|
32
|
-
key={item.id}
|
|
33
|
-
icon={item.icon}
|
|
34
|
-
selected={selected?.value === item.id}
|
|
35
|
-
onClick={() => onSelectStatus({ value: item.id })}>
|
|
36
|
-
{item.name}
|
|
37
|
-
</StatusMenuItem>
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<StyledMenu open={open} onClose={() => onSelectStatus()} anchorEl={anchorEl}>
|
|
44
|
-
<Typography
|
|
45
|
-
component="span"
|
|
46
|
-
sx={{
|
|
47
|
-
color: 'text.secondary',
|
|
48
|
-
pl: 2,
|
|
49
|
-
fontSize: '14px',
|
|
50
|
-
}}>
|
|
51
|
-
{t('profile.setStatus')}
|
|
52
|
-
</Typography>
|
|
53
|
-
{renderMenuItems()}
|
|
54
|
-
</StyledMenu>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export default StatusSelector;
|