@blocklet/discuss-kit-ux 1.6.184 → 1.6.186

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,73 @@ 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
+ showProfileCard: true,
3827
+ user: message.sender,
3828
+ createdAt: showTime ? message.createdAt : void 0,
3829
+ size: "sm"
3830
+ }
3831
+ ),
3832
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { ml: 6, width: "90%" }, children: /* @__PURE__ */ jsxRuntime.jsx(PostContent, { content: message.content }) })
3727
3833
  ]
3728
3834
  }
3729
3835
  );
3730
3836
  }
3731
- function NotificationMessage({ chat, message, prevMessage, ...rest }) {
3837
+ function NotificationMessage({ chat, message, prevMessage }) {
3732
3838
  const { session } = useSessionContext();
3733
3839
  const { t } = context.useLocaleContext();
3734
- const renderQuote = ({ title, excerpt, cover }) => {
3840
+ const renderQuote = ({ title, cover }) => {
3735
3841
  if ("post" in message) {
3736
3842
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { color: 14, mt: 1 }, children: [
3737
3843
  title && /* @__PURE__ */ jsxRuntime.jsx(
@@ -3770,25 +3876,44 @@ var __publicField = (obj, key, value) => {
3770
3876
  };
3771
3877
  const render = () => {
3772
3878
  var _a2, _b2, _c, _d, _e, _f, _g;
3879
+ const baseCardSx = {
3880
+ py: 1.5,
3881
+ px: 2,
3882
+ background: "#fff",
3883
+ width: "fit-content",
3884
+ maxWidth: "calc(100% - 16px)",
3885
+ wordWrap: "break-word",
3886
+ borderRadius: 1,
3887
+ transition: "all 120ms linear"
3888
+ };
3773
3889
  if (message.type === "post_create") {
3774
3890
  return /* @__PURE__ */ jsxRuntime.jsxs(
3775
3891
  Box,
3776
3892
  {
3777
3893
  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
3894
+ ...baseCardSx
3785
3895
  },
3786
3896
  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
- ] }),
3897
+ /* @__PURE__ */ jsxRuntime.jsxs(
3898
+ Box,
3899
+ {
3900
+ sx: {
3901
+ display: "flex",
3902
+ flexDirection: "row",
3903
+ justifyContent: "space-between",
3904
+ alignItems: "center",
3905
+ color: "primary.light"
3906
+ },
3907
+ children: [
3908
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
3909
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:news", style: { height: 15, width: 15, marginRight: 4 } }),
3910
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3911
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.newPost") })
3912
+ ] }),
3913
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
3914
+ ]
3915
+ }
3916
+ ),
3792
3917
  renderQuote(message.post)
3793
3918
  ]
3794
3919
  }
@@ -3799,20 +3924,29 @@ var __publicField = (obj, key, value) => {
3799
3924
  Box,
3800
3925
  {
3801
3926
  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
3927
+ ...baseCardSx
3809
3928
  },
3810
3929
  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
- ] }),
3930
+ /* @__PURE__ */ jsxRuntime.jsxs(
3931
+ Box,
3932
+ {
3933
+ sx: {
3934
+ display: "flex",
3935
+ flexDirection: "row",
3936
+ justifyContent: "space-between",
3937
+ alignItems: "center",
3938
+ color: "primary.light"
3939
+ },
3940
+ children: [
3941
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
3942
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
3943
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3944
+ /* @__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") })
3945
+ ] }),
3946
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
3947
+ ]
3948
+ }
3949
+ ),
3816
3950
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: (_c = message == null ? void 0 : message.comment) == null ? void 0 : _c.excerpt }),
3817
3951
  renderQuote(message.post)
3818
3952
  ]
@@ -3824,21 +3958,30 @@ var __publicField = (obj, key, value) => {
3824
3958
  Box,
3825
3959
  {
3826
3960
  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
3961
+ ...baseCardSx
3834
3962
  },
3835
3963
  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 }),
3964
+ /* @__PURE__ */ jsxRuntime.jsxs(
3965
+ Box,
3966
+ {
3967
+ sx: {
3968
+ display: "flex",
3969
+ flexDirection: "row",
3970
+ justifyContent: "space-between",
3971
+ alignItems: "center",
3972
+ color: "primary.light"
3973
+ },
3974
+ children: [
3975
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
3976
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
3977
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
3978
+ /* @__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") })
3979
+ ] }),
3980
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
3981
+ ]
3982
+ }
3983
+ ),
3984
+ /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: message.reply.excerpt }),
3842
3985
  renderQuote({ title: message.post.title, excerpt: message.comment.excerpt })
3843
3986
  ]
3844
3987
  }
@@ -3849,23 +3992,32 @@ var __publicField = (obj, key, value) => {
3849
3992
  Box,
3850
3993
  {
3851
3994
  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
3995
+ ...baseCardSx
3859
3996
  },
3860
3997
  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
- ] }),
3998
+ /* @__PURE__ */ jsxRuntime.jsxs(
3999
+ Box,
4000
+ {
4001
+ sx: {
4002
+ display: "flex",
4003
+ flexDirection: "row",
4004
+ justifyContent: "space-between",
4005
+ alignItems: "center",
4006
+ color: "primary.light"
4007
+ },
4008
+ children: [
4009
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4010
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
4011
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4012
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4013
+ " ",
4014
+ t("chat.mentionInComment")
4015
+ ] })
4016
+ ] }),
4017
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
4018
+ ]
4019
+ }
4020
+ ),
3869
4021
  /* @__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
4022
  renderQuote(message.post)
3871
4023
  ]
@@ -3877,20 +4029,29 @@ var __publicField = (obj, key, value) => {
3877
4029
  Box,
3878
4030
  {
3879
4031
  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"
4032
+ ...baseCardSx
3887
4033
  },
3888
4034
  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
- ] }),
4035
+ /* @__PURE__ */ jsxRuntime.jsxs(
4036
+ Box,
4037
+ {
4038
+ sx: {
4039
+ display: "flex",
4040
+ flexDirection: "row",
4041
+ justifyContent: "space-between",
4042
+ alignItems: "center",
4043
+ color: "primary.light"
4044
+ },
4045
+ children: [
4046
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4047
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
4048
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4049
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.mentionInPost") })
4050
+ ] }),
4051
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
4052
+ ]
4053
+ }
4054
+ ),
3894
4055
  renderQuote(message.post)
