UNPKG

@blocklet/ui-react

Version:

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

26 lines (25 loc) 1.11 kB
import { jsxs as c, jsx as a } from "react/jsx-runtime"; import { useMemo as l } from "react"; import { Button as u } from "@mui/material"; import { useMemoizedFn as r } from "ahooks"; import { Icon as d } from "@iconify/react"; import { translate as f } from "@arcblock/ux/lib/Locale/util"; import { useLocaleContext as p } from "@arcblock/ux/lib/Locale/context"; import { joinURL as h } from "ufo"; import { translations as g } from "../../../libs/locales.js"; const x = () => { const { componentMountPoints: o = [] } = window.blocklet || {}; return o.find((t) => t.name === "did-comments")?.mountPoint; }; function L({ user: o }) { const { locale: n } = p(), t = r((m, s = {}) => f(g, m, n, "en", s)), i = l(() => x(), []), e = r(() => { window.open(h(i, `/chat/dm/${o?.did}`), "_blank"); }); return i ? /* @__PURE__ */ c(u, { fullWidth: !0, variant: "outlined", color: "inherit", onClick: e, sx: { borderColor: "divider" }, children: [ /* @__PURE__ */ a(d, { icon: "tabler:message-dots", style: { marginRight: 4 } }), t("profile.chat") ] }) : null; } export { L as default };