@blocklet/discuss-kit-ux 1.6.185 → 1.6.187

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/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("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/ux/lib/Theme"), 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("@arcblock/did-connect/lib/Address"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@mui/icons-material/Groups2Rounded"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("url-join"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), 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/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", "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/ux/lib/Theme", "@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", "@arcblock/did-connect/lib/Address", "@mui/icons-material/NotificationsActiveOutlined", "@mui/icons-material/Groups2Rounded", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "url-join", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "react-dom", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@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.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.Theme, 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$1, global.Session, global.material, global.DIDAddress, global.NotificationsActiveOutlinedIcon, global.Groups2RoundedIcon, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.joinUrl, global.orderBy, global.Typography, global.Skeleton, global.reactDom, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, 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, react, Box, isNil, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, Theme, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$1, Session, material, DIDAddress, NotificationsActiveOutlinedIcon, Groups2RoundedIcon, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, joinUrl, orderBy, Typography, Skeleton, reactDom, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, Fab, debounce, TextField, AddIcon, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), 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/ux/lib/Theme"), 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", "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/ux/lib/Theme", "@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.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.Theme, 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$1, 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.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, react, Box, isNil, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, Theme, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$1, Session, material, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, reactDom, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, 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) => {
@@ -924,8 +924,13 @@ var __publicField = (obj, key, value) => {
924
924
  return r(values2);
925
925
  };
926
926
  function ProfileCard({ user, click, ...rest }) {
927
- var _a2, _b2;
927
+ var _a2, _b2, _c;
928
928
  const { session } = useSessionContext();
929
+ const { t } = context.useLocaleContext();
930
+ let chatUrl = (user == null ? void 0 : user.did) && `/chat/dm/${user == null ? void 0 : user.did}`;
931
+ if (chatUrl && ((_a2 = window.location.pathname) == null ? void 0 : _a2.includes(user == null ? void 0 : user.did))) {
932
+ chatUrl = "";
933
+ }
929
934
  return /* @__PURE__ */ jsxRuntime.jsxs(
930
935
  Box,
931
936
  {
@@ -987,18 +992,18 @@ var __publicField = (obj, key, value) => {
987
992
  )
988
993
  ] })
989
994
  ] }),
990
- ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did) && ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) !== user.did && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
995
+ chatUrl && ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) && ((_c = session == null ? void 0 : session.user) == null ? void 0 : _c.did) !== user.did && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
991
996
  /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { my: 2, borderTop: "1px solid #eee" } }),
992
997
  /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
993
998
  Button,
994
999
  {
995
1000
  component: reactRouterDom.Link,
996
- to: `/chat/dm/${user.did}`,
1001
+ to: chatUrl,
997
1002
  variant: "outlined",
998
1003
  color: "inherit",
999
1004
  startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ChatBubbleOutlineOutlined, { style: { fontSize: 16 } }),
1000
1005
  sx: { fontSize: 12 },
1001
- children: "Message"
1006
+ children: t("messages")
1002
1007
  }
1003
1008
  ) })
1004
1009
  ] })
@@ -1023,6 +1028,7 @@ var __publicField = (obj, key, value) => {
1023
1028
  showDID = true,
1024
1029
  newTitle = void 0,
1025
1030
  profileUse = false,
1031
+ children,
1026
1032
  ...rest
1027
1033
  }) {
1028
1034
  const theme = styles.useTheme();
@@ -1031,7 +1037,7 @@ var __publicField = (obj, key, value) => {
1031
1037
  const [open, setOpen] = react.useState(false);
1032
1038
  const sm = size === "sm";
1033
1039
  let fontSize = sm ? 12 : 14;
1034
- let avatarSize = profileUse ? 24 : sm ? 32 : 40;
1040
+ let avatarSize = profileUse ? 24 : sm ? 40 : 48;
1035
1041
  if (responsive && downMd) {
1036
1042
  fontSize = 12;
1037
1043
  avatarSize = 24;
@@ -1046,7 +1052,10 @@ var __publicField = (obj, key, value) => {
1046
1052
  createdAt = typeof createdAt === "string" ? new Date(createdAt) : createdAt;
1047
1053
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { component: RelativeTime, sx: { color: "text.secondary" }, value: createdAt });
1048
1054
  };
1049
- const click = () => {
1055
+ const click = (e) => {
1056
+ var _a2, _b2;
1057
+ (_a2 = e == null ? void 0 : e.stopPropagation) == null ? void 0 : _a2.call(e);
1058
+ (_b2 = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b2.call(e);
1050
1059
  setOpen(false);
1051
1060
  setTimeout(() => {
1052
1061
  navigate(`/profile/${user == null ? void 0 : user.did}`);
@@ -1061,7 +1070,7 @@ var __publicField = (obj, key, value) => {
1061
1070
  onClose: () => setOpen(false),
1062
1071
  onOpen: () => setOpen(true),
1063
1072
  title: /* @__PURE__ */ jsxRuntime.jsx(ProfileCard, { user, click }),
1064
- children: /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", cursor: "pointer" }, onClick: click, children: /* @__PURE__ */ jsxRuntime.jsx(
1073
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", cursor: "pointer", width: avatarSize, height: avatarSize }, onClick: click, children: /* @__PURE__ */ jsxRuntime.jsx(
1065
1074
  Avatar,
1066
1075
  {
1067
1076
  did: user == null ? void 0 : user.did,
@@ -1070,14 +1079,15 @@ var __publicField = (obj, key, value) => {
1070
1079
  shape: "circle",
1071
1080
  variant: "circle",
1072
1081
  sx: {
1073
- width: avatarSize
1082
+ width: "100%",
1083
+ height: "100%"
1074
1084
  }
1075
1085
  }
1076
1086
  ) })
1077
1087
  }
1078
1088
  );
1079
1089
  }
1080
- return /* @__PURE__ */ jsxRuntime.jsx(
1090
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", cursor: "pointer", width: avatarSize, height: avatarSize }, onClick: click, children: /* @__PURE__ */ jsxRuntime.jsx(
1081
1091
  Avatar,
1082
1092
  {
1083
1093
  did: user == null ? void 0 : user.did,
@@ -1086,10 +1096,11 @@ var __publicField = (obj, key, value) => {
1086
1096
  shape: "circle",
1087
1097
  variant: "circle",
1088
1098
  sx: {
1089
- width: avatarSize
1099
+ width: "100%",
1100
+ height: "100%"
1090
1101
  }
1091
1102
  }
1092
- );
1103
+ ) });
1093
1104
  };
1094
1105
  const BadgeRender = /* @__PURE__ */ jsxRuntime.jsx(
1095
1106
  Badge,
@@ -1120,7 +1131,8 @@ var __publicField = (obj, key, value) => {
1120
1131
  }
1121
1132
  ),
1122
1133
  showBadge && downMd && /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 0.5, children: BadgeRender }),
1123
- showDID && !(responsive && downMd) && /* @__PURE__ */ jsxRuntime.jsx(DID, { style: { lineHeight: 1.4, minHeight: 20, maxWidth: 250 }, size: 14, did: user == null ? void 0 : user.did })
1134
+ showDID && !(responsive && downMd) && /* @__PURE__ */ jsxRuntime.jsx(DID, { style: { lineHeight: 1.5, minHeight: 20, maxWidth: 250 }, size: 14, did: user == null ? void 0 : user.did }),
1135
+ children && /* @__PURE__ */ jsxRuntime.jsx(Box, { children })
1124
1136
  ] })