3895
4056
  ]
3896
4057
  }
@@ -3918,20 +4079,29 @@ var __publicField = (obj, key, value) => {
3918
4079
  Box,
3919
4080
  {
3920
4081
  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"
4082
+ ...baseCardSx
3928
4083
  },
3929
4084
  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
- ] }),
4085
+ /* @__PURE__ */ jsxRuntime.jsxs(
4086
+ Box,
4087
+ {
4088
+ sx: {
4089
+ display: "flex",
4090
+ flexDirection: "row",
4091
+ justifyContent: "space-between",
4092
+ alignItems: "center",
4093
+ color: "primary.light"
4094
+ },
4095
+ children: [
4096
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4097
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:arrow-forward-up", style: { height: 15, width: 15, marginRight: 4 } }),
4098
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4099
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: titles[message.subtype] })
4100
+ ] }),
4101
+ /* @__PURE__ */ jsxRuntime.jsx(Time, { createdAt: message.createdAt })
4102
+ ]
4103
+ }
4104
+ ),
3935
4105
  renderQuote(message.post)
3936
4106
  ]
3937
4107
  }
@@ -3939,11 +4109,7 @@ var __publicField = (obj, key, value) => {
3939
4109
  }
3940
4110
  return /* @__PURE__ */ jsxRuntime.jsx(Message, { message, showTime: false });
3941
4111
  };
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
- ] });
4112
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { ...baseItemSx, fontSize: 14 }, children: render() });
3947
4113
  }
