@poolse/react-ui 2.22.0 → 2.23.0
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.cjs +12 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { createContext, forwardRef, useState, useRef, useCallback, useImperativeHandle, useEffect, useMemo, Fragment as Fragment$1, useContext } from 'react';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, sameDay, formatDayLabel, formatCallLogPreview, useLiveCall, callLogDisplayFor, useThread, useReactions, useAttachmentUrl, useCalls, useCallRoom, useVoiceRoom } from '@poolse/react';
|
|
4
|
+
import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, receiptsOf, computeGroupPosition, sameDay, formatDayLabel, canEditOwnMessage, formatCallLogPreview, useLiveCall, callLogDisplayFor, useThread, useReactions, useAttachmentUrl, useCalls, useCallRoom, useVoiceRoom } from '@poolse/react';
|
|
5
5
|
import ReactMarkdown from 'react-markdown';
|
|
6
6
|
import remarkGfm from 'remark-gfm';
|
|
7
7
|
|
|
@@ -2757,8 +2757,10 @@ function ConversationView({
|
|
|
2757
2757
|
() => messages.filter((m) => isMessageVisibleTo(m, meIdForFeed)),
|
|
2758
2758
|
[messages, meIdForFeed]
|
|
2759
2759
|
);
|
|
2760
|
+
const receiptsVisible = receiptsOf(me).visible;
|
|
2761
|
+
const showReadState = readReceipts && receiptsVisible;
|
|
2760
2762
|
const maxReadByOthers = useMemo(() => {
|
|
2761
|
-
if (!
|
|
2763
|
+
if (!showReadState || !me) return null;
|
|
2762
2764
|
let max = 0;
|
|
2763
2765
|
let any = false;
|
|
2764
2766
|
for (const m of members) {
|
|
@@ -2773,7 +2775,7 @@ function ConversationView({
|
|
|
2773
2775
|
any = true;
|
|
2774
2776
|
}
|
|
2775
2777
|
return any ? max : null;
|
|
2776
|
-
}, [
|
|
2778
|
+
}, [showReadState, me, members, messages]);
|
|
2777
2779
|
const [editingId, setEditingId] = useState(null);
|
|
2778
2780
|
const [threadRootId, setThreadRootId] = useState(null);
|
|
2779
2781
|
const threadRoot = useMemo(
|
|
@@ -2926,7 +2928,7 @@ function ConversationView({
|
|
|
2926
2928
|
};
|
|
2927
2929
|
})() : msg;
|
|
2928
2930
|
const isSelf = me !== null && msg.sender_id === me.id;
|
|
2929
|
-
const readState =
|
|
2931
|
+
const readState = showReadState && isSelf && maxReadByOthers !== null ? maxReadByOthers >= msg.sequence ? "read" : "sent" : void 0;
|
|
2930
2932
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2931
2933
|
showDaySeparator && /* @__PURE__ */ jsx("div", { className: "poolse-day-separator", "aria-hidden": "false", children: /* @__PURE__ */ jsx("span", { children: formatDayLabel(msg.inserted_at) }) }),
|
|
2932
2934
|
/* @__PURE__ */ jsx(
|
|
@@ -2947,7 +2949,13 @@ function ConversationView({
|
|
|
2947
2949
|
...readState ? { readState } : {},
|
|
2948
2950
|
...labelFor ? { labelFor } : {},
|
|
2949
2951
|
editing: editingId === msg.id,
|
|
2950
|
-
|
|
2952
|
+
...canEditOwnMessage({
|
|
2953
|
+
isSelf,
|
|
2954
|
+
deleted: !!msg.deleted_at,
|
|
2955
|
+
receiptsVisible,
|
|
2956
|
+
readState,
|
|
2957
|
+
insertedAt: msg.inserted_at
|
|
2958
|
+
}) ? { onStartEdit: () => setEditingId(msg.id) } : {},
|
|
2951
2959
|
onCancelEdit: () => setEditingId(null),
|
|
2952
2960
|
onSaveEdit: async (body) => {
|
|
2953
2961
|
await edit(msg.id, body);
|