- {inviteIconVisible && (
-
-
-
+ };
+ const [{ isActive }, drop] = useDrop(() => ({
+ accept: [NativeTypes.FILE],
+ drop({ dataTransfer }) {
+ if (dataTransfer.files.length) {
+ // console.log(files, rest);
+ setFiles([...dataTransfer.files]);
+ navigate(`/chat/channel/${id}`);
+ // 重置
+ setTimeout(() => {
+ setFiles([]);
+ }, 300);
+ }
+ },
+ collect: (monitor) => ({
+ isActive: monitor.canDrop() && monitor.isOver(),
+ }),
+ }));
+ const handleReadAll = () => {
+ const lastMid = mids[mids.length - 1];
+ console.log("last mid", mids, lastMid);
+ if (lastMid) {
+ const param = { groups: [{ gid: id, mid: lastMid }] };
+ updateReadIndex(param);
+ }
+ };
+ const toggleInviteModalVisible = (evt) => {
+ if (evt) {
+ evt.preventDefault();
+ evt.stopPropagation();
+ }
+ setInviteModalVisible((prev) => !prev);
+ };
+ const handleMute = () => {
+ const data = muted
+ ? { remove_groups: [id] }
+ : { add_groups: [{ gid: id }] };
+ muteChannel(data);
+ };
+ const { is_public, name, owner } = channel;
+ const { unreads = 0, mentions = [] } = getUnreadCount({
+ mids,
+ messageData,
+ readIndex,
+ loginUid,
+ });
+ const isMentions = mentions.length !== 0;
+ const inviteIconVisible = is_public || owner == loginUid;
+ return (
+ <>
+
+ }
+ >
+
+
+
+ {name}
+
+
+ {inviteIconVisible && (
+
+
+
+ )}
+
+
+
+ {unreads > 0 && (
+
+ {isMentions ? mentions.length : unreads}
+
+ )}
+
+
+
+ {inviteModalVisible && (
+
)}
-
-
-
- {unreads > 0 && (
-
- {isMentions ? mentions.length : unreads}
-
- )}
-
-