@blocklet/discuss-kit-ux 1.6.248 → 1.6.249

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.
@@ -3,5 +3,6 @@ export declare const useChatInWallet: () => {
3
3
  id: string;
4
4
  title: string;
5
5
  }) => void;
6
+ navigateToChatList: () => void;
6
7
  isChatInWalletV2: boolean;
7
8
  };
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
4
4
  import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
5
5
  import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
6
6
  import { lazy } from "react";
7
- import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-B9C3Sh2v.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-B4ARcakL.mjs";
8
8
  const BlockletEditor = lazy(() => import("@blocklet/editor"));
9
9
  const Root = styled(Box)`
10
10
  .be-editable,
@@ -10,7 +10,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
10
10
  import { useTheme, ThemeProvider, styled } from "@mui/material/styles";
11
11
  import { create as create$1, styled as styled$1 } from "@arcblock/ux/lib/Theme";
12
12
  import require$$0, { useEffect, useRef, useState, createElement, useContext, useMemo, isValidElement, lazy, Suspense, createContext, Fragment as Fragment$1, forwardRef, useCallback } from "react";
13
- import { Box, useTheme as useTheme$1, useMediaQuery, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Dialog as Dialog$1, DialogTitle, DialogContent, DialogActions, DialogContentText, Button as Button$1, Divider, Skeleton, IconButton as IconButton$2, InputBase, tooltipClasses as tooltipClasses$1, Backdrop, Autocomplete, Typography as Typography$1, TextField as TextField$1, InputAdornment, Badge as Badge$1, Paper, ToggleButtonGroup, ToggleButton } from "@mui/material";
13
+ import { Box, useTheme as useTheme$1, useMediaQuery, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Dialog as Dialog$1, DialogTitle, DialogContent, DialogActions, DialogContentText, Button as Button$1, Divider, Skeleton, IconButton as IconButton$2, InputBase, tooltipClasses as tooltipClasses$1, Backdrop, Autocomplete, Typography as Typography$1, TextField as TextField$1, InputAdornment, SwipeableDrawer, Badge as Badge$1, Paper, ToggleButtonGroup, ToggleButton } from "@mui/material";
14
14
  import isNil from "lodash/isNil";
15
15
  import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/config";
16
16
  import { lazyWithPreload } from "react-lazy-with-preload";
@@ -34,7 +34,7 @@ import { grey, green, amber } from "@mui/material/colors";
34
34
  import useMediaQuery$1 from "@mui/material/useMediaQuery";
35
35
  import DID from "@arcblock/ux/lib/DID";
36
36
  import Tooltip, { tooltipClasses } from "@mui/material/Tooltip";
37
- import { Link, useNavigate, useLocation, useParams, useSearchParams, useBlocker } from "react-router-dom";
37
+ import { Link, useNavigate, useLocation, useParams, Outlet, useSearchParams, useBlocker } from "react-router-dom";
38
38
  import UxRelativeTime from "@arcblock/ux/lib/RelativeTime";
39
39
  import Chip from "@mui/material/Chip";
40
40
  import Stack from "@mui/material/Stack";
@@ -4827,7 +4827,10 @@ const useChatInWallet = () => {
4827
4827
  bridge.call("clickChat", { id: id2, title });
4828
4828
  }
4829
4829
  };
4830
- return { navigateToChat, isChatInWalletV2 };
4830
+ const navigateToChatList = () => {
4831
+ navigate("/chat-in-wallet");
4832
+ };
4833
+ return { navigateToChat, navigateToChatList, isChatInWalletV2 };
4831
4834
  };
4832
4835
  function ChatList({ inWallet, ...rest }) {
4833
4836
  const { t } = useLocaleContext();
@@ -4951,7 +4954,7 @@ function Message({ message, prevMessage, showTime = true, ...rest }) {
4951
4954
  const { t } = useLocaleContext();
4952
4955
  const { session, isAdmin } = useSessionContext();
4953
4956
  const { confirm } = useConfirm();
4954
- const { activeChatId, deleteMessage } = useChatContext();
4957
+ const { activeChatId, deleteMessage, isInWallet } = useChatContext();
4955
4958
  const handleDeleteMessage = async () => {
4956
4959
  if (activeChatId) {
4957
4960
  const proceed = await confirm({
@@ -5034,6 +5037,7 @@ function Message({ message, prevMessage, showTime = true, ...rest }) {
5034
5037
  showDID: false,
5035
5038
  user: message.sender,
5036
5039
  createdAt: showTime ? message.createdAt : void 0,
5040
+ linkToProfile: !isInWallet,
5037
5041
  size: "sm",
5038
5042
  style: {
5039
5043
  alignItems: "flex-start"
@@ -6155,24 +6159,12 @@ function Empty({ sx }) {
6155
6159
  }
6156
6160
  function ChatListInWallet({ sx, ...rest }) {
6157
6161
  const { initialized, chats, activeChatId } = useChatContext();
6158
- const downMd = useMediaQuery((theme) => theme.breakpoints.down("sm"));
6159
- const show = useMemo(() => {
6160
- if (downMd) {
6161
- return {
6162
- left: !activeChatId,
6163
- right: !!activeChatId
6164
- };
6165
- }
6166
- return {
6167
- left: true,
6168
- right: true
6169
- };
6170
- }, [downMd, activeChatId]);
6162
+ const { navigateToChatList } = useChatInWallet();
6171
6163
  if (!initialized) {
6172
6164
  return /* @__PURE__ */ jsx(CircularProgress, {});
6173
6165
  }
6174
6166
  const mergedSx = [{ display: "flex", height: "100%", bgcolor: "#fff" }, ...Array.isArray(sx) ? sx : [sx]];
6175
- return /* @__PURE__ */ jsx(Box$1, { ...rest, sx: mergedSx, children: show.left && /* @__PURE__ */ jsxs(
6167
+ return /* @__PURE__ */ jsx(Box$1, { ...rest, sx: mergedSx, children: /* @__PURE__ */ jsxs(
6176
6168
  Box$1,
6177
6169
  {
6178
6170
  sx: {
@@ -6185,7 +6177,19 @@ function ChatListInWallet({ sx, ...rest }) {
6185
6177
  /* @__PURE__ */ jsx(UserSearch, { sx: { flex: "0 0 auto", py: 1, px: 3 } }),
6186
6178
  /* @__PURE__ */ jsx(Divider, {}),
6187
6179
  !!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsx(ChatList, { sx: { flex: 1, overflowY: "auto" }, inWallet: true }),
6188
- !(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsx(Empty, { sx: { flex: 1 } })
6180
+ !(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsx(Empty, { sx: { flex: 1 } }),
6181
+ /* @__PURE__ */ jsx(
6182
+ SwipeableDrawer,
6183
+ {
6184
+ PaperProps: { sx: { width: 1 } },
6185
+ anchor: "right",
6186
+ open: !!activeChatId,
6187
+ onClose: () => navigateToChatList(),
6188
+ onOpen: () => {
6189
+ },
6190
+ children: /* @__PURE__ */ jsx(Box$1, { sx: { width: 1 }, children: /* @__PURE__ */ jsx(Outlet, {}) })
6191
+ }
6192
+ )
6189
6193
  ]
6190
6194
  }
6191
6195
  ) });
@@ -6482,7 +6486,7 @@ function Pagination({
6482
6486
  }
6483
6487
  );
6484
6488
  }
6485
- const Editor = lazy(() => import("./editor-DnJ6aon9.mjs"));
6489
+ const Editor = lazy(() => import("./editor-BHV8m65L.mjs"));
6486
6490
  function LazyEditor(props) {
6487
6491
  const fallback = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
6488
6492
  /* @__PURE__ */ jsx(Skeleton, {}),
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "@blocklet/labels";
2
- import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-B9C3Sh2v.mjs";
2
+ import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-B4ARcakL.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
package/dist/index.umd.js CHANGED
@@ -4757,7 +4757,10 @@ var __publicField = (obj, key, value) => {
4757
4757
  bridge.call("clickChat", { id: id2, title });
4758
4758
  }
4759
4759
  };
4760
- return { navigateToChat, isChatInWalletV2 };
4760
+ const navigateToChatList = () => {
4761
+ navigate("/chat-in-wallet");
4762
+ };
4763
+ return { navigateToChat, navigateToChatList, isChatInWalletV2 };
4761
4764
  };
4762
4765
  function ChatList({ inWallet, ...rest }) {
4763
4766
  const { t } = context.useLocaleContext();
@@ -4881,7 +4884,7 @@ var __publicField = (obj, key, value) => {
4881
4884
  const { t } = context.useLocaleContext();
4882
4885
  const { session, isAdmin } = useSessionContext();
4883
4886
  const { confirm } = useConfirm();
4884
- const { activeChatId, deleteMessage } = useChatContext();
4887
+ const { activeChatId, deleteMessage, isInWallet } = useChatContext();
4885
4888
  const handleDeleteMessage = async () => {
4886
4889
  if (activeChatId) {
4887
4890
  const proceed = await confirm({
@@ -4964,6 +4967,7 @@ var __publicField = (obj, key, value) => {
4964
4967
  showDID: false,
4965
4968
  user: message.sender,
4966
4969
  createdAt: showTime ? message.createdAt : void 0,
4970
+ linkToProfile: !isInWallet,
4967
4971
  size: "sm",
4968
4972
  style: {
4969
4973
  alignItems: "flex-start"
@@ -6085,24 +6089,12 @@ var __publicField = (obj, key, value) => {
6085
6089
  }
6086
6090
  function ChatListInWallet({ sx, ...rest }) {
6087
6091
  const { initialized, chats, activeChatId } = useChatContext();
6088
- const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
6089
- const show = require$$0.useMemo(() => {
6090
- if (downMd) {
6091
- return {
6092
- left: !activeChatId,
6093
- right: !!activeChatId
6094
- };
6095
- }
6096
- return {
6097
- left: true,
6098
- right: true
6099
- };
6100
- }, [downMd, activeChatId]);
6092
+ const { navigateToChatList } = useChatInWallet();
6101
6093
  if (!initialized) {
6102
6094
  return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, {});
6103
6095
  }
6104
6096
  const mergedSx = [{ display: "flex", height: "100%", bgcolor: "#fff" }, ...Array.isArray(sx) ? sx : [sx]];
6105
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, sx: mergedSx, children: show.left && /* @__PURE__ */ jsxRuntime.jsxs(
6097
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, sx: mergedSx, children: /* @__PURE__ */ jsxRuntime.jsxs(
6106
6098
  Box,
6107
6099
  {
6108
6100
  sx: {
@@ -6115,7 +6107,19 @@ var __publicField = (obj, key, value) => {
6115
6107
  /* @__PURE__ */ jsxRuntime.jsx(UserSearch, { sx: { flex: "0 0 auto", py: 1, px: 3 } }),
6116
6108
  /* @__PURE__ */ jsxRuntime.jsx(material.Divider, {}),
6117
6109
  !!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(ChatList, { sx: { flex: 1, overflowY: "auto" }, inWallet: true }),
6118
- !(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(Empty, { sx: { flex: 1 } })
6110
+ !(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(Empty, { sx: { flex: 1 } }),
6111
+ /* @__PURE__ */ jsxRuntime.jsx(
6112
+ material.SwipeableDrawer,
6113
+ {
6114
+ PaperProps: { sx: { width: 1 } },
6115
+ anchor: "right",
6116
+ open: !!activeChatId,
6117
+ onClose: () => navigateToChatList(),
6118
+ onOpen: () => {
6119
+ },
6120
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { width: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {}) })
6121
+ }
6122
+ )
6119
6123
  ]
6120
6124
  }
6121
6125
  ) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "1.6.248",
3
+ "version": "1.6.249",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -30,8 +30,8 @@
30
30
  "dependencies": {
31
31
  "@arcblock/bridge": "^2.9.77",
32
32
  "@arcblock/ws": "^1.18.116",
33
- "@blocklet/editor": "1.6.248",
34
- "@blocklet/labels": "1.6.248",
33
+ "@blocklet/editor": "1.6.249",
34
+ "@blocklet/labels": "1.6.249",
35
35
  "@blocklet/uploader": "^0.1.2",
36
36
  "@emotion/css": "^11.10.5",
37
37
  "@emotion/react": "^11.10.5",
@@ -98,5 +98,5 @@
98
98
  "resolutions": {
99
99
  "react": "^18.2.0"
100
100
  },
101
- "gitHead": "3c8c1ef53a2022d046862c57ba938b252d264525"
101
+ "gitHead": "f751ad2aafb6e37c2069c490659c8323d1e409b1"
102
102
  }