1125
1137
  ] });
1126
1138
  }
@@ -1133,7 +1145,7 @@ var __publicField = (obj, key, value) => {
1133
1145
  ...rest
1134
1146
  }) {
1135
1147
  const sm = size === "sm";
1136
- const iconSize = sm ? 36 : 40;
1148
+ const iconSize = sm ? 40 : 48;
1137
1149
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize: 14 }, ...rest, children: [
1138
1150
  showIcon && /* @__PURE__ */ jsxRuntime.jsx(
1139
1151
  Box,
@@ -1144,6 +1156,7 @@ var __publicField = (obj, key, value) => {
1144
1156
  alignItems: "center",
1145
1157
  width: iconSize,
1146
1158
  height: iconSize,
1159
+ p: 1,
1147
1160
  color: "#fff",
1148
1161
  bgcolor: "secondary.main",
1149
1162
  borderRadius: "100%"
@@ -1152,49 +1165,14 @@ var __publicField = (obj, key, value) => {
1152
1165
  }
1153
1166
  ),
1154
1167
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "column" }, children: [
1155
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontWeight: "bold" }, children: name }) }),
1156
- showDidAddress && /* @__PURE__ */ jsxRuntime.jsx(DIDAddress, { inline: true, responsive: false, compact: true, copyable: false, style: { marginTop: 4, lineHeight: 1 }, children: window.blocklet.appId })
1157
- ] })
1158
- ] });
1159
- }
1160
- function ChannelGroup({ size = "normal", chat, ...rest }) {
1161
- var _a2;
1162
- const sm = size === "sm";
1163
- const iconSize = sm ? 36 : 40;
1164
- const lastMessage = chat && chat.messages && chat.messages[chat.messages.length - 1];
1165
- const messageText = lastMessage ? `${(_a2 = lastMessage == null ? void 0 : lastMessage.sender) == null ? void 0 : _a2.fullName}: ${getExcerptFromLexicalContent(lastMessage == null ? void 0 : lastMessage.content)}` : "";
1166
- return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize: 14 }, ...rest, children: [
1167
- /* @__PURE__ */ jsxRuntime.jsx(
1168
- Box,
1169
- {
1170
- sx: {
1171
- display: "flex",
1172
- justifyContent: "center",
1173
- alignItems: "center",
1174
- width: iconSize,
1175
- height: iconSize,
1176
- color: "#fff",
1177
- bgcolor: colors.amber[200],
1178
- borderRadius: "100%"
1179
- },
1180
- children: /* @__PURE__ */ jsxRuntime.jsx(Groups2RoundedIcon, { sx: { fontSize: size === "sm" ? 16 : 18, color: colors.amber[700] } })
1181
- }
1182
- ),
1183
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "column", height: "100%", justifyContent: "space-between" }, children: [
1184
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontWeight: "bold" }, children: chat == null ? void 0 : chat.name }) }),
1185
- /* @__PURE__ */ jsxRuntime.jsx(
1186
- Box,
1168
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1.5, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontWeight: "bold" }, children: name }) }),
1169
+ showDidAddress && /* @__PURE__ */ jsxRuntime.jsx(
1170
+ DID,
1187
1171
  {
1188
- className: "message-content-text",
1189
- sx: {
1190
- overflow: "hidden",
1191
- textOverflow: "ellipsis",
1192
- whiteSpace: "nowrap",
1193
- width: 220,
1194
- fontWeight: "regular",
1195
- fontSize: 14
1196
- },
1197
- children: messageText
1172
+ style: { lineHeight: 1.5, minHeight: 20, maxWidth: 200 },
1173
+ size: 14,
1174
+ did: window.blocklet.appId,
1175
+ copyable: false
1198
1176
  }
1199
1177
  )
1200
1178
  ] })
@@ -1337,7 +1315,16 @@ var __publicField = (obj, key, value) => {
1337
1315
  return null;
1338
1316
  }
1339
1317
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { display: "inline-block", ...rest, onClick: handleOnClick, children: [
1340
- /* @__PURE__ */ jsxRuntime.jsx(IconButton$1, { size: "medium", className: "menu-icon", onClick: handleClick, children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.MoreVert, { sx: { fontSize: 18 } }) }),
1318
+ /* @__PURE__ */ jsxRuntime.jsx(
1319
+ IconButton$1,
1320
+ {
1321
+ size: "medium",
1322
+ className: "menu-icon",
1323
+ onClick: handleClick,
1324
+ sx: { p: 1, borderRadius: 1, border: 1, borderColor: "grey.200", height: 32, width: 32 },
1325
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.MoreVert, { sx: { fontSize: 18 } })
1326
+ }
1327
+ ),
1341
1328
  /* @__PURE__ */ jsxRuntime.jsx(
1342
1329
  StyledMuiMenu,
1343
1330
  {
@@ -3448,7 +3435,7 @@ var __publicField = (obj, key, value) => {
3448
3435
  const addParticipant = (chatId, participant) => {
3449
3436
  updateChat(chatId, (chat) => ({
3450
3437
  ...chat,
3451
- participants: [...chat.participants, participant]
3438
+ participants: uniqBy([...chat.participants, participant], "did")
3452
3439
  }));
3453
3440
  };
3454
3441
  const removeParticipant = (chatId, participant) => {
@@ -3493,6 +3480,23 @@ var __publicField = (obj, key, value) => {
3493
3480
  addMessage(chatId, saved);
3494
3481
  updateLastAckTime(chatId);
3495
3482
  };
3483
+ const getLastMessageText = (chat) => {
3484
+ const lastMessage = chat && chat.messages && chat.messages[chat.messages.length - 1];
3485
+ const getPrefix = (sender) => {
3486
+ const isMyselfMessage = sender.did === (currentUser == null ? void 0 : currentUser.did);
3487
+ if (isMyselfMessage || !(sender == null ? void 0 : sender.fullName)) {
3488
+ return "";
3489
+ }
3490
+ return `${sender.fullName}: `;
3491
+ };
3492
+ if (lastMessage) {
3493
+ return `${getPrefix(lastMessage == null ? void 0 : lastMessage.sender)}${getExcerptFromLexicalContent(lastMessage == null ? void 0 : lastMessage.content)}`;
3494
+ }
3495
+ if (chat.lastMessage) {
3496
+ return `${getPrefix(chat.lastMessage.sender)}${chat.lastMessage.excerpt}`;
3497
+ }
3498
+ return "";
3499
+ };
3496
3500
  const initChatRoom = async (chatId) => {
3497
3501
  const {
3498
3502
  chat: { participants },
@@ -3619,24 +3623,70 @@ var __publicField = (obj, key, value) => {
3619
3623
  deleteMessage,
3620
3624
  hasUnreadMessages,
3621
3625
  refresh,
3622
- orderedChats
3626
+ orderedChats,
3627
+ getLastMessageText
3623
3628
  };
3624
3629
  }, [state, client2, currentUser == null ? void 0 : currentUser.did]);
3625
3630
  return /* @__PURE__ */ jsxRuntime.jsx(ChatContext.Provider, { value, children });
3626
3631
  }
3632
+ const tablerUsersGroup = (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: "M10 13a2 2 0 1 0 4 0a2 2 0 0 0-4 0m-2 8v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1M15 5a2 2 0 1 0 4 0a2 2 0 0 0-4 0m2 5h2a2 2 0 0 1 2 2v1M5 5a2 2 0 1 0 4 0a2 2 0 0 0-4 0m-2 8v-1a2 2 0 0 1 2-2h2" }) });
3633
+ function ChannelGroup({ size = "normal", chat, children, ...rest }) {
3634
+ const sm = size === "sm";
3635
+ const iconSize = sm ? 40 : 48;
3636
+ return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize: 14 }, ...rest, children: [
3637
+ /* @__PURE__ */ jsxRuntime.jsx(
3638
+ Box,
3639
+ {
3640
+ sx: {
3641
+ display: "flex",
3642
+ justifyContent: "center",
3643
+ alignItems: "center",
3644
+ color: "#fff",
3645
+ bgcolor: "rgba(254, 244, 199, 1)",
3646
+ width: iconSize,
3647
+ height: iconSize,
3648
+ p: 0.8,
3649
+ borderRadius: "100%"
3650
+ },
3651
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerUsersGroup, sx: { fontSize: 16, color: colors.amber[700], width: iconSize } })
3652
+ }
3653
+ ),
3654
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "column", height: "100%", justifyContent: "space-between" }, children: [
3655
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1.5, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontWeight: "bold" }, children: chat == null ? void 0 : chat.name }) }),
3656
+ children && /* @__PURE__ */ jsxRuntime.jsx(Box, { children })
3657
+ ] })
3658
+ ] });
3659
+ }
3627
3660
  function ChatList(props) {
3628
3661
  const { t } = context.useLocaleContext();
3629
- const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages } = useChatContext();
3662
+ const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages, getLastMessageText } = useChatContext();
3630
3663
  const renderItem = (chat) => {
3631
3664
  if (chat.type === "notification") {
3632
3665
  return /* @__PURE__ */ jsxRuntime.jsx(SystemUser, { name: t("chat.notification") });
3633
3666
  }
3667
+ const latestMessageText = getLastMessageText(chat);
3668
+ const latestMessageTextContent = latestMessageText && /* @__PURE__ */ jsxRuntime.jsx(
3669
+ Box,
3670
+ {
3671
+ className: "message-content-text",
3672
+ sx: {
3673
+ overflow: "hidden",
3674
+ textOverflow: "ellipsis",
3675
+ whiteSpace: "nowrap",
3676
+ width: 220,
3677
+ fontWeight: "regular",
3678
+ fontSize: 14,
3679
+ lineHeight: 1.5
3680
+ },
3681
+ children: latestMessageText
3682
+ }
3683
+ );
3634
3684
  if (chat.type === "dm") {
3635
3685
  const oppositeUser = getOppositeUser(chat);
3636
- return /* @__PURE__ */ jsxRuntime.jsx(AuthorInfo, { user: oppositeUser, showProfileCard: false, showBadge: false, showDID: false });
3686
+ return /* @__PURE__ */ jsxRuntime.jsx(AuthorInfo, { user: oppositeUser, showProfileCard: false, showBadge: false, showDID: false, children: latestMessageTextContent });
3637
3687
  }
3638
3688
  if (chat.type === "channel") {
3639
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", children: /* @__PURE__ */ jsxRuntime.jsx(ChannelGroup, { chat }) });
3689
+ return /* @__PURE__ */ jsxRuntime.jsx(ChannelGroup, { chat, children: latestMessageTextContent });
3640
3690
  }
3641
3691
  return null;
3642
3692
  };
