@blocklet/discuss-kit-ux 1.6.222 → 1.6.224
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.
- package/dist/components/avatars/author-info.d.ts +2 -1
- package/dist/components/chat/chat-client.d.ts +11 -0
- package/dist/components/chat/chat-in-wallet.d.ts +7 -0
- package/dist/components/chat/chat-list-in-wallet.d.ts +7 -0
- package/dist/components/chat/chat-list.d.ts +2 -1
- package/dist/components/chat/chat-room.d.ts +2 -1
- package/dist/components/chat/context.d.ts +5 -2
- package/dist/components/chat/index.d.ts +2 -0
- package/dist/components/chat/user-search.d.ts +7 -0
- package/dist/{editor-Bv0IhrR_.mjs → editor-xw6iQCuH.mjs} +1 -1
- package/dist/{index-BHZcv0rr.mjs → index-BYwPg7XF.mjs} +370 -69
- package/dist/index.es.js +35 -33
- package/dist/index.umd.js +335 -35
- package/package.json +7 -6
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material/Box"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("react-dom"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material/Box", "lodash/isNil", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "@mui/material", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "react-dom", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "@mui/icons-material/Add", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.react, global.Box, global.isNil, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$
|
|
3
|
-
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, Box, isNil, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material/Box"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("react-dom"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("@arcblock/bridge"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material/Box", "lodash/isNil", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "@mui/material", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "react-dom", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "@arcblock/bridge", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "@mui/icons-material/Add", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.react, global.Box, global.isNil, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$3, global.Session, global.material, global.NotificationsActiveOutlinedIcon, global.CheckboxPlugin, global.DIDAddress, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.ReactDOM, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.bridge, global.Fab, global.debounce, global.TextField, global.AddIcon, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
|
|
3
|
+
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, Box, isNil, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, material, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, ReactDOM, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, bridge, Fab, debounce, TextField, AddIcon, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -788,7 +788,7 @@ var __publicField = (obj, key, value) => {
|
|
|
788
788
|
flexDirection: "column",
|
|
789
789
|
alignItems: "cetner",
|
|
790
790
|
justifyContent: "center",
|
|
791
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Empty$
|
|
791
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Empty$3, { children: t("profile.empty") })
|
|
792
792
|
}
|
|
793
793
|
);
|
|
794
794
|
}
|
|
@@ -940,7 +940,8 @@ var __publicField = (obj, key, value) => {
|
|
|
940
940
|
}
|
|
941
941
|
},
|
|
942
942
|
...restProps
|
|
943
|
-
}
|
|
943
|
+
},
|
|
944
|
+
badgeName
|
|
944
945
|
);
|
|
945
946
|
})
|
|
946
947
|
},
|
|
@@ -1149,6 +1150,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1149
1150
|
newTitle = void 0,
|
|
1150
1151
|
profileUse = false,
|
|
1151
1152
|
children,
|
|
1153
|
+
linkToProfile = true,
|
|
1152
1154
|
...rest
|
|
1153
1155
|
}) {
|
|
1154
1156
|
const theme = styles.useTheme();
|
|
@@ -1174,6 +1176,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1174
1176
|
};
|
|
1175
1177
|
const click = (e) => {
|
|
1176
1178
|
var _a2, _b2;
|
|
1179
|
+
if (!linkToProfile) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1177
1182
|
(_a2 = e == null ? void 0 : e.stopPropagation) == null ? void 0 : _a2.call(e);
|
|
1178
1183
|
(_b2 = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b2.call(e);
|
|
1179
1184
|
setOpen(false);
|
|
@@ -2734,7 +2739,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2734
2739
|
window.uploaderRef = uploaderRef;
|
|
2735
2740
|
return /* @__PURE__ */ jsxRuntime.jsxs(UploaderContext.Provider, { value: uploaderRef, children: [
|
|
2736
2741
|
children,
|
|
2737
|
-
|
|
2742
|
+
ReactDOM.createPortal(
|
|
2738
2743
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2739
2744
|
UploaderComponent,
|
|
2740
2745
|
{
|
|
@@ -3494,6 +3499,10 @@ var __publicField = (obj, key, value) => {
|
|
|
3494
3499
|
this.emitter.on("deleteChannel", callback);
|
|
3495
3500
|
return () => this.emitter.off("deleteChannel", callback);
|
|
3496
3501
|
}
|
|
3502
|
+
onUpdateLastAckTime(callback) {
|
|
3503
|
+
this.emitter.on("updateLastAckTime", callback);
|
|
3504
|
+
return () => this.emitter.off("updateLastAckTime", callback);
|
|
3505
|
+
}
|
|
3497
3506
|
}
|
|
3498
3507
|
const iconoirChatBubbleEmpty = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12c0 1.821.487 3.53 1.338 5L2.5 21.5l4.5-.838A9.955 9.955 0 0 0 12 22Z" }) });
|
|
3499
3508
|
const UnreadNotificationContext = react.createContext(
|
|
@@ -3530,7 +3539,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3530
3539
|
const sorted = orderBy(unique, ["createdAt", "id"], [order, order]);
|
|
3531
3540
|
return sorted;
|
|
3532
3541
|
};
|
|
3533
|
-
function ChatProvider({ client: client2, activeChatId, children }) {
|
|
3542
|
+
function ChatProvider({ client: client2, activeChatId, children, isInWallet }) {
|
|
3534
3543
|
const [state, setState] = ahooks.useSetState({
|
|
3535
3544
|
initialized: false,
|
|
3536
3545
|
chats: [],
|
|
@@ -3567,9 +3576,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3567
3576
|
return { ...prev, chats };
|
|
3568
3577
|
});
|
|
3569
3578
|
};
|
|
3570
|
-
const updateLastAckTime = async (chatId) => {
|
|
3579
|
+
const updateLastAckTime = async (chatId, clientOnly) => {
|
|
3571
3580
|
updateChat(chatId, (chat) => ({ ...chat, lastAckTime: chat.lastMessageAt }));
|
|
3572
|
-
|
|
3581
|
+
if (!clientOnly) {
|
|
3582
|
+
await client2.updateLastAckTime(chatId);
|
|
3583
|
+
}
|
|
3573
3584
|
};
|
|
3574
3585
|
const addMessage = (chatId, message) => {
|
|
3575
3586
|
updateChat(chatId, (chat) => ({
|
|
@@ -3594,7 +3605,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3594
3605
|
const chatId = chat == null ? void 0 : chat.id;
|
|
3595
3606
|
setState((prev) => ({ ...prev, activeChatId: chatId }));
|
|
3596
3607
|
if (chatId) {
|
|
3597
|
-
|
|
3608
|
+
if (isInWallet) {
|
|
3609
|
+
navigate(`/chat-in-wallet/${chatId}`, { replace: true });
|
|
3610
|
+
} else {
|
|
3611
|
+
navigate(`/chat/${chatId}`, { replace: true });
|
|
3612
|
+
}
|
|
3598
3613
|
updateChat(chatId, (origin) => ({
|
|
3599
3614
|
...origin,
|
|
3600
3615
|
isActivated: true
|
|
@@ -3606,6 +3621,22 @@ var __publicField = (obj, key, value) => {
|
|
|
3606
3621
|
navigate("/chat", { replace: true });
|
|
3607
3622
|
}
|
|
3608
3623
|
};
|
|
3624
|
+
const setActiveChatInWallet = (chat) => {
|
|
3625
|
+
const chatId = chat == null ? void 0 : chat.id;
|
|
3626
|
+
setState((prev) => ({ ...prev, activeChatId: chatId }));
|
|
3627
|
+
if (chatId) {
|
|
3628
|
+
navigate(`/chat-in-wallet/${chatId}`, { replace: true });
|
|
3629
|
+
updateChat(chatId, (origin) => ({
|
|
3630
|
+
...origin,
|
|
3631
|
+
isActivated: true
|
|
3632
|
+
}));
|
|
3633
|
+
if ((chat.type !== "channel" || chat.hasJoined) && hasUnreadMessages(chat)) {
|
|
3634
|
+
updateLastAckTime(chatId);
|
|
3635
|
+
}
|
|
3636
|
+
} else {
|
|
3637
|
+
navigate("/chat-in-wallet", { replace: true });
|
|
3638
|
+
}
|
|
3639
|
+
};
|
|
3609
3640
|
const addChat = (chat) => {
|
|
3610
3641
|
setState((prev) => ({ ...prev, chats: uniqAndSort([...state.chats, chat]) }));
|
|
3611
3642
|
};
|
|
@@ -3624,7 +3655,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3624
3655
|
const sendMessage = async (chatId, content) => {
|
|
3625
3656
|
const saved = await client2.sendMessage(chatId, content);
|
|
3626
3657
|
addMessage(chatId, saved);
|
|
3627
|
-
updateLastAckTime(chatId);
|
|
3658
|
+
updateLastAckTime(chatId, true);
|
|
3628
3659
|
};
|
|
3629
3660
|
const getLastMessageText = (chat) => {
|
|
3630
3661
|
const lastMessage = chat && chat.messages && chat.messages[chat.messages.length - 1];
|
|
@@ -3696,9 +3727,10 @@ var __publicField = (obj, key, value) => {
|
|
|
3696
3727
|
setState({ error: e.message });
|
|
3697
3728
|
}
|
|
3698
3729
|
};
|
|
3699
|
-
const
|
|
3700
|
-
client2.
|
|
3701
|
-
|
|
3730
|
+
const createDM = async (oppositeUserDid) => {
|
|
3731
|
+
const chat = await client2.createDM(oppositeUserDid);
|
|
3732
|
+
addChat(chat);
|
|
3733
|
+
return chat;
|
|
3702
3734
|
};
|
|
3703
3735
|
react.useEffect(() => {
|
|
3704
3736
|
if (currentUser == null ? void 0 : currentUser.did) {
|
|
@@ -3729,14 +3761,17 @@ var __publicField = (obj, key, value) => {
|
|
|
3729
3761
|
const cancels = [
|
|
3730
3762
|
client2.onMessage(({ chatId, message }) => {
|
|
3731
3763
|
addMessage(chatId, message);
|
|
3732
|
-
if (
|
|
3764
|
+
if (message.sender.did === (currentUser == null ? void 0 : currentUser.did)) {
|
|
3765
|
+
updateLastAckTime(chatId, true);
|
|
3766
|
+
} else if (isActiveChat(chatId)) {
|
|
3733
3767
|
updateLastAckTime(chatId);
|
|
3734
3768
|
}
|
|
3735
3769
|
}),
|
|
3736
3770
|
client2.onCreateChat(({ chat }) => addChat(chat)),
|
|
3737
3771
|
client2.onJoinChannel(({ chatId, participant }) => addParticipant(chatId, participant)),
|
|
3738
3772
|
client2.onLeaveChannel(({ chatId, participant }) => removeParticipant(chatId, participant)),
|
|
3739
|
-
client2.onDeleteChannel(({ chatId }) => deleteChat(chatId))
|
|
3773
|
+
client2.onDeleteChannel(({ chatId }) => deleteChat(chatId)),
|
|
3774
|
+
client2.onUpdateLastAckTime(({ chatId }) => updateLastAckTime(chatId, true))
|
|
3740
3775
|
];
|
|
3741
3776
|
return () => {
|
|
3742
3777
|
cancels.forEach((cancel) => cancel == null ? void 0 : cancel());
|
|
@@ -3752,6 +3787,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3752
3787
|
...state,
|
|
3753
3788
|
client: client2,
|
|
3754
3789
|
setActiveChat,
|
|
3790
|
+
setActiveChatInWallet,
|
|
3755
3791
|
isActiveChat,
|
|
3756
3792
|
getOppositeUser: (chat) => {
|
|
3757
3793
|
if (chat.type === "dm") {
|
|
@@ -3768,9 +3804,10 @@ var __publicField = (obj, key, value) => {
|
|
|
3768
3804
|
deleteChannel,
|
|
3769
3805
|
deleteMessage,
|
|
3770
3806
|
hasUnreadMessages,
|
|
3771
|
-
refresh,
|
|
3772
3807
|
orderedChats,
|
|
3773
|
-
getLastMessageText
|
|
3808
|
+
getLastMessageText,
|
|
3809
|
+
isInWallet,
|
|
3810
|
+
createDM
|
|
3774
3811
|
};
|
|
3775
3812
|
}, [state, client2, currentUser == null ? void 0 : currentUser.did]);
|
|
3776
3813
|
return /* @__PURE__ */ jsxRuntime.jsx(ChatContext.Provider, { value, children });
|
|
@@ -3803,7 +3840,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3803
3840
|
] })
|
|
3804
3841
|
] });
|
|
3805
3842
|
}
|
|
3806
|
-
function ChatList(
|
|
3843
|
+
function ChatList({ inWallet, ...rest }) {
|
|
3807
3844
|
const { t } = context.useLocaleContext();
|
|
3808
3845
|
const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages, getLastMessageText } = useChatContext();
|
|
3809
3846
|
const renderItem = (chat) => {
|
|
@@ -3829,14 +3866,24 @@ var __publicField = (obj, key, value) => {
|
|
|
3829
3866
|
);
|
|
3830
3867
|
if (chat.type === "dm") {
|
|
3831
3868
|
const oppositeUser = getOppositeUser(chat);
|
|
3832
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3869
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3870
|
+
AuthorInfo,
|
|
3871
|
+
{
|
|
3872
|
+
user: oppositeUser,
|
|
3873
|
+
showProfileCard: false,
|
|
3874
|
+
showBadge: false,
|
|
3875
|
+
showDID: false,
|
|
3876
|
+
linkToProfile: !inWallet,
|
|
3877
|
+
children: latestMessageTextContent
|
|
3878
|
+
}
|
|
3879
|
+
);
|
|
3833
3880
|
}
|
|
3834
3881
|
if (chat.type === "channel") {
|
|
3835
3882
|
return /* @__PURE__ */ jsxRuntime.jsx(ChannelGroup, { chat, children: latestMessageTextContent });
|
|
3836
3883
|
}
|
|
3837
3884
|
return null;
|
|
3838
3885
|
};
|
|
3839
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box, { ...
|
|
3886
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(reactFlipToolkit.Flipper, { flipKey: orderedChats.map((x) => x.id).join(""), children: orderedChats.map((chat) => {
|
|
3840
3887
|
const isActiveChat = activeChatId === chat.id;
|
|
3841
3888
|
const _hasUnreadMessages = hasUnreadMessages(chat) && (chat.type !== "channel" || chat.hasJoined);
|
|
3842
3889
|
return /* @__PURE__ */ jsxRuntime.jsx(reactFlipToolkit.Flipped, { flipId: chat.id, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3857,7 +3904,29 @@ var __publicField = (obj, key, value) => {
|
|
|
3857
3904
|
".message-content-text": { color: `${grey[500]}` }
|
|
3858
3905
|
}
|
|
3859
3906
|
},
|
|
3860
|
-
onClick: () =>
|
|
3907
|
+
onClick: () => {
|
|
3908
|
+
if (inWallet) {
|
|
3909
|
+
const webTitleMap = {
|
|
3910
|
+
dm: () => {
|
|
3911
|
+
var _a2;
|
|
3912
|
+
return ((_a2 = getOppositeUser(chat)) == null ? void 0 : _a2.fullName) || t("chat.unknown");
|
|
3913
|
+
},
|
|
3914
|
+
notification: () => t("chat.notification"),
|
|
3915
|
+
channel: () => (chat == null ? void 0 : chat.type) === "channel" ? `# ${chat.name}` : t("chat.unknownChannel"),
|
|
3916
|
+
default: () => t("chat.chats")
|
|
3917
|
+
};
|
|
3918
|
+
const getWebTitle = () => {
|
|
3919
|
+
if (!chat) {
|
|
3920
|
+
return t("chat.chats");
|
|
3921
|
+
}
|
|
3922
|
+
const getTitle = webTitleMap[chat.type] || webTitleMap.default;
|
|
3923
|
+
return getTitle();
|
|
3924
|
+
};
|
|
3925
|
+
bridge.call("clickChat", { id: chat.id, title: getWebTitle() });
|
|
3926
|
+
} else {
|
|
3927
|
+
setActiveChat(chat);
|
|
3928
|
+
}
|
|
3929
|
+
},
|
|
3861
3930
|
children: [
|
|
3862
3931
|
renderItem(chat),
|
|
3863
3932
|
_hasUnreadMessages && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4521,7 +4590,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4521
4590
|
function RoomTitle({ title }) {
|
|
4522
4591
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "medium" }, children: title });
|
|
4523
4592
|
}
|
|
4524
|
-
function ChatRoom({ chat, ...rest }) {
|
|
4593
|
+
function ChatRoom({ chat, inWallet, ...rest }) {
|
|
4525
4594
|
var _a2;
|
|
4526
4595
|
const { t } = context.useLocaleContext();
|
|
4527
4596
|
const theme = styles.useTheme();
|
|
@@ -4593,7 +4662,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4593
4662
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, {}) });
|
|
4594
4663
|
}
|
|
4595
4664
|
return /* @__PURE__ */ jsxRuntime.jsxs(Box, { ...rest, sx: { display: isActive ? "flex" : "none", flexDirection: "column", height: "100%" }, children: [
|
|
4596
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4665
|
+
!inWallet && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4597
4666
|
Box,
|
|
4598
4667
|
{
|
|
4599
4668
|
sx: {
|
|
@@ -4758,7 +4827,138 @@ var __publicField = (obj, key, value) => {
|
|
|
4758
4827
|
}
|
|
4759
4828
|
);
|
|
4760
4829
|
}
|
|
4761
|
-
|
|
4830
|
+
const tablerSearch = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 10a7 7 0 1 0 14 0a7 7 0 1 0-14 0m18 11l-6-6" }) });
|
|
4831
|
+
function UserSearch({ sx, ...rest }) {
|
|
4832
|
+
var _a2;
|
|
4833
|
+
const { session } = useSessionContext();
|
|
4834
|
+
const navigate = reactRouterDom.useNavigate();
|
|
4835
|
+
const { client: client2, isInWallet, chats, setActiveChat, createDM } = useChatContext();
|
|
4836
|
+
const [inputValue, setInputValue] = react.useState("");
|
|
4837
|
+
const [open, setOpen] = react.useState(false);
|
|
4838
|
+
const { data, loading } = ahooks.useRequest(
|
|
4839
|
+
async () => {
|
|
4840
|
+
if (!open) {
|
|
4841
|
+
return Promise.resolve([]);
|
|
4842
|
+
}
|
|
4843
|
+
const results = await client2.searchUsers({ search: inputValue });
|
|
4844
|
+
if (!(results == null ? void 0 : results.length)) {
|
|
4845
|
+
return [];
|
|
4846
|
+
}
|
|
4847
|
+
return results.filter((x) => {
|
|
4848
|
+
var _a3;
|
|
4849
|
+
return x.did !== ((_a3 = session == null ? void 0 : session.user) == null ? void 0 : _a3.did);
|
|
4850
|
+
});
|
|
4851
|
+
},
|
|
4852
|
+
{
|
|
4853
|
+
throttleWait: 500,
|
|
4854
|
+
throttleLeading: false,
|
|
4855
|
+
refreshDeps: [open, inputValue, (_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did]
|
|
4856
|
+
}
|
|
4857
|
+
);
|
|
4858
|
+
const mergedSx = mergeSx({}, sx);
|
|
4859
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: mergedSx, ...rest, children: [
|
|
4860
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4861
|
+
material.Autocomplete,
|
|
4862
|
+
{
|
|
4863
|
+
open,
|
|
4864
|
+
onOpen: () => setOpen(true),
|
|
4865
|
+
onClose: () => {
|
|
4866
|
+
setInputValue("");
|
|
4867
|
+
setOpen(false);
|
|
4868
|
+
},
|
|
4869
|
+
disableClearable: true,
|
|
4870
|
+
filterOptions: (x) => x,
|
|
4871
|
+
options: data || [],
|
|
4872
|
+
getOptionLabel: () => "",
|
|
4873
|
+
renderOption: (props, option) => /* @__PURE__ */ react.createElement(material.Box, { component: "li", ...props, key: option.did, sx: { px: "8px!important" } }, /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center", width: 1 }, children: [
|
|
4874
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mt: 0.25, lineHeight: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Avatar, { did: option.did, src: option.avatar, size: 28, shape: "circle", variant: "circle" }) }),
|
|
4875
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4876
|
+
material.Box,
|
|
4877
|
+
{
|
|
4878
|
+
sx: {
|
|
4879
|
+
flex: 1,
|
|
4880
|
+
display: "flex",
|
|
4881
|
+
flexDirection: "column",
|
|
4882
|
+
overflow: "hidden",
|
|
4883
|
+
ml: 1
|
|
4884
|
+
},
|
|
4885
|
+
children: [
|
|
4886
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4887
|
+
material.Typography,
|
|
4888
|
+
{
|
|
4889
|
+
variant: "body2",
|
|
4890
|
+
sx: {
|
|
4891
|
+
fontSize: 12,
|
|
4892
|
+
fontWeight: "bold",
|
|
4893
|
+
overflow: "hidden",
|
|
4894
|
+
whiteSpace: "nowrap",
|
|
4895
|
+
textOverflow: "ellipsis"
|
|
4896
|
+
},
|
|
4897
|
+
children: option.fullName
|
|
4898
|
+
}
|
|
4899
|
+
),
|
|
4900
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { ".span": { lineHeight: 1 } }, children: /* @__PURE__ */ jsxRuntime.jsx(DID, { did: option.did, copyable: false, compact: true, responsive: false, size: 12 }) })
|
|
4901
|
+
]
|
|
4902
|
+
}
|
|
4903
|
+
)
|
|
4904
|
+
] })),
|
|
4905
|
+
onChange: async (event, newValue, reason) => {
|
|
4906
|
+
var _a3;
|
|
4907
|
+
if (event.type === "keydown" && event.key === "Backspace" && reason === "removeOption") {
|
|
4908
|
+
return;
|
|
4909
|
+
}
|
|
4910
|
+
const chatId = [newValue.did, (_a3 = session == null ? void 0 : session.user) == null ? void 0 : _a3.did].sort().join("-");
|
|
4911
|
+
const chat = chats.find((x) => x.id === chatId);
|
|
4912
|
+
if (isInWallet) {
|
|
4913
|
+
if (chat) {
|
|
4914
|
+
bridge.call("clickChat", { id: chat.id, title: newValue.fullName });
|
|
4915
|
+
} else {
|
|
4916
|
+
const dm = await createDM(newValue.did);
|
|
4917
|
+
bridge.call("clickChat", { id: dm.id, title: newValue.fullName });
|
|
4918
|
+
}
|
|
4919
|
+
} else if (chat) {
|
|
4920
|
+
setActiveChat(chat);
|
|
4921
|
+
} else {
|
|
4922
|
+
navigate(`/chat/dm/${newValue.did}`);
|
|
4923
|
+
}
|
|
4924
|
+
},
|
|
4925
|
+
loading,
|
|
4926
|
+
onInputChange: (_, newInputValue, reason) => {
|
|
4927
|
+
if (reason === "reset") {
|
|
4928
|
+
return;
|
|
4929
|
+
}
|
|
4930
|
+
setInputValue(newInputValue);
|
|
4931
|
+
},
|
|
4932
|
+
renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4933
|
+
material.TextField,
|
|
4934
|
+
{
|
|
4935
|
+
...params,
|
|
4936
|
+
placeholder: "Search user",
|
|
4937
|
+
variant: "outlined",
|
|
4938
|
+
InputProps: {
|
|
4939
|
+
...params.InputProps,
|
|
4940
|
+
type: "search",
|
|
4941
|
+
startAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "start", children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: tablerSearch, sx: { fontSize: 14 } }) })
|
|
4942
|
+
},
|
|
4943
|
+
sx: {
|
|
4944
|
+
fontSize: 12,
|
|
4945
|
+
".MuiInputBase-root": { pr: "8px!important" },
|
|
4946
|
+
".MuiInputBase-input": { py: "0!important" },
|
|
4947
|
+
fieldset: { borderColor: "#eee!important" }
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4950
|
+
),
|
|
4951
|
+
isOptionEqualToValue: (option, value) => option.did === value.did,
|
|
4952
|
+
sx: { ".MuiAutocomplete-endAdornment": { display: "none" } }
|
|
4953
|
+
}
|
|
4954
|
+
),
|
|
4955
|
+
ReactDOM.createPortal(
|
|
4956
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Backdrop, { open, sx: { zIndex: "modal", bgcolor: "transparent" } }),
|
|
4957
|
+
window.document.body
|
|
4958
|
+
)
|
|
4959
|
+
] });
|
|
4960
|
+
}
|
|
4961
|
+
function Empty$2({ sx }) {
|
|
4762
4962
|
const { t } = context.useLocaleContext();
|
|
4763
4963
|
const mergedSx = [
|
|
4764
4964
|
{
|
|
@@ -4778,7 +4978,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4778
4978
|
}
|
|
4779
4979
|
function Chat({ sx, ...rest }) {
|
|
4780
4980
|
var _a2;
|
|
4781
|
-
const { client: client2, initialized, chats, activeChatId, addChat, setActiveChat,
|
|
4981
|
+
const { client: client2, initialized, chats, activeChatId, addChat, setActiveChat, getOppositeUser } = useChatContext();
|
|
4782
4982
|
const [newChannelVisible, setNewChannelVisible] = react.useState(false);
|
|
4783
4983
|
const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
|
|
4784
4984
|
const { t } = context.useLocaleContext();
|
|
@@ -4799,9 +4999,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4799
4999
|
const getTitle = webTitleMap[activeChat.type] || webTitleMap.default;
|
|
4800
5000
|
return getTitle();
|
|
4801
5001
|
};
|
|
4802
|
-
react.useEffect(() => {
|
|
4803
|
-
refresh();
|
|
4804
|
-
}, []);
|
|
4805
5002
|
const show = react.useMemo(() => {
|
|
4806
5003
|
if (downMd) {
|
|
4807
5004
|
return {
|
|
@@ -4844,12 +5041,13 @@ var __publicField = (obj, key, value) => {
|
|
|
4844
5041
|
display: "flex",
|
|
4845
5042
|
justifyContent: "space-between",
|
|
4846
5043
|
alignItems: "center",
|
|
5044
|
+
gap: 1,
|
|
4847
5045
|
height: 52,
|
|
4848
|
-
px:
|
|
5046
|
+
px: 3,
|
|
4849
5047
|
borderBottom: "1px solid #e5e5e5"
|
|
4850
5048
|
},
|
|
4851
5049
|
children: [
|
|
4852
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5050
|
+
/* @__PURE__ */ jsxRuntime.jsx(UserSearch, { sx: { flex: 1 } }),
|
|
4853
5051
|
/* @__PURE__ */ jsxRuntime.jsx(AccessControl, { roles: ["owner", "admin"], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4854
5052
|
IconButton$1,
|
|
4855
5053
|
{
|
|
@@ -4861,16 +5059,16 @@ var __publicField = (obj, key, value) => {
|
|
|
4861
5059
|
]
|
|
4862
5060
|
}
|
|
4863
5061
|
),
|
|
4864
|
-
!!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(ChatList, { sx: { flex: 1, overflowY: "auto" } }),
|
|
4865
|
-
!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(Empty, { sx: { flex: 1 } })
|
|
5062
|
+
!!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(ChatList, { sx: { flex: 1, overflowY: "auto" }, inWallet: false }),
|
|
5063
|
+
!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(Empty$2, { sx: { flex: 1 } })
|
|
4866
5064
|
]
|
|
4867
5065
|
}
|
|
4868
5066
|
),
|
|
4869
5067
|
show.right && /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { flex: 1, overflow: "hidden" }, children: [
|
|
4870
5068
|
chats.map((chat) => {
|
|
4871
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ChatRoom, { chat }, chat.id);
|
|
5069
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ChatRoom, { chat, inWallet: false }, chat.id);
|
|
4872
5070
|
}),
|
|
4873
|
-
!activeChatId && /* @__PURE__ */ jsxRuntime.jsx(Empty, { sx: { height: 1 } })
|
|
5071
|
+
!activeChatId && /* @__PURE__ */ jsxRuntime.jsx(Empty$2, { sx: { height: 1 } })
|
|
4874
5072
|
] }),
|
|
4875
5073
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4876
5074
|
NewChannelDialog,
|
|
@@ -4883,6 +5081,106 @@ var __publicField = (obj, key, value) => {
|
|
|
4883
5081
|
)
|
|
4884
5082
|
] });
|
|
4885
5083
|
}
|
|
5084
|
+
function Empty$1({ sx }) {
|
|
5085
|
+
const { t } = context.useLocaleContext();
|
|
5086
|
+
const mergedSx = [
|
|
5087
|
+
{
|
|
5088
|
+
display: "flex",
|
|
5089
|
+
flexDirection: "column",
|
|
5090
|
+
justifyContent: "center",
|
|
5091
|
+
alignItems: "center",
|
|
5092
|
+
gap: 1,
|
|
5093
|
+
color: "grey.600"
|
|
5094
|
+
},
|
|
5095
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
5096
|
+
];
|
|
5097
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: mergedSx, children: [
|
|
5098
|
+
/* @__PURE__ */ jsxRuntime.jsx(iconoirChatBubbleEmpty, { style: { fontSize: 32 } }),
|
|
5099
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: 500 }, children: t("chat.noChats") })
|
|
5100
|
+
] });
|
|
5101
|
+
}
|
|
5102
|
+
function ChatInWallet({ sx, ...rest }) {
|
|
5103
|
+
var _a2;
|
|
5104
|
+
const { chatId: activeChatId } = reactRouterDom.useParams();
|
|
5105
|
+
const { initialized, chats } = useChatContext();
|
|
5106
|
+
const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
|
|
5107
|
+
const activeChat = (_a2 = chats == null ? void 0 : chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)) == null ? void 0 : _a2[0];
|
|
5108
|
+
const show = react.useMemo(() => {
|
|
5109
|
+
if (downMd) {
|
|
5110
|
+
return {
|
|
5111
|
+
left: !activeChatId,
|
|
5112
|
+
right: !!activeChatId
|
|
5113
|
+
};
|
|
5114
|
+
}
|
|
5115
|
+
return {
|
|
5116
|
+
left: true,
|
|
5117
|
+
right: true
|
|
5118
|
+
};
|
|
5119
|
+
}, [downMd, activeChatId]);
|
|
5120
|
+
if (!initialized) {
|
|
5121
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, {});
|
|
5122
|
+
}
|
|
5123
|
+
const mergedSx = [{ display: "flex", height: "100%", bgcolor: "#fff" }, ...Array.isArray(sx) ? sx : [sx]];
|
|
5124
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, sx: mergedSx, children: show.right && /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { flex: 1, overflow: "hidden" }, children: [
|
|
5125
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChatRoom, { chat: activeChat, inWallet: true }),
|
|
5126
|
+
!activeChatId && /* @__PURE__ */ jsxRuntime.jsx(Empty$1, { sx: { height: 1 } })
|
|
5127
|
+
] }) });
|
|
5128
|
+
}
|
|
5129
|
+
function Empty({ sx }) {
|
|
5130
|
+
const { t } = context.useLocaleContext();
|
|
5131
|
+
const mergedSx = [
|
|
5132
|
+
{
|
|
5133
|
+
display: "flex",
|
|
5134
|
+
flexDirection: "column",
|
|
5135
|
+
justifyContent: "center",
|
|
5136
|
+
alignItems: "center",
|
|
5137
|
+
gap: 1,
|
|
5138
|
+
color: "grey.600"
|
|
5139
|
+
},
|
|
5140
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
5141
|
+
];
|
|
5142
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: mergedSx, children: [
|
|
5143
|
+
/* @__PURE__ */ jsxRuntime.jsx(iconoirChatBubbleEmpty, { style: { fontSize: 32 } }),
|
|
5144
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: 500 }, children: t("chat.noChats") })
|
|
5145
|
+
] });
|
|
5146
|
+
}
|
|
5147
|
+
function ChatListInWallet({ sx, ...rest }) {
|
|
5148
|
+
const { initialized, chats, activeChatId } = useChatContext();
|
|
5149
|
+
const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
|
|
5150
|
+
const show = react.useMemo(() => {
|
|
5151
|
+
if (downMd) {
|
|
5152
|
+
return {
|
|
5153
|
+
left: !activeChatId,
|
|
5154
|
+
right: !!activeChatId
|
|
5155
|
+
};
|
|
5156
|
+
}
|
|
5157
|
+
return {
|
|
5158
|
+
left: true,
|
|
5159
|
+
right: true
|
|
5160
|
+
};
|
|
5161
|
+
}, [downMd, activeChatId]);
|
|
5162
|
+
if (!initialized) {
|
|
5163
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, {});
|
|
5164
|
+
}
|
|
5165
|
+
const mergedSx = [{ display: "flex", height: "100%", bgcolor: "#fff" }, ...Array.isArray(sx) ? sx : [sx]];
|
|
5166
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, sx: mergedSx, children: show.left && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5167
|
+
Box,
|
|
5168
|
+
{
|
|
5169
|
+
sx: {
|
|
5170
|
+
display: "flex",
|
|
5171
|
+
flexDirection: "column",
|
|
5172
|
+
width: { sm: 320, xs: "100%" },
|
|
5173
|
+
borderRight: { sm: "1px solid #e5e5e5" }
|
|
5174
|
+
},
|
|
5175
|
+
children: [
|
|
5176
|
+
/* @__PURE__ */ jsxRuntime.jsx(UserSearch, { sx: { flex: "0 0 auto", py: 1, px: 3 } }),
|
|
5177
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Divider, {}),
|
|
5178
|
+
!!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(ChatList, { sx: { flex: 1, overflowY: "auto" }, inWallet: true }),
|
|
5179
|
+
!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(Empty, { sx: { flex: 1 } })
|
|
5180
|
+
]
|
|
5181
|
+
}
|
|
5182
|
+
) });
|
|
5183
|
+
}
|
|
4886
5184
|
const iconoirMessageText = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: 1.5, children: [
|
|
4887
5185
|
/* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 12h10M7 8h6" }),
|
|
4888
5186
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 20.29V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H7.961a2 2 0 0 0-1.561.75l-2.331 2.914A.6.6 0 0 1 3 20.29Z" })
|
|
@@ -11117,7 +11415,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11117
11415
|
return (_a3 = handlers[event]) == null ? void 0 : _a3.call(handlers, data);
|
|
11118
11416
|
}, []);
|
|
11119
11417
|
return /* @__PURE__ */ jsxRuntime.jsxs(PointUpContext.Provider, { value, children: [
|
|
11120
|
-
(pointUpComponent == null ? void 0 : pointUpComponent.mountPoint) &&
|
|
11418
|
+
(pointUpComponent == null ? void 0 : pointUpComponent.mountPoint) && ReactDOM.createPortal(
|
|
11121
11419
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11122
11420
|
Box,
|
|
11123
11421
|
{
|
|
@@ -11423,6 +11721,8 @@ var __publicField = (obj, key, value) => {
|
|
|
11423
11721
|
exports2.Chat = Chat;
|
|
11424
11722
|
exports2.ChatClient = ChatClient;
|
|
11425
11723
|
exports2.ChatHeaderAddon = ChatHeaderAddon;
|
|
11724
|
+
exports2.ChatInWallet = ChatInWallet;
|
|
11725
|
+
exports2.ChatListInWallet = ChatListInWallet;
|
|
11426
11726
|
exports2.ChatProvider = ChatProvider;
|
|
11427
11727
|
exports2.Comment = Comment;
|
|
11428
11728
|
exports2.CommentInput = CommentInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.224",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@arcblock/bridge": "^2.9.65",
|
|
31
32
|
"@arcblock/ws": "^1.18.115",
|
|
32
|
-
"@blocklet/editor": "1.6.
|
|
33
|
-
"@blocklet/labels": "1.6.
|
|
33
|
+
"@blocklet/editor": "1.6.224",
|
|
34
|
+
"@blocklet/labels": "1.6.224",
|
|
34
35
|
"@blocklet/uploader": "^0.0.78",
|
|
35
36
|
"@emotion/css": "^11.10.5",
|
|
36
37
|
"@emotion/react": "^11.10.5",
|
|
@@ -52,8 +53,8 @@
|
|
|
52
53
|
"url-join": "^4.0.1"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
|
-
"@arcblock/did-connect": "^2.9.
|
|
56
|
-
"@arcblock/ux": "^2.9.
|
|
56
|
+
"@arcblock/did-connect": "^2.9.70",
|
|
57
|
+
"@arcblock/ux": "^2.9.70",
|
|
57
58
|
"@mui/icons-material": "^5.10.9",
|
|
58
59
|
"@mui/lab": "^5.0.0-alpha.109",
|
|
59
60
|
"@mui/material": "^5.10.13",
|
|
@@ -94,5 +95,5 @@
|
|
|
94
95
|
"resolutions": {
|
|
95
96
|
"react": "^18.2.0"
|
|
96
97
|
},
|
|
97
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "16547e2b9301b69d2210d80c2ffbba21f4235543"
|
|
98
99
|
}
|