@natoe/colab 0.1.3 → 0.1.4
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.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +414 -152
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +414 -152
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -828,6 +828,7 @@ function useConversation({
|
|
|
828
828
|
body,
|
|
829
829
|
type: "text",
|
|
830
830
|
insertedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
831
|
+
status: "sending",
|
|
831
832
|
...replyTo ? {
|
|
832
833
|
replyToId: replyTo.id,
|
|
833
834
|
replyToSnapshot: {
|
|
@@ -843,7 +844,9 @@ function useConversation({
|
|
|
843
844
|
try {
|
|
844
845
|
await socket.sendMessage(conv.id, payload);
|
|
845
846
|
} catch (err) {
|
|
846
|
-
setMessages(
|
|
847
|
+
setMessages(
|
|
848
|
+
(prev) => prev.map((m) => m.id === optimistic.id ? { ...m, status: "failed" } : m)
|
|
849
|
+
);
|
|
847
850
|
config.onError?.({
|
|
848
851
|
code: "SEND_FAILED",
|
|
849
852
|
message: "Failed to send message",
|
|
@@ -853,6 +856,34 @@ function useConversation({
|
|
|
853
856
|
},
|
|
854
857
|
[ensureConversation, socket, replyTo, config]
|
|
855
858
|
);
|
|
859
|
+
const retryMessage = useCallback(
|
|
860
|
+
async (messageId) => {
|
|
861
|
+
if (!conversation) return;
|
|
862
|
+
const target = messages.find((m) => m.id === messageId);
|
|
863
|
+
if (!target || target.status !== "failed" || target.type !== "text") return;
|
|
864
|
+
setMessages(
|
|
865
|
+
(prev) => prev.map((m) => m.id === messageId ? { ...m, status: "sending" } : m)
|
|
866
|
+
);
|
|
867
|
+
const payload = {
|
|
868
|
+
body: target.body,
|
|
869
|
+
type: "text",
|
|
870
|
+
...target.replyToId ? { replyToId: target.replyToId } : {}
|
|
871
|
+
};
|
|
872
|
+
try {
|
|
873
|
+
await socket.sendMessage(conversation.id, payload);
|
|
874
|
+
} catch (err) {
|
|
875
|
+
setMessages(
|
|
876
|
+
(prev) => prev.map((m) => m.id === messageId ? { ...m, status: "failed" } : m)
|
|
877
|
+
);
|
|
878
|
+
config.onError?.({
|
|
879
|
+
code: "SEND_FAILED",
|
|
880
|
+
message: "Failed to send message",
|
|
881
|
+
details: err
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
[conversation, messages, socket, config]
|
|
886
|
+
);
|
|
856
887
|
const sendAudioMessage = useCallback(
|
|
857
888
|
async (audioBlob, duration) => {
|
|
858
889
|
if (!config.onUploadFile) return;
|
|
@@ -945,6 +976,7 @@ function useConversation({
|
|
|
945
976
|
message: "Failed to pin message",
|
|
946
977
|
details: err
|
|
947
978
|
});
|
|
979
|
+
throw err;
|
|
948
980
|
}
|
|
949
981
|
},
|
|
950
982
|
[conversation, pinMessageApi, config]
|
|
@@ -960,6 +992,7 @@ function useConversation({
|
|
|
960
992
|
message: "Failed to unpin message",
|
|
961
993
|
details: err
|
|
962
994
|
});
|
|
995
|
+
throw err;
|
|
963
996
|
}
|
|
964
997
|
},
|
|
965
998
|
[conversation, unpinMessageApi, config]
|
|
@@ -977,6 +1010,7 @@ function useConversation({
|
|
|
977
1010
|
replyTo,
|
|
978
1011
|
setReplyTo,
|
|
979
1012
|
sendMessage,
|
|
1013
|
+
retryMessage,
|
|
980
1014
|
sendAudioMessage,
|
|
981
1015
|
sendFileMessage,
|
|
982
1016
|
sendDeepLink,
|
|
@@ -1454,6 +1488,48 @@ function PinIcon({ size = 14, color = "currentColor" }) {
|
|
|
1454
1488
|
}
|
|
1455
1489
|
);
|
|
1456
1490
|
}
|
|
1491
|
+
function AlertIcon({ size = 14, color = "currentColor" }) {
|
|
1492
|
+
return /* @__PURE__ */ jsx(
|
|
1493
|
+
"svg",
|
|
1494
|
+
{
|
|
1495
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1496
|
+
width: size,
|
|
1497
|
+
height: size,
|
|
1498
|
+
viewBox: "0 0 24 24",
|
|
1499
|
+
fill: color,
|
|
1500
|
+
"aria-hidden": "true",
|
|
1501
|
+
children: /* @__PURE__ */ jsx("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" })
|
|
1502
|
+
}
|
|
1503
|
+
);
|
|
1504
|
+
}
|
|
1505
|
+
function Spinner({ size = 16, color = "#6b7280", thickness = 2 }) {
|
|
1506
|
+
return /* @__PURE__ */ jsx(
|
|
1507
|
+
"span",
|
|
1508
|
+
{
|
|
1509
|
+
role: "status",
|
|
1510
|
+
"aria-label": "Loading",
|
|
1511
|
+
style: {
|
|
1512
|
+
display: "inline-block",
|
|
1513
|
+
width: size,
|
|
1514
|
+
height: size,
|
|
1515
|
+
border: `${thickness}px solid ${color}33`,
|
|
1516
|
+
borderTopColor: color,
|
|
1517
|
+
borderRadius: "50%",
|
|
1518
|
+
animation: "natoe-colab-spin 800ms linear infinite",
|
|
1519
|
+
verticalAlign: "middle"
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
);
|
|
1523
|
+
}
|
|
1524
|
+
if (typeof document !== "undefined") {
|
|
1525
|
+
const existing = document.getElementById("natoe-colab-spin-keyframes");
|
|
1526
|
+
if (!existing) {
|
|
1527
|
+
const style = document.createElement("style");
|
|
1528
|
+
style.id = "natoe-colab-spin-keyframes";
|
|
1529
|
+
style.textContent = `@keyframes natoe-colab-spin { to { transform: rotate(360deg); } }`;
|
|
1530
|
+
document.head.appendChild(style);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1457
1533
|
var ROLE_LABELS = {
|
|
1458
1534
|
radiologist: "Radiologist",
|
|
1459
1535
|
lab: "Imaging Center",
|
|
@@ -1472,6 +1548,7 @@ function MessageBubble({
|
|
|
1472
1548
|
onUnpin,
|
|
1473
1549
|
onCopy,
|
|
1474
1550
|
onReplyJumpTo,
|
|
1551
|
+
onRetry,
|
|
1475
1552
|
pinDisabled = false,
|
|
1476
1553
|
className
|
|
1477
1554
|
}) {
|
|
@@ -1521,7 +1598,25 @@ function MessageBubble({
|
|
|
1521
1598
|
message.type === "file" && /* @__PURE__ */ jsx(FileContent, { mediaUrl: message.mediaUrl, fileName: message.fileName }),
|
|
1522
1599
|
message.type === "deep_link" && /* @__PURE__ */ jsx(DeepLinkContent, { body: message.body, metadata: message.metadata, onDeepLinkClick }),
|
|
1523
1600
|
/* @__PURE__ */ jsx("div", { style: styles5.timestamp, children: formatTime(message.insertedAt) }),
|
|
1524
|
-
|
|
1601
|
+
isOwn && message.status === "sending" && /* @__PURE__ */ jsxs("div", { style: styles5.statusRow, children: [
|
|
1602
|
+
/* @__PURE__ */ jsx(Spinner, { size: 12, color: "rgba(255,255,255,0.85)" }),
|
|
1603
|
+
/* @__PURE__ */ jsx("span", { style: styles5.statusText, children: "Sending\u2026" })
|
|
1604
|
+
] }),
|
|
1605
|
+
isOwn && message.status === "failed" && /* @__PURE__ */ jsxs("div", { style: styles5.statusRow, children: [
|
|
1606
|
+
/* @__PURE__ */ jsx(AlertIcon, { size: 12, color: "#fecaca" }),
|
|
1607
|
+
/* @__PURE__ */ jsx("span", { style: styles5.statusText, children: "Not sent" }),
|
|
1608
|
+
onRetry && /* @__PURE__ */ jsx(
|
|
1609
|
+
"button",
|
|
1610
|
+
{
|
|
1611
|
+
type: "button",
|
|
1612
|
+
onClick: () => onRetry(message.id),
|
|
1613
|
+
style: styles5.retryButton,
|
|
1614
|
+
"aria-label": "Retry sending message",
|
|
1615
|
+
children: "Retry"
|
|
1616
|
+
}
|
|
1617
|
+
)
|
|
1618
|
+
] }),
|
|
1619
|
+
showSeenBy && isOwn && !message.status && /* @__PURE__ */ jsx(
|
|
1525
1620
|
SeenByIndicator,
|
|
1526
1621
|
{
|
|
1527
1622
|
readBy: message.readBy ?? [],
|
|
@@ -1716,6 +1811,28 @@ var styles5 = {
|
|
|
1716
1811
|
marginTop: "4px",
|
|
1717
1812
|
textAlign: "right"
|
|
1718
1813
|
},
|
|
1814
|
+
statusRow: {
|
|
1815
|
+
display: "flex",
|
|
1816
|
+
alignItems: "center",
|
|
1817
|
+
gap: "6px",
|
|
1818
|
+
marginTop: "4px",
|
|
1819
|
+
fontSize: "12px",
|
|
1820
|
+
justifyContent: "flex-end",
|
|
1821
|
+
color: "rgba(255, 255, 255, 0.9)"
|
|
1822
|
+
},
|
|
1823
|
+
statusText: {
|
|
1824
|
+
opacity: 0.9
|
|
1825
|
+
},
|
|
1826
|
+
retryButton: {
|
|
1827
|
+
background: "transparent",
|
|
1828
|
+
border: "none",
|
|
1829
|
+
color: "#ffffff",
|
|
1830
|
+
fontWeight: 600,
|
|
1831
|
+
fontSize: "12px",
|
|
1832
|
+
textDecoration: "underline",
|
|
1833
|
+
cursor: "pointer",
|
|
1834
|
+
padding: "0 2px"
|
|
1835
|
+
},
|
|
1719
1836
|
actionsWrapper: {
|
|
1720
1837
|
position: "absolute",
|
|
1721
1838
|
top: "50%",
|
|
@@ -1794,6 +1911,44 @@ var styles5 = {
|
|
|
1794
1911
|
color: "#9ca3af"
|
|
1795
1912
|
}
|
|
1796
1913
|
};
|
|
1914
|
+
function ChatIllustration({ size = 96 }) {
|
|
1915
|
+
return /* @__PURE__ */ jsxs(
|
|
1916
|
+
"svg",
|
|
1917
|
+
{
|
|
1918
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1919
|
+
width: size,
|
|
1920
|
+
height: size,
|
|
1921
|
+
viewBox: "0 0 120 120",
|
|
1922
|
+
fill: "none",
|
|
1923
|
+
"aria-hidden": "true",
|
|
1924
|
+
children: [
|
|
1925
|
+
/* @__PURE__ */ jsx("circle", { cx: "60", cy: "60", r: "56", fill: "#eff6ff" }),
|
|
1926
|
+
/* @__PURE__ */ jsx(
|
|
1927
|
+
"path",
|
|
1928
|
+
{
|
|
1929
|
+
d: "M28 44a10 10 0 0 1 10-10h28a10 10 0 0 1 10 10v18a10 10 0 0 1-10 10H46l-10 8v-8h2a10 10 0 0 1-10-10V44Z",
|
|
1930
|
+
fill: "#ffffff",
|
|
1931
|
+
stroke: "#2563eb",
|
|
1932
|
+
strokeWidth: "2.5"
|
|
1933
|
+
}
|
|
1934
|
+
),
|
|
1935
|
+
/* @__PURE__ */ jsx(
|
|
1936
|
+
"path",
|
|
1937
|
+
{
|
|
1938
|
+
d: "M52 60a8 8 0 0 1 8-8h26a8 8 0 0 1 8 8v14a8 8 0 0 1-8 8H72l8 8v-8h6a8 8 0 0 0 0-30Z",
|
|
1939
|
+
fill: "#dbeafe",
|
|
1940
|
+
stroke: "#2563eb",
|
|
1941
|
+
strokeWidth: "2.5"
|
|
1942
|
+
}
|
|
1943
|
+
),
|
|
1944
|
+
/* @__PURE__ */ jsx("circle", { cx: "48", cy: "53", r: "2.5", fill: "#2563eb" }),
|
|
1945
|
+
/* @__PURE__ */ jsx("circle", { cx: "58", cy: "53", r: "2.5", fill: "#2563eb" }),
|
|
1946
|
+
/* @__PURE__ */ jsx("circle", { cx: "68", cy: "68", r: "2.5", fill: "#2563eb" }),
|
|
1947
|
+
/* @__PURE__ */ jsx("circle", { cx: "78", cy: "68", r: "2.5", fill: "#2563eb" })
|
|
1948
|
+
]
|
|
1949
|
+
}
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1797
1952
|
|
|
1798
1953
|
// src/core/dateLabels.ts
|
|
1799
1954
|
var SHORT_MONTHS = [
|
|
@@ -1885,6 +2040,7 @@ var MessageList = forwardRef(function MessageList2({
|
|
|
1885
2040
|
onPin,
|
|
1886
2041
|
onUnpin,
|
|
1887
2042
|
onCopy,
|
|
2043
|
+
onRetry,
|
|
1888
2044
|
pinDisabled,
|
|
1889
2045
|
className
|
|
1890
2046
|
}, ref) {
|
|
@@ -1949,12 +2105,17 @@ var MessageList = forwardRef(function MessageList2({
|
|
|
1949
2105
|
style: styles6.container,
|
|
1950
2106
|
onScroll: handleScroll,
|
|
1951
2107
|
children: [
|
|
1952
|
-
isLoading && /* @__PURE__ */
|
|
2108
|
+
isLoading && messages.length > 0 && /* @__PURE__ */ jsxs("div", { style: styles6.loadingMore, children: [
|
|
2109
|
+
/* @__PURE__ */ jsx(Spinner, { size: 14 }),
|
|
2110
|
+
/* @__PURE__ */ jsx("span", { children: "Loading earlier messages\u2026" })
|
|
2111
|
+
] }),
|
|
1953
2112
|
hasMore && !isLoading && messages.length > 0 && /* @__PURE__ */ jsx("button", { onClick: onLoadMore, style: styles6.loadMoreButton, type: "button", children: "Load earlier messages" }),
|
|
1954
2113
|
messages.length === 0 && !isLoading && /* @__PURE__ */ jsxs("div", { style: styles6.empty, children: [
|
|
2114
|
+
/* @__PURE__ */ jsx(ChatIllustration, { size: 104 }),
|
|
1955
2115
|
/* @__PURE__ */ jsx("p", { style: styles6.emptyTitle, children: "No messages yet" }),
|
|
1956
|
-
/* @__PURE__ */ jsx("p", { style: styles6.emptySubtitle, children: "Start the conversation
|
|
2116
|
+
/* @__PURE__ */ jsx("p", { style: styles6.emptySubtitle, children: "Start the conversation \u2014 everyone on this case will see what you write." })
|
|
1957
2117
|
] }),
|
|
2118
|
+
messages.length === 0 && isLoading && /* @__PURE__ */ jsx("div", { style: styles6.firstLoad, children: /* @__PURE__ */ jsx(Spinner, { size: 20 }) }),
|
|
1958
2119
|
messages.map((message, index) => {
|
|
1959
2120
|
const currentBucket = dayBucketKey(message.insertedAt);
|
|
1960
2121
|
const prevBucket = index === 0 ? null : dayBucketKey(messages[index - 1].insertedAt);
|
|
@@ -1974,6 +2135,7 @@ var MessageList = forwardRef(function MessageList2({
|
|
|
1974
2135
|
onPin,
|
|
1975
2136
|
onUnpin,
|
|
1976
2137
|
onCopy,
|
|
2138
|
+
onRetry,
|
|
1977
2139
|
pinDisabled
|
|
1978
2140
|
}
|
|
1979
2141
|
) })
|
|
@@ -2002,11 +2164,20 @@ var styles6 = {
|
|
|
2002
2164
|
paddingBottom: "8px"
|
|
2003
2165
|
},
|
|
2004
2166
|
loadingMore: {
|
|
2005
|
-
|
|
2167
|
+
display: "flex",
|
|
2168
|
+
alignItems: "center",
|
|
2169
|
+
justifyContent: "center",
|
|
2170
|
+
gap: "8px",
|
|
2006
2171
|
padding: "12px",
|
|
2007
2172
|
fontSize: "14px",
|
|
2008
2173
|
color: "#6b7280"
|
|
2009
2174
|
},
|
|
2175
|
+
firstLoad: {
|
|
2176
|
+
display: "flex",
|
|
2177
|
+
alignItems: "center",
|
|
2178
|
+
justifyContent: "center",
|
|
2179
|
+
padding: "48px 16px"
|
|
2180
|
+
},
|
|
2010
2181
|
loadMoreButton: {
|
|
2011
2182
|
display: "block",
|
|
2012
2183
|
margin: "0 auto 12px",
|
|
@@ -2031,11 +2202,14 @@ var styles6 = {
|
|
|
2031
2202
|
fontSize: "16px",
|
|
2032
2203
|
fontWeight: 600,
|
|
2033
2204
|
color: "#374151",
|
|
2034
|
-
margin: "
|
|
2205
|
+
margin: "14px 0 4px"
|
|
2035
2206
|
},
|
|
2036
2207
|
emptySubtitle: {
|
|
2037
2208
|
fontSize: "14px",
|
|
2038
|
-
margin: 0
|
|
2209
|
+
margin: 0,
|
|
2210
|
+
maxWidth: "280px",
|
|
2211
|
+
lineHeight: 1.45,
|
|
2212
|
+
textAlign: "center"
|
|
2039
2213
|
},
|
|
2040
2214
|
typingIndicator: {
|
|
2041
2215
|
padding: "4px 16px 8px",
|
|
@@ -3039,6 +3213,64 @@ var styles11 = {
|
|
|
3039
3213
|
flexShrink: 0
|
|
3040
3214
|
}
|
|
3041
3215
|
};
|
|
3216
|
+
function Toast({ toast, onDismiss, durationMs = 4e3 }) {
|
|
3217
|
+
useEffect(() => {
|
|
3218
|
+
if (!toast) return;
|
|
3219
|
+
const timer = setTimeout(onDismiss, durationMs);
|
|
3220
|
+
return () => clearTimeout(timer);
|
|
3221
|
+
}, [toast, onDismiss, durationMs]);
|
|
3222
|
+
if (!toast) return null;
|
|
3223
|
+
return /* @__PURE__ */ jsxs("div", { style: styles12.container, role: "status", "aria-live": "polite", children: [
|
|
3224
|
+
/* @__PURE__ */ jsx("span", { style: styles12.message, children: toast.message }),
|
|
3225
|
+
toast.actionLabel && toast.onAction && /* @__PURE__ */ jsx(
|
|
3226
|
+
"button",
|
|
3227
|
+
{
|
|
3228
|
+
type: "button",
|
|
3229
|
+
onClick: () => {
|
|
3230
|
+
toast.onAction?.();
|
|
3231
|
+
onDismiss();
|
|
3232
|
+
},
|
|
3233
|
+
style: styles12.action,
|
|
3234
|
+
children: toast.actionLabel
|
|
3235
|
+
}
|
|
3236
|
+
)
|
|
3237
|
+
] });
|
|
3238
|
+
}
|
|
3239
|
+
var styles12 = {
|
|
3240
|
+
container: {
|
|
3241
|
+
position: "absolute",
|
|
3242
|
+
bottom: "76px",
|
|
3243
|
+
left: "50%",
|
|
3244
|
+
transform: "translateX(-50%)",
|
|
3245
|
+
display: "flex",
|
|
3246
|
+
alignItems: "center",
|
|
3247
|
+
gap: "12px",
|
|
3248
|
+
padding: "10px 14px",
|
|
3249
|
+
backgroundColor: "#1e293b",
|
|
3250
|
+
color: "#ffffff",
|
|
3251
|
+
borderRadius: "8px",
|
|
3252
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.18)",
|
|
3253
|
+
fontSize: "14px",
|
|
3254
|
+
maxWidth: "90%",
|
|
3255
|
+
zIndex: 20
|
|
3256
|
+
},
|
|
3257
|
+
message: {
|
|
3258
|
+
whiteSpace: "nowrap",
|
|
3259
|
+
overflow: "hidden",
|
|
3260
|
+
textOverflow: "ellipsis"
|
|
3261
|
+
},
|
|
3262
|
+
action: {
|
|
3263
|
+
background: "transparent",
|
|
3264
|
+
border: "none",
|
|
3265
|
+
color: "#93c5fd",
|
|
3266
|
+
fontWeight: 600,
|
|
3267
|
+
fontSize: "14px",
|
|
3268
|
+
cursor: "pointer",
|
|
3269
|
+
padding: "4px 6px",
|
|
3270
|
+
textTransform: "uppercase",
|
|
3271
|
+
letterSpacing: "0.4px"
|
|
3272
|
+
}
|
|
3273
|
+
};
|
|
3042
3274
|
function CollabPanel({
|
|
3043
3275
|
orderId,
|
|
3044
3276
|
patientData,
|
|
@@ -3049,6 +3281,7 @@ function CollabPanel({
|
|
|
3049
3281
|
}) {
|
|
3050
3282
|
const { config } = useCollab();
|
|
3051
3283
|
const [showSettings, setShowSettings] = useState(false);
|
|
3284
|
+
const [toast, setToast] = useState(null);
|
|
3052
3285
|
const messageListRef = useRef(null);
|
|
3053
3286
|
const {
|
|
3054
3287
|
conversation,
|
|
@@ -3062,6 +3295,7 @@ function CollabPanel({
|
|
|
3062
3295
|
replyTo,
|
|
3063
3296
|
setReplyTo,
|
|
3064
3297
|
sendMessage,
|
|
3298
|
+
retryMessage,
|
|
3065
3299
|
sendAudioMessage,
|
|
3066
3300
|
sendFileMessage,
|
|
3067
3301
|
sendTyping,
|
|
@@ -3086,10 +3320,33 @@ function CollabPanel({
|
|
|
3086
3320
|
try {
|
|
3087
3321
|
if (navigator.clipboard) {
|
|
3088
3322
|
await navigator.clipboard.writeText(text);
|
|
3323
|
+
setToast({ message: "Copied to clipboard" });
|
|
3089
3324
|
}
|
|
3090
3325
|
} catch {
|
|
3091
3326
|
}
|
|
3092
3327
|
};
|
|
3328
|
+
const handlePin = async (messageId) => {
|
|
3329
|
+
try {
|
|
3330
|
+
await pinMessage(messageId);
|
|
3331
|
+
setToast({
|
|
3332
|
+
message: "Pinned",
|
|
3333
|
+
actionLabel: "Undo",
|
|
3334
|
+
onAction: () => {
|
|
3335
|
+
void unpinMessage(messageId);
|
|
3336
|
+
}
|
|
3337
|
+
});
|
|
3338
|
+
} catch {
|
|
3339
|
+
setToast({ message: "Could not pin message" });
|
|
3340
|
+
}
|
|
3341
|
+
};
|
|
3342
|
+
const handleUnpin = async (messageId) => {
|
|
3343
|
+
try {
|
|
3344
|
+
await unpinMessage(messageId);
|
|
3345
|
+
setToast({ message: "Unpinned" });
|
|
3346
|
+
} catch {
|
|
3347
|
+
setToast({ message: "Could not unpin message" });
|
|
3348
|
+
}
|
|
3349
|
+
};
|
|
3093
3350
|
const pinDisabled = pinnedMessages.length >= MAX_PINNED_MESSAGES;
|
|
3094
3351
|
if (error) {
|
|
3095
3352
|
return /* @__PURE__ */ jsx("div", { className, style: { ...panelStyles.container, ...style }, children: /* @__PURE__ */ jsxs("div", { style: panelStyles.errorState, children: [
|
|
@@ -3100,78 +3357,83 @@ function CollabPanel({
|
|
|
3100
3357
|
if (isLoading && !conversation) {
|
|
3101
3358
|
return /* @__PURE__ */ jsx("div", { className, style: { ...panelStyles.container, ...style }, children: /* @__PURE__ */ jsx("div", { style: panelStyles.loadingState, children: "Loading conversation..." }) });
|
|
3102
3359
|
}
|
|
3103
|
-
return /* @__PURE__ */
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
conversationId: conversation.id,
|
|
3107
|
-
channelName: conversation.name,
|
|
3108
|
-
channelPicture: conversation.picture,
|
|
3109
|
-
participants,
|
|
3110
|
-
currentUserId: config.userId,
|
|
3111
|
-
isAdmin: channelSettings.isAdmin,
|
|
3112
|
-
isUpdating: channelSettings.isUpdating,
|
|
3113
|
-
error: channelSettings.error,
|
|
3114
|
-
onUpdateChannel: channelSettings.updateChannel,
|
|
3115
|
-
onInviteUser: channelSettings.inviteUser,
|
|
3116
|
-
onRemoveUser: channelSettings.removeUser,
|
|
3117
|
-
onLeaveChannel: channelSettings.leaveChannel,
|
|
3118
|
-
onDeleteChannel: channelSettings.deleteChannel,
|
|
3119
|
-
onClose: () => setShowSettings(false)
|
|
3120
|
-
}
|
|
3121
|
-
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3122
|
-
/* @__PURE__ */ jsx(
|
|
3123
|
-
PatientHeader,
|
|
3360
|
+
return /* @__PURE__ */ jsxs("div", { className, style: { ...panelStyles.container, ...style }, children: [
|
|
3361
|
+
showSettings && conversation ? /* @__PURE__ */ jsx(
|
|
3362
|
+
ChannelSettings,
|
|
3124
3363
|
{
|
|
3125
|
-
|
|
3364
|
+
conversationId: conversation.id,
|
|
3365
|
+
channelName: conversation.name,
|
|
3366
|
+
channelPicture: conversation.picture,
|
|
3126
3367
|
participants,
|
|
3127
|
-
onOpenDicom: handleOpenDicom,
|
|
3128
|
-
onOpenSettings: () => setShowSettings(true)
|
|
3129
|
-
}
|
|
3130
|
-
),
|
|
3131
|
-
pinnedMessages.length > 0 && /* @__PURE__ */ jsx(
|
|
3132
|
-
PinnedMessagesBar,
|
|
3133
|
-
{
|
|
3134
|
-
pinnedMessages,
|
|
3135
|
-
onJumpTo: handleJumpToMessage,
|
|
3136
|
-
onUnpin: unpinMessage
|
|
3137
|
-
}
|
|
3138
|
-
),
|
|
3139
|
-
/* @__PURE__ */ jsx(
|
|
3140
|
-
MessageList,
|
|
3141
|
-
{
|
|
3142
|
-
ref: messageListRef,
|
|
3143
|
-
messages,
|
|
3144
3368
|
currentUserId: config.userId,
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
onPin: pinMessage,
|
|
3155
|
-
onUnpin: unpinMessage,
|
|
3156
|
-
onCopy: handleCopy,
|
|
3157
|
-
pinDisabled
|
|
3158
|
-
}
|
|
3159
|
-
),
|
|
3160
|
-
/* @__PURE__ */ jsx(
|
|
3161
|
-
MessageInput,
|
|
3162
|
-
{
|
|
3163
|
-
onSendText: sendMessage,
|
|
3164
|
-
onSendAudio: sendAudioMessage,
|
|
3165
|
-
onSendFile: sendFileMessage,
|
|
3166
|
-
onTyping: sendTyping,
|
|
3167
|
-
replyTo,
|
|
3168
|
-
onCancelReply: () => setReplyTo(null)
|
|
3369
|
+
isAdmin: channelSettings.isAdmin,
|
|
3370
|
+
isUpdating: channelSettings.isUpdating,
|
|
3371
|
+
error: channelSettings.error,
|
|
3372
|
+
onUpdateChannel: channelSettings.updateChannel,
|
|
3373
|
+
onInviteUser: channelSettings.inviteUser,
|
|
3374
|
+
onRemoveUser: channelSettings.removeUser,
|
|
3375
|
+
onLeaveChannel: channelSettings.leaveChannel,
|
|
3376
|
+
onDeleteChannel: channelSettings.deleteChannel,
|
|
3377
|
+
onClose: () => setShowSettings(false)
|
|
3169
3378
|
}
|
|
3170
|
-
)
|
|
3171
|
-
|
|
3379
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3380
|
+
/* @__PURE__ */ jsx(
|
|
3381
|
+
PatientHeader,
|
|
3382
|
+
{
|
|
3383
|
+
patientData,
|
|
3384
|
+
participants,
|
|
3385
|
+
onOpenDicom: handleOpenDicom,
|
|
3386
|
+
onOpenSettings: () => setShowSettings(true)
|
|
3387
|
+
}
|
|
3388
|
+
),
|
|
3389
|
+
pinnedMessages.length > 0 && /* @__PURE__ */ jsx(
|
|
3390
|
+
PinnedMessagesBar,
|
|
3391
|
+
{
|
|
3392
|
+
pinnedMessages,
|
|
3393
|
+
onJumpTo: handleJumpToMessage,
|
|
3394
|
+
onUnpin: handleUnpin
|
|
3395
|
+
}
|
|
3396
|
+
),
|
|
3397
|
+
/* @__PURE__ */ jsx(
|
|
3398
|
+
MessageList,
|
|
3399
|
+
{
|
|
3400
|
+
ref: messageListRef,
|
|
3401
|
+
messages,
|
|
3402
|
+
currentUserId: config.userId,
|
|
3403
|
+
participants,
|
|
3404
|
+
showSeenBy,
|
|
3405
|
+
typingUsers,
|
|
3406
|
+
hasMore,
|
|
3407
|
+
isLoading,
|
|
3408
|
+
onLoadMore: loadMoreMessages,
|
|
3409
|
+
onDeepLinkClick: handleDeepLink,
|
|
3410
|
+
onMessageVisible: markAsRead,
|
|
3411
|
+
onReply: setReplyTo,
|
|
3412
|
+
onPin: handlePin,
|
|
3413
|
+
onUnpin: handleUnpin,
|
|
3414
|
+
onCopy: handleCopy,
|
|
3415
|
+
onRetry: retryMessage,
|
|
3416
|
+
pinDisabled
|
|
3417
|
+
}
|
|
3418
|
+
),
|
|
3419
|
+
/* @__PURE__ */ jsx(
|
|
3420
|
+
MessageInput,
|
|
3421
|
+
{
|
|
3422
|
+
onSendText: sendMessage,
|
|
3423
|
+
onSendAudio: sendAudioMessage,
|
|
3424
|
+
onSendFile: sendFileMessage,
|
|
3425
|
+
onTyping: sendTyping,
|
|
3426
|
+
replyTo,
|
|
3427
|
+
onCancelReply: () => setReplyTo(null)
|
|
3428
|
+
}
|
|
3429
|
+
)
|
|
3430
|
+
] }),
|
|
3431
|
+
/* @__PURE__ */ jsx(Toast, { toast, onDismiss: () => setToast(null) })
|
|
3432
|
+
] });
|
|
3172
3433
|
}
|
|
3173
3434
|
var panelStyles = {
|
|
3174
3435
|
container: {
|
|
3436
|
+
position: "relative",
|
|
3175
3437
|
display: "flex",
|
|
3176
3438
|
flexDirection: "column",
|
|
3177
3439
|
height: "100%",
|
|
@@ -3306,7 +3568,7 @@ function CollabPopup({
|
|
|
3306
3568
|
ref: containerRef,
|
|
3307
3569
|
className,
|
|
3308
3570
|
style: {
|
|
3309
|
-
...
|
|
3571
|
+
...styles13.container,
|
|
3310
3572
|
left: position.x,
|
|
3311
3573
|
top: position.y,
|
|
3312
3574
|
width,
|
|
@@ -3315,14 +3577,14 @@ function CollabPopup({
|
|
|
3315
3577
|
},
|
|
3316
3578
|
onMouseDown: handleMouseDown,
|
|
3317
3579
|
children: [
|
|
3318
|
-
/* @__PURE__ */ jsxs("div", { "data-drag-handle": true, style:
|
|
3319
|
-
/* @__PURE__ */ jsx("span", { style:
|
|
3320
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
3580
|
+
/* @__PURE__ */ jsxs("div", { "data-drag-handle": true, style: styles13.titleBar, children: [
|
|
3581
|
+
/* @__PURE__ */ jsx("span", { style: styles13.titleText, children: buildChannelName(patientData) }),
|
|
3582
|
+
/* @__PURE__ */ jsxs("div", { style: styles13.titleActions, children: [
|
|
3321
3583
|
/* @__PURE__ */ jsx(
|
|
3322
3584
|
"button",
|
|
3323
3585
|
{
|
|
3324
3586
|
onClick: () => setIsMinimized(!isMinimized),
|
|
3325
|
-
style:
|
|
3587
|
+
style: styles13.titleButton,
|
|
3326
3588
|
"aria-label": isMinimized ? "Expand chat" : "Minimize chat",
|
|
3327
3589
|
title: isMinimized ? "Expand" : "Minimize",
|
|
3328
3590
|
type: "button",
|
|
@@ -3333,7 +3595,7 @@ function CollabPopup({
|
|
|
3333
3595
|
"button",
|
|
3334
3596
|
{
|
|
3335
3597
|
onClick: onClose,
|
|
3336
|
-
style:
|
|
3598
|
+
style: styles13.titleButton,
|
|
3337
3599
|
"aria-label": "Close chat",
|
|
3338
3600
|
title: "Close",
|
|
3339
3601
|
type: "button",
|
|
@@ -3342,12 +3604,12 @@ function CollabPopup({
|
|
|
3342
3604
|
)
|
|
3343
3605
|
] })
|
|
3344
3606
|
] }),
|
|
3345
|
-
!isMinimized && /* @__PURE__ */ jsx("div", { style:
|
|
3607
|
+
!isMinimized && /* @__PURE__ */ jsx("div", { style: styles13.panelWrapper, children: /* @__PURE__ */ jsx(CollabPanel, { orderId, patientData, participantIds }) })
|
|
3346
3608
|
]
|
|
3347
3609
|
}
|
|
3348
3610
|
);
|
|
3349
3611
|
}
|
|
3350
|
-
var
|
|
3612
|
+
var styles13 = {
|
|
3351
3613
|
container: {
|
|
3352
3614
|
position: "fixed",
|
|
3353
3615
|
zIndex: 9999,
|
|
@@ -3652,11 +3914,11 @@ function CollabInline({
|
|
|
3652
3914
|
containerRef
|
|
3653
3915
|
} = useInlineCollab({ orderId, patientData, participantIds, messageLimit });
|
|
3654
3916
|
if (isLoading && !hasConversation) {
|
|
3655
|
-
return /* @__PURE__ */ jsx("div", { className, style: { ...
|
|
3917
|
+
return /* @__PURE__ */ jsx("div", { className, style: { ...styles14.container, ...style }, children: /* @__PURE__ */ jsx("div", { style: styles14.loadingState, children: "Loading..." }) });
|
|
3656
3918
|
}
|
|
3657
|
-
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className, style: { ...
|
|
3658
|
-
hasConversation && messages.length > 0 && /* @__PURE__ */ jsx("div", { style:
|
|
3659
|
-
error && /* @__PURE__ */ jsx("div", { style:
|
|
3919
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className, style: { ...styles14.container, ...style }, children: [
|
|
3920
|
+
hasConversation && messages.length > 0 && /* @__PURE__ */ jsx("div", { style: styles14.preview, children: messages.slice(-messageLimit).map((message) => /* @__PURE__ */ jsx(InlineMessageRow, { message }, message.id)) }),
|
|
3921
|
+
error && /* @__PURE__ */ jsx("div", { style: styles14.error, children: error }),
|
|
3660
3922
|
/* @__PURE__ */ jsx(
|
|
3661
3923
|
InlineInputBar,
|
|
3662
3924
|
{
|
|
@@ -3673,12 +3935,12 @@ function CollabInline({
|
|
|
3673
3935
|
}
|
|
3674
3936
|
function InlineMessageRow({ message }) {
|
|
3675
3937
|
if (message.type === "system") {
|
|
3676
|
-
return /* @__PURE__ */ jsx("div", { style:
|
|
3938
|
+
return /* @__PURE__ */ jsx("div", { style: styles14.systemRow, children: /* @__PURE__ */ jsx("span", { style: styles14.systemText, children: message.body }) });
|
|
3677
3939
|
}
|
|
3678
3940
|
if (message.type === "audio" && message.mediaUrl) {
|
|
3679
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
3941
|
+
return /* @__PURE__ */ jsxs("div", { style: styles14.messageRow, children: [
|
|
3680
3942
|
/* @__PURE__ */ jsx(RoleDot, { role: message.senderRole }),
|
|
3681
|
-
/* @__PURE__ */ jsxs("span", { style:
|
|
3943
|
+
/* @__PURE__ */ jsxs("span", { style: styles14.senderName, children: [
|
|
3682
3944
|
message.senderName,
|
|
3683
3945
|
":"
|
|
3684
3946
|
] }),
|
|
@@ -3686,13 +3948,13 @@ function InlineMessageRow({ message }) {
|
|
|
3686
3948
|
] });
|
|
3687
3949
|
}
|
|
3688
3950
|
const preview = renderMessagePreview(message);
|
|
3689
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
3951
|
+
return /* @__PURE__ */ jsxs("div", { style: styles14.messageRow, children: [
|
|
3690
3952
|
/* @__PURE__ */ jsx(RoleDot, { role: message.senderRole }),
|
|
3691
|
-
/* @__PURE__ */ jsxs("span", { style:
|
|
3953
|
+
/* @__PURE__ */ jsxs("span", { style: styles14.senderName, children: [
|
|
3692
3954
|
message.senderName,
|
|
3693
3955
|
":"
|
|
3694
3956
|
] }),
|
|
3695
|
-
/* @__PURE__ */ jsx("span", { style:
|
|
3957
|
+
/* @__PURE__ */ jsx("span", { style: styles14.messageText, children: preview })
|
|
3696
3958
|
] });
|
|
3697
3959
|
}
|
|
3698
3960
|
function RoleDot({ role }) {
|
|
@@ -3702,7 +3964,7 @@ function RoleDot({ role }) {
|
|
|
3702
3964
|
physician: "#059669",
|
|
3703
3965
|
admin: "#dc2626"
|
|
3704
3966
|
};
|
|
3705
|
-
return /* @__PURE__ */ jsx("span", { style: { ...
|
|
3967
|
+
return /* @__PURE__ */ jsx("span", { style: { ...styles14.roleDot, backgroundColor: colors[role] } });
|
|
3706
3968
|
}
|
|
3707
3969
|
function InlineAudioPlayer({ url, duration }) {
|
|
3708
3970
|
const audioRef = useRef(null);
|
|
@@ -3746,27 +4008,27 @@ function InlineAudioPlayer({ url, duration }) {
|
|
|
3746
4008
|
const total = duration ?? 0;
|
|
3747
4009
|
const remaining = Math.max(0, total - Math.floor(currentTime));
|
|
3748
4010
|
const displayTime = isPlaying ? remaining : total;
|
|
3749
|
-
return /* @__PURE__ */ jsxs("span", { style:
|
|
4011
|
+
return /* @__PURE__ */ jsxs("span", { style: styles14.audioPlayer, children: [
|
|
3750
4012
|
/* @__PURE__ */ jsx(
|
|
3751
4013
|
"button",
|
|
3752
4014
|
{
|
|
3753
4015
|
onClick: toggle,
|
|
3754
|
-
style:
|
|
4016
|
+
style: styles14.audioButton,
|
|
3755
4017
|
title: isPlaying ? "Pause" : "Play",
|
|
3756
4018
|
type: "button",
|
|
3757
4019
|
children: isPlaying ? "\u23F8" : "\u25B6"
|
|
3758
4020
|
}
|
|
3759
4021
|
),
|
|
3760
|
-
/* @__PURE__ */ jsxs("span", { style:
|
|
3761
|
-
/* @__PURE__ */ jsx("span", { style: { ...
|
|
3762
|
-
/* @__PURE__ */ jsx("span", { style: { ...
|
|
3763
|
-
/* @__PURE__ */ jsx("span", { style: { ...
|
|
3764
|
-
/* @__PURE__ */ jsx("span", { style: { ...
|
|
3765
|
-
/* @__PURE__ */ jsx("span", { style: { ...
|
|
3766
|
-
/* @__PURE__ */ jsx("span", { style: { ...
|
|
3767
|
-
/* @__PURE__ */ jsx("span", { style: { ...
|
|
4022
|
+
/* @__PURE__ */ jsxs("span", { style: styles14.audioWaveform, children: [
|
|
4023
|
+
/* @__PURE__ */ jsx("span", { style: { ...styles14.waveBar, height: "40%" } }),
|
|
4024
|
+
/* @__PURE__ */ jsx("span", { style: { ...styles14.waveBar, height: "80%" } }),
|
|
4025
|
+
/* @__PURE__ */ jsx("span", { style: { ...styles14.waveBar, height: "60%" } }),
|
|
4026
|
+
/* @__PURE__ */ jsx("span", { style: { ...styles14.waveBar, height: "90%" } }),
|
|
4027
|
+
/* @__PURE__ */ jsx("span", { style: { ...styles14.waveBar, height: "50%" } }),
|
|
4028
|
+
/* @__PURE__ */ jsx("span", { style: { ...styles14.waveBar, height: "70%" } }),
|
|
4029
|
+
/* @__PURE__ */ jsx("span", { style: { ...styles14.waveBar, height: "40%" } })
|
|
3768
4030
|
] }),
|
|
3769
|
-
/* @__PURE__ */ jsx("span", { style:
|
|
4031
|
+
/* @__PURE__ */ jsx("span", { style: styles14.audioDuration, children: formatDuration2(displayTime) }),
|
|
3770
4032
|
/* @__PURE__ */ jsx("audio", { ref: audioRef, src: url, preload: "metadata" })
|
|
3771
4033
|
] });
|
|
3772
4034
|
}
|
|
@@ -3822,7 +4084,7 @@ function InlineInputBar({
|
|
|
3822
4084
|
},
|
|
3823
4085
|
[handleSend]
|
|
3824
4086
|
);
|
|
3825
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
4087
|
+
return /* @__PURE__ */ jsxs("div", { style: styles14.inputBar, children: [
|
|
3826
4088
|
/* @__PURE__ */ jsx(
|
|
3827
4089
|
"input",
|
|
3828
4090
|
{
|
|
@@ -3833,17 +4095,17 @@ function InlineInputBar({
|
|
|
3833
4095
|
onKeyDown: handleKeyDown,
|
|
3834
4096
|
placeholder,
|
|
3835
4097
|
disabled: isSending,
|
|
3836
|
-
style:
|
|
4098
|
+
style: styles14.input
|
|
3837
4099
|
}
|
|
3838
4100
|
),
|
|
3839
|
-
unreadCount > 0 && /* @__PURE__ */ jsx("span", { style:
|
|
3840
|
-
isLive && /* @__PURE__ */ jsx("span", { style:
|
|
4101
|
+
unreadCount > 0 && /* @__PURE__ */ jsx("span", { style: styles14.unreadBadge, title: `${unreadCount} unread`, children: unreadCount > 99 ? "99+" : unreadCount }),
|
|
4102
|
+
isLive && /* @__PURE__ */ jsx("span", { style: styles14.liveDot, title: "Live updates active" }),
|
|
3841
4103
|
text.trim() && /* @__PURE__ */ jsx(
|
|
3842
4104
|
"button",
|
|
3843
4105
|
{
|
|
3844
4106
|
onClick: handleSend,
|
|
3845
4107
|
disabled: isSending,
|
|
3846
|
-
style:
|
|
4108
|
+
style: styles14.sendButton,
|
|
3847
4109
|
title: "Send message",
|
|
3848
4110
|
type: "button",
|
|
3849
4111
|
children: "\u27A4"
|
|
@@ -3853,7 +4115,7 @@ function InlineInputBar({
|
|
|
3853
4115
|
"button",
|
|
3854
4116
|
{
|
|
3855
4117
|
onClick: onExpand,
|
|
3856
|
-
style:
|
|
4118
|
+
style: styles14.expandButton,
|
|
3857
4119
|
title: "Expand to full chat",
|
|
3858
4120
|
type: "button",
|
|
3859
4121
|
children: "\u26F6"
|
|
@@ -3861,7 +4123,7 @@ function InlineInputBar({
|
|
|
3861
4123
|
)
|
|
3862
4124
|
] });
|
|
3863
4125
|
}
|
|
3864
|
-
var
|
|
4126
|
+
var styles14 = {
|
|
3865
4127
|
container: {
|
|
3866
4128
|
display: "flex",
|
|
3867
4129
|
flexDirection: "column",
|
|
@@ -4128,24 +4390,24 @@ function ConversationListItem({
|
|
|
4128
4390
|
className,
|
|
4129
4391
|
onClick,
|
|
4130
4392
|
style: {
|
|
4131
|
-
...
|
|
4132
|
-
...isSelected ?
|
|
4133
|
-
...hasUnread ?
|
|
4393
|
+
...styles15.container,
|
|
4394
|
+
...isSelected ? styles15.selected : {},
|
|
4395
|
+
...hasUnread ? styles15.unread : {}
|
|
4134
4396
|
},
|
|
4135
4397
|
type: "button",
|
|
4136
4398
|
children: [
|
|
4137
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
4138
|
-
item.picture ? /* @__PURE__ */ jsx("img", { src: item.picture, alt: "", style:
|
|
4139
|
-
hasUnread && /* @__PURE__ */ jsx("span", { style:
|
|
4399
|
+
/* @__PURE__ */ jsxs("div", { style: styles15.avatarWrapper, children: [
|
|
4400
|
+
item.picture ? /* @__PURE__ */ jsx("img", { src: item.picture, alt: "", style: styles15.avatar }) : /* @__PURE__ */ jsx("div", { style: styles15.avatarFallback, children: (displayName).charAt(0).toUpperCase() }),
|
|
4401
|
+
hasUnread && /* @__PURE__ */ jsx("span", { style: styles15.unreadDot })
|
|
4140
4402
|
] }),
|
|
4141
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
4142
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
4403
|
+
/* @__PURE__ */ jsxs("div", { style: styles15.content, children: [
|
|
4404
|
+
/* @__PURE__ */ jsxs("div", { style: styles15.topRow, children: [
|
|
4143
4405
|
/* @__PURE__ */ jsx(
|
|
4144
4406
|
"span",
|
|
4145
4407
|
{
|
|
4146
4408
|
style: {
|
|
4147
|
-
...
|
|
4148
|
-
...hasUnread ?
|
|
4409
|
+
...styles15.name,
|
|
4410
|
+
...hasUnread ? styles15.nameUnread : {}
|
|
4149
4411
|
},
|
|
4150
4412
|
children: displayName
|
|
4151
4413
|
}
|
|
@@ -4154,25 +4416,25 @@ function ConversationListItem({
|
|
|
4154
4416
|
"span",
|
|
4155
4417
|
{
|
|
4156
4418
|
style: {
|
|
4157
|
-
...
|
|
4158
|
-
...hasUnread ?
|
|
4419
|
+
...styles15.time,
|
|
4420
|
+
...hasUnread ? styles15.timeUnread : {}
|
|
4159
4421
|
},
|
|
4160
4422
|
children: formatInboxTimestamp(item.lastActivityAt)
|
|
4161
4423
|
}
|
|
4162
4424
|
)
|
|
4163
4425
|
] }),
|
|
4164
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
4426
|
+
/* @__PURE__ */ jsxs("div", { style: styles15.bottomRow, children: [
|
|
4165
4427
|
/* @__PURE__ */ jsx(
|
|
4166
4428
|
"span",
|
|
4167
4429
|
{
|
|
4168
4430
|
style: {
|
|
4169
|
-
...
|
|
4170
|
-
...hasUnread ?
|
|
4431
|
+
...styles15.preview,
|
|
4432
|
+
...hasUnread ? styles15.previewUnread : {}
|
|
4171
4433
|
},
|
|
4172
4434
|
children: renderLastMessagePreview(item.lastMessage)
|
|
4173
4435
|
}
|
|
4174
4436
|
),
|
|
4175
|
-
hasUnread && /* @__PURE__ */ jsx("span", { style:
|
|
4437
|
+
hasUnread && /* @__PURE__ */ jsx("span", { style: styles15.badge, children: item.unreadCount > 99 ? "99+" : item.unreadCount })
|
|
4176
4438
|
] })
|
|
4177
4439
|
] })
|
|
4178
4440
|
]
|
|
@@ -4200,7 +4462,7 @@ function renderLastMessagePreview(message) {
|
|
|
4200
4462
|
}
|
|
4201
4463
|
}
|
|
4202
4464
|
}
|
|
4203
|
-
var
|
|
4465
|
+
var styles15 = {
|
|
4204
4466
|
container: {
|
|
4205
4467
|
display: "flex",
|
|
4206
4468
|
alignItems: "center",
|
|
@@ -4347,30 +4609,30 @@ function ConversationList({
|
|
|
4347
4609
|
return result;
|
|
4348
4610
|
}, [conversations, query, showUnreadOnly]);
|
|
4349
4611
|
const totalUnread = conversations.reduce((sum, c) => sum + c.unreadCount, 0);
|
|
4350
|
-
return /* @__PURE__ */ jsxs("div", { className, style:
|
|
4351
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
4352
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
4353
|
-
/* @__PURE__ */ jsx("h3", { style:
|
|
4354
|
-
totalUnread > 0 && /* @__PURE__ */ jsx("span", { style:
|
|
4612
|
+
return /* @__PURE__ */ jsxs("div", { className, style: styles16.container, children: [
|
|
4613
|
+
/* @__PURE__ */ jsxs("div", { style: styles16.header, children: [
|
|
4614
|
+
/* @__PURE__ */ jsxs("div", { style: styles16.titleRow, children: [
|
|
4615
|
+
/* @__PURE__ */ jsx("h3", { style: styles16.title, children: title }),
|
|
4616
|
+
totalUnread > 0 && /* @__PURE__ */ jsx("span", { style: styles16.totalBadge, children: totalUnread })
|
|
4355
4617
|
] }),
|
|
4356
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
4618
|
+
/* @__PURE__ */ jsx("div", { style: styles16.searchRow, children: /* @__PURE__ */ jsx(
|
|
4357
4619
|
"input",
|
|
4358
4620
|
{
|
|
4359
4621
|
type: "text",
|
|
4360
4622
|
value: query,
|
|
4361
4623
|
onChange: (e) => setQuery(e.target.value),
|
|
4362
4624
|
placeholder: "Search patients or channels...",
|
|
4363
|
-
style:
|
|
4625
|
+
style: styles16.searchInput
|
|
4364
4626
|
}
|
|
4365
4627
|
) }),
|
|
4366
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
4628
|
+
/* @__PURE__ */ jsxs("div", { style: styles16.filterRow, children: [
|
|
4367
4629
|
/* @__PURE__ */ jsx(
|
|
4368
4630
|
"button",
|
|
4369
4631
|
{
|
|
4370
4632
|
onClick: () => setShowUnreadOnly(false),
|
|
4371
4633
|
style: {
|
|
4372
|
-
...
|
|
4373
|
-
...!showUnreadOnly ?
|
|
4634
|
+
...styles16.filterButton,
|
|
4635
|
+
...!showUnreadOnly ? styles16.filterButtonActive : {}
|
|
4374
4636
|
},
|
|
4375
4637
|
type: "button",
|
|
4376
4638
|
children: "All"
|
|
@@ -4381,8 +4643,8 @@ function ConversationList({
|
|
|
4381
4643
|
{
|
|
4382
4644
|
onClick: () => setShowUnreadOnly(true),
|
|
4383
4645
|
style: {
|
|
4384
|
-
...
|
|
4385
|
-
...showUnreadOnly ?
|
|
4646
|
+
...styles16.filterButton,
|
|
4647
|
+
...showUnreadOnly ? styles16.filterButtonActive : {}
|
|
4386
4648
|
},
|
|
4387
4649
|
type: "button",
|
|
4388
4650
|
children: [
|
|
@@ -4393,10 +4655,10 @@ function ConversationList({
|
|
|
4393
4655
|
)
|
|
4394
4656
|
] })
|
|
4395
4657
|
] }),
|
|
4396
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
4397
|
-
isLoading && /* @__PURE__ */ jsx("div", { style:
|
|
4398
|
-
error && /* @__PURE__ */ jsx("div", { style:
|
|
4399
|
-
!isLoading && !error && filtered.length === 0 && /* @__PURE__ */ jsx("div", { style:
|
|
4658
|
+
/* @__PURE__ */ jsxs("div", { style: styles16.list, children: [
|
|
4659
|
+
isLoading && /* @__PURE__ */ jsx("div", { style: styles16.state, children: "Loading conversations..." }),
|
|
4660
|
+
error && /* @__PURE__ */ jsx("div", { style: styles16.errorState, children: error }),
|
|
4661
|
+
!isLoading && !error && filtered.length === 0 && /* @__PURE__ */ jsx("div", { style: styles16.state, children: query ? "No matching conversations" : "No conversations yet" }),
|
|
4400
4662
|
filtered.map((item) => /* @__PURE__ */ jsx(
|
|
4401
4663
|
ConversationListItem,
|
|
4402
4664
|
{
|
|
@@ -4409,7 +4671,7 @@ function ConversationList({
|
|
|
4409
4671
|
] })
|
|
4410
4672
|
] });
|
|
4411
4673
|
}
|
|
4412
|
-
var
|
|
4674
|
+
var styles16 = {
|
|
4413
4675
|
container: {
|
|
4414
4676
|
display: "flex",
|
|
4415
4677
|
flexDirection: "column",
|
|
@@ -4514,8 +4776,8 @@ function CollabInbox({
|
|
|
4514
4776
|
setSelectedId(item.id);
|
|
4515
4777
|
onSelectConversation?.(item);
|
|
4516
4778
|
};
|
|
4517
|
-
return /* @__PURE__ */ jsxs("div", { className, style: { ...
|
|
4518
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
4779
|
+
return /* @__PURE__ */ jsxs("div", { className, style: { ...styles17.container, ...style }, children: [
|
|
4780
|
+
/* @__PURE__ */ jsx("div", { style: styles17.sidebar, children: /* @__PURE__ */ jsx(
|
|
4519
4781
|
ConversationList,
|
|
4520
4782
|
{
|
|
4521
4783
|
conversations,
|
|
@@ -4526,13 +4788,13 @@ function CollabInbox({
|
|
|
4526
4788
|
title
|
|
4527
4789
|
}
|
|
4528
4790
|
) }),
|
|
4529
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
4791
|
+
/* @__PURE__ */ jsx("div", { style: styles17.main, children: selected ? /* @__PURE__ */ jsx(
|
|
4530
4792
|
CollabPanel,
|
|
4531
4793
|
{
|
|
4532
4794
|
orderId: selected.orderId,
|
|
4533
4795
|
patientData: buildPatientData(selected),
|
|
4534
4796
|
showSeenBy: true,
|
|
4535
|
-
style:
|
|
4797
|
+
style: styles17.panel
|
|
4536
4798
|
},
|
|
4537
4799
|
selected.id
|
|
4538
4800
|
) : /* @__PURE__ */ jsx(EmptyState, { hasAny: conversations.length > 0 }) })
|
|
@@ -4546,13 +4808,13 @@ function buildPatientData(item) {
|
|
|
4546
4808
|
};
|
|
4547
4809
|
}
|
|
4548
4810
|
function EmptyState({ hasAny }) {
|
|
4549
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
4550
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
4551
|
-
/* @__PURE__ */ jsx("h3", { style:
|
|
4552
|
-
/* @__PURE__ */ jsx("p", { style:
|
|
4811
|
+
return /* @__PURE__ */ jsxs("div", { style: styles17.empty, children: [
|
|
4812
|
+
/* @__PURE__ */ jsx("div", { style: styles17.emptyIcon, children: "\u{1F4AC}" }),
|
|
4813
|
+
/* @__PURE__ */ jsx("h3", { style: styles17.emptyTitle, children: hasAny ? "Select a conversation" : "No conversations yet" }),
|
|
4814
|
+
/* @__PURE__ */ jsx("p", { style: styles17.emptySubtitle, children: hasAny ? "Pick a patient from the list to start collaborating" : "Conversations appear here once you start messaging about a case" })
|
|
4553
4815
|
] });
|
|
4554
4816
|
}
|
|
4555
|
-
var
|
|
4817
|
+
var styles17 = {
|
|
4556
4818
|
container: {
|
|
4557
4819
|
display: "flex",
|
|
4558
4820
|
height: "100%",
|