@@ -3657,8 +3707,8 @@ var __publicField = (obj, key, value) => {
3657
3707
  borderRadius: 1,
3658
3708
  cursor: "pointer",
3659
3709
  ...isActiveChat && {
3660
- ".did-address-text": { color: "grey.500" },
3661
- ".message-content-text": { color: "grey.500" }
3710
+ ".did-address-text": { color: `${grey[500]} !important` },
3711
+ ".message-content-text": { color: `${grey[500]}` }
3662
3712
  }
3663
3713
  },
3664
3714
  onClick: () => setActiveChat(chat),
@@ -3684,8 +3734,25 @@ var __publicField = (obj, key, value) => {
3684
3734
  ) }, chat.id);
3685
3735
  }) }) });
3686
3736
  }
3687
- function Message({ message, showTime = true, ...rest }) {
3688
- var _a2;
3737
+ const tablerUsersPlus = (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: "M5 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M3 21v-2a4 4 0 0 1 4-4h4c.96 0 1.84.338 2.53.901M16 3.13a4 4 0 0 1 0 7.75M16 19h6m-3-3v6" }) });
3738
+ const Time = ({ createdAt }) => {
3739
+ if (!createdAt) {
3740
+ return null;
3741
+ }
3742
+ const messageTime = typeof createdAt === "string" ? new Date(createdAt) : createdAt;
3743
+ const now = /* @__PURE__ */ new Date();
3744
+ const diffInMilliseconds = now.getTime() - messageTime.getTime();
3745
+ const diffInDays = diffInMilliseconds / (1e3 * 60 * 60 * 24);
3746
+ const isWithinSevenDays = diffInDays <= 3;
3747
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "inline-block", fontSize: 12, color: "grey.500", ml: 3 }, children: isWithinSevenDays ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { value: createdAt }) : dayjs(messageTime).format("YYYY-MM-DD HH:mm") }) });
3748
+ };
3749
+ const baseItemSx = {
3750
+ px: 1.25,
3751
+ py: 1,
3752
+ transition: "all 120ms linear"
3753
+ };
3754
+ function Message({ message, prevMessage, showTime = true, ...rest }) {
3755
+ var _a2, _b2;
3689
3756
  const { t } = context.useLocaleContext();
3690
3757
  const { session, isAdmin } = useSessionContext();
3691
3758
  const { confirm } = useConfirm();
@@ -3704,34 +3771,74 @@ var __publicField = (obj, key, value) => {
3704
3771
  };
3705
3772
  const menuItems = [];
3706
3773
  const isSender = message.sender.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
3774
+ const messageDate = new Date(message.createdAt);
3775
+ const prevMessageDate = prevMessage ? new Date(prevMessage.createdAt) : /* @__PURE__ */ new Date(0);
3776
+ const messageInterval = messageDate.getTime() - prevMessageDate.getTime();
3777
+ const isSameUser = message.sender.did === ((_b2 = prevMessage == null ? void 0 : prevMessage.sender) == null ? void 0 : _b2.did);
3707
3778
  if (isSender || isAdmin) {
3708
3779
  menuItems.push(
3709
3780
  /* @__PURE__ */ jsxRuntime.jsx(MuiMenuItem, { onClick: handleDeleteMessage, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { color: "error.main" }, children: t("delete") }) }, "delete")
3710
3781
  );
3711
3782
  }
