@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.cjs
CHANGED
|
@@ -2764,8 +2764,10 @@ function ConversationView({
|
|
|
2764
2764
|
() => messages.filter((m) => react$1.isMessageVisibleTo(m, meIdForFeed)),
|
|
2765
2765
|
[messages, meIdForFeed]
|
|
2766
2766
|
);
|
|
2767
|
+
const receiptsVisible = react$1.receiptsOf(me).visible;
|
|
2768
|
+
const showReadState = readReceipts && receiptsVisible;
|
|
2767
2769
|
const maxReadByOthers = react.useMemo(() => {
|
|
2768
|
-
if (!
|
|
2770
|
+
if (!showReadState || !me) return null;
|
|
2769
2771
|
let max = 0;
|
|
2770
2772
|
let any = false;
|
|
2771
2773
|
for (const m of members) {
|
|
@@ -2780,7 +2782,7 @@ function ConversationView({
|
|
|
2780
2782
|
any = true;
|
|
2781
2783
|
}
|
|
2782
2784
|
return any ? max : null;
|
|
2783
|
-
}, [
|
|
2785
|
+
}, [showReadState, me, members, messages]);
|
|
2784
2786
|
const [editingId, setEditingId] = react.useState(null);
|
|
2785
2787
|
const [threadRootId, setThreadRootId] = react.useState(null);
|
|
2786
2788
|
const threadRoot = react.useMemo(
|
|
@@ -2933,7 +2935,7 @@ function ConversationView({
|
|
|
2933
2935
|
};
|
|
2934
2936
|
})() : msg;
|
|
2935
2937
|
const isSelf = me !== null && msg.sender_id === me.id;
|
|
2936
|
-
const readState =
|
|
2938
|
+
const readState = showReadState && isSelf && maxReadByOthers !== null ? maxReadByOthers >= msg.sequence ? "read" : "sent" : void 0;
|
|
2937
2939
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
2938
2940
|
showDaySeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-day-separator", "aria-hidden": "false", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: react$1.formatDayLabel(msg.inserted_at) }) }),
|
|
2939
2941
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2954,7 +2956,13 @@ function ConversationView({
|
|
|
2954
2956
|
...readState ? { readState } : {},
|
|
2955
2957
|
...labelFor ? { labelFor } : {},
|
|
2956
2958
|
editing: editingId === msg.id,
|
|
2957
|
-
|
|
2959
|
+
...react$1.canEditOwnMessage({
|
|
2960
|
+
isSelf,
|
|
2961
|
+
deleted: !!msg.deleted_at,
|
|
2962
|
+
receiptsVisible,
|
|
2963
|
+
readState,
|
|
2964
|
+
insertedAt: msg.inserted_at
|
|
2965
|
+
}) ? { onStartEdit: () => setEditingId(msg.id) } : {},
|
|
2958
2966
|
onCancelEdit: () => setEditingId(null),
|
|
2959
2967
|
onSaveEdit: async (body) => {
|
|
2960
2968
|
await edit(msg.id, body);
|