@blocklet/ui-react 2.9.22 → 2.9.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/es/Footer/index.js +12 -2
  2. package/es/Header/index.js +5 -1
  3. package/es/UserCenter/components/passport.d.ts +2 -2
  4. package/es/UserCenter/components/passport.js +44 -29
  5. package/es/UserCenter/components/user-basic-info.d.ts +3 -2
  6. package/es/UserCenter/components/user-basic-info.js +6 -11
  7. package/es/UserCenter/components/user-center.d.ts +2 -2
  8. package/es/UserCenter/components/user-center.js +160 -100
  9. package/es/UserCenter/components/user-info-item.js +12 -21
  10. package/es/UserCenter/components/user-info.d.ts +2 -2
  11. package/es/UserCenter/components/user-info.js +13 -16
  12. package/es/UserCenter/libs/locales.d.ts +6 -0
  13. package/es/UserCenter/libs/locales.js +8 -2
  14. package/lib/Footer/index.js +7 -2
  15. package/lib/Header/index.js +7 -1
  16. package/lib/UserCenter/components/passport.d.ts +2 -2
  17. package/lib/UserCenter/components/passport.js +17 -10
  18. package/lib/UserCenter/components/user-basic-info.d.ts +3 -2
  19. package/lib/UserCenter/components/user-basic-info.js +8 -11
  20. package/lib/UserCenter/components/user-center.d.ts +2 -2
  21. package/lib/UserCenter/components/user-center.js +135 -95
  22. package/lib/UserCenter/components/user-info-item.js +8 -16
  23. package/lib/UserCenter/components/user-info.d.ts +2 -2
  24. package/lib/UserCenter/components/user-info.js +18 -17
  25. package/lib/UserCenter/libs/locales.d.ts +6 -0
  26. package/lib/UserCenter/libs/locales.js +8 -2
  27. package/package.json +4 -4
  28. package/src/Footer/index.jsx +9 -3
  29. package/src/Header/index.jsx +6 -2
  30. package/src/UserCenter/components/passport.tsx +23 -9
  31. package/src/UserCenter/components/user-basic-info.tsx +8 -12
  32. package/src/UserCenter/components/user-center.tsx +147 -101
  33. package/src/UserCenter/components/user-info-item.tsx +6 -14
  34. package/src/UserCenter/components/user-info.tsx +18 -25
  35. package/src/UserCenter/libs/locales.ts +7 -1
@@ -1,11 +1,12 @@
1
- import { Paper } from '@mui/material';
2
- import type { PaperProps } from '@mui/material';
1
+ import { Box } from '@mui/material';
2
+ import type { BoxProps } from '@mui/material';
3
3
  import { Icon } from '@iconify/react';
4
4
  import { useMemoizedFn, useCreation } from 'ahooks';
5
5
  import MailOutlineRoundedIcon from '@iconify-icons/material-symbols/mail-outline-rounded';
6
6
  import ScheduleOutlineRoundedIcon from '@iconify-icons/material-symbols/schedule-outline-rounded';
7
7
  import MoreTimeRoundedIcon from '@iconify-icons/material-symbols/more-time-rounded';
8
8
  import CaptivePortalRoundedIcon from '@iconify-icons/material-symbols/captive-portal-rounded';
9
+ import SettingsInputAntennaRoundedIcon from '@iconify-icons/material-symbols/settings-input-antenna-rounded';
9
10
  import RelativeTime from '@arcblock/ux/lib/RelativeTime';
10
11
  import { translate } from '@arcblock/ux/lib/Locale/util';