3783
+ const compactMessage = messageInterval <= 6e4 && isSameUser;
3712
3784
  return /* @__PURE__ */ jsxRuntime.jsxs(
3713
3785
  Box,
3714
3786
  {
3715
3787
  ...rest,
3716
3788
  sx: {
3789
+ ...baseItemSx,
3717
3790
  position: "relative",
3718
- px: 2,
3719
- py: 1,
3720
3791
  fontSize: 14,
3721
- "&:hover": { bgcolor: "grey.50" }
3792
+ borderRadius: 1,
3793
+ "&:hover": {
3794
+ bgcolor: "white",
3795
+ ".message-menu": {
3796
+ display: "flex !important"
3797
+ }
3798
+ },
3799
+ ...{
3800
+ ".be-editable": {
3801
+ "& > *:last-child": {
3802
+ marginBottom: "0em !important"
3803
+ }
3804
+ }
3805
+ }
3722
3806
  },
3723
3807
  children: [
3724
- /* @__PURE__ */ jsxRuntime.jsx(Menu, { items: menuItems, style: { position: "absolute", right: 0, top: 0 } }),
3725
- /* @__PURE__ */ jsxRuntime.jsx(AuthorInfo, { user: message.sender, createdAt: showTime ? message.createdAt : void 0 }),
3726
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { ml: 5.5 }, children: /* @__PURE__ */ jsxRuntime.jsx(PostContent, { content: message.content }) })
3808
+ /* @__PURE__ */ jsxRuntime.jsx(
3809
+ Menu,
3810
+ {
3811
+ items: menuItems,
3812
+ className: "message-menu",
3813
+ style: {
3814
+ position: "absolute",
3815
+ right: 12,
3816
+ top: 0,
3817
+ bottom: 0,
3818
+ alignItems: "center",
3819
+ display: "none"
3820
+ }
3821
+ }
3822
+ ),
3823
+ !compactMessage && /* @__PURE__ */ jsxRuntime.jsx(
3824
+ AuthorInfo,
3825
+ {
3826
+ showBadge: false,
3827
+ showProfileCard: true,
3828
+ user: message.sender,
3829
+ createdAt: showTime ? message.createdAt : void 0,
3830
+ size: "sm"
3831
+ }
3832
+ ),
3833
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { ml: 6, width: "90%" }, children: /* @__PURE__ */ jsxRuntime.jsx(PostContent, { content: message.content }) })
3727
3834
  ]
3728
3835
  }
3729
3836
  );
3730
3837
  }
3731
- function NotificationMessage({ chat, message, prevMessage, ...rest }) {
3838
+ function NotificationMessage({ chat, message, prevMessage }) {
3732
3839
  const { session } = useSessionContext();
3733
3840
  const { t } = context.useLocaleContext();
3734
- const renderQuote = ({ title, excerpt, cover }) => {
3841
+ const renderQuote = ({ title, cover }) => {
3735
3842
  if ("post" in message) {
3736
3843
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { color: 14, mt: 1 }, children: [
3737
3844
  title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -3770,25 +3877,44 @@ var __publicField = (obj, key, value) => {
3770
3877
  };
3771
3878
  const render = () => {
3772
3879
  var _a2, _b2, _c, _d, _e, _f, _g;
3880
+ const baseCardSx = {
3881
+ py: 1.5,
3882
+ px: 2,
3883
+ background: "#fff",
3884
+ width: "fit-content",
3885
+ maxWidth: "calc(100% - 16px)",
3886
+ wordWrap: "break-word",
3887
+ borderRadius: 1,
3888
+ transition: "all 120ms linear"
3889
+ };
3773
3890
  if (message.type === "post_create") {
3774
3891
  return /* @__PURE__ */ jsxRuntime.jsxs(
3775
3892
  Box,
3776
3893
  {
3777
3894
  sx: {
3778
- py: 1.5,
3779
- px: 2,
3780
- background: "#fff",
3781
- width: "fit-content",
3782
- maxWidth: "calc(100% - 16px)",
3783
- wordWrap: "break-word",
3784
- borderRadius: 1
3895
+ ...baseCardSx
3785
3896
  },
3786
3897
  children: [
3787
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "row", alignItems: "center", color: "primary.light" }, children: [
3788
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:news", style: { height: 15, width: 15, marginRight: 4 } }),
3789
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3790
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.newPost") })
3791
- ] }),
3898
+ /* @__PURE__ */ jsxRuntime.jsxs(
3899
+ Box,
3900
+ {
3901
+ sx: {
3902
+ display: "flex",
3903
+ flexDirection: "row",
3904
+ justifyContent: "space-between",
3905
+ alignItems: "center",
3906
+ color: "primary.light"
3907
+ },
3908
+ children: [
3909
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
3910
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:news", style: { height: 15, width: 15, marginRight: 4 } }),
3911
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3912
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.newPost") })
3913
+ ] }),
3914
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
3915
+ ]
3916
+ }
3917
+ ),
3792
3918
  renderQuote(message.post)
3793
3919
  ]
3794
3920
  }
@@ -3799,20 +3925,29 @@ var __publicField = (obj, key, value) => {
3799
3925
  Box,
3800
3926
  {
3801
3927
  sx: {
3802
- py: 1.5,
3803
- px: 2,
3804
- background: "#fff",
3805
- width: "fit-content",
3806
- maxWidth: "calc(100% - 16px)",
3807
- wordWrap: "break-word",
3808
- borderRadius: 1
3928
+ ...baseCardSx
3809
3929
  },
3810
3930
  children: [
3811
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "row", alignItems: "center", color: "primary.light" }, children: [
3812
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
3813
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3814
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: ((_a2 = message == null ? void 0 : message.sourceUser) == null ? void 0 : _a2.did) === ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) ? t("chat.commentedYourPost") : t("chat.commentedPost") })
3815
- ] }),
3931
+ /* @__PURE__ */ jsxRuntime.jsxs(
3932
+ Box,
3933
+ {
3934
+ sx: {
3935
+ display: "flex",
3936
+ flexDirection: "row",
3937
+ justifyContent: "space-between",
3938
+ alignItems: "center",
3939
+ color: "primary.light"
3940
+ },
3941
+ children: [
3942
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
3943
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
3944
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3945
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: ((_a2 = message == null ? void 0 : message.sourceUser) == null ? void 0 : _a2.did) === ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) ? t("chat.commentedYourPost") : t("chat.commentedPost") })
3946
+ ] }),
3947
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
3948
+ ]
3949
+ }
3950
+ ),
3816
3951
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: (_c = message == null ? void 0 : message.comment) == null ? void 0 : _c.excerpt }),
3817
3952
  renderQuote(message.post)
3818
3953
  ]
@@ -3824,21 +3959,30 @@ var __publicField = (obj, key, value) => {
3824
3959
  Box,
3825
3960
  {
3826
3961
  sx: {
3827
- py: 1.5,
3828
- px: 2,
3829
- background: "#fff",
3830
- width: "fit-content",
3831
- maxWidth: "calc(100% - 16px)",
3832
- wordWrap: "break-word",
3833
- borderRadius: 1
3962
+ ...baseCardSx
3834
3963
  },
3835
3964
  children: [
3836
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "row", alignItems: "center", color: "primary.light" }, children: [
3837
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
3838
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3839
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: (message == null ? void 0 : message.recipient) === ((_d = session == null ? void 0 : session.user) == null ? void 0 : _d.did) ? t("chat.replyYourComment") : t("chat.replyComment") })
3840
- ] }),
3841
- /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body1", children: message.reply.excerpt }),
3965
+ /* @__PURE__ */ jsxRuntime.jsxs(
3966
+ Box,
3967
+ {
3968
+ sx: {
3969
+ display: "flex",
3970
+ flexDirection: "row",
3971
+ justifyContent: "space-between",
3972
+ alignItems: "center",
3973
+ color: "primary.light"
3974
+ },
3975
+ children: [
3976
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
3977
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
3978
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3979
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: (message == null ? void 0 : message.recipient) === ((_d = session == null ? void 0 : session.user) == null ? void 0 : _d.did) ? t("chat.replyYourComment") : t("chat.replyComment") })
3980
+ ] }),
3981
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
3982
+ ]
3983
+ }
3984
+ ),
3985
+ /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: message.reply.excerpt }),
3842
3986
  renderQuote({ title: message.post.title, excerpt: message.comment.excerpt })
3843
3987
  ]
