UNPKG

@blocklet/ui-react

Version:

Some useful front-end web components that can be used in Blocklets.

23 lines (22 loc) 998 B
import { jsx as l } from "react/jsx-runtime"; import n from "@arcblock/ux/lib/Empty"; import { translate as a } from "@arcblock/ux/lib/Locale/util"; import { useMemoizedFn as c } from "ahooks"; import { useLocaleContext as d } from "@arcblock/ux/lib/Locale/context"; import { translations as w } from "../libs/locales.js"; import { useUserFollowersContext as x } from "../../contexts/user-followers.js"; function z({ currentActiveTab: r, isMyself: f, isSupportFollow: m = !1, children: t }) { const { locale: s } = d(), e = c((p, u = {}) => a(w, p, s, "en", u)), { followed: i } = x(); if (f || !r?.protected || r?.protected === "all") return t; const { protected: o } = r; return !m && o === "follower-only" ? t : o === !0 || o === "private" ? /* @__PURE__ */ l(n, { children: e("underProtected") }) : o === "follower-only" ? i ? t : /* @__PURE__ */ l(n, { children: e("followersOnly") }) : /* @__PURE__ */ l(n, { children: e("underProtected") }); } export { z as default };