3948
4114
  const checkIsAtBottom = (element) => {
3949
4115
  return element && (element.scrollHeight === 0 || element.scrollHeight - element.scrollTop < element.clientHeight + 60);
@@ -3951,6 +4117,7 @@ var __publicField = (obj, key, value) => {
3951
4117
  function MessageList({ chat, ...rest }) {
3952
4118
  var _a2, _b2;
3953
4119
  const { isActiveChat, loadMessages } = useChatContext();
4120
+ const { t } = context.useLocaleContext();
3954
4121
  const isActive = isActiveChat(chat.id);
3955
4122
  const containerRef = react.useRef(null);
3956
4123
  const [isAtBottom, setIsAtBottom] = react.useState(true);
@@ -3979,34 +4146,56 @@ var __publicField = (obj, key, value) => {
3979
4146
  setIsAtBottom(checkIsAtBottom(containerRef.current));
3980
4147
  }
3981
4148
  }, [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
- ] }),
4149
+ return /* @__PURE__ */ jsxRuntime.jsxs(Box, { ...rest, sx: { position: "relative", height: "100%" }, children: [
4150
+ /* @__PURE__ */ jsxRuntime.jsxs(
4151
+ Box,
4152
+ {
4153
+ sx: {
4154
+ height: "100%",
4155
+ overflowY: "auto",
4156
+ display: "flex",
4157
+ flexDirection: "column",
4158
+ py: 2.5,
4159
+ px: 1.25,
4160
+ gap: 1,
4161
+ background: "rgba(249, 250, 251, 1)"
4162
+ },
4163
+ ref: containerRef,
4164
+ children: [
4165
+ chat.nextCursor && /* @__PURE__ */ jsxRuntime.jsx(Box, { id: "next-cursor", sx: { display: "flex", justifyContent: "center", py: 0.5 }, children: /* @__PURE__ */ jsxRuntime.jsx(
4166
+ Button,
4167
+ {
4168
+ variant: "text",
4169
+ color: "inherit",
4170
+ onClick: async () => {
4171
+ var _a3;
4172
+ (_a3 = document.getElementById("next-cursor")) == null ? void 0 : _a3.scrollIntoView();
4173
+ await loadMessages(chat.id, chat.nextCursor);
4174
+ },
4175
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowUpward, {}),
4176
+ children: t("chat.loadMore")
4177
+ }
4178
+ ) }),
4179
+ chat.type !== "notification" && ((_a2 = chat.messages) == null ? void 0 : _a2.map((message, index) => {
4180
+ var _a3;
4181
+ const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
4182
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(Message, { message, prevMessage: prev }) }, message.id);
4183
+ })),
4184
+ chat.type === "notification" && ((_b2 = chat.messages) == null ? void 0 : _b2.map((message, index) => {
4185
+ var _a3;
4186
+ const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
4187
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(
4188
+ NotificationMessage,
4189
+ {
4190
+ chat,
4191
+ message,
4192
+ prevMessage: prev
4193
+ }
4194
+ ) }, message.id);
4195
+ }))
4196
+ ]
4197
+ }
4198
+ ),
4010
4199
  !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
4200
  ] });
4012
4201
  }
@@ -4039,7 +4228,10 @@ var __publicField = (obj, key, value) => {
4039
4228
  p: 0.5,
4040
4229
  pr: 1,
4041
4230
  border: 1,
4042
- borderColor: "grey.300"
4231
+ borderColor: "grey.300",
4232
+ ".MuiAvatarGroup-root": {
4233
+ height: 24
4234
+ }
4043
4235
  },
4044
4236
  ...Array.isArray(sx) ? sx : [sx]
4045
4237
  ];
@@ -4056,8 +4248,8 @@ var __publicField = (obj, key, value) => {
4056
4248
  disableTouchListener: true,
4057
4249
  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
4250
  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 })
4251
+ /* @__PURE__ */ jsxRuntime.jsx(Avatars, { users: visibleUsers, max: 5 }),
4252
+ /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { fontSize: 12, fontWeight: "bold", color: "grey.600" }, children: users.length })
4061
4253
  ] })
4062
4254
  }
4063
4255
  ) }) });
@@ -4107,6 +4299,18 @@ var __publicField = (obj, key, value) => {
4107
4299
  }
4108
4300
  );
4109
4301
  }
4302
+ function getLineClamp(count) {
4303
+ return {
4304
+ display: "-webkit-box",
4305
+ WebkitLineClamp: count,
4306
+ WebkitBoxOrient: "vertical",
4307
+ overflow: "hidden",
4308
+ lineHeight: 1.5
4309
+ };
4310
+ }
4311
+ function RoomTitle({ title }) {
4312
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "medium" }, children: title });
4313
+ }
4110
4314
  function ChatRoom({ chat, ...rest }) {
4111
4315
  var _a2;
4112
4316
  const { t } = context.useLocaleContext();
@@ -4134,11 +4338,11 @@ var __publicField = (obj, key, value) => {
4134
4338
  };
4135
4339
  const renderRoomHeader = () => {
4136
4340
  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 }) });
4341
+ return /* @__PURE__ */ jsxRuntime.jsx(RoomTitle, { title: t("chat.notification") });
4138
4342
  }
4139
4343
  if (chat.type === "dm") {
4140
4344
  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 }) });
4345
+ return /* @__PURE__ */ jsxRuntime.jsx(RoomTitle, { title: oppositeUser.fullName });
4142
4346
  }