3844
3988
  }
@@ -3849,23 +3993,32 @@ var __publicField = (obj, key, value) => {
3849
3993
  Box,
3850
3994
  {
3851
3995
  sx: {
3852
- py: 1.5,
3853
- px: 2,
3854
- background: "#fff",
3855
- width: "fit-content",
3856
- maxWidth: "calc(100% - 16px)",
3857
- wordWrap: "break-word",
3858
- borderRadius: 1
3996
+ ...baseCardSx
3859
3997
  },
3860
3998
  children: [
3861
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "row", alignItems: "center", color: "primary.light" }, children: [
3862
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
3863
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3864
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
3865
- " ",
3866
- t("chat.mentionInComment")
3867
- ] })
3868
- ] }),
3999
+ /* @__PURE__ */ jsxRuntime.jsxs(
4000
+ Box,
4001
+ {
4002
+ sx: {
4003
+ display: "flex",
4004
+ flexDirection: "row",
4005
+ justifyContent: "space-between",
4006
+ alignItems: "center",
4007
+ color: "primary.light"
4008
+ },
4009
+ children: [
4010
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4011
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
4012
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4013
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4014
+ " ",
4015
+ t("chat.mentionInComment")
4016
+ ] })
4017
+ ] }),
4018
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
4019
+ ]
4020
+ }
4021
+ ),
3869
4022
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: (_g = (_e = message == null ? void 0 : message.comment) == null ? void 0 : _e.excerpt) == null ? void 0 : _g.replace((_f = session == null ? void 0 : session.user) == null ? void 0 : _f.fullName, "") }),
3870
4023
  renderQuote(message.post)
3871
4024
  ]
@@ -3877,20 +4030,29 @@ var __publicField = (obj, key, value) => {
3877
4030
  Box,
3878
4031
  {
3879
4032
  sx: {
3880
- py: 1.5,
3881
- px: 2,
3882
- borderRadius: 1,
3883
- background: "#fff",
3884
- width: "fit-content",
3885
- maxWidth: "calc(100% - 16px)",
3886
- wordWrap: "break-word"
4033
+ ...baseCardSx
3887
4034
  },
3888
4035
  children: [
3889
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "row", alignItems: "center", color: "primary.light" }, children: [
3890
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
3891
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3892
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.mentionInPost") })
3893
- ] }),
4036
+ /* @__PURE__ */ jsxRuntime.jsxs(
4037
+ Box,
4038
+ {
4039
+ sx: {
4040
+ display: "flex",
4041
+ flexDirection: "row",
4042
+ justifyContent: "space-between",
4043
+ alignItems: "center",
4044
+ color: "primary.light"
4045
+ },
4046
+ children: [
4047
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4048
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
4049
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4050
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.mentionInPost") })
4051
+ ] }),
4052
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
4053
+ ]
4054
+ }
4055
+ ),
3894
4056
  renderQuote(message.post)
3895
4057
  ]
3896
4058
  }
@@ -3918,20 +4080,29 @@ var __publicField = (obj, key, value) => {
3918
4080
  Box,
3919
4081
  {
3920
4082
  sx: {
3921
- py: 1.5,
3922
- px: 2,
3923
- borderRadius: 1,
3924
- background: "#fff",
3925
- width: "fit-content",
3926
- maxWidth: "calc(100% - 16px)",
3927
- wordWrap: "break-word"
4083
+ ...baseCardSx
3928
4084
  },
3929
4085
  children: [
3930
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "row", alignItems: "center", color: "primary.light" }, children: [
3931
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:arrow-forward-up", style: { height: 15, width: 15, marginRight: 4 } }),
3932
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3933
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: titles[message.subtype] })
3934
- ] }),
4086
+ /* @__PURE__ */ jsxRuntime.jsxs(
4087
+ Box,
4088
+ {
4089
+ sx: {
4090
+ display: "flex",
4091
+ flexDirection: "row",
4092
+ justifyContent: "space-between",
4093
+ alignItems: "center",
4094
+ color: "primary.light"
4095
+ },
4096
+ children: [
4097
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4098
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:arrow-forward-up", style: { height: 15, width: 15, marginRight: 4 } }),
4099
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4100
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: titles[message.subtype] })
4101
+ ] }),
4102
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
4103
+ ]
4104
+ }
4105
+ ),
3935
4106
  renderQuote(message.post)
3936
4107
  ]
3937
4108
  }
@@ -3939,11 +4110,7 @@ var __publicField = (obj, key, value) => {
3939
4110
  }
3940
4111
  return /* @__PURE__ */ jsxRuntime.jsx(Message, { message, showTime: false });
3941
4112
  };
3942
- const messageInterval = message.createdAt.getTime() - ((prevMessage == null ? void 0 : prevMessage.createdAt.getTime()) || 0);
3943
- return /* @__PURE__ */ jsxRuntime.jsxs(Box, { ...rest, sx: { mt: 2 }, children: [
3944
- messageInterval > 6e4 && /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { my: 2, textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "inline-block", px: 1, fontSize: 12, bgcolor: "grey.300", borderRadius: 0.5 }, children: dayjs(message.createdAt).format("MM-DD HH:mm") }) }),
3945
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { p: 2, fontSize: 14, "&:hover": { bgcolor: "grey.50" } }, children: render() })
3946
- ] });
4113
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { ...baseItemSx, fontSize: 14 }, children: render() });
3947
4114
  }