11
12
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
@@ -19,7 +20,7 @@ export default function UserInfo({
19
20
  ...rest
20
21
  }: {
21
22
  user: User;
22
- } & PaperProps) {
23
+ } & BoxProps) {
23
24
  const { locale } = useLocaleContext();
24
25
  const t = useMemoizedFn((key, data = {}) => {
25
26
  return translate(translations, key, locale, 'en', data);
@@ -41,21 +42,18 @@ export default function UserInfo({
41
42
  });
42
43
  userInfoListData.push({
43
44
  icon: <Icon fontSize={16} icon={ScheduleOutlineRoundedIcon} />,
44
- title: t('lastLogin'),
45
- content: (
46
- <>
47
- {user?.lastLoginAt || user?.lastLoginIp ? (
48
- <>
49
- {user?.lastLoginAt ? <RelativeTime locale={locale} value={user?.lastLoginAt} /> : null}
50
- {user?.lastLoginAt && user?.lastLoginIp ? <br /> : null}
51
- {user?.lastLoginIp}
52
- </>
53
- ) : (
54
- t('unknown')
55
- )}
56
- </>
45
+ title: t('lastLoginAt'),
46
+ content: user?.lastLoginAt ? (
47
+ <RelativeTime locale={locale} value={user?.lastLoginAt} relativeRange={3 * 86400 * 1000} />
48
+ ) : (
49
+ t('unknown')
57
50
  ),
58
51
  });
52
+ userInfoListData.push({
53
+ icon: <Icon fontSize={16} icon={SettingsInputAntennaRoundedIcon} />,
54
+ title: t('lastLoginIp'),
55
+ content: user?.lastLoginIp || t('unknown'),
56
+ });
59
57
  userInfoListData.push({
60
58
  icon: <Icon fontSize={16} icon={MoreTimeRoundedIcon} />,
61
59
  title: t('createdAt'),
@@ -68,22 +66,17 @@ export default function UserInfo({
68
66
  });
69
67
 
70
68
  return (
71
- <Paper
72
- variant="outlined"
69
+ <Box
73
70
  {...rest}
74
71
  sx={{
75
72
  display: 'flex',
76
- flexDirection: {
77
- xs: 'column',
78
- md: 'row',
79
- },
80
- alignItems: 'flex-start',
81
- gap: 3,
73
+ flexDirection: 'column',
74
+ gap: 1.5,
82
75
  ...rest?.sx,
83
76
  }}>
84
77
  {userInfoListData.map((item) => (
85
78
  <UserInfoItem key={item.title} data={item} sx={{ flex: 1 }} />
86
79
  ))}
87
- </Paper>
80
+ </Box>
88
81
  );
89
82
  }
@@ -6,6 +6,8 @@ export const translations = {
6
6
  notification: '通知',
7
7
  email: '邮箱地址',
8
8
  lastLogin: '上次登录',
9
+ lastLoginAt: '上次登录时间',
10
+ lastLoginIp: '上次登录地址',
9
11
  createdAt: '创建时间',
10
12
  registerFrom: '注册来源',
11
13
  unknown: '未知',
@@ -23,7 +25,7 @@ export const translations = {
23
25
  noUserFound: '未找到指定的用户',
24
26
  notificationManagement: '通知管理',
25
27
  privacyManagement: '隐私管理',
26
- storageManagement: "存储管理",
28
+ storageManagement: '存储管理',
27
29
  webhook: {
28
30
  url: '自定义URL',
29
31
  slack: 'Slack',
@@ -36,6 +38,7 @@ export const translations = {
36
38
  currentPassport: '当前使用的通行证',
37
39
  switchProfile: '切换',
38
40
  userInfo: '个人信息',
41
+ myInfo: '我的信息',
39
42
  },
40
43
  en: {
41
44
  settings: 'Settings',
@@ -44,6 +47,8 @@ export const translations = {
44
47
  notification: 'Notification',
45
48
  email: 'Email',
46
49
  lastLogin: 'Last Login & IP',
50
+ lastLoginAt: 'Last Login',
51
+ lastLoginIp: 'Last IP',
47
52
  createdAt: 'Created At',
48
53
  registerFrom: 'Register From',
49
54
  unknown: 'Unknown',
@@ -74,5 +79,6 @@ export const translations = {
74
79
  currentPassport: 'Passport currently in use',
75
80
  switchProfile: 'Switch',
76
81
  userInfo: 'User Info',
82
+ myInfo: 'My Info',
77
83
  },
78
84
  };