4143
4347
  if (chat.type === "channel") {
4144
4348
  const menuItems = [];
@@ -4154,11 +4358,20 @@ var __publicField = (obj, key, value) => {
4154
4358
  }
4155
4359
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", width: 1, flex: 1 }, children: [
4156
4360
  /* @__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 })
4361
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "bold", color: "grey.700", ...getLineClamp(1) }, children: chat.name }),
4362
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 12, color: "grey.500", ...getLineClamp(1) }, children: chat.description })
4159
4363
  ] }),
4160
4364
  /* @__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") }),
4365
+ !chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsx(
4366
+ Button,
4367
+ {
4368
+ variant: "contained",
4369
+ color: "primary",
4370
+ onClick: () => joinChannel(chat.id),
4371
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerUsersPlus, sx: { fontSize: "16px!important" } }),
4372
+ children: t("chat.joinChannel")
4373
+ }
4374
+ ),
4162
4375
  chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(Participants, { users: chat.participants, sx: { border: "none" } }) }),
4163
4376
  /* @__PURE__ */ jsxRuntime.jsx(Menu, { items: menuItems })
4164
4377
  ] })
@@ -4177,8 +4390,8 @@ var __publicField = (obj, key, value) => {
4177
4390
  display: "flex",
4178
4391
  alignItems: "center",
4179
4392
  flex: "0 0 auto",
4180
- height: 64,
4181
- px: 2,
4393
+ height: 52,
4394
+ px: 2.5,
4182
4395
  borderBottom: "1px solid #e5e5e5"
4183
4396
  },
4184
4397
  children: [
@@ -4194,17 +4407,55 @@ var __publicField = (obj, key, value) => {
4194
4407
  sx: {
4195
4408
  flex: "0 0 auto",
4196
4409
  ".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"
4410
+ ".be-editable, .be-content": { minHeight: "64px !important" },
4411
+ ".be-shell": {
4412
+ border: "none !important",
4413
+ borderTop: "1px solid #e5e5e5 !important",
4414
+ borderRadius: "0px !important"
4206
4415
  }
4207
- )
4416
+ },
4417
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { position: "relative" }, children: [
4418
+ /* @__PURE__ */ jsxRuntime.jsx(
4419
+ CommentInput,
4420
+ {
4421
+ send: (content) => sendMessage(chat.id, content),
4422
+ placeholder: t("chat.typeSomething"),
4423
+ sendText: t("chat.reply"),
4424
+ disabledSend: !(chat.type !== "channel" || chat.hasJoined)
4425
+ }
4426
+ ),
4427
+ chat.type === "channel" && !chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsxs(
4428
+ Box,
4429
+ {
4430
+ sx: {
4431
+ position: "absolute",
4432
+ zIndex: 9999999,
4433
+ top: 0,
4434
+ left: 0,
4435
+ right: 0,
4436
+ bottom: 0,
4437
+ bgcolor: "rgba(255, 255, 255, 0.7)",
4438
+ display: "flex",
4439
+ flexDirection: "column",
4440
+ alignItems: "center",
4441
+ justifyContent: "center",
4442
+ color: "#fff"
4443
+ },
4444
+ children: [
4445
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { mb: 0.5, fontSize: 18 }, children: "🚪" }),
4446
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { color: "primary.main", mb: 0.5, fontSize: 13, fontWeight: 500 }, children: t("chat.notYetJoinedTheChannel") }),
4447
+ /* @__PURE__ */ jsxRuntime.jsx(
4448
+ Box,
4449
+ {
4450
+ sx: { color: "secondary.main", cursor: "pointer", fontSize: 13 },
4451
+ onClick: () => joinChannel(chat.id),
4452
+ children: t("chat.joinChannel")
4453
+ }
4454
+ )
4455
+ ]
4456
+ }
4457
+ )
4458
+ ] })
4208
4459
  }
4209
4460
  )
4210
4461
  ] });
@@ -4235,49 +4486,65 @@ var __publicField = (obj, key, value) => {
4235
4486
  ] }),
4236
4487
  onClose,
4237
4488
  ...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