3948
4115
  const checkIsAtBottom = (element) => {
3949
4116
  return element && (element.scrollHeight === 0 || element.scrollHeight - element.scrollTop < element.clientHeight + 60);
@@ -3951,6 +4118,7 @@ var __publicField = (obj, key, value) => {
3951
4118
  function MessageList({ chat, ...rest }) {
3952
4119
  var _a2, _b2;
3953
4120
  const { isActiveChat, loadMessages } = useChatContext();
4121
+ const { t } = context.useLocaleContext();
3954
4122
  const isActive = isActiveChat(chat.id);
3955
4123
  const containerRef = react.useRef(null);
3956
4124
  const [isAtBottom, setIsAtBottom] = react.useState(true);
@@ -3979,34 +4147,83 @@ var __publicField = (obj, key, value) => {
3979
4147
  setIsAtBottom(checkIsAtBottom(containerRef.current));
3980
4148
  }
3981
4149
  }, [isActive]);
3982
- return /* @__PURE__ */ jsxRuntime.jsxs(Box, { ...rest, sx: { position: "relative", height: "100%", py: 1 }, children: [
3983
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { height: "100%", px: { sm: 2, xs: 0 }, overflowY: "auto" }, ref: containerRef, children: [
3984
- chat.nextCursor && /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", justifyContent: "center", py: 0.5 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3985
- Button,
3986
- {
3987
- variant: "text",
3988
- color: "inherit",
3989
- onClick: () => loadMessages(chat.id, chat.nextCursor),
3990
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowUpward, {}),
3991
- children: "Load older messages"
3992
- }
3993
- ) }),
3994
- chat.type !== "notification" && ((_a2 = chat.messages) == null ? void 0 : _a2.map((message) => {
3995
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(Message, { message }) }, message.id);
3996
- })),
3997
- chat.type === "notification" && ((_b2 = chat.messages) == null ? void 0 : _b2.map((message, index) => {
3998
- var _a3;
3999
- const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
4000
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
4001
- NotificationMessage,
4002
- {
4003
- chat,
4004
- message,
4005
- prevMessage: prev
4006
- }
4007
- ) }, message.id);
4008
- }))
4009
- ] }),
4150
+ return /* @__PURE__ */ jsxRuntime.jsxs(Box, { ...rest, sx: { position: "relative", height: "100%" }, children: [
4151
+ /* @__PURE__ */ jsxRuntime.jsxs(
4152
+ Box,
4153
+ {
4154
+ sx: {
4155
+ height: "100%",
4156
+ overflowY: "auto",
4157
+ display: "flex",
4158
+ flexDirection: "column",
4159
+ py: 2.5,
4160
+ px: 1.25,
4161
+ gap: 1,
4162
+ background: "rgba(249, 250, 251, 1)"
4163
+ },
4164
+ ref: containerRef,
4165
+ children: [
4166
+ chat.nextCursor && /* @__PURE__ */ jsxRuntime.jsx(
4167
+ Box,
4168
+ {
4169
+ id: "next-cursor",
4170
+ sx: {
4171
+ display: "flex",
4172
+ justifyContent: "center",
4173
+ py: 0.5,
4174
+ // 闪烁
4175
+ "@keyframes fade-in": {
4176
+ "0%": { opacity: 0 },
4177
+ "50%": { opacity: 1 },
4178
+ "100%": { opacity: 0 }
4179
+ }
4180
+ },
4181
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4182
+ Button,
4183
+ {
4184
+ variant: "text",
4185
+ color: "inherit",
4186
+ onClick: async () => {
4187
+ await loadMessages(chat.id, chat.nextCursor);
4188
+ setTimeout(() => {
4189
+ var _a3, _b3;
4190
+ const divider = document.createElement("div");
4191
+ divider.style.animation = "fade-in 1s linear";
4192
+ divider.style.animationIterationCount = "5";
4193
+ divider.style.borderTop = "1px solid #e5e5e5";
4194
+ divider.style.opacity = "0";
4195
+ divider.style.height = "0";
4196
+ const insertBeforeElement = document.getElementById(chat.nextCursor);
4197
+ (_a3 = insertBeforeElement == null ? void 0 : insertBeforeElement.parentElement) == null ? void 0 : _a3.insertBefore(divider, insertBeforeElement);
4198
+ (_b3 = containerRef.current) == null ? void 0 : _b3.scrollTo({ top: divider.offsetTop - 140, behavior: "smooth" });
4199
+ }, 100);
4200
+ },
4201
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowUpward, {}),
4202
+ children: t("chat.loadMore")
4203
+ }
4204
+ )
4205
+ }
4206
+ ),
4207
+ chat.type !== "notification" && ((_a2 = chat.messages) == null ? void 0 : _a2.map((message, index) => {
4208
+ var _a3;
4209
+ const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
4210
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(Message, { message, prevMessage: prev }) }, message.id);
4211
+ })),
4212
+ chat.type === "notification" && ((_b2 = chat.messages) == null ? void 0 : _b2.map((message, index) => {
4213
+ var _a3;
4214
+ const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
4215
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(
4216
+ NotificationMessage,
4217
+ {
4218
+ chat,
4219
+ message,
4220
+ prevMessage: prev
4221
+ }
4222
+ ) }, message.id);
4223
+ }))
4224
+ ]
4225
+ }
4226
+ ),
4010
4227
  !isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { position: "absolute", bottom: 16, right: 24 }, onClick: scrollToBottom, children: /* @__PURE__ */ jsxRuntime.jsx(Fab, { color: "inherit", sx: { width: { xs: 36, sm: 44 }, height: { xs: 36, sm: 44 } }, children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowDownward, {}) }) })
4011
4228
  ] });
4012
4229
  }
@@ -4039,7 +4256,10 @@ var __publicField = (obj, key, value) => {
4039
4256
  p: 0.5,
4040
4257
  pr: 1,
4041
4258
  border: 1,
4042
- borderColor: "grey.300"
4259
+ borderColor: "grey.300",
4260
+ ".MuiAvatarGroup-root": {
4261
+ height: 24
4262
+ }
4043
4263
  },
4044
4264
  ...Array.isArray(sx) ? sx : [sx]
4045
4265
  ];
@@ -4056,8 +4276,8 @@ var __publicField = (obj, key, value) => {
4056
4276
  disableTouchListener: true,
4057
4277
  title: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: users.map((item, i) => /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { p: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(AuthorInfo, { user: item, size: "sm" }) }, i)) }),
4058
4278
  children: /* @__PURE__ */ jsxRuntime.jsxs(material.Button, { ...rest, sx: mergedSx, onClick: handleTooltipOpen, children: [
4059
- /* @__PURE__ */ jsxRuntime.jsx(Avatars, { users: visibleUsers }),
4060
- /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { fontSize: 13, fontWeight: "bold", color: "grey.600" }, children: users.length })
4279
+ /* @__PURE__ */ jsxRuntime.jsx(Avatars, { users: visibleUsers, max: 5 }),
4280
+ /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { fontSize: 12, fontWeight: "bold", color: "grey.600" }, children: users.length })
4061
4281
  ] })
4062
4282
  }
4063
4283
  ) }) });
@@ -4107,6 +4327,18 @@ var __publicField = (obj, key, value) => {
4107
4327
  }
4108
4328
  );
4109
4329
  }
4330
+ function getLineClamp(count) {
4331
+ return {
4332
+ display: "-webkit-box",
4333
+ WebkitLineClamp: count,
4334
+ WebkitBoxOrient: "vertical",
4335
+ overflow: "hidden",
4336
+ lineHeight: 1.5
4337
+ };
4338
+ }
4339
+ function RoomTitle({ title }) {
4340
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "medium" }, children: title });
4341
+ }
4110
4342
  function ChatRoom({ chat, ...rest }) {
4111
4343
  var _a2;
4112
4344
  const { t } = context.useLocaleContext();
@@ -4134,11 +4366,11 @@ var __publicField = (obj, key, value) => {
4134
4366
  };
4135
4367
  const renderRoomHeader = () => {
4136
4368
  if (chat.type === "notification") {
4137
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 1, flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(SystemUser, { name: t("chat.notification"), showDidAddress: false, size: "sm", showIcon: false }) });
4369
+ return /* @__PURE__ */ jsxRuntime.jsx(RoomTitle, { title: t("chat.notification") });
4138
4370
  }
4139
4371
  if (chat.type === "dm") {
4140
4372
  const oppositeUser = getOppositeUser(chat);
4141
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 1, flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, color: "grey.600", fontWeight: "bold" }, children: oppositeUser.fullName }) });
4373
+ return /* @__PURE__ */ jsxRuntime.jsx(RoomTitle, { title: oppositeUser.fullName });
4142
4374
  }
4143
4375
  if (chat.type === "channel") {
4144
4376
  const menuItems = [];
@@ -4154,11 +4386,20 @@ var __publicField = (obj, key, value) => {
4154
4386
  }
4155
4387
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", width: 1, flex: 1 }, children: [
4156
4388
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { children: [
4157
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "bold", color: "grey.700" }, children: chat.name }),
4158
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 12, color: "grey.500" }, children: chat.description })
4389
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "bold", color: "grey.700", ...getLineClamp(1) }, children: chat.name }),
4390
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 12, color: "grey.500", ...getLineClamp(1) }, children: chat.description })
4159
4391
  ] }),
