@poolse/react-ui 0.2.0-alpha.4 → 0.2.0-alpha.7

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.js CHANGED
@@ -250,7 +250,9 @@ function MentionInput({
250
250
  onTyping,
251
251
  placeholder = "Type a message\u2026",
252
252
  disabled = false,
253
- labelFor
253
+ labelFor,
254
+ replyingTo,
255
+ onCancelReply
254
256
  }) {
255
257
  const { members } = useMembers(conversationId);
256
258
  const [value, setValue] = useState("");
@@ -272,7 +274,8 @@ function MentionInput({
272
274
  const mentions = Array.from(selectedMentions.current);
273
275
  await onSend({
274
276
  body: trimmed,
275
- ...mentions.length > 0 ? { mentions } : {}
277
+ ...mentions.length > 0 ? { mentions } : {},
278
+ ...replyingTo ? { quoted_message_id: replyingTo.id } : {}
276
279
  });
277
280
  setValue("");
278
281
  selectedMentions.current = /* @__PURE__ */ new Set();
@@ -348,7 +351,12 @@ function MentionInput({
348
351
  e.preventDefault();
349
352
  void submit();
350
353
  }
354
+ if (e.key === "Escape" && replyingTo && onCancelReply && !mention) {
355
+ e.preventDefault();
356
+ onCancelReply();
357
+ }
351
358
  };
359
+ const replyLabel = replyingTo?.sender_id ? labelFor?.(replyingTo.sender_id) ?? `User ${replyingTo.sender_id.slice(0, 6)}` : "Unknown";
352
360
  return /* @__PURE__ */ jsxs(
353
361
  "form",
354
362
  {
@@ -359,29 +367,51 @@ function MentionInput({
359
367
  },
360
368
  style: { position: "relative" },
361
369
  children: [
362
- /* @__PURE__ */ jsx(
363
- "textarea",
364
- {
365
- ref: taRef,
366
- className: "poolse-composer__input",
367
- rows: 1,
368
- value,
369
- onChange,
370
- onKeyDown,
371
- placeholder,
372
- disabled: disabled || sending
373
- }
374
- ),
375
- /* @__PURE__ */ jsx(
376
- "button",
377
- {
378
- type: "submit",
379
- className: "poolse-composer__send",
380
- disabled: disabled || sending || value.trim() === "",
381
- "aria-label": "Send message",
382
- children: /* @__PURE__ */ jsx(PoolseIcon, { name: "send-fill", label: null })
383
- }
384
- ),
370
+ replyingTo && /* @__PURE__ */ jsxs("div", { className: "poolse-composer__reply", role: "status", children: [
371
+ /* @__PURE__ */ jsxs("div", { className: "poolse-composer__reply-body", children: [
372
+ /* @__PURE__ */ jsxs("span", { className: "poolse-composer__reply-label", children: [
373
+ "Replying to ",
374
+ replyLabel
375
+ ] }),
376
+ /* @__PURE__ */ jsx("span", { className: "poolse-composer__reply-preview", children: replyingTo.body ?? "" })
377
+ ] }),
378
+ onCancelReply && /* @__PURE__ */ jsx(
379
+ "button",
380
+ {
381
+ type: "button",
382
+ className: "poolse-composer__reply-cancel",
383
+ onClick: onCancelReply,
384
+ "aria-label": "Cancel reply",
385
+ title: "Cancel reply",
386
+ children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 14, label: null })
387
+ }
388
+ )
389
+ ] }),
390
+ /* @__PURE__ */ jsxs("div", { className: "poolse-composer__row", children: [
391
+ /* @__PURE__ */ jsx(
392
+ "textarea",
393
+ {
394
+ ref: taRef,
395
+ className: "poolse-composer__input",
396
+ rows: 1,
397
+ value,
398
+ onChange,
399
+ onKeyDown,
400
+ placeholder,
401
+ disabled: disabled || sending
402
+ }
403
+ ),
404
+ /* @__PURE__ */ jsx(
405
+ "button",
406
+ {
407
+ type: "submit",
408
+ className: "poolse-composer__send",
409
+ disabled: disabled || sending || value.trim() === "",
410
+ "aria-label": "Send message",
411
+ children: /* @__PURE__ */ jsx(PoolseIcon, { name: "send-fill", label: null })
412
+ }
413
+ )
414
+ ] }),
385
415
  mention && filtered.length > 0 && /* @__PURE__ */ jsx("div", { className: "poolse-mention-menu", role: "listbox", "aria-label": "Members", children: filtered.map((m, i) => /* @__PURE__ */ jsx(
386
416
  "div",
387
417
  {
@@ -407,7 +437,10 @@ function MessageComposer({
407
437
  onSend,
408
438
  onTyping,
409
439
  placeholder = "Type a message\u2026",
410
- disabled = false
440
+ disabled = false,
441
+ replyingTo,
442
+ onCancelReply,
443
+ labelFor
411
444
  }) {
412
445
  const [value, setValue] = useState("");
413
446
  const [sending, setSending] = useState(false);
@@ -416,7 +449,7 @@ function MessageComposer({
416
449
  if (!trimmed || sending) return;
417
450
  setSending(true);
418
451
  try {
419
- await onSend(trimmed);
452
+ await onSend(trimmed, replyingTo ? { quoted_message_id: replyingTo.id } : void 0);
420
453
  setValue("");
421
454
  } finally {
422
455
  setSending(false);
@@ -427,6 +460,10 @@ function MessageComposer({
427
460
  e.preventDefault();
428
461
  void submit();
429
462
  }
463
+ if (e.key === "Escape" && replyingTo && onCancelReply) {
464
+ e.preventDefault();
465
+ onCancelReply();
466
+ }
430
467
  };
431
468
  const onChange = (e) => {
432
469
  setValue(e.target.value);
@@ -441,32 +478,70 @@ function MessageComposer({
441
478
  void submit();
442
479
  },
443
480
  children: [
444
- /* @__PURE__ */ jsx(
445
- "textarea",
481
+ replyingTo && /* @__PURE__ */ jsx(
482
+ ReplyChip,
446
483
  {
447
- className: "poolse-composer__input",
448
- rows: 1,
449
- value,
450
- onChange,
451
- onKeyDown,
452
- placeholder,
453
- disabled: disabled || sending
484
+ message: replyingTo,
485
+ ...labelFor ? { labelFor } : {},
486
+ ...onCancelReply ? { onCancel: onCancelReply } : {}
454
487
  }
455
488
  ),
456
- /* @__PURE__ */ jsx(
457
- "button",
458
- {
459
- type: "submit",
460
- className: "poolse-composer__send",
461
- disabled: disabled || sending || value.trim() === "",
462
- "aria-label": "Send message",
463
- children: /* @__PURE__ */ jsx(PoolseIcon, { name: "send-fill", label: null })
464
- }
465
- )
489
+ /* @__PURE__ */ jsxs("div", { className: "poolse-composer__row", children: [
490
+ /* @__PURE__ */ jsx(
491
+ "textarea",
492
+ {
493
+ className: "poolse-composer__input",
494
+ rows: 1,
495
+ value,
496
+ onChange,
497
+ onKeyDown,
498
+ placeholder,
499
+ disabled: disabled || sending
500
+ }
501
+ ),
502
+ /* @__PURE__ */ jsx(
503
+ "button",
504
+ {
505
+ type: "submit",
506
+ className: "poolse-composer__send",
507
+ disabled: disabled || sending || value.trim() === "",
508
+ "aria-label": "Send message",
509
+ children: /* @__PURE__ */ jsx(PoolseIcon, { name: "send-fill", label: null })
510
+ }
511
+ )
512
+ ] })
466
513
  ]
467
514
  }
468
515
  );
469
516
  }
517
+ function ReplyChip({
518
+ message,
519
+ labelFor,
520
+ onCancel
521
+ }) {
522
+ const senderLabel = message.sender_id ? labelFor?.(message.sender_id) ?? `User ${message.sender_id.slice(0, 6)}` : "Unknown";
523
+ const preview = message.body ?? "";
524
+ return /* @__PURE__ */ jsxs("div", { className: "poolse-composer__reply", role: "status", children: [
525
+ /* @__PURE__ */ jsxs("div", { className: "poolse-composer__reply-body", children: [
526
+ /* @__PURE__ */ jsxs("span", { className: "poolse-composer__reply-label", children: [
527
+ "Replying to ",
528
+ senderLabel
529
+ ] }),
530
+ /* @__PURE__ */ jsx("span", { className: "poolse-composer__reply-preview", children: preview })
531
+ ] }),
532
+ onCancel && /* @__PURE__ */ jsx(
533
+ "button",
534
+ {
535
+ type: "button",
536
+ className: "poolse-composer__reply-cancel",
537
+ onClick: onCancel,
538
+ "aria-label": "Cancel reply",
539
+ title: "Cancel reply",
540
+ children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 14, label: null })
541
+ }
542
+ )
543
+ ] });
544
+ }
470
545
  function AttachmentPreview({ attachment, onClick }) {
471
546
  const isFullRow = "content_type" in attachment;
472
547
  const { url, loading, error } = useAttachmentUrl(attachment.id);
@@ -561,7 +636,13 @@ function formatBytes(n) {
561
636
  if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
562
637
  return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
563
638
  }
564
- function MessageBubble({ message, currentUserId, readState }) {
639
+ function MessageBubble({
640
+ message,
641
+ currentUserId,
642
+ readState,
643
+ labelFor,
644
+ onQuotedClick
645
+ }) {
565
646
  const isSelf = currentUserId !== null && message.sender_id === currentUserId;
566
647
  const className = [
567
648
  "poolse-message",
@@ -572,6 +653,15 @@ function MessageBubble({ message, currentUserId, readState }) {
572
653
  minute: "2-digit"
573
654
  }) : "";
574
655
  return /* @__PURE__ */ jsxs("div", { className, children: [
656
+ message.quoted_message && /* @__PURE__ */ jsx(
657
+ QuotedCard,
658
+ {
659
+ quoted: message.quoted_message,
660
+ isSelf,
661
+ ...labelFor ? { labelFor } : {},
662
+ ...onQuotedClick ? { onClick: onQuotedClick } : {}
663
+ }
664
+ ),
575
665
  message.deleted_at ? /* @__PURE__ */ jsx("span", { className: "poolse-message__body--deleted", children: "[deleted]" }) : /* @__PURE__ */ jsx("span", { children: message.body ?? "" }),
576
666
  /* @__PURE__ */ jsxs("span", { className: "poolse-message__meta", children: [
577
667
  /* @__PURE__ */ jsx("span", { children: time }),
@@ -587,6 +677,30 @@ function MessageBubble({ message, currentUserId, readState }) {
587
677
  ] })
588
678
  ] });
589
679
  }
680
+ function QuotedCard({
681
+ quoted,
682
+ isSelf,
683
+ labelFor,
684
+ onClick
685
+ }) {
686
+ const senderLabel = quoted.sender_id ? labelFor?.(quoted.sender_id) ?? `User ${quoted.sender_id.slice(0, 6)}` : "Unknown";
687
+ const isDeleted = !!quoted.deleted_at;
688
+ const handleClick = onClick ? () => onClick(quoted.id) : void 0;
689
+ return /* @__PURE__ */ jsxs(
690
+ "button",
691
+ {
692
+ type: "button",
693
+ className: `poolse-quote ${isSelf ? "poolse-quote--self" : "poolse-quote--other"}`,
694
+ onClick: handleClick,
695
+ disabled: !handleClick,
696
+ "aria-label": `Quoted message from ${senderLabel}`,
697
+ children: [
698
+ /* @__PURE__ */ jsx("span", { className: "poolse-quote__sender", children: senderLabel }),
699
+ /* @__PURE__ */ jsx("span", { className: "poolse-quote__body", children: isDeleted ? "Original message deleted" : quoted.body ?? "" })
700
+ ]
701
+ }
702
+ );
703
+ }
590
704
  function EditableMessageBubble({
591
705
  message,
592
706
  currentUserId,
@@ -766,6 +880,7 @@ function ReactionPicker({
766
880
  function MessageActions({
767
881
  onReact,
768
882
  onReply,
883
+ onQuote,
769
884
  onCopy,
770
885
  onEdit,
771
886
  onDelete,
@@ -794,7 +909,8 @@ function MessageActions({
794
909
  }
795
910
  ) })
796
911
  ] }),
797
- onReply && /* @__PURE__ */ jsx(ActionButton, { label: "Reply in thread", icon: "reply", onClick: onReply }),
912
+ onReply && /* @__PURE__ */ jsx(ActionButton, { label: "Reply in thread", icon: "messages", onClick: onReply }),
913
+ onQuote && /* @__PURE__ */ jsx(ActionButton, { label: "Reply", icon: "reply", onClick: onQuote }),
798
914
  onCopy && /* @__PURE__ */ jsx(ActionButton, { label: "Copy", icon: "copy", onClick: onCopy }),
799
915
  onEdit && /* @__PURE__ */ jsx(ActionButton, { label: "Edit", icon: "edit", onClick: onEdit }),
800
916
  onDelete && /* @__PURE__ */ jsx(ActionButton, { label: "Delete", icon: "trash", danger: true, onClick: onDelete }),
@@ -822,13 +938,17 @@ function MessageRow({
822
938
  attachments = true,
823
939
  actions = true,
824
940
  threads = true,
941
+ quotations = true,
825
942
  readState,
826
943
  editing = false,
827
944
  onStartEdit,
828
945
  onCancelEdit,
829
946
  onSaveEdit,
830
947
  onDelete,
831
- onOpenThread
948
+ onOpenThread,
949
+ onQuote,
950
+ labelFor,
951
+ onQuotedClick
832
952
  }) {
833
953
  const isSelf = meId !== null && msg.sender_id === meId;
834
954
  const reactionsHook = useReactions(reactions ? msg.id : "", {
@@ -854,7 +974,16 @@ function MessageRow({
854
974
  onSave: handleSave,
855
975
  onCancel: handleCancel
856
976
  }
857
- ) : /* @__PURE__ */ jsx(MessageBubble, { message: msg, currentUserId: meId, ...readState ? { readState } : {} }),
977
+ ) : /* @__PURE__ */ jsx(
978
+ MessageBubble,
979
+ {
980
+ message: msg,
981
+ currentUserId: meId,
982
+ ...readState ? { readState } : {},
983
+ ...labelFor ? { labelFor } : {},
984
+ ...onQuotedClick ? { onQuotedClick } : {}
985
+ }
986
+ ),
858
987
  showAttachments && /* @__PURE__ */ jsx("div", { className: `poolse-message-row__attachments ${isSelf ? "is-self" : ""}`, children: msg.attachments.map((att) => /* @__PURE__ */ jsx(AttachmentPreview, { attachment: att }, att.id)) }),
859
988
  showReactions && /* @__PURE__ */ jsx("div", { className: `poolse-message-row__reactions ${isSelf ? "is-self" : ""}`, children: /* @__PURE__ */ jsx(
860
989
  InlineReactions,
@@ -895,6 +1024,7 @@ function MessageRow({
895
1024
  }
896
1025
  } : {},
897
1026
  ...threads && onOpenThread ? { onReply: onOpenThread } : {},
1027
+ ...quotations && onQuote ? { onQuote } : {},
898
1028
  ...msg.body ? {
899
1029
  onCopy: () => {
900
1030
  void navigator?.clipboard?.writeText(msg.body ?? "").catch(() => void 0);
@@ -1025,6 +1155,7 @@ function ConversationView({
1025
1155
  attachments = TRUE,
1026
1156
  actions = TRUE,
1027
1157
  threads = TRUE,
1158
+ quotations = TRUE,
1028
1159
  readReceipts = TRUE,
1029
1160
  onMarkedRead
1030
1161
  }) {
@@ -1124,6 +1255,21 @@ function ConversationView({
1124
1255
  () => threadRootId ? messages.find((m) => m.id === threadRootId) ?? null : null,
1125
1256
  [threadRootId, messages]
1126
1257
  );
1258
+ const [replyingTo, setReplyingTo] = useState(null);
1259
+ useEffect(() => {
1260
+ setReplyingTo(null);
1261
+ setEditingId(null);
1262
+ setThreadRootId(null);
1263
+ }, [conversationId]);
1264
+ const scrollToOriginal = (id) => {
1265
+ const root = listRef.current;
1266
+ if (!root) return;
1267
+ const el = root.querySelector(`[data-message-id="${id}"]`);
1268
+ if (!(el instanceof HTMLElement)) return;
1269
+ el.scrollIntoView({ behavior: "smooth", block: "center" });
1270
+ el.classList.add("poolse-message-row--highlight");
1271
+ setTimeout(() => el.classList.remove("poolse-message-row--highlight"), 1600);
1272
+ };
1127
1273
  const { upload, uploading } = useAttachmentUpload();
1128
1274
  const onPickFile = async (file) => {
1129
1275
  try {
@@ -1138,20 +1284,35 @@ function ConversationView({
1138
1284
  console.error("attachment upload failed:", err);
1139
1285
  }
1140
1286
  };
1141
- const onSendBody = async (body) => {
1142
- await send({ body });
1287
+ const onSendBody = async (body, opts) => {
1288
+ await send({
1289
+ body,
1290
+ ...opts?.quoted_message_id ? { quoted_message_id: opts.quoted_message_id } : {}
1291
+ });
1292
+ setReplyingTo(null);
1143
1293
  };
1144
1294
  const onSendWithMentions = async (req) => {
1145
1295
  await send(req);
1296
+ setReplyingTo(null);
1146
1297
  };
1147
1298
  const Composer = mentions && members.length > 0 ? /* @__PURE__ */ jsx(
1148
1299
  MentionInput,
1149
1300
  {
1150
1301
  conversationId,
1151
1302
  onSend: onSendWithMentions,
1152
- onTyping: signalTyping
1303
+ onTyping: signalTyping,
1304
+ ...labelFor ? { labelFor } : {},
1305
+ ...quotations ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
1306
+ }
1307
+ ) : /* @__PURE__ */ jsx(
1308
+ MessageComposer,
1309
+ {
1310
+ onSend: onSendBody,
1311
+ onTyping: signalTyping,
1312
+ ...labelFor ? { labelFor } : {},
1313
+ ...quotations ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
1153
1314
  }
1154
- ) : /* @__PURE__ */ jsx(MessageComposer, { onSend: onSendBody, onTyping: signalTyping });
1315
+ );
1155
1316
  return /* @__PURE__ */ jsxs("div", { className: "poolse-conversation-shell", children: [
1156
1317
  /* @__PURE__ */ jsxs("div", { className: "poolse-conversation", children: [
1157
1318
  status !== "connected" && status !== "idle" && /* @__PURE__ */ jsxs("div", { className: "poolse-conversation__status", children: [
@@ -1165,18 +1326,34 @@ function ConversationView({
1165
1326
  if (renderMessage) {
1166
1327
  return /* @__PURE__ */ jsx(Fragment$1, { children: renderMessage(msg, me?.id ?? null) }, msg.id);
1167
1328
  }
1329
+ const enriched = quotations && msg.quoted_message_id && !msg.quoted_message ? (() => {
1330
+ const original = messages.find((m) => m.id === msg.quoted_message_id);
1331
+ if (!original) return msg;
1332
+ return {
1333
+ ...msg,
1334
+ quoted_message: {
1335
+ id: original.id,
1336
+ sender_id: original.sender_id,
1337
+ body: original.body,
1338
+ deleted_at: original.deleted_at,
1339
+ inserted_at: original.inserted_at
1340
+ }
1341
+ };
1342
+ })() : msg;
1168
1343
  const isSelf = me !== null && msg.sender_id === me.id;
1169
1344
  const readState = readReceipts && isSelf && maxReadByOthers !== null ? maxReadByOthers >= msg.sequence ? "read" : "sent" : void 0;
1170
- return /* @__PURE__ */ jsx(
1345
+ return /* @__PURE__ */ jsx("div", { "data-message-id": msg.id, children: /* @__PURE__ */ jsx(
1171
1346
  MessageRow,
1172
1347
  {
1173
- msg,
1348
+ msg: enriched,
1174
1349
  meId: me?.id ?? null,
1175
1350
  reactions,
1176
1351
  attachments,
1177
1352
  actions,
1178
1353
  threads,
1354
+ quotations,
1179
1355
  ...readState ? { readState } : {},
1356
+ ...labelFor ? { labelFor } : {},
1180
1357
  editing: editingId === msg.id,
1181
1358
  onStartEdit: () => setEditingId(msg.id),
1182
1359
  onCancelEdit: () => setEditingId(null),
@@ -1185,10 +1362,11 @@ function ConversationView({
1185
1362
  setEditingId(null);
1186
1363
  },
1187
1364
  onDelete: () => void deleteMsg(msg.id),
1188
- onOpenThread: () => setThreadRootId(msg.id)
1189
- },
1190
- msg.id
1191
- );
1365
+ onOpenThread: () => setThreadRootId(msg.id),
1366
+ onQuote: () => setReplyingTo(msg),
1367
+ onQuotedClick: scrollToOriginal
1368
+ }
1369
+ ) }, msg.id);
1192
1370
  }),
1193
1371
  error && /* @__PURE__ */ jsxs("div", { className: "poolse-conversation__empty", children: [
1194
1372
  "Failed to load: ",
@@ -1284,13 +1462,15 @@ function ConversationList({
1284
1462
  emptyState,
1285
1463
  conversations: controlledConversations,
1286
1464
  loading: controlledLoading,
1287
- error: controlledError
1465
+ error: controlledError,
1466
+ unreadCounts
1288
1467
  }) {
1289
1468
  const auto = useConversations();
1290
1469
  const isControlled = controlledConversations !== void 0;
1291
1470
  const conversations = isControlled ? controlledConversations : auto.conversations;
1292
1471
  const loading = isControlled ? controlledLoading ?? false : auto.loading;
1293
1472
  const error = isControlled ? controlledError ?? null : auto.error;
1473
+ const counts = unreadCounts ?? (isControlled ? void 0 : auto.unreadCounts);
1294
1474
  if (loading && conversations.length === 0) {
1295
1475
  return /* @__PURE__ */ jsx("div", { className: "poolse-list poolse-list--placeholder", children: "Loading conversations\u2026" });
1296
1476
  }
@@ -1302,7 +1482,8 @@ function ConversationList({
1302
1482
  }
1303
1483
  return /* @__PURE__ */ jsx("ul", { className: "poolse-list", role: "listbox", "aria-label": "Conversations", children: conversations.map((conv) => {
1304
1484
  const selected = selectedId === conv.id;
1305
- const content = renderItem ? renderItem(conv, selected) : /* @__PURE__ */ jsx(DefaultRow, { conv, selected });
1485
+ const unread = counts?.[conv.id] ?? 0;
1486
+ const content = renderItem ? renderItem(conv, selected) : /* @__PURE__ */ jsx(DefaultRow, { conv, selected, unread });
1306
1487
  return /* @__PURE__ */ jsx(
1307
1488
  "li",
1308
1489
  {
@@ -1323,18 +1504,31 @@ function ConversationList({
1323
1504
  );
1324
1505
  }) });
1325
1506
  }
1326
- function DefaultRow({ conv, selected: _selected }) {
1507
+ function DefaultRow({
1508
+ conv,
1509
+ selected: _selected,
1510
+ unread
1511
+ }) {
1327
1512
  const title = conv.name ?? "Untitled conversation";
1328
1513
  const time = conv.last_message_at ? formatRelative(conv.last_message_at) : "";
1514
+ const hasUnread = unread > 0;
1329
1515
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1330
1516
  /* @__PURE__ */ jsx(Avatar, { src: conv.avatar_url ?? null, name: conv.name, size: "md" }),
1331
1517
  /* @__PURE__ */ jsxs("div", { className: "poolse-list__body", children: [
1332
1518
  /* @__PURE__ */ jsxs("div", { className: "poolse-list__head", children: [
1333
- /* @__PURE__ */ jsx("span", { className: "poolse-list__title", children: title }),
1519
+ /* @__PURE__ */ jsx("span", { className: `poolse-list__title${hasUnread ? " poolse-list__title--unread" : ""}`, children: title }),
1334
1520
  time && /* @__PURE__ */ jsx("span", { className: "poolse-list__time", children: time })
1335
1521
  ] }),
1336
1522
  /* @__PURE__ */ jsx("div", { className: "poolse-list__preview", children: conv.last_sequence > 0 ? `${conv.last_sequence} message${conv.last_sequence === 1 ? "" : "s"}` : "No messages yet" })
1337
- ] })
1523
+ ] }),
1524
+ hasUnread && /* @__PURE__ */ jsx(
1525
+ "span",
1526
+ {
1527
+ className: "poolse-list__unread-badge",
1528
+ "aria-label": `${unread} unread ${unread === 1 ? "message" : "messages"}`,
1529
+ children: unread > 99 ? "99+" : unread
1530
+ }
1531
+ )
1338
1532
  ] });
1339
1533
  }
1340
1534
  function formatRelative(iso) {