- ] })
4489
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
4490
+ Box,
4491
+ {
4492
+ width: { xs: "100%", md: 560 },
4493
+ sx: {
4494
+ display: "flex",
4495
+ flexDirection: "column",
4496
+ gap: 2,
4497
+ lineHeight: 1.75
4498
+ },
4499
+ minHeight: 140,
4500
+ children: [
4501
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { children: [
4502
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 14, fontWeight: "medium", mb: 0 }, children: t("chat.channelName") }),
4503
+ /* @__PURE__ */ jsxRuntime.jsx(
4504
+ TextField,
4505
+ {
4506
+ value: state.name,
4507
+ placeholder: t("chat.channelName"),
4508
+ size: "small",
4509
+ fullWidth: true,
4510
+ sx: {
4511
+ "& .MuiInputBase-root": {
4512
+ height: 40,
4513
+ backgroundColor: theme.palette.grey[100]
4514
+ }
4515
+ },
4516
+ onChange: (e) => setState({ name: e.target.value })
4517
+ }
4518
+ )
4519
+ ] }),
4520
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { children: [
4521
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 14, fontWeight: "medium", mb: 0 }, children: t("chat.channelDescription") }),
4522
+ /* @__PURE__ */ jsxRuntime.jsx(
4523
+ TextField,
4524
+ {
4525
+ value: state.description,
4526
+ placeholder: t("chat.channelDescription"),
4527
+ fullWidth: true,
4528
+ multiline: true,
4529
+ onChange: (e) => setState({ description: e.target.value }),
4530
+ minRows: 2,
4531
+ sx: {
4532
+ "& .MuiInputBase-root": {
4533
+ display: "flex",
4534
+ alignItems: "flex-start",
4535
+ backgroundColor: theme.palette.grey[100]
4536
+ },
4537
+ "& .MuiInputBase-inputMultiline": {
4538
+ maxHeight: "100%",
4539
+ overflowY: "auto"
4540
+ }
4541
+ }
4542
+ }
4543
+ )
4544
+ ] })
4545
+ ]
4546
+ }
4547
+ )
4281
4548
  }
4282
4549
  );
4283
4550
  }
@@ -4296,22 +4563,23 @@ var __publicField = (obj, key, value) => {
4296
4563
  ];
4297
4564
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: mergedSx, children: [
4298
4565
  /* @__PURE__ */ jsxRuntime.jsx(iconoirChatBubbleEmpty, { style: { fontSize: 32 } }),
4299
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "bold" }, children: t("chat.noChats") })
4566
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: 500 }, children: t("chat.noChats") })
4300
4567
  ] });
4301
4568
  }
4302
4569
  function Chat({ sx, ...rest }) {
4570
+ var _a2;
4303
4571
  const { client: client2, initialized, chats, activeChatId, addChat, setActiveChat, refresh, getOppositeUser } = useChatContext();
4304
4572
  const [newChannelVisible, setNewChannelVisible] = react.useState(false);
4305
4573
  const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
4306
4574
  const { t } = context.useLocaleContext();
4307
- const activeChat = chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)[0];
4575
+ const activeChat = (_a2 = chats == null ? void 0 : chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)) == null ? void 0 : _a2[0];
4308
4576
  const webTitleMap = {
4309
4577
  dm: () => {
4310
- var _a2;
4311
- return ((_a2 = getOppositeUser(activeChat)) == null ? void 0 : _a2.fullName) || t("chat.unknown");
4578
+ var _a3;
4579
+ return ((_a3 = getOppositeUser(activeChat)) == null ? void 0 : _a3.fullName) || t("chat.unknown");
4312
4580
  },
4313
4581
  notification: () => t("chat.notification"),
4314
- channel: () => (activeChat == null ? void 0 : activeChat.type) === "channel" ? `#${activeChat.name}` : t("chat.unknownChannel"),
4582
+ channel: () => (activeChat == null ? void 0 : activeChat.type) === "channel" ? `# ${activeChat.name}` : t("chat.unknownChannel"),
4315
4583
  default: () => t("chat.chats")
4316
4584
  };
4317
4585
  const getWebTitle = () => {
@@ -4366,17 +4634,17 @@ var __publicField = (obj, key, value) => {
4366
4634
  display: "flex",
4367
4635
  justifyContent: "space-between",
4368
4636
  alignItems: "center",
4369
- height: 64,
4370
- px: 2,
4637
+ height: 52,
4638
+ px: 2.5,
4371
4639
  borderBottom: "1px solid #e5e5e5"
4372
4640
  },
4373
4641
  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") }) }),
4642
+ /* @__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
4643
  /* @__PURE__ */ jsxRuntime.jsx(AccessControl, { roles: ["owner", "admin"], children: /* @__PURE__ */ jsxRuntime.jsx(
4376
4644
  IconButton$1,
4377
4645
  {
4378
4646
  onClick: () => setNewChannelVisible(true),
4379
- sx: { p: 1, borderRadius: 1, border: `1px solid ${colors.grey[200]}` },
4647
+ sx: { p: 1, borderRadius: 1, border: 1, borderColor: "grey.200", height: 32, width: 32 },
4380
4648
  children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Add, { sx: { color: "#000" } })
4381
4649
  }
4382
4650
  ) })