4160
4392
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
4161
- !chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "contained", color: "primary", onClick: () => joinChannel(chat.id), children: t("chat.joinChannel") }),
4393
+ !chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsx(
4394
+ Button,
4395
+ {
4396
+ variant: "contained",
4397
+ color: "primary",
4398
+ onClick: () => joinChannel(chat.id),
4399
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerUsersPlus, sx: { fontSize: "16px!important" } }),
4400
+ children: t("chat.joinChannel")
4401
+ }
4402
+ ),
4162
4403
  chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(Participants, { users: chat.participants, sx: { border: "none" } }) }),
4163
4404
  /* @__PURE__ */ jsxRuntime.jsx(Menu, { items: menuItems })
4164
4405
  ] })
@@ -4177,8 +4418,8 @@ var __publicField = (obj, key, value) => {
4177
4418
  display: "flex",
4178
4419
  alignItems: "center",
4179
4420
  flex: "0 0 auto",
4180
- height: 64,
4181
- px: 2,
4421
+ height: 52,
4422
+ px: 2.5,
4182
4423
  borderBottom: "1px solid #e5e5e5"
4183
4424
  },
4184
4425
  children: [
@@ -4194,17 +4435,55 @@ var __publicField = (obj, key, value) => {
4194
4435
  sx: {
4195
4436
  flex: "0 0 auto",
4196
4437
  ".be-editable": { maxHeight: 200, overflow: "auto" },
4197
- ".be-editable, .be-content": { minHeight: "64px!important" }
4198
- },
4199
- children: (chat.type !== "channel" || chat.hasJoined) && /* @__PURE__ */ jsxRuntime.jsx(
4200
- CommentInput,
4201
- {
4202
- send: (content) => sendMessage(chat.id, content),
4203
- placeholder: "Type something...",
4204
- sendText: "Send",
4205
- shortcut: "ENTER"
4438
+ ".be-editable, .be-content": { minHeight: "64px !important" },
4439
+ ".be-shell": {
4440
+ border: "none !important",
4441
+ borderTop: "1px solid #e5e5e5 !important",
4442
+ borderRadius: "0px !important"
4206
4443
  }
4207
- )
4444
+ },
4445
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { position: "relative" }, children: [
4446
+ /* @__PURE__ */ jsxRuntime.jsx(
4447
+ CommentInput,
4448
+ {
4449
+ send: (content) => sendMessage(chat.id, content),
4450
+ placeholder: t("chat.typeSomething"),
4451
+ sendText: t("chat.reply"),
4452
+ disabledSend: !(chat.type !== "channel" || chat.hasJoined)
4453
+ }
4454
+ ),
4455
+ chat.type === "channel" && !chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsxs(
4456
+ Box,
4457
+ {
4458
+ sx: {
4459
+ position: "absolute",
4460
+ zIndex: 9999999,
4461
+ top: 0,
4462
+ left: 0,
4463
+ right: 0,
4464
+ bottom: 0,
4465
+ bgcolor: "rgba(255, 255, 255, 0.7)",
4466
+ display: "flex",
4467
+ flexDirection: "column",
4468
+ alignItems: "center",
4469
+ justifyContent: "center",
4470
+ color: "#fff"
4471
+ },
4472
+ children: [
4473
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { mb: 0.5, fontSize: 18 }, children: "🚪" }),
4474
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { color: "primary.main", mb: 0.5, fontSize: 13, fontWeight: 500 }, children: t("chat.notYetJoinedTheChannel") }),
4475
+ /* @__PURE__ */ jsxRuntime.jsx(
4476
+ Box,
4477
+ {
4478
+ sx: { color: "secondary.main", cursor: "pointer", fontSize: 13 },
4479
+ onClick: () => joinChannel(chat.id),
4480
+ children: t("chat.joinChannel")
4481
+ }
4482
+ )
4483
+ ]
4484
+ }
4485
+ )
4486
+ ] })
4208
4487
  }
4209
4488
  )
4210
4489
  ] });
@@ -4235,49 +4514,65 @@ var __publicField = (obj, key, value) => {
4235
4514
  ] }),
4236
4515
  onClose,
4237
4516
  ...rest,
4238
- children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { width: { xs: "100%", md: 560 }, minHeight: 140, children: [
4239
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 14, lineHeight: 3, fontWeight: "medium", mb: 1 }, children: t("chat.channel") }),
4240
- /* @__PURE__ */ jsxRuntime.jsx(
4241
- TextField,
4242
- {
4243
- value: state.name,
4244
- placeholder: t("chat.channelName"),
4245
- size: "small",
4246
- fullWidth: true,
4247
- sx: {
4248
- "& .MuiInputBase-root": {
4249
- height: 40,
4250
- backgroundColor: theme.palette.grey[100]
4251
- }
4252
- },
4253
- onChange: (e) => setState({ name: e.target.value })
4254
- }
4255
- ),
4256
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 14, lineHeight: 3, fontWeight: "medium", mt: 1 }, children: t("chat.description") }),
4257
- /* @__PURE__ */ jsxRuntime.jsx(
4258
- TextField,
4259
- {
4260
- value: state.description,
4261
- placeholder: t("chat.channelDescription"),
4262
- fullWidth: true,
4263
- multiline: true,
4264
- onChange: (e) => setState({ description: e.target.value }),
4265
- sx: {
4266
- my: 1,
4267
- "& .MuiInputBase-root": {
4268
- height: 64,
4269
- display: "flex",
4270
- alignItems: "flex-start",
4271
- backgroundColor: theme.palette.grey[100]
4272
- },
4273
- "& .MuiInputBase-inputMultiline": {
4274
- maxHeight: "100%",
4275
- overflowY: "auto"
4276
- }
4277
- }
4278
- }
4279
- )
4280
- ] })
4517
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
4518
+ Box,
4519
+ {
4520
+ width: { xs: "100%", md: 560 },
4521
+ sx: {
4522
+ display: "flex",
4523
+ flexDirection: "column",
4524
+ gap: 2,
4525
+ lineHeight: 1.75
4526
+ },
4527
+ minHeight: 140,
4528
+ children: [
4529
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { children: [
4530
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 14, fontWeight: "medium", mb: 0 }, children: t("chat.channelName") }),
4531
+ /* @__PURE__ */ jsxRuntime.jsx(
4532
+ TextField,
4533
+ {
4534
+ value: state.name,
4535
+ placeholder: t("chat.channelName"),
4536
+ size: "small",
4537
+ fullWidth: true,
4538
+ sx: {
4539
+ "& .MuiInputBase-root": {
4540
+ height: 40,
4541
+ backgroundColor: theme.palette.grey[100]
4542
+ }
4543
+ },
4544
+ onChange: (e) => setState({ name: e.target.value })
4545
+ }
4546
+ )
4547
+ ] }),
4548
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { children: [
4549
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 14, fontWeight: "medium", mb: 0 }, children: t("chat.channelDescription") }),
4550
+ /* @__PURE__ */ jsxRuntime.jsx(
4551
+ TextField,
4552
+ {
4553
+ value: state.description,
4554
+ placeholder: t("chat.channelDescription"),
4555
+ fullWidth: true,
4556
+ multiline: true,
4557
+ onChange: (e) => setState({ description: e.target.value }),
4558
+ minRows: 2,
4559
+ sx: {
4560
+ "& .MuiInputBase-root": {
4561
+ display: "flex",
4562
+ alignItems: "flex-start",
4563
+ backgroundColor: theme.palette.grey[100]
4564
+ },
4565
+ "& .MuiInputBase-inputMultiline": {
4566
+ maxHeight: "100%",
4567
+ overflowY: "auto"
4568
+ }
4569
+ }
4570
+ }
4571
+ )
4572
+ ] })
4573
+ ]
4574
+ }
4575
+ )
4281
4576
  }
