@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/components/avatars/author-info.d.ts +2 -1
- package/dist/components/avatars/index.d.ts +0 -1
- package/dist/components/chat/channel-group.d.ts +9 -0
- package/dist/components/chat/context.d.ts +1 -0
- package/dist/components/chat/message.d.ts +3 -2
- package/dist/components/chat/time.d.ts +6 -0
- package/dist/components/chat/types.d.ts +4 -0
- package/dist/components/locale/en.d.ts +5 -0
- package/dist/components/locale/index.d.ts +10 -0
- package/dist/components/locale/zh.d.ts +5 -0
- package/dist/{editor-LUBMEeS4.mjs → editor-HUTb7nXS.mjs} +3 -3
- package/dist/{index-LsAi57M8.mjs → index-p8mA3-D0.mjs} +588 -311
- package/dist/index.es.js +53 -54
- package/dist/index.umd.js +537 -260
- package/package.json +4 -4
- package/dist/components/avatars/channel-group.d.ts +0 -7
|
@@ -46,10 +46,9 @@ import { Icon } from "@iconify/react";
|
|
|
46
46
|
import Empty$1 from "@arcblock/ux/lib/Empty";
|
|
47
47
|
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
48
48
|
import { useTheme as useTheme$1, useMediaQuery, Box as Box$1, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Dialog as Dialog$1, DialogTitle, DialogContent, DialogActions, DialogContentText, Button as Button$1, Skeleton, IconButton as IconButton$2, InputBase, tooltipClasses as tooltipClasses$1, Badge as Badge$1, Paper, ToggleButtonGroup, ToggleButton } from "@mui/material";
|
|
49
|
-
import DIDAddress from "@arcblock/did-connect/lib/Address";
|
|
50
49
|
import NotificationsActiveOutlinedIcon from "@mui/icons-material/NotificationsActiveOutlined";
|
|
51
|
-
import Groups2RoundedIcon from "@mui/icons-material/Groups2Rounded";
|
|
52
50
|
import CheckboxPlugin from "@blocklet/editor/lib/ext/CheckboxPlugin";
|
|
51
|
+
import DIDAddress from "@arcblock/did-connect/lib/Address";
|
|
53
52
|
import MuiMenuItem from "@mui/material/MenuItem";
|
|
54
53
|
import clsx from "clsx";
|
|
55
54
|
import IconButton$1 from "@mui/material/IconButton";
|
|
@@ -65,6 +64,7 @@ import mitt from "mitt";
|
|
|
65
64
|
import CircularProgress from "@mui/material/CircularProgress";
|
|
66
65
|
import { Helmet } from "react-helmet";
|
|
67
66
|
import { Flipper, Flipped } from "react-flip-toolkit";
|
|
67
|
+
import grey$1 from "@mui/material/colors/grey";
|
|
68
68
|
import Fab from "@mui/material/Fab";
|
|
69
69
|
import debounce from "lodash/debounce";
|
|
70
70
|
import TextField from "@mui/material/TextField";
|
|
@@ -991,8 +991,13 @@ const useResponsiveValue = (values2) => {
|
|
|
991
991
|
return r(values2);
|
|
992
992
|
};
|
|
993
993
|
function ProfileCard({ user, click, ...rest }) {
|
|
994
|
-
var _a2, _b2;
|
|
994
|
+
var _a2, _b2, _c;
|
|
995
995
|
const { session } = useSessionContext();
|
|
996
|
+
const { t } = useLocaleContext();
|
|
997
|
+
let chatUrl = (user == null ? void 0 : user.did) && `/chat/dm/${user == null ? void 0 : user.did}`;
|
|
998
|
+
if (chatUrl && ((_a2 = window.location.pathname) == null ? void 0 : _a2.includes(user == null ? void 0 : user.did))) {
|
|
999
|
+
chatUrl = "";
|
|
1000
|
+
}
|
|
996
1001
|
return /* @__PURE__ */ jsxs(
|
|
997
1002
|
Box,
|
|
998
1003
|
{
|
|
@@ -1054,18 +1059,18 @@ function ProfileCard({ user, click, ...rest }) {
|
|
|
1054
1059
|
)
|
|
1055
1060
|
] })
|
|
1056
1061
|
] }),
|
|
1057
|
-
((
|
|
1062
|
+
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__ */ jsxs(Fragment, { children: [
|
|
1058
1063
|
/* @__PURE__ */ jsx(Box, { sx: { my: 2, borderTop: "1px solid #eee" } }),
|
|
1059
1064
|
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
1060
1065
|
Button,
|
|
1061
1066
|
{
|
|
1062
1067
|
component: Link,
|
|
1063
|
-
to:
|
|
1068
|
+
to: chatUrl,
|
|
1064
1069
|
variant: "outlined",
|
|
1065
1070
|
color: "inherit",
|
|
1066
1071
|
startIcon: /* @__PURE__ */ jsx(ChatBubbleOutlineOutlined, { style: { fontSize: 16 } }),
|
|
1067
1072
|
sx: { fontSize: 12 },
|
|
1068
|
-
children: "
|
|
1073
|
+
children: t("messages")
|
|
1069
1074
|
}
|
|
1070
1075
|
) })
|
|
1071
1076
|
] })
|
|
@@ -1090,6 +1095,7 @@ function AuthorInfo({
|
|
|
1090
1095
|
showDID = true,
|
|
1091
1096
|
newTitle = void 0,
|
|
1092
1097
|
profileUse = false,
|
|
1098
|
+
children,
|
|
1093
1099
|
...rest
|
|
1094
1100
|
}) {
|
|
1095
1101
|
const theme = useTheme();
|
|
@@ -1098,7 +1104,7 @@ function AuthorInfo({
|
|
|
1098
1104
|
const [open, setOpen] = useState(false);
|
|
1099
1105
|
const sm = size === "sm";
|
|
1100
1106
|
let fontSize = sm ? 12 : 14;
|
|
1101
|
-
let avatarSize = profileUse ? 24 : sm ?
|
|
1107
|
+
let avatarSize = profileUse ? 24 : sm ? 40 : 48;
|
|
1102
1108
|
if (responsive && downMd) {
|
|
1103
1109
|
fontSize = 12;
|
|
1104
1110
|
avatarSize = 24;
|
|
@@ -1113,7 +1119,10 @@ function AuthorInfo({
|
|
|
1113
1119
|
createdAt = typeof createdAt === "string" ? new Date(createdAt) : createdAt;
|
|
1114
1120
|
return /* @__PURE__ */ jsx(Box, { component: RelativeTime, sx: { color: "text.secondary" }, value: createdAt });
|
|
1115
1121
|
};
|
|
1116
|
-
const click = () => {
|
|
1122
|
+
const click = (e) => {
|
|
1123
|
+
var _a2, _b2;
|
|
1124
|
+
(_a2 = e == null ? void 0 : e.stopPropagation) == null ? void 0 : _a2.call(e);
|
|
1125
|
+
(_b2 = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b2.call(e);
|
|
1117
1126
|
setOpen(false);
|
|
1118
1127
|
setTimeout(() => {
|
|
1119
1128
|
navigate(`/profile/${user == null ? void 0 : user.did}`);
|
|
@@ -1128,7 +1137,7 @@ function AuthorInfo({
|
|
|
1128
1137
|
onClose: () => setOpen(false),
|
|
1129
1138
|
onOpen: () => setOpen(true),
|
|
1130
1139
|
title: /* @__PURE__ */ jsx(ProfileCard, { user, click }),
|
|
1131
|
-
children: /* @__PURE__ */ jsx(Box, { sx: { display: "flex", cursor: "pointer" }, onClick: click, children: /* @__PURE__ */ jsx(
|
|
1140
|
+
children: /* @__PURE__ */ jsx(Box, { sx: { display: "flex", cursor: "pointer", width: avatarSize, height: avatarSize }, onClick: click, children: /* @__PURE__ */ jsx(
|
|
1132
1141
|
Avatar,
|
|
1133
1142
|
{
|
|
1134
1143
|
did: user == null ? void 0 : user.did,
|
|
@@ -1137,14 +1146,15 @@ function AuthorInfo({
|
|
|
1137
1146
|
shape: "circle",
|
|
1138
1147
|
variant: "circle",
|
|
1139
1148
|
sx: {
|
|
1140
|
-
width:
|
|
1149
|
+
width: "100%",
|
|
1150
|
+
height: "100%"
|
|
1141
1151
|
}
|
|
1142
1152
|
}
|
|
1143
1153
|
) })
|
|
1144
1154
|
}
|
|
1145
1155
|
);
|
|
1146
1156
|
}
|
|
1147
|
-
return /* @__PURE__ */ jsx(
|
|
1157
|
+
return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", cursor: "pointer", width: avatarSize, height: avatarSize }, onClick: click, children: /* @__PURE__ */ jsx(
|
|
1148
1158
|
Avatar,
|
|
1149
1159
|
{
|
|
1150
1160
|
did: user == null ? void 0 : user.did,
|
|
@@ -1153,10 +1163,11 @@ function AuthorInfo({
|
|
|
1153
1163
|
shape: "circle",
|
|
1154
1164
|
variant: "circle",
|
|
1155
1165
|
sx: {
|
|
1156
|
-
width:
|
|
1166
|
+
width: "100%",
|
|
1167
|
+
height: "100%"
|
|
1157
1168
|
}
|
|
1158
1169
|
}
|
|
1159
|
-
);
|
|
1170
|
+
) });
|
|
1160
1171
|
};
|
|
1161
1172
|
const BadgeRender = /* @__PURE__ */ jsx(
|
|
1162
1173
|
Badge,
|
|
@@ -1187,7 +1198,8 @@ function AuthorInfo({
|
|
|
1187
1198
|
}
|
|
1188
1199
|
),
|
|
1189
1200
|
showBadge && downMd && /* @__PURE__ */ jsx(Box, { mt: 0.5, children: BadgeRender }),
|
|
1190
|
-
showDID && !(responsive && downMd) && /* @__PURE__ */ jsx(DID, { style: { lineHeight: 1.
|
|
1201
|
+
showDID && !(responsive && downMd) && /* @__PURE__ */ jsx(DID, { style: { lineHeight: 1.5, minHeight: 20, maxWidth: 250 }, size: 14, did: user == null ? void 0 : user.did }),
|
|
1202
|
+
children && /* @__PURE__ */ jsx(Box, { children })
|
|
1191
1203
|
] })
|
|
1192
1204
|
] });
|
|
1193
1205
|
}
|
|
@@ -1200,7 +1212,7 @@ function SystemUser({
|
|
|
1200
1212
|
...rest
|
|
1201
1213
|
}) {
|
|
1202
1214
|
const sm = size === "sm";
|
|
1203
|
-
const iconSize = sm ?
|
|
1215
|
+
const iconSize = sm ? 40 : 48;
|
|
1204
1216
|
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize: 14 }, ...rest, children: [
|
|
1205
1217
|
showIcon && /* @__PURE__ */ jsx(
|
|
1206
1218
|
Box,
|
|
@@ -1211,6 +1223,7 @@ function SystemUser({
|
|
|
1211
1223
|
alignItems: "center",
|
|
1212
1224
|
width: iconSize,
|
|
1213
1225
|
height: iconSize,
|
|
1226
|
+
p: 1,
|
|
1214
1227
|
color: "#fff",
|
|
1215
1228
|
bgcolor: "secondary.main",
|
|
1216
1229
|
borderRadius: "100%"
|
|
@@ -1219,49 +1232,14 @@ function SystemUser({
|
|
|
1219
1232
|
}
|
|
1220
1233
|
),
|
|
1221
1234
|
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
1222
|
-
/* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1, children: /* @__PURE__ */ jsx(Box, { component: "span", sx: { fontWeight: "bold" }, children: name }) }),
|
|
1223
|
-
showDidAddress && /* @__PURE__ */ jsx(
|
|
1224
|
-
|
|
1225
|
-
] });
|
|
1226
|
-
}
|
|
1227
|
-
function ChannelGroup({ size = "normal", chat, ...rest }) {
|
|
1228
|
-
var _a2;
|
|
1229
|
-
const sm = size === "sm";
|
|
1230
|
-
const iconSize = sm ? 36 : 40;
|
|
1231
|
-
const lastMessage = chat && chat.messages && chat.messages[chat.messages.length - 1];
|
|
1232
|
-
const messageText = lastMessage ? `${(_a2 = lastMessage == null ? void 0 : lastMessage.sender) == null ? void 0 : _a2.fullName}: ${getExcerptFromLexicalContent(lastMessage == null ? void 0 : lastMessage.content)}` : "";
|
|
1233
|
-
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize: 14 }, ...rest, children: [
|
|
1234
|
-
/* @__PURE__ */ jsx(
|
|
1235
|
-
Box,
|
|
1236
|
-
{
|
|
1237
|
-
sx: {
|
|
1238
|
-
display: "flex",
|
|
1239
|
-
justifyContent: "center",
|
|
1240
|
-
alignItems: "center",
|
|
1241
|
-
width: iconSize,
|
|
1242
|
-
height: iconSize,
|
|
1243
|
-
color: "#fff",
|
|
1244
|
-
bgcolor: amber[200],
|
|
1245
|
-
borderRadius: "100%"
|
|
1246
|
-
},
|
|
1247
|
-
children: /* @__PURE__ */ jsx(Groups2RoundedIcon, { sx: { fontSize: size === "sm" ? 16 : 18, color: amber[700] } })
|
|
1248
|
-
}
|
|
1249
|
-
),
|
|
1250
|
-
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", height: "100%", justifyContent: "space-between" }, children: [
|
|
1251
|
-
/* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1, children: /* @__PURE__ */ jsx(Box, { component: "span", sx: { fontWeight: "bold" }, children: chat == null ? void 0 : chat.name }) }),
|
|
1252
|
-
/* @__PURE__ */ jsx(
|
|
1253
|
-
Box,
|
|
1235
|
+
/* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1.5, children: /* @__PURE__ */ jsx(Box, { component: "span", sx: { fontWeight: "bold" }, children: name }) }),
|
|
1236
|
+
showDidAddress && /* @__PURE__ */ jsx(
|
|
1237
|
+
DID,
|
|
1254
1238
|
{
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
whiteSpace: "nowrap",
|
|
1260
|
-
width: 220,
|
|
1261
|
-
fontWeight: "regular",
|
|
1262
|
-
fontSize: 14
|
|
1263
|
-
},
|
|
1264
|
-
children: messageText
|
|
1239
|
+
style: { lineHeight: 1.5, minHeight: 20, maxWidth: 200 },
|
|
1240
|
+
size: 14,
|
|
1241
|
+
did: window.blocklet.appId,
|
|
1242
|
+
copyable: false
|
|
1265
1243
|
}
|
|
1266
1244
|
)
|
|
1267
1245
|
] })
|
|
@@ -1404,7 +1382,16 @@ function Menu({ items = [], ...rest }) {
|
|
|
1404
1382
|
return null;
|
|
1405
1383
|
}
|
|
1406
1384
|
return /* @__PURE__ */ jsxs(Box, { display: "inline-block", ...rest, onClick: handleOnClick, children: [
|
|
1407
|
-
/* @__PURE__ */ jsx(
|
|
1385
|
+
/* @__PURE__ */ jsx(
|
|
1386
|
+
IconButton$1,
|
|
1387
|
+
{
|
|
1388
|
+
size: "medium",
|
|
1389
|
+
className: "menu-icon",
|
|
1390
|
+
onClick: handleClick,
|
|
1391
|
+
sx: { p: 1, borderRadius: 1, border: 1, borderColor: "grey.200", height: 32, width: 32 },
|
|
1392
|
+
children: /* @__PURE__ */ jsx(MoreVert, { sx: { fontSize: 18 } })
|
|
1393
|
+
}
|
|
1394
|
+
),
|
|
1408
1395
|
/* @__PURE__ */ jsx(
|
|
1409
1396
|
StyledMuiMenu,
|
|
1410
1397
|
{
|
|
@@ -3515,7 +3502,7 @@ function ChatProvider({ client: client2, activeChatId, children }) {
|
|
|
3515
3502
|
const addParticipant = (chatId, participant) => {
|
|
3516
3503
|
updateChat(chatId, (chat) => ({
|
|
3517
3504
|
...chat,
|
|
3518
|
-
participants: [...chat.participants, participant]
|
|
3505
|
+
participants: uniqBy([...chat.participants, participant], "did")
|
|
3519
3506
|
}));
|
|
3520
3507
|
};
|
|
3521
3508
|
const removeParticipant = (chatId, participant) => {
|
|
@@ -3560,6 +3547,23 @@ function ChatProvider({ client: client2, activeChatId, children }) {
|
|
|
3560
3547
|
addMessage(chatId, saved);
|
|
3561
3548
|
updateLastAckTime(chatId);
|
|
3562
3549
|
};
|
|
3550
|
+
const getLastMessageText = (chat) => {
|
|
3551
|
+
const lastMessage = chat && chat.messages && chat.messages[chat.messages.length - 1];
|
|
3552
|
+
const getPrefix = (sender) => {
|
|
3553
|
+
const isMyselfMessage = sender.did === (currentUser == null ? void 0 : currentUser.did);
|
|
3554
|
+
if (isMyselfMessage || !(sender == null ? void 0 : sender.fullName)) {
|
|
3555
|
+
return "";
|
|
3556
|
+
}
|
|
3557
|
+
return `${sender.fullName}: `;
|
|
3558
|
+
};
|
|
3559
|
+
if (lastMessage) {
|
|
3560
|
+
return `${getPrefix(lastMessage == null ? void 0 : lastMessage.sender)}${getExcerptFromLexicalContent(lastMessage == null ? void 0 : lastMessage.content)}`;
|
|
3561
|
+
}
|
|
3562
|
+
if (chat.lastMessage) {
|
|
3563
|
+
return `${getPrefix(chat.lastMessage.sender)}${chat.lastMessage.excerpt}`;
|
|
3564
|
+
}
|
|
3565
|
+
return "";
|
|
3566
|
+
};
|
|
3563
3567
|
const initChatRoom = async (chatId) => {
|
|
3564
3568
|
const {
|
|
3565
3569
|
chat: { participants },
|
|
@@ -3686,24 +3690,70 @@ function ChatProvider({ client: client2, activeChatId, children }) {
|
|
|
3686
3690
|
deleteMessage,
|
|
3687
3691
|
hasUnreadMessages,
|
|
3688
3692
|
refresh,
|
|
3689
|
-
orderedChats
|
|
3693
|
+
orderedChats,
|
|
3694
|
+
getLastMessageText
|
|
3690
3695
|
};
|
|
3691
3696
|
}, [state, client2, currentUser == null ? void 0 : currentUser.did]);
|
|
3692
3697
|
return /* @__PURE__ */ jsx(ChatContext.Provider, { value, children });
|
|
3693
3698
|
}
|
|
3699
|
+
const tablerUsersGroup = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ 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" }) });
|
|
3700
|
+
function ChannelGroup({ size = "normal", chat, children, ...rest }) {
|
|
3701
|
+
const sm = size === "sm";
|
|
3702
|
+
const iconSize = sm ? 40 : 48;
|
|
3703
|
+
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize: 14 }, ...rest, children: [
|
|
3704
|
+
/* @__PURE__ */ jsx(
|
|
3705
|
+
Box,
|
|
3706
|
+
{
|
|
3707
|
+
sx: {
|
|
3708
|
+
display: "flex",
|
|
3709
|
+
justifyContent: "center",
|
|
3710
|
+
alignItems: "center",
|
|
3711
|
+
color: "#fff",
|
|
3712
|
+
bgcolor: "rgba(254, 244, 199, 1)",
|
|
3713
|
+
width: iconSize,
|
|
3714
|
+
height: iconSize,
|
|
3715
|
+
p: 0.8,
|
|
3716
|
+
borderRadius: "100%"
|
|
3717
|
+
},
|
|
3718
|
+
children: /* @__PURE__ */ jsx(Box, { component: tablerUsersGroup, sx: { fontSize: 16, color: amber[700], width: iconSize } })
|
|
3719
|
+
}
|
|
3720
|
+
),
|
|
3721
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", height: "100%", justifyContent: "space-between" }, children: [
|
|
3722
|
+
/* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1.5, children: /* @__PURE__ */ jsx(Box, { component: "span", sx: { fontWeight: "bold" }, children: chat == null ? void 0 : chat.name }) }),
|
|
3723
|
+
children && /* @__PURE__ */ jsx(Box, { children })
|
|
3724
|
+
] })
|
|
3725
|
+
] });
|
|
3726
|
+
}
|
|
3694
3727
|
function ChatList(props) {
|
|
3695
3728
|
const { t } = useLocaleContext();
|
|
3696
|
-
const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages } = useChatContext();
|
|
3729
|
+
const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages, getLastMessageText } = useChatContext();
|
|
3697
3730
|
const renderItem = (chat) => {
|
|
3698
3731
|
if (chat.type === "notification") {
|
|
3699
3732
|
return /* @__PURE__ */ jsx(SystemUser, { name: t("chat.notification") });
|
|
3700
3733
|
}
|
|
3734
|
+
const latestMessageText = getLastMessageText(chat);
|
|
3735
|
+
const latestMessageTextContent = latestMessageText && /* @__PURE__ */ jsx(
|
|
3736
|
+
Box,
|
|
3737
|
+
{
|
|
3738
|
+
className: "message-content-text",
|
|
3739
|
+
sx: {
|
|
3740
|
+
overflow: "hidden",
|
|
3741
|
+
textOverflow: "ellipsis",
|
|
3742
|
+
whiteSpace: "nowrap",
|
|
3743
|
+
width: 220,
|
|
3744
|
+
fontWeight: "regular",
|
|
3745
|
+
fontSize: 14,
|
|
3746
|
+
lineHeight: 1.5
|
|
3747
|
+
},
|
|
3748
|
+
children: latestMessageText
|
|
3749
|
+
}
|
|
3750
|
+
);
|
|
3701
3751
|
if (chat.type === "dm") {
|
|
3702
3752
|
const oppositeUser = getOppositeUser(chat);
|
|
3703
|
-
return /* @__PURE__ */ jsx(AuthorInfo, { user: oppositeUser, showProfileCard: false, showBadge: false, showDID: false });
|
|
3753
|
+
return /* @__PURE__ */ jsx(AuthorInfo, { user: oppositeUser, showProfileCard: false, showBadge: false, showDID: false, children: latestMessageTextContent });
|
|
3704
3754
|
}
|
|
3705
3755
|
if (chat.type === "channel") {
|
|
3706
|
-
return /* @__PURE__ */ jsx(
|
|
3756
|
+
return /* @__PURE__ */ jsx(ChannelGroup, { chat, children: latestMessageTextContent });
|
|
3707
3757
|
}
|
|
3708
3758
|
return null;
|
|
3709
3759
|
};
|
|
@@ -3724,8 +3774,8 @@ function ChatList(props) {
|
|
|
3724
3774
|
borderRadius: 1,
|
|
3725
3775
|
cursor: "pointer",
|
|
3726
3776
|
...isActiveChat && {
|
|
3727
|
-
".did-address-text": { color:
|
|
3728
|
-
".message-content-text": { color:
|
|
3777
|
+
".did-address-text": { color: `${grey$1[500]} !important` },
|
|
3778
|
+
".message-content-text": { color: `${grey$1[500]}` }
|
|
3729
3779
|
}
|
|
3730
3780
|
},
|
|
3731
3781
|
onClick: () => setActiveChat(chat),
|
|
@@ -3751,8 +3801,25 @@ function ChatList(props) {
|
|
|
3751
3801
|
) }, chat.id);
|
|
3752
3802
|
}) }) });
|
|
3753
3803
|
}
|
|
3754
|
-
|
|
3755
|
-
|
|
3804
|
+
const tablerUsersPlus = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ 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" }) });
|
|
3805
|
+
const Time = ({ createdAt }) => {
|
|
3806
|
+
if (!createdAt) {
|
|
3807
|
+
return null;
|
|
3808
|
+
}
|
|
3809
|
+
const messageTime = typeof createdAt === "string" ? new Date(createdAt) : createdAt;
|
|
3810
|
+
const now = /* @__PURE__ */ new Date();
|
|
3811
|
+
const diffInMilliseconds = now.getTime() - messageTime.getTime();
|
|
3812
|
+
const diffInDays = diffInMilliseconds / (1e3 * 60 * 60 * 24);
|
|
3813
|
+
const isWithinSevenDays = diffInDays <= 3;
|
|
3814
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Box, { sx: { display: "inline-block", fontSize: 12, color: "grey.500", ml: 3 }, children: isWithinSevenDays ? /* @__PURE__ */ jsx(RelativeTime, { value: createdAt }) : dayjs(messageTime).format("YYYY-MM-DD HH:mm") }) });
|
|
3815
|
+
};
|
|
3816
|
+
const baseItemSx = {
|
|
3817
|
+
px: 1.25,
|
|
3818
|
+
py: 1,
|
|
3819
|
+
transition: "all 120ms linear"
|
|
3820
|
+
};
|
|
3821
|
+
function Message({ message, prevMessage, showTime = true, ...rest }) {
|
|
3822
|
+
var _a2, _b2;
|
|
3756
3823
|
const { t } = useLocaleContext();
|
|
3757
3824
|
const { session, isAdmin } = useSessionContext();
|
|
3758
3825
|
const { confirm } = useConfirm();
|
|
@@ -3771,34 +3838,73 @@ function Message({ message, showTime = true, ...rest }) {
|
|
|
3771
3838
|
};
|
|
3772
3839
|
const menuItems = [];
|
|
3773
3840
|
const isSender = message.sender.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
|
|
3841
|
+
const messageDate = new Date(message.createdAt);
|
|
3842
|
+
const prevMessageDate = prevMessage ? new Date(prevMessage.createdAt) : /* @__PURE__ */ new Date(0);
|
|
3843
|
+
const messageInterval = messageDate.getTime() - prevMessageDate.getTime();
|
|
3844
|
+
const isSameUser = message.sender.did === ((_b2 = prevMessage == null ? void 0 : prevMessage.sender) == null ? void 0 : _b2.did);
|
|
3774
3845
|
if (isSender || isAdmin) {
|
|
3775
3846
|
menuItems.push(
|
|
3776
3847
|
/* @__PURE__ */ jsx(MuiMenuItem, { onClick: handleDeleteMessage, children: /* @__PURE__ */ jsx(Box, { component: "span", sx: { color: "error.main" }, children: t("delete") }) }, "delete")
|
|
3777
3848
|
);
|
|
3778
3849
|
}
|
|
3850
|
+
const compactMessage = messageInterval <= 6e4 && isSameUser;
|
|
3779
3851
|
return /* @__PURE__ */ jsxs(
|
|
3780
3852
|
Box,
|
|
3781
3853
|
{
|
|
3782
3854
|
...rest,
|
|
3783
3855
|
sx: {
|
|
3856
|
+
...baseItemSx,
|
|
3784
3857
|
position: "relative",
|
|
3785
|
-
px: 2,
|
|
3786
|
-
py: 1,
|
|
3787
3858
|
fontSize: 14,
|
|
3788
|
-
|
|
3859
|
+
borderRadius: 1,
|
|
3860
|
+
"&:hover": {
|
|
3861
|
+
bgcolor: "white",
|
|
3862
|
+
".message-menu": {
|
|
3863
|
+
display: "flex !important"
|
|
3864
|
+
}
|
|
3865
|
+
},
|
|
3866
|
+
...{
|
|
3867
|
+
".be-editable": {
|
|
3868
|
+
"& > *:last-child": {
|
|
3869
|
+
marginBottom: "0em !important"
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3789
3873
|
},
|
|
3790
3874
|
children: [
|
|
3791
|
-
/* @__PURE__ */ jsx(
|
|
3792
|
-
|
|
3793
|
-
|
|
3875
|
+
/* @__PURE__ */ jsx(
|
|
3876
|
+
Menu,
|
|
3877
|
+
{
|
|
3878
|
+
items: menuItems,
|
|
3879
|
+
className: "message-menu",
|
|
3880
|
+
style: {
|
|
3881
|
+
position: "absolute",
|
|
3882
|
+
right: 12,
|
|
3883
|
+
top: 0,
|
|
3884
|
+
bottom: 0,
|
|
3885
|
+
alignItems: "center",
|
|
3886
|
+
display: "none"
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
),
|
|
3890
|
+
!compactMessage && /* @__PURE__ */ jsx(
|
|
3891
|
+
AuthorInfo,
|
|
3892
|
+
{
|
|
3893
|
+
showProfileCard: true,
|
|
3894
|
+
user: message.sender,
|
|
3895
|
+
createdAt: showTime ? message.createdAt : void 0,
|
|
3896
|
+
size: "sm"
|
|
3897
|
+
}
|
|
3898
|
+
),
|
|
3899
|
+
/* @__PURE__ */ jsx(Box, { sx: { ml: 6, width: "90%" }, children: /* @__PURE__ */ jsx(PostContent, { content: message.content }) })
|
|
3794
3900
|
]
|
|
3795
3901
|
}
|
|
3796
3902
|
);
|
|
3797
3903
|
}
|
|
3798
|
-
function NotificationMessage({ chat, message, prevMessage
|
|
3904
|
+
function NotificationMessage({ chat, message, prevMessage }) {
|
|
3799
3905
|
const { session } = useSessionContext();
|
|
3800
3906
|
const { t } = useLocaleContext();
|
|
3801
|
-
const renderQuote = ({ title,
|
|
3907
|
+
const renderQuote = ({ title, cover }) => {
|
|
3802
3908
|
if ("post" in message) {
|
|
3803
3909
|
return /* @__PURE__ */ jsxs(Box, { sx: { color: 14, mt: 1 }, children: [
|
|
3804
3910
|
title && /* @__PURE__ */ jsx(
|
|
@@ -3837,25 +3943,44 @@ function NotificationMessage({ chat, message, prevMessage, ...rest }) {
|
|
|
3837
3943
|
};
|
|
3838
3944
|
const render = () => {
|
|
3839
3945
|
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
3946
|
+
const baseCardSx = {
|
|
3947
|
+
py: 1.5,
|
|
3948
|
+
px: 2,
|
|
3949
|
+
background: "#fff",
|
|
3950
|
+
width: "fit-content",
|
|
3951
|
+
maxWidth: "calc(100% - 16px)",
|
|
3952
|
+
wordWrap: "break-word",
|
|
3953
|
+
borderRadius: 1,
|
|
3954
|
+
transition: "all 120ms linear"
|
|
3955
|
+
};
|
|
3840
3956
|
if (message.type === "post_create") {
|
|
3841
3957
|
return /* @__PURE__ */ jsxs(
|
|
3842
3958
|
Box,
|
|
3843
3959
|
{
|
|
3844
3960
|
sx: {
|
|
3845
|
-
|
|
3846
|
-
px: 2,
|
|
3847
|
-
background: "#fff",
|
|
3848
|
-
width: "fit-content",
|
|
3849
|
-
maxWidth: "calc(100% - 16px)",
|
|
3850
|
-
wordWrap: "break-word",
|
|
3851
|
-
borderRadius: 1
|
|
3961
|
+
...baseCardSx
|
|
3852
3962
|
},
|
|
3853
3963
|
children: [
|
|
3854
|
-
/* @__PURE__ */ jsxs(
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3964
|
+
/* @__PURE__ */ 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__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
3976
|
+
/* @__PURE__ */ jsx(Icon, { icon: "tabler:news", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
3977
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
3978
|
+
/* @__PURE__ */ jsx("span", { children: t("chat.newPost") })
|
|
3979
|
+
] }),
|
|
3980
|
+
/* @__PURE__ */ jsx(Time, { createdAt: message.createdAt })
|
|
3981
|
+
]
|
|
3982
|
+
}
|
|
3983
|
+
),
|
|
3859
3984
|
renderQuote(message.post)
|
|
3860
3985
|
]
|
|
3861
3986
|
}
|
|
@@ -3866,20 +3991,29 @@ function NotificationMessage({ chat, message, prevMessage, ...rest }) {
|
|
|
3866
3991
|
Box,
|
|
3867
3992
|
{
|
|
3868
3993
|
sx: {
|
|
3869
|
-
|
|
3870
|
-
px: 2,
|
|
3871
|
-
background: "#fff",
|
|
3872
|
-
width: "fit-content",
|
|
3873
|
-
maxWidth: "calc(100% - 16px)",
|
|
3874
|
-
wordWrap: "break-word",
|
|
3875
|
-
borderRadius: 1
|
|
3994
|
+
...baseCardSx
|
|
3876
3995
|
},
|
|
3877
3996
|
children: [
|
|
3878
|
-
/* @__PURE__ */ jsxs(
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3997
|
+
/* @__PURE__ */ jsxs(
|
|
3998
|
+
Box,
|
|
3999
|
+
{
|
|
4000
|
+
sx: {
|
|
4001
|
+
display: "flex",
|
|
4002
|
+
flexDirection: "row",
|
|
4003
|
+
justifyContent: "space-between",
|
|
4004
|
+
alignItems: "center",
|
|
4005
|
+
color: "primary.light"
|
|
4006
|
+
},
|
|
4007
|
+
children: [
|
|
4008
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4009
|
+
/* @__PURE__ */ jsx(Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4010
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4011
|
+
/* @__PURE__ */ 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") })
|
|
4012
|
+
] }),
|
|
4013
|
+
/* @__PURE__ */ jsx(Time, { createdAt: message.createdAt })
|
|
4014
|
+
]
|
|
4015
|
+
}
|
|
4016
|
+
),
|
|
3883
4017
|
/* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: (_c = message == null ? void 0 : message.comment) == null ? void 0 : _c.excerpt }),
|
|
3884
4018
|
renderQuote(message.post)
|
|
3885
4019
|
]
|
|
@@ -3891,21 +4025,30 @@ function NotificationMessage({ chat, message, prevMessage, ...rest }) {
|
|
|
3891
4025
|
Box,
|
|
3892
4026
|
{
|
|
3893
4027
|
sx: {
|
|
3894
|
-
|
|
3895
|
-
px: 2,
|
|
3896
|
-
background: "#fff",
|
|
3897
|
-
width: "fit-content",
|
|
3898
|
-
maxWidth: "calc(100% - 16px)",
|
|
3899
|
-
wordWrap: "break-word",
|
|
3900
|
-
borderRadius: 1
|
|
4028
|
+
...baseCardSx
|
|
3901
4029
|
},
|
|
3902
4030
|
children: [
|
|
3903
|
-
/* @__PURE__ */ jsxs(
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
4031
|
+
/* @__PURE__ */ jsxs(
|
|
4032
|
+
Box,
|
|
4033
|
+
{
|
|
4034
|
+
sx: {
|
|
4035
|
+
display: "flex",
|
|
4036
|
+
flexDirection: "row",
|
|
4037
|
+
justifyContent: "space-between",
|
|
4038
|
+
alignItems: "center",
|
|
4039
|
+
color: "primary.light"
|
|
4040
|
+
},
|
|
4041
|
+
children: [
|
|
4042
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4043
|
+
/* @__PURE__ */ jsx(Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4044
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4045
|
+
/* @__PURE__ */ 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") })
|
|
4046
|
+
] }),
|
|
4047
|
+
/* @__PURE__ */ jsx(Time, { createdAt: message.createdAt })
|
|
4048
|
+
]
|
|
4049
|
+
}
|
|
4050
|
+
),
|
|
4051
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { fontSize: 16 }, children: message.reply.excerpt }),
|
|
3909
4052
|
renderQuote({ title: message.post.title, excerpt: message.comment.excerpt })
|
|
3910
4053
|
]
|
|
3911
4054
|
}
|
|
@@ -3916,23 +4059,32 @@ function NotificationMessage({ chat, message, prevMessage, ...rest }) {
|
|
|
3916
4059
|
Box,
|
|
3917
4060
|
{
|
|
3918
4061
|
sx: {
|
|
3919
|
-
|
|
3920
|
-
px: 2,
|
|
3921
|
-
background: "#fff",
|
|
3922
|
-
width: "fit-content",
|
|
3923
|
-
maxWidth: "calc(100% - 16px)",
|
|
3924
|
-
wordWrap: "break-word",
|
|
3925
|
-
borderRadius: 1
|
|
4062
|
+
...baseCardSx
|
|
3926
4063
|
},
|
|
3927
4064
|
children: [
|
|
3928
|
-
/* @__PURE__ */ jsxs(
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
4065
|
+
/* @__PURE__ */ jsxs(
|
|
4066
|
+
Box,
|
|
4067
|
+
{
|
|
4068
|
+
sx: {
|
|
4069
|
+
display: "flex",
|
|
4070
|
+
flexDirection: "row",
|
|
4071
|
+
justifyContent: "space-between",
|
|
4072
|
+
alignItems: "center",
|
|
4073
|
+
color: "primary.light"
|
|
4074
|
+
},
|
|
4075
|
+
children: [
|
|
4076
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4077
|
+
/* @__PURE__ */ jsx(Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4078
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4079
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4080
|
+
" ",
|
|
4081
|
+
t("chat.mentionInComment")
|
|
4082
|
+
] })
|
|
4083
|
+
] }),
|
|
4084
|
+
/* @__PURE__ */ jsx(Time, { createdAt: message.createdAt })
|
|
4085
|
+
]
|
|
4086
|
+
}
|
|
4087
|
+
),
|
|
3936
4088
|
/* @__PURE__ */ 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, "") }),
|
|
3937
4089
|
renderQuote(message.post)
|
|
3938
4090
|
]
|
|
@@ -3944,20 +4096,29 @@ function NotificationMessage({ chat, message, prevMessage, ...rest }) {
|
|
|
3944
4096
|
Box,
|
|
3945
4097
|
{
|
|
3946
4098
|
sx: {
|
|
3947
|
-
|
|
3948
|
-
px: 2,
|
|
3949
|
-
borderRadius: 1,
|
|
3950
|
-
background: "#fff",
|
|
3951
|
-
width: "fit-content",
|
|
3952
|
-
maxWidth: "calc(100% - 16px)",
|
|
3953
|
-
wordWrap: "break-word"
|
|
4099
|
+
...baseCardSx
|
|
3954
4100
|
},
|
|
3955
4101
|
children: [
|
|
3956
|
-
/* @__PURE__ */ jsxs(
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
4102
|
+
/* @__PURE__ */ jsxs(
|
|
4103
|
+
Box,
|
|
4104
|
+
{
|
|
4105
|
+
sx: {
|
|
4106
|
+
display: "flex",
|
|
4107
|
+
flexDirection: "row",
|
|
4108
|
+
justifyContent: "space-between",
|
|
4109
|
+
alignItems: "center",
|
|
4110
|
+
color: "primary.light"
|
|
4111
|
+
},
|
|
4112
|
+
children: [
|
|
4113
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4114
|
+
/* @__PURE__ */ jsx(Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4115
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4116
|
+
/* @__PURE__ */ jsx("span", { children: t("chat.mentionInPost") })
|
|
4117
|
+
] }),
|
|
4118
|
+
/* @__PURE__ */ jsx(Time, { createdAt: message.createdAt })
|
|
4119
|
+
]
|
|
4120
|
+
}
|
|
4121
|
+
),
|
|
3961
4122
|
renderQuote(message.post)
|
|
3962
4123
|
]
|
|
3963
4124
|
}
|
|
@@ -3985,20 +4146,29 @@ function NotificationMessage({ chat, message, prevMessage, ...rest }) {
|
|
|
3985
4146
|
Box,
|
|
3986
4147
|
{
|
|
3987
4148
|
sx: {
|
|
3988
|
-
|
|
3989
|
-
px: 2,
|
|
3990
|
-
borderRadius: 1,
|
|
3991
|
-
background: "#fff",
|
|
3992
|
-
width: "fit-content",
|
|
3993
|
-
maxWidth: "calc(100% - 16px)",
|
|
3994
|
-
wordWrap: "break-word"
|
|
4149
|
+
...baseCardSx
|
|
3995
4150
|
},
|
|
3996
4151
|
children: [
|
|
3997
|
-
/* @__PURE__ */ jsxs(
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4152
|
+
/* @__PURE__ */ jsxs(
|
|
4153
|
+
Box,
|
|
4154
|
+
{
|
|
4155
|
+
sx: {
|
|
4156
|
+
display: "flex",
|
|
4157
|
+
flexDirection: "row",
|
|
4158
|
+
justifyContent: "space-between",
|
|
4159
|
+
alignItems: "center",
|
|
4160
|
+
color: "primary.light"
|
|
4161
|
+
},
|
|
4162
|
+
children: [
|
|
4163
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4164
|
+
/* @__PURE__ */ jsx(Icon, { icon: "tabler:arrow-forward-up", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4165
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4166
|
+
/* @__PURE__ */ jsx("span", { children: titles[message.subtype] })
|
|
4167
|
+
] }),
|
|
4168
|
+
/* @__PURE__ */ jsx(Time, { createdAt: message.createdAt })
|
|
4169
|
+
]
|
|
4170
|
+
}
|
|
4171
|
+
),
|
|
4002
4172
|
renderQuote(message.post)
|
|
4003
4173
|
]
|
|
4004
4174
|
}
|
|
@@ -4006,11 +4176,7 @@ function NotificationMessage({ chat, message, prevMessage, ...rest }) {
|
|
|
4006
4176
|
}
|
|
4007
4177
|
return /* @__PURE__ */ jsx(Message, { message, showTime: false });
|
|
4008
4178
|
};
|
|
4009
|
-
|
|
4010
|
-
return /* @__PURE__ */ jsxs(Box, { ...rest, sx: { mt: 2 }, children: [
|
|
4011
|
-
messageInterval > 6e4 && /* @__PURE__ */ jsx(Box, { sx: { my: 2, textAlign: "center" }, children: /* @__PURE__ */ 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") }) }),
|
|
4012
|
-
/* @__PURE__ */ jsx(Box, { sx: { p: 2, fontSize: 14, "&:hover": { bgcolor: "grey.50" } }, children: render() })
|
|
4013
|
-
] });
|
|
4179
|
+
return /* @__PURE__ */ jsx(Box, { sx: { ...baseItemSx, fontSize: 14 }, children: render() });
|
|
4014
4180
|
}
|
|
4015
4181
|
const checkIsAtBottom = (element) => {
|
|
4016
4182
|
return element && (element.scrollHeight === 0 || element.scrollHeight - element.scrollTop < element.clientHeight + 60);
|
|
@@ -4018,6 +4184,7 @@ const checkIsAtBottom = (element) => {
|
|
|
4018
4184
|
function MessageList({ chat, ...rest }) {
|
|
4019
4185
|
var _a2, _b2;
|
|
4020
4186
|
const { isActiveChat, loadMessages } = useChatContext();
|
|
4187
|
+
const { t } = useLocaleContext();
|
|
4021
4188
|
const isActive = isActiveChat(chat.id);
|
|
4022
4189
|
const containerRef = useRef(null);
|
|
4023
4190
|
const [isAtBottom, setIsAtBottom] = useState(true);
|
|
@@ -4046,34 +4213,56 @@ function MessageList({ chat, ...rest }) {
|
|
|
4046
4213
|
setIsAtBottom(checkIsAtBottom(containerRef.current));
|
|
4047
4214
|
}
|
|
4048
4215
|
}, [isActive]);
|
|
4049
|
-
return /* @__PURE__ */ jsxs(Box, { ...rest, sx: { position: "relative", height: "100%"
|
|
4050
|
-
/* @__PURE__ */ jsxs(
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
{
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4216
|
+
return /* @__PURE__ */ jsxs(Box, { ...rest, sx: { position: "relative", height: "100%" }, children: [
|
|
4217
|
+
/* @__PURE__ */ jsxs(
|
|
4218
|
+
Box,
|
|
4219
|
+
{
|
|
4220
|
+
sx: {
|
|
4221
|
+
height: "100%",
|
|
4222
|
+
overflowY: "auto",
|
|
4223
|
+
display: "flex",
|
|
4224
|
+
flexDirection: "column",
|
|
4225
|
+
py: 2.5,
|
|
4226
|
+
px: 1.25,
|
|
4227
|
+
gap: 1,
|
|
4228
|
+
background: "rgba(249, 250, 251, 1)"
|
|
4229
|
+
},
|
|
4230
|
+
ref: containerRef,
|
|
4231
|
+
children: [
|
|
4232
|
+
chat.nextCursor && /* @__PURE__ */ jsx(Box, { id: "next-cursor", sx: { display: "flex", justifyContent: "center", py: 0.5 }, children: /* @__PURE__ */ jsx(
|
|
4233
|
+
Button,
|
|
4234
|
+
{
|
|
4235
|
+
variant: "text",
|
|
4236
|
+
color: "inherit",
|
|
4237
|
+
onClick: async () => {
|
|
4238
|
+
var _a3;
|
|
4239
|
+
(_a3 = document.getElementById("next-cursor")) == null ? void 0 : _a3.scrollIntoView();
|
|
4240
|
+
await loadMessages(chat.id, chat.nextCursor);
|
|
4241
|
+
},
|
|
4242
|
+
startIcon: /* @__PURE__ */ jsx(ArrowUpward, {}),
|
|
4243
|
+
children: t("chat.loadMore")
|
|
4244
|
+
}
|
|
4245
|
+
) }),
|
|
4246
|
+
chat.type !== "notification" && ((_a2 = chat.messages) == null ? void 0 : _a2.map((message, index) => {
|
|
4247
|
+
var _a3;
|
|
4248
|
+
const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
|
|
4249
|
+
return /* @__PURE__ */ jsx(Box, { id: message.id, children: /* @__PURE__ */ jsx(Message, { message, prevMessage: prev }) }, message.id);
|
|
4250
|
+
})),
|
|
4251
|
+
chat.type === "notification" && ((_b2 = chat.messages) == null ? void 0 : _b2.map((message, index) => {
|
|
4252
|
+
var _a3;
|
|
4253
|
+
const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
|
|
4254
|
+
return /* @__PURE__ */ jsx(Box, { id: message.id, children: /* @__PURE__ */ jsx(
|
|
4255
|
+
NotificationMessage,
|
|
4256
|
+
{
|
|
4257
|
+
chat,
|
|
4258
|
+
message,
|
|
4259
|
+
prevMessage: prev
|
|
4260
|
+
}
|
|
4261
|
+
) }, message.id);
|
|
4262
|
+
}))
|
|
4263
|
+
]
|
|
4264
|
+
}
|
|
4265
|
+
),
|
|
4077
4266
|
!isAtBottom && /* @__PURE__ */ jsx(Box, { sx: { position: "absolute", bottom: 16, right: 24 }, onClick: scrollToBottom, children: /* @__PURE__ */ jsx(Fab, { color: "inherit", sx: { width: { xs: 36, sm: 44 }, height: { xs: 36, sm: 44 } }, children: /* @__PURE__ */ jsx(ArrowDownward, {}) }) })
|
|
4078
4267
|
] });
|
|
4079
4268
|
}
|
|
@@ -4106,7 +4295,10 @@ function Participants({ users, sx, ...rest }) {
|
|
|
4106
4295
|
p: 0.5,
|
|
4107
4296
|
pr: 1,
|
|
4108
4297
|
border: 1,
|
|
4109
|
-
borderColor: "grey.300"
|
|
4298
|
+
borderColor: "grey.300",
|
|
4299
|
+
".MuiAvatarGroup-root": {
|
|
4300
|
+
height: 24
|
|
4301
|
+
}
|
|
4110
4302
|
},
|
|
4111
4303
|
...Array.isArray(sx) ? sx : [sx]
|
|
4112
4304
|
];
|
|
@@ -4123,8 +4315,8 @@ function Participants({ users, sx, ...rest }) {
|
|
|
4123
4315
|
disableTouchListener: true,
|
|
4124
4316
|
title: /* @__PURE__ */ jsx(Fragment, { children: users.map((item, i) => /* @__PURE__ */ jsx(Box$1, { sx: { p: 1 }, children: /* @__PURE__ */ jsx(AuthorInfo, { user: item, size: "sm" }) }, i)) }),
|
|
4125
4317
|
children: /* @__PURE__ */ jsxs(Button$1, { ...rest, sx: mergedSx, onClick: handleTooltipOpen, children: [
|
|
4126
|
-
/* @__PURE__ */ jsx(Avatars, { users: visibleUsers }),
|
|
4127
|
-
/* @__PURE__ */ jsx(Box$1, { sx: { fontSize:
|
|
4318
|
+
/* @__PURE__ */ jsx(Avatars, { users: visibleUsers, max: 5 }),
|
|
4319
|
+
/* @__PURE__ */ jsx(Box$1, { sx: { fontSize: 12, fontWeight: "bold", color: "grey.600" }, children: users.length })
|
|
4128
4320
|
] })
|
|
4129
4321
|
}
|
|
4130
4322
|
) }) });
|
|
@@ -4174,6 +4366,18 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
|
4174
4366
|
}
|
|
4175
4367
|
);
|
|
4176
4368
|
}
|
|
4369
|
+
function getLineClamp(count) {
|
|
4370
|
+
return {
|
|
4371
|
+
display: "-webkit-box",
|
|
4372
|
+
WebkitLineClamp: count,
|
|
4373
|
+
WebkitBoxOrient: "vertical",
|
|
4374
|
+
overflow: "hidden",
|
|
4375
|
+
lineHeight: 1.5
|
|
4376
|
+
};
|
|
4377
|
+
}
|
|
4378
|
+
function RoomTitle({ title }) {
|
|
4379
|
+
return /* @__PURE__ */ jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "medium" }, children: title });
|
|
4380
|
+
}
|
|
4177
4381
|
function ChatRoom({ chat, ...rest }) {
|
|
4178
4382
|
var _a2;
|
|
4179
4383
|
const { t } = useLocaleContext();
|
|
@@ -4201,11 +4405,11 @@ function ChatRoom({ chat, ...rest }) {
|
|
|
4201
4405
|
};
|
|
4202
4406
|
const renderRoomHeader = () => {
|
|
4203
4407
|
if (chat.type === "notification") {
|
|
4204
|
-
return /* @__PURE__ */ jsx(
|
|
4408
|
+
return /* @__PURE__ */ jsx(RoomTitle, { title: t("chat.notification") });
|
|
4205
4409
|
}
|
|
4206
4410
|
if (chat.type === "dm") {
|
|
4207
4411
|
const oppositeUser = getOppositeUser(chat);
|
|
4208
|
-
return /* @__PURE__ */ jsx(
|
|
4412
|
+
return /* @__PURE__ */ jsx(RoomTitle, { title: oppositeUser.fullName });
|
|
4209
4413
|
}
|
|
4210
4414
|
if (chat.type === "channel") {
|
|
4211
4415
|
const menuItems = [];
|
|
@@ -4221,11 +4425,20 @@ function ChatRoom({ chat, ...rest }) {
|
|
|
4221
4425
|
}
|
|
4222
4426
|
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", width: 1, flex: 1 }, children: [
|
|
4223
4427
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
4224
|
-
/* @__PURE__ */ jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "bold", color: "grey.700" }, children: chat.name }),
|
|
4225
|
-
/* @__PURE__ */ jsx(Box, { sx: { fontSize: 12, color: "grey.500" }, children: chat.description })
|
|
4428
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "bold", color: "grey.700", ...getLineClamp(1) }, children: chat.name }),
|
|
4429
|
+
/* @__PURE__ */ jsx(Box, { sx: { fontSize: 12, color: "grey.500", ...getLineClamp(1) }, children: chat.description })
|
|
4226
4430
|
] }),
|
|
4227
4431
|
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
4228
|
-
!chat.hasJoined && /* @__PURE__ */ jsx(
|
|
4432
|
+
!chat.hasJoined && /* @__PURE__ */ jsx(
|
|
4433
|
+
Button,
|
|
4434
|
+
{
|
|
4435
|
+
variant: "contained",
|
|
4436
|
+
color: "primary",
|
|
4437
|
+
onClick: () => joinChannel(chat.id),
|
|
4438
|
+
startIcon: /* @__PURE__ */ jsx(Box, { component: tablerUsersPlus, sx: { fontSize: "16px!important" } }),
|
|
4439
|
+
children: t("chat.joinChannel")
|
|
4440
|
+
}
|
|
4441
|
+
),
|
|
4229
4442
|
chat.hasJoined && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Participants, { users: chat.participants, sx: { border: "none" } }) }),
|
|
4230
4443
|
/* @__PURE__ */ jsx(Menu, { items: menuItems })
|
|
4231
4444
|
] })
|
|
@@ -4244,8 +4457,8 @@ function ChatRoom({ chat, ...rest }) {
|
|
|
4244
4457
|
display: "flex",
|
|
4245
4458
|
alignItems: "center",
|
|
4246
4459
|
flex: "0 0 auto",
|
|
4247
|
-
height:
|
|
4248
|
-
px: 2,
|
|
4460
|
+
height: 52,
|
|
4461
|
+
px: 2.5,
|
|
4249
4462
|
borderBottom: "1px solid #e5e5e5"
|
|
4250
4463
|
},
|
|
4251
4464
|
children: [
|
|
@@ -4261,17 +4474,55 @@ function ChatRoom({ chat, ...rest }) {
|
|
|
4261
4474
|
sx: {
|
|
4262
4475
|
flex: "0 0 auto",
|
|
4263
4476
|
".be-editable": { maxHeight: 200, overflow: "auto" },
|
|
4264
|
-
".be-editable, .be-content": { minHeight: "64px!important" }
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
send: (content) => sendMessage(chat.id, content),
|
|
4270
|
-
placeholder: "Type something...",
|
|
4271
|
-
sendText: "Send",
|
|
4272
|
-
shortcut: "ENTER"
|
|
4477
|
+
".be-editable, .be-content": { minHeight: "64px !important" },
|
|
4478
|
+
".be-shell": {
|
|
4479
|
+
border: "none !important",
|
|
4480
|
+
borderTop: "1px solid #e5e5e5 !important",
|
|
4481
|
+
borderRadius: "0px !important"
|
|
4273
4482
|
}
|
|
4274
|
-
|
|
4483
|
+
},
|
|
4484
|
+
children: /* @__PURE__ */ jsxs(Box, { sx: { position: "relative" }, children: [
|
|
4485
|
+
/* @__PURE__ */ jsx(
|
|
4486
|
+
CommentInput,
|
|
4487
|
+
{
|
|
4488
|
+
send: (content) => sendMessage(chat.id, content),
|
|
4489
|
+
placeholder: t("chat.typeSomething"),
|
|
4490
|
+
sendText: t("chat.reply"),
|
|
4491
|
+
disabledSend: !(chat.type !== "channel" || chat.hasJoined)
|
|
4492
|
+
}
|
|
4493
|
+
),
|
|
4494
|
+
chat.type === "channel" && !chat.hasJoined && /* @__PURE__ */ jsxs(
|
|
4495
|
+
Box,
|
|
4496
|
+
{
|
|
4497
|
+
sx: {
|
|
4498
|
+
position: "absolute",
|
|
4499
|
+
zIndex: 9999999,
|
|
4500
|
+
top: 0,
|
|
4501
|
+
left: 0,
|
|
4502
|
+
right: 0,
|
|
4503
|
+
bottom: 0,
|
|
4504
|
+
bgcolor: "rgba(255, 255, 255, 0.7)",
|
|
4505
|
+
display: "flex",
|
|
4506
|
+
flexDirection: "column",
|
|
4507
|
+
alignItems: "center",
|
|
4508
|
+
justifyContent: "center",
|
|
4509
|
+
color: "#fff"
|
|
4510
|
+
},
|
|
4511
|
+
children: [
|
|
4512
|
+
/* @__PURE__ */ jsx(Box, { sx: { mb: 0.5, fontSize: 18 }, children: "🚪" }),
|
|
4513
|
+
/* @__PURE__ */ jsx(Box, { sx: { color: "primary.main", mb: 0.5, fontSize: 13, fontWeight: 500 }, children: t("chat.notYetJoinedTheChannel") }),
|
|
4514
|
+
/* @__PURE__ */ jsx(
|
|
4515
|
+
Box,
|
|
4516
|
+
{
|
|
4517
|
+
sx: { color: "secondary.main", cursor: "pointer", fontSize: 13 },
|
|
4518
|
+
onClick: () => joinChannel(chat.id),
|
|
4519
|
+
children: t("chat.joinChannel")
|
|
4520
|
+
}
|
|
4521
|
+
)
|
|
4522
|
+
]
|
|
4523
|
+
}
|
|
4524
|
+
)
|
|
4525
|
+
] })
|
|
4275
4526
|
}
|
|
4276
4527
|
)
|
|
4277
4528
|
] });
|
|
@@ -4302,49 +4553,65 @@ function NewChannelDialog({ open, onSubmit, onClose, ...rest }) {
|
|
|
4302
4553
|
] }),
|
|
4303
4554
|
onClose,
|
|
4304
4555
|
...rest,
|
|
4305
|
-
children: /* @__PURE__ */ jsxs(
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
{
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
}
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4556
|
+
children: /* @__PURE__ */ jsxs(
|
|
4557
|
+
Box,
|
|
4558
|
+
{
|
|
4559
|
+
width: { xs: "100%", md: 560 },
|
|
4560
|
+
sx: {
|
|
4561
|
+
display: "flex",
|
|
4562
|
+
flexDirection: "column",
|
|
4563
|
+
gap: 2,
|
|
4564
|
+
lineHeight: 1.75
|
|
4565
|
+
},
|
|
4566
|
+
minHeight: 140,
|
|
4567
|
+
children: [
|
|
4568
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
4569
|
+
/* @__PURE__ */ jsx(Box, { sx: { fontSize: 14, fontWeight: "medium", mb: 0 }, children: t("chat.channelName") }),
|
|
4570
|
+
/* @__PURE__ */ jsx(
|
|
4571
|
+
TextField,
|
|
4572
|
+
{
|
|
4573
|
+
value: state.name,
|
|
4574
|
+
placeholder: t("chat.channelName"),
|
|
4575
|
+
size: "small",
|
|
4576
|
+
fullWidth: true,
|
|
4577
|
+
sx: {
|
|
4578
|
+
"& .MuiInputBase-root": {
|
|
4579
|
+
height: 40,
|
|
4580
|
+
backgroundColor: theme.palette.grey[100]
|
|
4581
|
+
}
|
|
4582
|
+
},
|
|
4583
|
+
onChange: (e) => setState({ name: e.target.value })
|
|
4584
|
+
}
|
|
4585
|
+
)
|
|
4586
|
+
] }),
|
|
4587
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
4588
|
+
/* @__PURE__ */ jsx(Box, { sx: { fontSize: 14, fontWeight: "medium", mb: 0 }, children: t("chat.channelDescription") }),
|
|
4589
|
+
/* @__PURE__ */ jsx(
|
|
4590
|
+
TextField,
|
|
4591
|
+
{
|
|
4592
|
+
value: state.description,
|
|
4593
|
+
placeholder: t("chat.channelDescription"),
|
|
4594
|
+
fullWidth: true,
|
|
4595
|
+
multiline: true,
|
|
4596
|
+
onChange: (e) => setState({ description: e.target.value }),
|
|
4597
|
+
minRows: 2,
|
|
4598
|
+
sx: {
|
|
4599
|
+
"& .MuiInputBase-root": {
|
|
4600
|
+
display: "flex",
|
|
4601
|
+
alignItems: "flex-start",
|
|
4602
|
+
backgroundColor: theme.palette.grey[100]
|
|
4603
|
+
},
|
|
4604
|
+
"& .MuiInputBase-inputMultiline": {
|
|
4605
|
+
maxHeight: "100%",
|
|
4606
|
+
overflowY: "auto"
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
)
|
|
4611
|
+
] })
|
|
4612
|
+
]
|
|
4613
|
+
}
|
|
4614
|
+
)
|
|
4348
4615
|
}
|
|
4349
4616
|
);
|
|
4350
4617
|
}
|
|
@@ -4363,22 +4630,23 @@ function Empty({ sx }) {
|
|
|
4363
4630
|
];
|
|
4364
4631
|
return /* @__PURE__ */ jsxs(Box, { sx: mergedSx, children: [
|
|
4365
4632
|
/* @__PURE__ */ jsx(iconoirChatBubbleEmpty, { style: { fontSize: 32 } }),
|
|
4366
|
-
/* @__PURE__ */ jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight:
|
|
4633
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: 500 }, children: t("chat.noChats") })
|
|
4367
4634
|
] });
|
|
4368
4635
|
}
|
|
4369
4636
|
function Chat({ sx, ...rest }) {
|
|
4637
|
+
var _a2;
|
|
4370
4638
|
const { client: client2, initialized, chats, activeChatId, addChat, setActiveChat, refresh, getOppositeUser } = useChatContext();
|
|
4371
4639
|
const [newChannelVisible, setNewChannelVisible] = useState(false);
|
|
4372
4640
|
const downMd = useMediaQuery((theme) => theme.breakpoints.down("sm"));
|
|
4373
4641
|
const { t } = useLocaleContext();
|
|
4374
|
-
const activeChat = chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)[0];
|
|
4642
|
+
const activeChat = (_a2 = chats == null ? void 0 : chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)) == null ? void 0 : _a2[0];
|
|
4375
4643
|
const webTitleMap = {
|
|
4376
4644
|
dm: () => {
|
|
4377
|
-
var
|
|
4378
|
-
return ((
|
|
4645
|
+
var _a3;
|
|
4646
|
+
return ((_a3 = getOppositeUser(activeChat)) == null ? void 0 : _a3.fullName) || t("chat.unknown");
|
|
4379
4647
|
},
|
|
4380
4648
|
notification: () => t("chat.notification"),
|
|
4381
|
-
channel: () => (activeChat == null ? void 0 : activeChat.type) === "channel" ?
|
|
4649
|
+
channel: () => (activeChat == null ? void 0 : activeChat.type) === "channel" ? `# ${activeChat.name}` : t("chat.unknownChannel"),
|
|
4382
4650
|
default: () => t("chat.chats")
|
|
4383
4651
|
};
|
|
4384
4652
|
const getWebTitle = () => {
|
|
@@ -4433,17 +4701,17 @@ function Chat({ sx, ...rest }) {
|
|
|
4433
4701
|
display: "flex",
|
|
4434
4702
|
justifyContent: "space-between",
|
|
4435
4703
|
alignItems: "center",
|
|
4436
|
-
height:
|
|
4437
|
-
px: 2,
|
|
4704
|
+
height: 52,
|
|
4705
|
+
px: 2.5,
|
|
4438
4706
|
borderBottom: "1px solid #e5e5e5"
|
|
4439
4707
|
},
|
|
4440
4708
|
children: [
|
|
4441
|
-
/* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: /* @__PURE__ */ jsx(Typography, { component: "span", variant: "subtitle1", sx: { fontSize:
|
|
4709
|
+
/* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: /* @__PURE__ */ jsx(Typography, { component: "span", variant: "subtitle1", sx: { fontSize: 14, fontWeight: 500 }, children: t("chat.chats") }) }),
|
|
4442
4710
|
/* @__PURE__ */ jsx(AccessControl, { roles: ["owner", "admin"], children: /* @__PURE__ */ jsx(
|
|
4443
4711
|
IconButton$1,
|
|
4444
4712
|
{
|
|
4445
4713
|
onClick: () => setNewChannelVisible(true),
|
|
4446
|
-
sx: { p: 1, borderRadius: 1, border:
|
|
4714
|
+
sx: { p: 1, borderRadius: 1, border: 1, borderColor: "grey.200", height: 32, width: 32 },
|
|
4447
4715
|
children: /* @__PURE__ */ jsx(Add, { sx: { color: "#000" } })
|
|
4448
4716
|
}
|
|
4449
4717
|
) })
|
|
@@ -4797,7 +5065,7 @@ function Pagination({
|
|
|
4797
5065
|
}
|
|
4798
5066
|
);
|
|
4799
5067
|
}
|
|
4800
|
-
const Editor = lazy(() => import("./editor-
|
|
5068
|
+
const Editor = lazy(() => import("./editor-HUTb7nXS.mjs"));
|
|
4801
5069
|
function LazyEditor(props) {
|
|
4802
5070
|
const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4803
5071
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -4920,6 +5188,7 @@ const en = {
|
|
|
4920
5188
|
sendComment: "Comment",
|
|
4921
5189
|
showMoreReplies: "Show more replies",
|
|
4922
5190
|
all: "All",
|
|
5191
|
+
messages: "Messages",
|
|
4923
5192
|
deleteMessage: {
|
|
4924
5193
|
title: "Delete message",
|
|
4925
5194
|
desc: "Do you want to delete this message permanently?"
|
|
@@ -4948,6 +5217,7 @@ const en = {
|
|
|
4948
5217
|
},
|
|
4949
5218
|
chat: {
|
|
4950
5219
|
notification: "Notification",
|
|
5220
|
+
reply: "Reply",
|
|
4951
5221
|
unknown: "Unknown",
|
|
4952
5222
|
chats: "Chats",
|
|
4953
5223
|
create: "Create",
|
|
@@ -4976,7 +5246,10 @@ const en = {
|
|
|
4976
5246
|
unassignTask: "unassigned you from a post",
|
|
4977
5247
|
points: "points",
|
|
4978
5248
|
point: "point",
|
|
4979
|
-
pointUp: "🎉 You got {points} {unit} {event}"
|
|
5249
|
+
pointUp: "🎉 You got {points} {unit} {event}",
|
|
5250
|
+
loadMore: "Load older messages",
|
|
5251
|
+
notYetJoinedTheChannel: "Not yet joined the channel",
|
|
5252
|
+
typeSomething: "Type here. Use Markdown, Drag or paste images"
|
|
4980
5253
|
}
|
|
4981
5254
|
};
|
|
4982
5255
|
const zh = {
|
|
@@ -4995,6 +5268,7 @@ const zh = {
|
|
|
4995
5268
|
sendComment: "评论",
|
|
4996
5269
|
showMoreReplies: "显示更多回复",
|
|
4997
5270
|
all: "所有",
|
|
5271
|
+
messages: "消息",
|
|
4998
5272
|
deleteMessage: {
|
|
4999
5273
|
title: "删除消息",
|
|
5000
5274
|
desc: "是否要永久删除此消息?"
|
|
@@ -5023,6 +5297,7 @@ const zh = {
|
|
|
5023
5297
|
},
|
|
5024
5298
|
chat: {
|
|
5025
5299
|
notification: "通知",
|
|
5300
|
+
reply: "回复",
|
|
5026
5301
|
unknown: "未命名",
|
|
5027
5302
|
chats: "聊天",
|
|
5028
5303
|
create: "创建",
|
|
@@ -5042,7 +5317,7 @@ const zh = {
|
|
|
5042
5317
|
replyYourComment: "回复了你的评论",
|
|
5043
5318
|
replyComment: "回复了评论",
|
|
5044
5319
|
deleteChannelTitle: "确认删除这个频道?",
|
|
5045
|
-
deleteChannelDesc: "如果你要删除这个频道,
|
|
5320
|
+
deleteChannelDesc: "如果你要删除这个频道, 频道内所有的消息都会立刻消除。",
|
|
5046
5321
|
leaveChannel: "离开频道",
|
|
5047
5322
|
joinChannel: "加入频道",
|
|
5048
5323
|
openTask: "创建了一个任务",
|
|
@@ -5051,7 +5326,10 @@ const zh = {
|
|
|
5051
5326
|
unassignTask: "取消给你分配的一个任务",
|
|
5052
5327
|
points: "分",
|
|
5053
5328
|
point: "分",
|
|
5054
|
-
pointUp: "🎉 您获得了 {points} {unit} {event}"
|
|
5329
|
+
pointUp: "🎉 您获得了 {points} {unit} {event}",
|
|
5330
|
+
loadMore: "加载更多消息",
|
|
5331
|
+
notYetJoinedTheChannel: "暂未加入这个频道",
|
|
5332
|
+
typeSomething: "在这里输入,适用 MarkDown,拽入或者黏贴图片"
|
|
5055
5333
|
}
|
|
5056
5334
|
};
|
|
5057
5335
|
const translations = { zh, en };
|
|
@@ -10953,61 +11231,60 @@ function SegmentedControl({ value, options, onChange, sx, ...rest }) {
|
|
|
10953
11231
|
) });
|
|
10954
11232
|
}
|
|
10955
11233
|
export {
|
|
10956
|
-
|
|
11234
|
+
UnreadNotificationProvider as $,
|
|
10957
11235
|
Avatar as A,
|
|
10958
11236
|
Badge as B,
|
|
10959
11237
|
CommentInput as C,
|
|
10960
11238
|
DefaultEditorConfigProvider as D,
|
|
10961
11239
|
EmptyStatus as E,
|
|
10962
|
-
|
|
11240
|
+
BlogCard as F,
|
|
10963
11241
|
GithubReaction as G,
|
|
10964
|
-
|
|
11242
|
+
BlogPermaLink as H,
|
|
10965
11243
|
ImagePathFixerPlugin as I,
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
11244
|
+
getBlogLink as J,
|
|
11245
|
+
CoverImage as K,
|
|
11246
|
+
CoverImageUpload as L,
|
|
10969
11247
|
Menu as M,
|
|
10970
|
-
|
|
10971
|
-
|
|
11248
|
+
AccessControl as N,
|
|
11249
|
+
useAuthzContext as O,
|
|
10972
11250
|
Pagination as P,
|
|
10973
|
-
|
|
11251
|
+
AuthzProvider as Q,
|
|
10974
11252
|
RelativeTime as R,
|
|
10975
11253
|
ScrollableEditorWrapper as S,
|
|
10976
|
-
|
|
10977
|
-
|
|
11254
|
+
ChatClient as T,
|
|
11255
|
+
Chat as U,
|
|
10978
11256
|
VideoPathFixerPlugin as V,
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
11257
|
+
ChatHeaderAddon as W,
|
|
11258
|
+
useChatContext as X,
|
|
11259
|
+
ChatProvider as Y,
|
|
11260
|
+
UnreadNotificationContext as Z,
|
|
11261
|
+
useUnreadNotification as _,
|
|
10984
11262
|
isEmptyContent as a,
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
useSubscription as ap,
|
|
11263
|
+
Confirm as a0,
|
|
11264
|
+
ConfirmContext as a1,
|
|
11265
|
+
useConfirm as a2,
|
|
11266
|
+
ConfirmProvider as a3,
|
|
11267
|
+
SecureLabelPicker as a4,
|
|
11268
|
+
useApiErrorHandler as a5,
|
|
11269
|
+
useDefaultApiErrorHandler as a6,
|
|
11270
|
+
PreviousLocationRecorder as a7,
|
|
11271
|
+
Back as a8,
|
|
11272
|
+
LazyEditor as a9,
|
|
11273
|
+
EditorPreview as aa,
|
|
11274
|
+
DirtyPromptContainer as ab,
|
|
11275
|
+
ConfirmNavigation as ac,
|
|
11276
|
+
UploaderContext as ad,
|
|
11277
|
+
useUploader as ae,
|
|
11278
|
+
UploaderTrigger as af,
|
|
11279
|
+
UploaderProvider as ag,
|
|
11280
|
+
composeImageUrl as ah,
|
|
11281
|
+
usePointUpContext as ai,
|
|
11282
|
+
PointUpProvider as aj,
|
|
11283
|
+
ButtonGroup as ak,
|
|
11284
|
+
SegmentedControl as al,
|
|
11285
|
+
create as am,
|
|
11286
|
+
getWsClient as an,
|
|
11287
|
+
useSubscription as ao,
|
|
11011
11288
|
Input as b,
|
|
11012
11289
|
useChanged as c,
|
|
11013
11290
|
utils as d,
|
|
@@ -11019,18 +11296,18 @@ export {
|
|
|
11019
11296
|
AuthorInfo as j,
|
|
11020
11297
|
SystemUser as k,
|
|
11021
11298
|
lexical as l,
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11299
|
+
PostContent as m,
|
|
11300
|
+
PostComponent as n,
|
|
11301
|
+
Comment as o,
|
|
11025
11302
|
preferences as p,
|
|
11026
|
-
|
|
11303
|
+
CommentList as q,
|
|
11027
11304
|
routes as r,
|
|
11028
11305
|
stringify as s,
|
|
11029
11306
|
translations as t,
|
|
11030
11307
|
useNow as u,
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11308
|
+
CommentsContext as v,
|
|
11309
|
+
useCommentsContext as w,
|
|
11310
|
+
CommentsProvider as x,
|
|
11311
|
+
BinaryThumb as y,
|
|
11312
|
+
BlogListWrapper as z
|
|
11036
11313
|
};
|