@@ -4853,6 +5121,7 @@ var __publicField = (obj, key, value) => {
4853
5121
  sendComment: "Comment",
4854
5122
  showMoreReplies: "Show more replies",
4855
5123
  all: "All",
5124
+ messages: "Messages",
4856
5125
  deleteMessage: {
4857
5126
  title: "Delete message",
4858
5127
  desc: "Do you want to delete this message permanently?"
@@ -4881,6 +5150,7 @@ var __publicField = (obj, key, value) => {
4881
5150
  },
4882
5151
  chat: {
4883
5152
  notification: "Notification",
5153
+ reply: "Reply",
4884
5154
  unknown: "Unknown",
4885
5155
  chats: "Chats",
4886
5156
  create: "Create",
@@ -4909,7 +5179,10 @@ var __publicField = (obj, key, value) => {
4909
5179
  unassignTask: "unassigned you from a post",
4910
5180
  points: "points",
4911
5181
  point: "point",
4912
- pointUp: "🎉 You got {points} {unit} {event}"
5182
+ pointUp: "🎉 You got {points} {unit} {event}",
5183
+ loadMore: "Load older messages",
5184
+ notYetJoinedTheChannel: "Not yet joined the channel",
5185
+ typeSomething: "Type here. Use Markdown, Drag or paste images"
4913
5186
  }
4914
5187
  };
4915
5188
  const zh = {
@@ -4928,6 +5201,7 @@ var __publicField = (obj, key, value) => {
4928
5201
  sendComment: "评论",
4929
5202
  showMoreReplies: "显示更多回复",
4930
5203
  all: "所有",
5204
+ messages: "消息",
4931
5205
  deleteMessage: {
4932
5206
  title: "删除消息",
4933
5207
  desc: "是否要永久删除此消息?"
@@ -4956,6 +5230,7 @@ var __publicField = (obj, key, value) => {
4956
5230
  },
4957
5231
  chat: {
4958
5232
  notification: "通知",
5233
+ reply: "回复",
4959
5234
  unknown: "未命名",
4960
5235
  chats: "聊天",
4961
5236
  create: "创建",
@@ -4975,7 +5250,7 @@ var __publicField = (obj, key, value) => {
4975
5250
  replyYourComment: "回复了你的评论",
4976
5251
  replyComment: "回复了评论",
4977
5252
  deleteChannelTitle: "确认删除这个频道?",
4978
- deleteChannelDesc: "如果你要删除这个频道, 所有频道的消息都会立刻消除。",
5253
+ deleteChannelDesc: "如果你要删除这个频道, 频道内所有的消息都会立刻消除。",
4979
5254
  leaveChannel: "离开频道",
4980
5255
  joinChannel: "加入频道",
4981
5256
  openTask: "创建了一个任务",
@@ -4984,7 +5259,10 @@ var __publicField = (obj, key, value) => {
4984
5259
  unassignTask: "取消给你分配的一个任务",
4985
5260
  points: "分",
4986
5261
  point: "分",
4987
- pointUp: "🎉 您获得了 {points} {unit} {event}"
5262
+ pointUp: "🎉 您获得了 {points} {unit} {event}",
5263
+ loadMore: "加载更多消息",
5264
+ notYetJoinedTheChannel: "暂未加入这个频道",
5265
+ typeSomething: "在这里输入,适用 MarkDown,拽入或者黏贴图片"
4988
5266
  }
4989
5267
  };
4990
5268
  const translations = { zh, en };
@@ -10928,7 +11206,6 @@ var __publicField = (obj, key, value) => {
10928
11206
  exports2.BlogList = BlogListWrapper;
10929
11207
  exports2.BlogPermaLink = BlogPermaLink;
10930
11208
  exports2.ButtonGroup = ButtonGroup;
10931
- exports2.ChannelGroup = ChannelGroup;
10932
11209
  exports2.Chat = Chat;
10933
11210
  exports2.ChatClient = ChatClient;
10934
11211
  exports2.ChatHeaderAddon = ChatHeaderAddon;