@blocklet/ui-react 3.1.25 → 3.1.27

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 (28) hide show
  1. package/lib/@types/index.d.ts +1 -1
  2. package/lib/UserCenter/components/fallback.d.ts +8 -0
  3. package/lib/UserCenter/components/fallback.js +21 -0
  4. package/lib/UserCenter/components/user-center.js +205 -200
  5. package/lib/UserCenter/components/user-info/social-actions/chat.d.ts +5 -0
  6. package/lib/UserCenter/components/user-info/social-actions/chat.js +24 -0
  7. package/lib/UserCenter/components/user-info/social-actions/follow.d.ts +2 -0
  8. package/lib/UserCenter/components/user-info/social-actions/follow.js +19 -0
  9. package/lib/UserCenter/components/user-info/social-actions/index.d.ts +5 -0
  10. package/lib/UserCenter/components/user-info/social-actions/index.js +13 -0
  11. package/lib/UserCenter/components/user-info/user-basic-info.js +37 -35
  12. package/lib/UserCenter/libs/locales.d.ts +14 -0
  13. package/lib/UserCenter/libs/locales.js +16 -2
  14. package/lib/contexts/user-followers.d.ts +13 -0
  15. package/lib/contexts/user-followers.js +40 -0
  16. package/lib/hooks/use-follow.d.ts +12 -0
  17. package/lib/hooks/use-follow.js +47 -0
  18. package/package.json +6 -6
  19. package/src/@types/index.ts +1 -1
  20. package/src/UserCenter/components/fallback.tsx +51 -0
  21. package/src/UserCenter/components/user-center.tsx +22 -12
  22. package/src/UserCenter/components/user-info/social-actions/chat.tsx +42 -0
  23. package/src/UserCenter/components/user-info/social-actions/follow.tsx +30 -0
  24. package/src/UserCenter/components/user-info/social-actions/index.tsx +17 -0
  25. package/src/UserCenter/components/user-info/user-basic-info.tsx +6 -0
  26. package/src/UserCenter/libs/locales.ts +14 -0
  27. package/src/contexts/user-followers.tsx +54 -0
  28. package/src/hooks/use-follow.tsx +74 -0
@@ -114,7 +114,7 @@ export type UserCenterTab = {
114
114
  value: string;
115
115
  label: string;
116
116
  url: string;
117
- protected: boolean;
117
+ protected: boolean | string;
118
118
  icon?: string;
119
119
  isPrivate?: boolean;
120
120
  };
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { UserCenterTab } from '../../@types';
3
+ declare function Fallback({ currentActiveTab, isMyself, children, }: {
4
+ currentActiveTab: UserCenterTab;
5
+ isMyself: boolean;
6
+ children: React.ReactNode;
7
+ }): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
8
+ export default Fallback;
@@ -0,0 +1,21 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import n from "@arcblock/ux/lib/Empty";
3
+ import { translate as c } from "@arcblock/ux/lib/Locale/util";
4
+ import { useMemoizedFn as d } from "ahooks";
5
+ import { useLocaleContext as u } from "@arcblock/ux/lib/Locale/context";
6
+ import { translations as a } from "../libs/locales.js";
7
+ import { useUserFollowersContext as w } from "../../contexts/user-followers.js";
8
+ function k({
9
+ currentActiveTab: o,
10
+ isMyself: m,
11
+ children: l
12
+ }) {
13
+ const { locale: f } = u(), r = d((s, p = {}) => c(a, s, f, "en", p)), { followed: i } = w();
14
+ if (m || !o?.protected || o?.protected === "all")
15
+ return l;
16
+ const { protected: t } = o;
17
+ return t === !0 || t === "private" ? /* @__PURE__ */ e(n, { children: r("underProtected") }) : t === "follower-only" ? i ? l : /* @__PURE__ */ e(n, { children: r("followersOnly") }) : /* @__PURE__ */ e(n, { children: r("underProtected") });
18
+ }
19
+ export {
20
+ k as default
21
+ };