4282
4577
  );
4283
4578
  }
@@ -4296,22 +4591,23 @@ var __publicField = (obj, key, value) => {
4296
4591
  ];
4297
4592
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: mergedSx, children: [
4298
4593
  /* @__PURE__ */ jsxRuntime.jsx(iconoirChatBubbleEmpty, { style: { fontSize: 32 } }),
4299
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "bold" }, children: t("chat.noChats") })
4594
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: 500 }, children: t("chat.noChats") })
4300
4595
  ] });
4301
4596
  }
4302
4597
  function Chat({ sx, ...rest }) {
4598
+ var _a2;
4303
4599
  const { client: client2, initialized, chats, activeChatId, addChat, setActiveChat, refresh, getOppositeUser } = useChatContext();
4304
4600
  const [newChannelVisible, setNewChannelVisible] = react.useState(false);
4305
4601
  const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
4306
4602
  const { t } = context.useLocaleContext();
4307
- const activeChat = chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)[0];
4603
+ const activeChat = (_a2 = chats == null ? void 0 : chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)) == null ? void 0 : _a2[0];
4308
4604
  const webTitleMap = {
4309
4605
  dm: () => {
4310
- var _a2;
4311
- return ((_a2 = getOppositeUser(activeChat)) == null ? void 0 : _a2.fullName) || t("chat.unknown");
4606
+ var _a3;
4607
+ return ((_a3 = getOppositeUser(activeChat)) == null ? void 0 : _a3.fullName) || t("chat.unknown");
4312
4608
  },
4313
4609
  notification: () => t("chat.notification"),
4314
- channel: () => (activeChat == null ? void 0 : activeChat.type) === "channel" ? `#${activeChat.name}` : t("chat.unknownChannel"),
4610
+ channel: () => (activeChat == null ? void 0 : activeChat.type) === "channel" ? `# ${activeChat.name}` : t("chat.unknownChannel"),
4315
4611
  default: () => t("chat.chats")
4316
4612
  };
4317
4613
  const getWebTitle = () => {
@@ -4366,17 +4662,17 @@ var __publicField = (obj, key, value) => {
4366
4662
  display: "flex",
4367
4663
  justifyContent: "space-between",
4368
4664
  alignItems: "center",
4369
- height: 64,
4370
- px: 2,
4665
+ height: 52,
4666
+ px: 2.5,
4371
4667
  borderBottom: "1px solid #e5e5e5"
4372
4668
  },
4373
4669
  children: [
4374
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { component: "span", variant: "subtitle1", sx: { fontSize: 16, fontWeight: "bold" }, children: t("chat.chats") }) }),
4670
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { component: "span", variant: "subtitle1", sx: { fontSize: 14, fontWeight: 500 }, children: t("chat.chats") }) }),
4375
4671
  /* @__PURE__ */ jsxRuntime.jsx(AccessControl, { roles: ["owner", "admin"], children: /* @__PURE__ */ jsxRuntime.jsx(
4376
4672
  IconButton$1,
4377
4673
  {
4378
4674
  onClick: () => setNewChannelVisible(true),
4379
- sx: { p: 1, borderRadius: 1, border: `1px solid ${colors.grey[200]}` },
4675
+ sx: { p: 1, borderRadius: 1, border: 1, borderColor: "grey.200", height: 32, width: 32 },
4380
4676
  children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Add, { sx: { color: "#000" } })
4381
4677
  }
4382
4678
  ) })
@@ -4853,6 +5149,7 @@ var __publicField = (obj, key, value) => {
4853
5149
  sendComment: "Comment",
4854
5150
  showMoreReplies: "Show more replies",
4855
5151
  all: "All",
5152
+ messages: "Messages",
4856
5153
  deleteMessage: {
4857
5154
  title: "Delete message",
4858
5155
  desc: "Do you want to delete this message permanently?"
@@ -4881,6 +5178,7 @@ var __publicField = (obj, key, value) => {
4881
5178
  },
4882
5179
  chat: {
4883
5180
  notification: "Notification",
5181
+ reply: "Reply",
4884
5182
  unknown: "Unknown",
4885
5183
  chats: "Chats",
4886
5184
  create: "Create",
@@ -4909,7 +5207,10 @@ var __publicField = (obj, key, value) => {
4909
5207
  unassignTask: "unassigned you from a post",
4910
5208
  points: "points",
4911
5209
  point: "point",
4912
- pointUp: "🎉 You got {points} {unit} {event}"
5210
+ pointUp: "🎉 You got {points} {unit} {event}",
5211
+ loadMore: "Load older messages",
5212
+ notYetJoinedTheChannel: "Not yet joined the channel",
5213
+ typeSomething: "Type here. Use Markdown, Drag or paste images"
4913
5214
  }
4914
5215
  };
4915
5216
  const zh = {
@@ -4928,6 +5229,7 @@ var __publicField = (obj, key, value) => {
4928
5229
  sendComment: "评论",
4929
5230
  showMoreReplies: "显示更多回复",
4930
5231
  all: "所有",
5232
+ messages: "消息",
4931
5233
  deleteMessage: {
4932
5234
  title: "删除消息",
4933
5235
  desc: "是否要永久删除此消息?"
@@ -4956,6 +5258,7 @@ var __publicField = (obj, key, value) => {
4956
5258
  },
4957
5259
  chat: {
4958
5260
  notification: "通知",
5261
+ reply: "回复",
4959
5262
  unknown: "未命名",
4960
5263
  chats: "聊天",
4961
5264
  create: "创建",
@@ -4975,7 +5278,7 @@ var __publicField = (obj, key, value) => {
4975
5278
  replyYourComment: "回复了你的评论",
4976
5279
  replyComment: "回复了评论",
4977
5280
  deleteChannelTitle: "确认删除这个频道?",
4978
- deleteChannelDesc: "如果你要删除这个频道, 所有频道的消息都会立刻消除。",
5281
+ deleteChannelDesc: "如果你要删除这个频道, 频道内所有的消息都会立刻消除。",
4979
5282
  leaveChannel: "离开频道",
4980
5283
  joinChannel: "加入频道",
4981
5284
  openTask: "创建了一个任务",
@@ -4984,7 +5287,10 @@ var __publicField = (obj, key, value) => {
4984
5287
  unassignTask: "取消给你分配的一个任务",
4985
5288
  points: "分",
4986
5289
  point: "分",
4987
- pointUp: "🎉 您获得了 {points} {unit} {event}"
5290
+ pointUp: "🎉 您获得了 {points} {unit} {event}",
5291
+ loadMore: "加载更多消息",
5292
+ notYetJoinedTheChannel: "暂未加入这个频道",
5293
+ typeSomething: "在这里输入,适用 MarkDown,拽入或者黏贴图片"
4988
5294
  }
4989
5295
  };
4990
5296
  const translations = { zh, en };
@@ -10928,7 +11234,6 @@ var __publicField = (obj, key, value) => {
10928
11234
  exports2.BlogList = BlogListWrapper;
10929
11235
  exports2.BlogPermaLink = BlogPermaLink;
10930
11236
  exports2.ButtonGroup = ButtonGroup;
10931
- exports2.ChannelGroup = ChannelGroup;
10932
11237
  exports2.Chat = Chat;
10933
11238
  exports2.ChatClient = ChatClient;
10934
11239
  exports2.ChatHeaderAddon = ChatHeaderAddon;