mr-chat-bird 1.0.11 → 1.0.13
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.css +52 -36
- package/dist/index.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +84 -740
- package/dist/index.mjs +92 -750
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -349,18 +349,16 @@ import {
|
|
|
349
349
|
ActionIcon as ActionIcon2,
|
|
350
350
|
Autocomplete,
|
|
351
351
|
Group,
|
|
352
|
-
Avatar as Avatar3
|
|
352
|
+
Avatar as Avatar3,
|
|
353
|
+
Loader
|
|
353
354
|
} from "@mantine/core";
|
|
354
355
|
import { IconPlus } from "@tabler/icons-react";
|
|
355
356
|
import { useDisclosure } from "@mantine/hooks";
|
|
356
357
|
|
|
357
358
|
// src/components/ChatUserList/ChatUserMessage.tsx
|
|
358
|
-
import { Text as Text2,
|
|
359
|
+
import { Text as Text2, Avatar as Avatar2 } from "@mantine/core";
|
|
359
360
|
import {
|
|
360
|
-
|
|
361
|
-
IconDotsVertical,
|
|
362
|
-
IconLock,
|
|
363
|
-
IconTrash as IconTrash2
|
|
361
|
+
IconLock
|
|
364
362
|
} from "@tabler/icons-react";
|
|
365
363
|
|
|
366
364
|
// src/components/RichTextEditor/RichTextEditor.tsx
|
|
@@ -369,7 +367,9 @@ import {
|
|
|
369
367
|
IconSend,
|
|
370
368
|
IconAlignLeft,
|
|
371
369
|
IconAlignCenter,
|
|
372
|
-
IconAlignRight
|
|
370
|
+
IconAlignRight,
|
|
371
|
+
IconMoodPlus,
|
|
372
|
+
IconTextColor
|
|
373
373
|
} from "@tabler/icons-react";
|
|
374
374
|
import Highlight from "@tiptap/extension-highlight";
|
|
375
375
|
import SubScript from "@tiptap/extension-subscript";
|
|
@@ -4796,12 +4796,6 @@ function EmojiPickerPopover({
|
|
|
4796
4796
|
);
|
|
4797
4797
|
}
|
|
4798
4798
|
|
|
4799
|
-
// src/utils/icons/richText/TextFormat.svg
|
|
4800
|
-
var TextFormat_default = "./TextFormat-R4ZVDKE2.svg";
|
|
4801
|
-
|
|
4802
|
-
// src/utils/icons/richText/AddReaction.svg
|
|
4803
|
-
var AddReaction_default = "./AddReaction-DCDVOMZB.svg";
|
|
4804
|
-
|
|
4805
4799
|
// src/components/RichTextEditor/EmojiNode.tsx
|
|
4806
4800
|
var EmojiNode = Node3.create({
|
|
4807
4801
|
name: "emoji",
|
|
@@ -4903,10 +4897,9 @@ function CustomRichTextEditor({
|
|
|
4903
4897
|
radius: "lg",
|
|
4904
4898
|
variant: "subtle",
|
|
4905
4899
|
"aria-label": "add",
|
|
4906
|
-
color: "#333",
|
|
4907
4900
|
className: "mrchat-mainActionEmojiIcon"
|
|
4908
4901
|
},
|
|
4909
|
-
/* @__PURE__ */ React4.createElement(
|
|
4902
|
+
/* @__PURE__ */ React4.createElement(IconMoodPlus, null)
|
|
4910
4903
|
)
|
|
4911
4904
|
}
|
|
4912
4905
|
), /* @__PURE__ */ React4.createElement(
|
|
@@ -4915,11 +4908,10 @@ function CustomRichTextEditor({
|
|
|
4915
4908
|
radius: "lg",
|
|
4916
4909
|
variant: "subtle",
|
|
4917
4910
|
"aria-label": "text_format",
|
|
4918
|
-
color: "#333",
|
|
4919
4911
|
className: "mrchat-mainTextFormatIcon",
|
|
4920
4912
|
onClick: () => setShowToolbar((prev) => !prev)
|
|
4921
4913
|
},
|
|
4922
|
-
/* @__PURE__ */ React4.createElement(
|
|
4914
|
+
/* @__PURE__ */ React4.createElement(IconTextColor, { stroke: 1.7 })
|
|
4923
4915
|
), /* @__PURE__ */ React4.createElement(
|
|
4924
4916
|
ActionIcon,
|
|
4925
4917
|
{
|
|
@@ -4942,7 +4934,6 @@ function CustomRichTextEditor({
|
|
|
4942
4934
|
{
|
|
4943
4935
|
variant: "outline",
|
|
4944
4936
|
size: "md",
|
|
4945
|
-
color: "#495057",
|
|
4946
4937
|
className: "mrchat-customToolActionItem"
|
|
4947
4938
|
},
|
|
4948
4939
|
/* @__PURE__ */ React4.createElement(IconAlignLeft, { size: 16, stroke: 1.5 })
|
|
@@ -5067,9 +5058,7 @@ function ChatScrollContainer({
|
|
|
5067
5058
|
import React6, { useEffect as useEffect3, useState as useState3 } from "react";
|
|
5068
5059
|
import { Avatar, Text } from "@mantine/core";
|
|
5069
5060
|
import {
|
|
5070
|
-
IconArrowLeft
|
|
5071
|
-
IconTrash,
|
|
5072
|
-
IconBan
|
|
5061
|
+
IconArrowLeft
|
|
5073
5062
|
} from "@tabler/icons-react";
|
|
5074
5063
|
function UserProfileDrawer({
|
|
5075
5064
|
opened,
|
|
@@ -5104,24 +5093,7 @@ function UserProfileDrawer({
|
|
|
5104
5093
|
style: { cursor: "pointer" },
|
|
5105
5094
|
onClick: () => user?.avatar ? setShowImagePreview(true) : {}
|
|
5106
5095
|
}
|
|
5107
|
-
), /* @__PURE__ */ React6.createElement(Text, { fw: 700, size: "lg", mt: "sm" }, user?.displayName), /* @__PURE__ */ React6.createElement(Text, { size: "sm", c: "dimmed" }, "@", user?.username))
|
|
5108
|
-
/* @__PURE__ */ React6.createElement("div", { className: "mrchat-actions" }, /* @__PURE__ */ React6.createElement(
|
|
5109
|
-
"div",
|
|
5110
|
-
{
|
|
5111
|
-
className: `${"mrchat-item"} ${"mrchat-itemDanger"}`,
|
|
5112
|
-
onClick: onDeleteMessages
|
|
5113
|
-
},
|
|
5114
|
-
/* @__PURE__ */ React6.createElement(IconTrash, { size: 18 }),
|
|
5115
|
-
/* @__PURE__ */ React6.createElement("span", null, "Delete all messages")
|
|
5116
|
-
), /* @__PURE__ */ React6.createElement(
|
|
5117
|
-
"div",
|
|
5118
|
-
{
|
|
5119
|
-
className: `${"mrchat-item"} ${"mrchat-itemDanger"}`,
|
|
5120
|
-
onClick: onBlock
|
|
5121
|
-
},
|
|
5122
|
-
/* @__PURE__ */ React6.createElement(IconBan, { size: 18 }),
|
|
5123
|
-
/* @__PURE__ */ React6.createElement("span", null, "Block")
|
|
5124
|
-
))
|
|
5096
|
+
), /* @__PURE__ */ React6.createElement(Text, { fw: 700, size: "lg", mt: "sm" }, user?.displayName), /* @__PURE__ */ React6.createElement(Text, { size: "sm", c: "dimmed" }, "@", user?.username))
|
|
5125
5097
|
)), showImagePreview && /* @__PURE__ */ React6.createElement(
|
|
5126
5098
|
"div",
|
|
5127
5099
|
{
|
|
@@ -5294,15 +5266,7 @@ function ChatUserMessage({
|
|
|
5294
5266
|
}
|
|
5295
5267
|
),
|
|
5296
5268
|
/* @__PURE__ */ React7.createElement(Text2, { fw: 600, size: "md" }, receiverDetails?.displayName || receiverDetails?.username)
|
|
5297
|
-
), /* @__PURE__ */ React7.createElement(
|
|
5298
|
-
Menu2.Item,
|
|
5299
|
-
{
|
|
5300
|
-
color: "red",
|
|
5301
|
-
leftSection: /* @__PURE__ */ React7.createElement(IconTrash2, { size: 16 }),
|
|
5302
|
-
onClick: handleDeleteMessages
|
|
5303
|
-
},
|
|
5304
|
-
"Delete all messages"
|
|
5305
|
-
), /* @__PURE__ */ React7.createElement(Menu2.Item, { color: "red", leftSection: /* @__PURE__ */ React7.createElement(IconBan2, { size: 16 }) }, "Block"))))), /* @__PURE__ */ React7.createElement("div", { className: "mrchat-messageArea" }, isEmpty ? /* @__PURE__ */ React7.createElement("div", { className: "mrchat-emptyState" }, /* @__PURE__ */ React7.createElement("div", { className: "mrchat-encryptionMinimal" }, /* @__PURE__ */ React7.createElement(IconLock, { size: 20, stroke: 1.8 }), /* @__PURE__ */ React7.createElement(Text2, { className: "mrchat-encryptionText", size: "md" }, "End-to-end encrypted"))) : /* @__PURE__ */ React7.createElement(
|
|
5269
|
+
))), /* @__PURE__ */ React7.createElement("div", { className: "mrchat-messageArea" }, isEmpty ? /* @__PURE__ */ React7.createElement("div", { className: "mrchat-emptyState" }, /* @__PURE__ */ React7.createElement("div", { className: "mrchat-encryptionMinimal" }, /* @__PURE__ */ React7.createElement(IconLock, { size: 20, stroke: 1.8 }), /* @__PURE__ */ React7.createElement(Text2, { className: "mrchat-encryptionText", size: "md" }, "End-to-end encrypted"))) : /* @__PURE__ */ React7.createElement(
|
|
5306
5270
|
ChatScrollContainer,
|
|
5307
5271
|
{
|
|
5308
5272
|
data: messages,
|
|
@@ -5381,656 +5345,6 @@ function ChatUserMessage({
|
|
|
5381
5345
|
import { useDispatch as useDispatch2, useSelector as useSelector2 } from "react-redux";
|
|
5382
5346
|
import React9, { useEffect as useEffect5, useState as useState5 } from "react";
|
|
5383
5347
|
|
|
5384
|
-
// src/components/ChatUserList/users_list.json
|
|
5385
|
-
var users_list_default = [
|
|
5386
|
-
{
|
|
5387
|
-
userId: "7036421",
|
|
5388
|
-
username: "paul53",
|
|
5389
|
-
displayName: "Scott Lamb",
|
|
5390
|
-
avatar: "https://i.pravatar.cc/150?img=1"
|
|
5391
|
-
},
|
|
5392
|
-
{
|
|
5393
|
-
userId: "7751072",
|
|
5394
|
-
username: "ysuarez",
|
|
5395
|
-
displayName: "Joseph Jenkins",
|
|
5396
|
-
email: "bethanyrivas@gordon-lopez.org"
|
|
5397
|
-
},
|
|
5398
|
-
{
|
|
5399
|
-
userId: "4741636",
|
|
5400
|
-
username: "trevoracevedo",
|
|
5401
|
-
displayName: "Kristen Lynch",
|
|
5402
|
-
avatar: "https://i.pravatar.cc/150?img=3"
|
|
5403
|
-
},
|
|
5404
|
-
{
|
|
5405
|
-
userId: "8760149",
|
|
5406
|
-
username: "denisereeves",
|
|
5407
|
-
displayName: "Douglas Hernandez",
|
|
5408
|
-
email: "cwalker@hotmail.com",
|
|
5409
|
-
avatar: "https://i.pravatar.cc/150?img=4"
|
|
5410
|
-
},
|
|
5411
|
-
{
|
|
5412
|
-
userId: "7860290",
|
|
5413
|
-
username: "tiffany20",
|
|
5414
|
-
displayName: "Lisa Rodriguez",
|
|
5415
|
-
avatar: "https://i.pravatar.cc/150?img=5"
|
|
5416
|
-
},
|
|
5417
|
-
{
|
|
5418
|
-
userId: "5779060",
|
|
5419
|
-
username: "kathleenaustin",
|
|
5420
|
-
avatar: "https://i.pravatar.cc/150?img=6"
|
|
5421
|
-
},
|
|
5422
|
-
{
|
|
5423
|
-
userId: "3703452",
|
|
5424
|
-
username: "kimberlyvelazquez",
|
|
5425
|
-
displayName: "Stephen Bates",
|
|
5426
|
-
avatar: "https://i.pravatar.cc/150?img=7"
|
|
5427
|
-
},
|
|
5428
|
-
{
|
|
5429
|
-
userId: "6411379",
|
|
5430
|
-
username: "gmueller"
|
|
5431
|
-
},
|
|
5432
|
-
{
|
|
5433
|
-
userId: "2237280",
|
|
5434
|
-
username: "pscott",
|
|
5435
|
-
displayName: "Amanda Fry",
|
|
5436
|
-
avatar: "https://i.pravatar.cc/150?img=9"
|
|
5437
|
-
},
|
|
5438
|
-
{
|
|
5439
|
-
userId: "4656816",
|
|
5440
|
-
username: "moranjonathan",
|
|
5441
|
-
displayName: "John White",
|
|
5442
|
-
avatar: "https://i.pravatar.cc/150?img=10"
|
|
5443
|
-
},
|
|
5444
|
-
{
|
|
5445
|
-
userId: "3190200",
|
|
5446
|
-
username: "rnelson",
|
|
5447
|
-
displayName: "Kristi Cardenas",
|
|
5448
|
-
email: "corey03@bray.biz",
|
|
5449
|
-
avatar: "https://i.pravatar.cc/150?img=11"
|
|
5450
|
-
},
|
|
5451
|
-
{
|
|
5452
|
-
userId: "5440578",
|
|
5453
|
-
username: "harringtonkimberly",
|
|
5454
|
-
displayName: "John Crosby",
|
|
5455
|
-
avatar: "https://i.pravatar.cc/150?img=12"
|
|
5456
|
-
},
|
|
5457
|
-
{
|
|
5458
|
-
userId: "4885496",
|
|
5459
|
-
username: "dylan10",
|
|
5460
|
-
displayName: "Christine Carson",
|
|
5461
|
-
email: "joshua84@harrison-booth.com",
|
|
5462
|
-
avatar: "https://i.pravatar.cc/150?img=13"
|
|
5463
|
-
},
|
|
5464
|
-
{
|
|
5465
|
-
userId: "4634667",
|
|
5466
|
-
username: "angelaramirez",
|
|
5467
|
-
displayName: "Michael Harris",
|
|
5468
|
-
email: "josephlopez@white.com",
|
|
5469
|
-
avatar: "https://i.pravatar.cc/150?img=14"
|
|
5470
|
-
},
|
|
5471
|
-
{
|
|
5472
|
-
userId: "5702972",
|
|
5473
|
-
username: "itran",
|
|
5474
|
-
displayName: "Jennifer Johnson",
|
|
5475
|
-
email: "milesryan@hotmail.com",
|
|
5476
|
-
avatar: "https://i.pravatar.cc/150?img=15"
|
|
5477
|
-
},
|
|
5478
|
-
{
|
|
5479
|
-
userId: "2785214",
|
|
5480
|
-
username: "conniebarr",
|
|
5481
|
-
displayName: "Haley Duffy",
|
|
5482
|
-
email: "watkinsstephanie@yahoo.com",
|
|
5483
|
-
avatar: "https://i.pravatar.cc/150?img=16"
|
|
5484
|
-
},
|
|
5485
|
-
{
|
|
5486
|
-
userId: "6435046",
|
|
5487
|
-
username: "brandon29",
|
|
5488
|
-
displayName: "Max Stein",
|
|
5489
|
-
avatar: "https://i.pravatar.cc/150?img=17"
|
|
5490
|
-
},
|
|
5491
|
-
{
|
|
5492
|
-
userId: "1446780",
|
|
5493
|
-
username: "imontgomery",
|
|
5494
|
-
displayName: "Megan Ross",
|
|
5495
|
-
avatar: "https://i.pravatar.cc/150?img=18"
|
|
5496
|
-
},
|
|
5497
|
-
{
|
|
5498
|
-
userId: "8563828",
|
|
5499
|
-
username: "martinmcdaniel",
|
|
5500
|
-
displayName: "Cynthia Allen",
|
|
5501
|
-
avatar: "https://i.pravatar.cc/150?img=19"
|
|
5502
|
-
},
|
|
5503
|
-
{
|
|
5504
|
-
userId: "6408653",
|
|
5505
|
-
username: "jasonbooth",
|
|
5506
|
-
displayName: "Jesse Hobbs",
|
|
5507
|
-
avatar: "https://i.pravatar.cc/150?img=20"
|
|
5508
|
-
},
|
|
5509
|
-
{
|
|
5510
|
-
userId: "1882055",
|
|
5511
|
-
username: "qparker",
|
|
5512
|
-
displayName: "Teresa Romero",
|
|
5513
|
-
email: "gillespieheather@yahoo.com",
|
|
5514
|
-
avatar: "https://i.pravatar.cc/150?img=21"
|
|
5515
|
-
},
|
|
5516
|
-
{
|
|
5517
|
-
userId: "9073447",
|
|
5518
|
-
username: "williamsanchez",
|
|
5519
|
-
displayName: "Michael Yang",
|
|
5520
|
-
avatar: "https://i.pravatar.cc/150?img=22"
|
|
5521
|
-
},
|
|
5522
|
-
{
|
|
5523
|
-
userId: "2740582",
|
|
5524
|
-
username: "caroladams",
|
|
5525
|
-
displayName: "Sara Burgess",
|
|
5526
|
-
email: "tdawson@davis-cruz.biz",
|
|
5527
|
-
avatar: "https://i.pravatar.cc/150?img=23"
|
|
5528
|
-
},
|
|
5529
|
-
{
|
|
5530
|
-
userId: "8800791",
|
|
5531
|
-
username: "daniellewillis",
|
|
5532
|
-
displayName: "Kristin Huerta",
|
|
5533
|
-
email: "johnsonpeter@yahoo.com",
|
|
5534
|
-
avatar: "https://i.pravatar.cc/150?img=24"
|
|
5535
|
-
},
|
|
5536
|
-
{
|
|
5537
|
-
userId: "6312408",
|
|
5538
|
-
username: "kochveronica",
|
|
5539
|
-
displayName: "Shelia Ellison",
|
|
5540
|
-
avatar: "https://i.pravatar.cc/150?img=25"
|
|
5541
|
-
},
|
|
5542
|
-
{
|
|
5543
|
-
userId: "3930592",
|
|
5544
|
-
username: "josephcox",
|
|
5545
|
-
displayName: "David Warren",
|
|
5546
|
-
email: "smithjenny@yahoo.com",
|
|
5547
|
-
avatar: "https://i.pravatar.cc/150?img=26"
|
|
5548
|
-
},
|
|
5549
|
-
{
|
|
5550
|
-
userId: "5745377",
|
|
5551
|
-
username: "westjennifer",
|
|
5552
|
-
displayName: "Michelle Simmons",
|
|
5553
|
-
email: "christina76@taylor.biz",
|
|
5554
|
-
avatar: "https://i.pravatar.cc/150?img=27"
|
|
5555
|
-
},
|
|
5556
|
-
{
|
|
5557
|
-
userId: "1233544",
|
|
5558
|
-
username: "christian34",
|
|
5559
|
-
displayName: "Jessica Reynolds MD",
|
|
5560
|
-
avatar: "https://i.pravatar.cc/150?img=28"
|
|
5561
|
-
},
|
|
5562
|
-
{
|
|
5563
|
-
userId: "3076089",
|
|
5564
|
-
username: "wrightsabrina",
|
|
5565
|
-
displayName: "Barbara Patterson",
|
|
5566
|
-
email: "danieldunn@keller-perez.org",
|
|
5567
|
-
avatar: "https://i.pravatar.cc/150?img=29"
|
|
5568
|
-
},
|
|
5569
|
-
{
|
|
5570
|
-
userId: "4076079",
|
|
5571
|
-
username: "reidlinda",
|
|
5572
|
-
displayName: "Emily Wheeler",
|
|
5573
|
-
avatar: "https://i.pravatar.cc/150?img=30"
|
|
5574
|
-
},
|
|
5575
|
-
{
|
|
5576
|
-
userId: "1910143",
|
|
5577
|
-
username: "gking",
|
|
5578
|
-
displayName: "Linda White",
|
|
5579
|
-
email: "nichole74@yahoo.com",
|
|
5580
|
-
avatar: "https://i.pravatar.cc/150?img=31"
|
|
5581
|
-
},
|
|
5582
|
-
{
|
|
5583
|
-
userId: "6768563",
|
|
5584
|
-
username: "sextonnicholas",
|
|
5585
|
-
displayName: "Jessica Lucas",
|
|
5586
|
-
email: "zdiaz@thomas.net",
|
|
5587
|
-
avatar: "https://i.pravatar.cc/150?img=32"
|
|
5588
|
-
},
|
|
5589
|
-
{
|
|
5590
|
-
userId: "2581511",
|
|
5591
|
-
username: "donnahorton",
|
|
5592
|
-
displayName: "Jesus Aguirre",
|
|
5593
|
-
email: "osbornepriscilla@gmail.com",
|
|
5594
|
-
avatar: "https://i.pravatar.cc/150?img=33"
|
|
5595
|
-
},
|
|
5596
|
-
{
|
|
5597
|
-
userId: "9815769",
|
|
5598
|
-
username: "hernandezjoseph",
|
|
5599
|
-
displayName: "Anne Holden MD",
|
|
5600
|
-
avatar: "https://i.pravatar.cc/150?img=34"
|
|
5601
|
-
},
|
|
5602
|
-
{
|
|
5603
|
-
userId: "8020976",
|
|
5604
|
-
username: "michellestuart",
|
|
5605
|
-
displayName: "Traci Cunningham",
|
|
5606
|
-
email: "lgonzalez@gmail.com",
|
|
5607
|
-
avatar: "https://i.pravatar.cc/150?img=35"
|
|
5608
|
-
},
|
|
5609
|
-
{
|
|
5610
|
-
userId: "3915464",
|
|
5611
|
-
username: "vdixon",
|
|
5612
|
-
displayName: "Mr. Steven Davis",
|
|
5613
|
-
avatar: "https://i.pravatar.cc/150?img=36"
|
|
5614
|
-
},
|
|
5615
|
-
{
|
|
5616
|
-
userId: "1859539",
|
|
5617
|
-
username: "rodriguezjoshua",
|
|
5618
|
-
displayName: "James Anderson",
|
|
5619
|
-
avatar: "https://i.pravatar.cc/150?img=37"
|
|
5620
|
-
},
|
|
5621
|
-
{
|
|
5622
|
-
userId: "1905847",
|
|
5623
|
-
username: "randallvincent",
|
|
5624
|
-
displayName: "Matthew Roberts",
|
|
5625
|
-
email: "sharon26@cooper.com",
|
|
5626
|
-
avatar: "https://i.pravatar.cc/150?img=38"
|
|
5627
|
-
},
|
|
5628
|
-
{
|
|
5629
|
-
userId: "4977720",
|
|
5630
|
-
username: "kentgarcia",
|
|
5631
|
-
displayName: "Francis Love",
|
|
5632
|
-
avatar: "https://i.pravatar.cc/150?img=39"
|
|
5633
|
-
},
|
|
5634
|
-
{
|
|
5635
|
-
userId: "6947604",
|
|
5636
|
-
username: "rbeard",
|
|
5637
|
-
displayName: "Sheila Harper",
|
|
5638
|
-
email: "kristin42@benson.info",
|
|
5639
|
-
avatar: "https://i.pravatar.cc/150?img=40"
|
|
5640
|
-
},
|
|
5641
|
-
{
|
|
5642
|
-
userId: "8208627",
|
|
5643
|
-
username: "kramerbenjamin",
|
|
5644
|
-
displayName: "Gregory Boyd",
|
|
5645
|
-
avatar: "https://i.pravatar.cc/150?img=41"
|
|
5646
|
-
},
|
|
5647
|
-
{
|
|
5648
|
-
userId: "4501323",
|
|
5649
|
-
username: "dianamartinez",
|
|
5650
|
-
displayName: "John Johnson",
|
|
5651
|
-
avatar: "https://i.pravatar.cc/150?img=42"
|
|
5652
|
-
},
|
|
5653
|
-
{
|
|
5654
|
-
userId: "4342767",
|
|
5655
|
-
username: "kimjoe",
|
|
5656
|
-
displayName: "Charles Conner",
|
|
5657
|
-
avatar: "https://i.pravatar.cc/150?img=43"
|
|
5658
|
-
},
|
|
5659
|
-
{
|
|
5660
|
-
userId: "2573585",
|
|
5661
|
-
username: "deniseward",
|
|
5662
|
-
displayName: "Gabrielle Garcia",
|
|
5663
|
-
avatar: "https://i.pravatar.cc/150?img=44"
|
|
5664
|
-
},
|
|
5665
|
-
{
|
|
5666
|
-
userId: "9792211",
|
|
5667
|
-
username: "williamsmichael",
|
|
5668
|
-
displayName: "Diana Jones",
|
|
5669
|
-
email: "lpena@wilson.com",
|
|
5670
|
-
avatar: "https://i.pravatar.cc/150?img=45"
|
|
5671
|
-
},
|
|
5672
|
-
{
|
|
5673
|
-
userId: "6368087",
|
|
5674
|
-
username: "nathaniel88",
|
|
5675
|
-
displayName: "Travis Allen",
|
|
5676
|
-
email: "jon72@hotmail.com",
|
|
5677
|
-
avatar: "https://i.pravatar.cc/150?img=46"
|
|
5678
|
-
},
|
|
5679
|
-
{
|
|
5680
|
-
userId: "7706511",
|
|
5681
|
-
username: "ireed",
|
|
5682
|
-
displayName: "Tracy Sanchez",
|
|
5683
|
-
avatar: "https://i.pravatar.cc/150?img=47"
|
|
5684
|
-
},
|
|
5685
|
-
{
|
|
5686
|
-
userId: "6860644",
|
|
5687
|
-
username: "fyoder",
|
|
5688
|
-
displayName: "Linda Kemp",
|
|
5689
|
-
email: "amandacarr@yahoo.com",
|
|
5690
|
-
avatar: "https://i.pravatar.cc/150?img=48"
|
|
5691
|
-
},
|
|
5692
|
-
{
|
|
5693
|
-
userId: "5134565",
|
|
5694
|
-
username: "bernardpaul",
|
|
5695
|
-
displayName: "Jessica Perry",
|
|
5696
|
-
email: "pearsonann@hogan-miller.net",
|
|
5697
|
-
avatar: "https://i.pravatar.cc/150?img=49"
|
|
5698
|
-
},
|
|
5699
|
-
{
|
|
5700
|
-
userId: "9375192",
|
|
5701
|
-
username: "hernandezarthur",
|
|
5702
|
-
displayName: "Collin Lynn",
|
|
5703
|
-
email: "normanholland@morales.com",
|
|
5704
|
-
avatar: "https://i.pravatar.cc/150?img=50"
|
|
5705
|
-
},
|
|
5706
|
-
{
|
|
5707
|
-
userId: "4419504",
|
|
5708
|
-
username: "kennethortega",
|
|
5709
|
-
displayName: "David Sims",
|
|
5710
|
-
avatar: "https://i.pravatar.cc/150?img=51"
|
|
5711
|
-
},
|
|
5712
|
-
{
|
|
5713
|
-
userId: "8710391",
|
|
5714
|
-
username: "fmccarthy",
|
|
5715
|
-
displayName: "Victoria Fletcher",
|
|
5716
|
-
email: "jillianberry@thompson-simpson.com",
|
|
5717
|
-
avatar: "https://i.pravatar.cc/150?img=52"
|
|
5718
|
-
},
|
|
5719
|
-
{
|
|
5720
|
-
userId: "4125262",
|
|
5721
|
-
username: "youngjulie",
|
|
5722
|
-
displayName: "James Bentley",
|
|
5723
|
-
avatar: "https://i.pravatar.cc/150?img=53"
|
|
5724
|
-
},
|
|
5725
|
-
{
|
|
5726
|
-
userId: "5874590",
|
|
5727
|
-
username: "harrisonalexandria",
|
|
5728
|
-
displayName: "Michelle Reyes",
|
|
5729
|
-
email: "pcole@yahoo.com",
|
|
5730
|
-
avatar: "https://i.pravatar.cc/150?img=54"
|
|
5731
|
-
},
|
|
5732
|
-
{
|
|
5733
|
-
userId: "1171541",
|
|
5734
|
-
username: "katherine38",
|
|
5735
|
-
displayName: "Mary Thomas",
|
|
5736
|
-
avatar: "https://i.pravatar.cc/150?img=55"
|
|
5737
|
-
},
|
|
5738
|
-
{
|
|
5739
|
-
userId: "6212527",
|
|
5740
|
-
username: "molson",
|
|
5741
|
-
displayName: "Emily Horne",
|
|
5742
|
-
email: "tmiddleton@yahoo.com",
|
|
5743
|
-
avatar: "https://i.pravatar.cc/150?img=56"
|
|
5744
|
-
},
|
|
5745
|
-
{
|
|
5746
|
-
userId: "1520546",
|
|
5747
|
-
username: "raymondheidi",
|
|
5748
|
-
displayName: "Dr. Timothy Henry",
|
|
5749
|
-
email: "charlesporter@alexander-douglas.com",
|
|
5750
|
-
avatar: "https://i.pravatar.cc/150?img=57"
|
|
5751
|
-
},
|
|
5752
|
-
{
|
|
5753
|
-
userId: "8695422",
|
|
5754
|
-
username: "yperez",
|
|
5755
|
-
displayName: "Matthew Gould",
|
|
5756
|
-
email: "alexanderwilliams@gmail.com",
|
|
5757
|
-
avatar: "https://i.pravatar.cc/150?img=58"
|
|
5758
|
-
},
|
|
5759
|
-
{
|
|
5760
|
-
userId: "1576474",
|
|
5761
|
-
username: "levinebrandon",
|
|
5762
|
-
displayName: "Steven Jones",
|
|
5763
|
-
email: "james05@stephenson-long.com",
|
|
5764
|
-
avatar: "https://i.pravatar.cc/150?img=59"
|
|
5765
|
-
},
|
|
5766
|
-
{
|
|
5767
|
-
userId: "3764960",
|
|
5768
|
-
username: "jeremyhuynh",
|
|
5769
|
-
displayName: "Veronica Martinez",
|
|
5770
|
-
avatar: "https://i.pravatar.cc/150?img=60"
|
|
5771
|
-
},
|
|
5772
|
-
{
|
|
5773
|
-
userId: "7813766",
|
|
5774
|
-
username: "marshallricky",
|
|
5775
|
-
displayName: "Thomas Martin",
|
|
5776
|
-
email: "todd46@yahoo.com",
|
|
5777
|
-
avatar: "https://i.pravatar.cc/150?img=61"
|
|
5778
|
-
},
|
|
5779
|
-
{
|
|
5780
|
-
userId: "3265121",
|
|
5781
|
-
username: "jessicaoconnell",
|
|
5782
|
-
displayName: "David Hoover",
|
|
5783
|
-
email: "jennifer58@hotmail.com",
|
|
5784
|
-
avatar: "https://i.pravatar.cc/150?img=62"
|
|
5785
|
-
},
|
|
5786
|
-
{
|
|
5787
|
-
userId: "8177761",
|
|
5788
|
-
username: "michaelsparks",
|
|
5789
|
-
displayName: "Jeffrey Hoffman",
|
|
5790
|
-
avatar: "https://i.pravatar.cc/150?img=63"
|
|
5791
|
-
},
|
|
5792
|
-
{
|
|
5793
|
-
userId: "5212768",
|
|
5794
|
-
username: "gomezjames",
|
|
5795
|
-
displayName: "Jennifer Shaw",
|
|
5796
|
-
avatar: "https://i.pravatar.cc/150?img=64"
|
|
5797
|
-
},
|
|
5798
|
-
{
|
|
5799
|
-
userId: "2316645",
|
|
5800
|
-
username: "timothylopez",
|
|
5801
|
-
displayName: "Alexander Hicks",
|
|
5802
|
-
email: "sandrasmith@yahoo.com",
|
|
5803
|
-
avatar: "https://i.pravatar.cc/150?img=65"
|
|
5804
|
-
},
|
|
5805
|
-
{
|
|
5806
|
-
userId: "2582937",
|
|
5807
|
-
username: "reynoldsbrad",
|
|
5808
|
-
displayName: "Theresa Willis",
|
|
5809
|
-
avatar: "https://i.pravatar.cc/150?img=66"
|
|
5810
|
-
},
|
|
5811
|
-
{
|
|
5812
|
-
userId: "1463707",
|
|
5813
|
-
username: "othompson",
|
|
5814
|
-
displayName: "Lauren Holmes",
|
|
5815
|
-
email: "charles40@hamilton-johnson.com",
|
|
5816
|
-
avatar: "https://i.pravatar.cc/150?img=67"
|
|
5817
|
-
},
|
|
5818
|
-
{
|
|
5819
|
-
userId: "2368693",
|
|
5820
|
-
username: "dholland",
|
|
5821
|
-
displayName: "Alexandra Hansen",
|
|
5822
|
-
email: "annlivingston@davis-spencer.com",
|
|
5823
|
-
avatar: "https://i.pravatar.cc/150?img=68"
|
|
5824
|
-
},
|
|
5825
|
-
{
|
|
5826
|
-
userId: "6792547",
|
|
5827
|
-
username: "nataliehenry",
|
|
5828
|
-
displayName: "Brian Henson",
|
|
5829
|
-
avatar: "https://i.pravatar.cc/150?img=69"
|
|
5830
|
-
},
|
|
5831
|
-
{
|
|
5832
|
-
userId: "6279552",
|
|
5833
|
-
username: "ewingmichael",
|
|
5834
|
-
displayName: "Eric Blackwell",
|
|
5835
|
-
avatar: "https://i.pravatar.cc/150?img=70"
|
|
5836
|
-
},
|
|
5837
|
-
{
|
|
5838
|
-
userId: "5284305",
|
|
5839
|
-
username: "jcox",
|
|
5840
|
-
displayName: "Eric Anderson",
|
|
5841
|
-
email: "hleonard@mitchell.com",
|
|
5842
|
-
avatar: "https://i.pravatar.cc/150?img=1"
|
|
5843
|
-
},
|
|
5844
|
-
{
|
|
5845
|
-
userId: "7124467",
|
|
5846
|
-
username: "christine01",
|
|
5847
|
-
displayName: "Jeffrey Adams",
|
|
5848
|
-
avatar: "https://i.pravatar.cc/150?img=2"
|
|
5849
|
-
},
|
|
5850
|
-
{
|
|
5851
|
-
userId: "9947233",
|
|
5852
|
-
username: "holly09",
|
|
5853
|
-
displayName: "Beth Cooper",
|
|
5854
|
-
avatar: "https://i.pravatar.cc/150?img=3"
|
|
5855
|
-
},
|
|
5856
|
-
{
|
|
5857
|
-
userId: "4481447",
|
|
5858
|
-
username: "hstephens",
|
|
5859
|
-
displayName: "James Montes",
|
|
5860
|
-
email: "oandersen@yahoo.com",
|
|
5861
|
-
avatar: "https://i.pravatar.cc/150?img=4"
|
|
5862
|
-
},
|
|
5863
|
-
{
|
|
5864
|
-
userId: "2136050",
|
|
5865
|
-
username: "lewispaul",
|
|
5866
|
-
displayName: "Alexander Green",
|
|
5867
|
-
avatar: "https://i.pravatar.cc/150?img=5"
|
|
5868
|
-
},
|
|
5869
|
-
{
|
|
5870
|
-
userId: "7517470",
|
|
5871
|
-
username: "haroldroy",
|
|
5872
|
-
displayName: "Karen Arroyo",
|
|
5873
|
-
avatar: "https://i.pravatar.cc/150?img=6"
|
|
5874
|
-
},
|
|
5875
|
-
{
|
|
5876
|
-
userId: "6153183",
|
|
5877
|
-
username: "nbrown",
|
|
5878
|
-
displayName: "Eileen White",
|
|
5879
|
-
avatar: "https://i.pravatar.cc/150?img=7"
|
|
5880
|
-
},
|
|
5881
|
-
{
|
|
5882
|
-
userId: "6159881",
|
|
5883
|
-
username: "mayopatrick",
|
|
5884
|
-
displayName: "Joanne Clark",
|
|
5885
|
-
avatar: "https://i.pravatar.cc/150?img=8"
|
|
5886
|
-
},
|
|
5887
|
-
{
|
|
5888
|
-
userId: "4545032",
|
|
5889
|
-
username: "jonesbriana",
|
|
5890
|
-
displayName: "Joshua Hogan",
|
|
5891
|
-
avatar: "https://i.pravatar.cc/150?img=9"
|
|
5892
|
-
},
|
|
5893
|
-
{
|
|
5894
|
-
userId: "1877889",
|
|
5895
|
-
username: "david27",
|
|
5896
|
-
displayName: "Amanda Smith",
|
|
5897
|
-
avatar: "https://i.pravatar.cc/150?img=10"
|
|
5898
|
-
},
|
|
5899
|
-
{
|
|
5900
|
-
userId: "8011103",
|
|
5901
|
-
username: "samanthamontgomery",
|
|
5902
|
-
displayName: "Michelle James",
|
|
5903
|
-
avatar: "https://i.pravatar.cc/150?img=11"
|
|
5904
|
-
},
|
|
5905
|
-
{
|
|
5906
|
-
userId: "1770816",
|
|
5907
|
-
username: "jasonhawkins",
|
|
5908
|
-
displayName: "Krystal Montoya",
|
|
5909
|
-
email: "carol49@hawkins.com",
|
|
5910
|
-
avatar: "https://i.pravatar.cc/150?img=12"
|
|
5911
|
-
},
|
|
5912
|
-
{
|
|
5913
|
-
userId: "7398757",
|
|
5914
|
-
username: "fstrickland",
|
|
5915
|
-
displayName: "Jesse Foster",
|
|
5916
|
-
avatar: "https://i.pravatar.cc/150?img=13"
|
|
5917
|
-
},
|
|
5918
|
-
{
|
|
5919
|
-
userId: "6174493",
|
|
5920
|
-
username: "vanessa41",
|
|
5921
|
-
displayName: "Travis Werner",
|
|
5922
|
-
avatar: "https://i.pravatar.cc/150?img=14"
|
|
5923
|
-
},
|
|
5924
|
-
{
|
|
5925
|
-
userId: "5698330",
|
|
5926
|
-
username: "leah20",
|
|
5927
|
-
displayName: "Lisa Davis",
|
|
5928
|
-
email: "mannwilliam@singh.com",
|
|
5929
|
-
avatar: "https://i.pravatar.cc/150?img=15"
|
|
5930
|
-
},
|
|
5931
|
-
{
|
|
5932
|
-
userId: "5919037",
|
|
5933
|
-
username: "garciashane",
|
|
5934
|
-
displayName: "Sean Murphy",
|
|
5935
|
-
email: "hgonzalez@avila.info",
|
|
5936
|
-
avatar: "https://i.pravatar.cc/150?img=16"
|
|
5937
|
-
},
|
|
5938
|
-
{
|
|
5939
|
-
userId: "4577301",
|
|
5940
|
-
username: "margaret94",
|
|
5941
|
-
displayName: "Blake Mcfarland",
|
|
5942
|
-
avatar: "https://i.pravatar.cc/150?img=17"
|
|
5943
|
-
},
|
|
5944
|
-
{
|
|
5945
|
-
userId: "2155330",
|
|
5946
|
-
username: "amberarellano",
|
|
5947
|
-
displayName: "Jonathan Hawkins",
|
|
5948
|
-
email: "rebecca14@reynolds-carlson.com",
|
|
5949
|
-
avatar: "https://i.pravatar.cc/150?img=18"
|
|
5950
|
-
},
|
|
5951
|
-
{
|
|
5952
|
-
userId: "4843253",
|
|
5953
|
-
username: "villarrealannette",
|
|
5954
|
-
displayName: "Angel Gonzales",
|
|
5955
|
-
avatar: "https://i.pravatar.cc/150?img=19"
|
|
5956
|
-
},
|
|
5957
|
-
{
|
|
5958
|
-
userId: "1906659",
|
|
5959
|
-
username: "andrea21",
|
|
5960
|
-
displayName: "Sarah Fitzgerald",
|
|
5961
|
-
email: "smithrachel@shaw.com",
|
|
5962
|
-
avatar: "https://i.pravatar.cc/150?img=20"
|
|
5963
|
-
},
|
|
5964
|
-
{
|
|
5965
|
-
userId: "2119584",
|
|
5966
|
-
username: "gsmith",
|
|
5967
|
-
displayName: "Rachel Hamilton",
|
|
5968
|
-
email: "angelajones@nixon.com",
|
|
5969
|
-
avatar: "https://i.pravatar.cc/150?img=21"
|
|
5970
|
-
},
|
|
5971
|
-
{
|
|
5972
|
-
userId: "4752319",
|
|
5973
|
-
username: "gflores",
|
|
5974
|
-
displayName: "Larry Larson",
|
|
5975
|
-
email: "deborah84@hotmail.com",
|
|
5976
|
-
avatar: "https://i.pravatar.cc/150?img=22"
|
|
5977
|
-
},
|
|
5978
|
-
{
|
|
5979
|
-
userId: "5512539",
|
|
5980
|
-
username: "terrihart",
|
|
5981
|
-
displayName: "Melissa James",
|
|
5982
|
-
email: "scottgregory@murphy.org",
|
|
5983
|
-
avatar: "https://i.pravatar.cc/150?img=23"
|
|
5984
|
-
},
|
|
5985
|
-
{
|
|
5986
|
-
userId: "7735585",
|
|
5987
|
-
username: "randallmartinez",
|
|
5988
|
-
displayName: "Heather Morris",
|
|
5989
|
-
email: "raymond84@hunter-benjamin.com",
|
|
5990
|
-
avatar: "https://i.pravatar.cc/150?img=24"
|
|
5991
|
-
},
|
|
5992
|
-
{
|
|
5993
|
-
userId: "5081733",
|
|
5994
|
-
username: "zgibson",
|
|
5995
|
-
displayName: "Steven Burch",
|
|
5996
|
-
email: "victoria55@hotmail.com",
|
|
5997
|
-
avatar: "https://i.pravatar.cc/150?img=25"
|
|
5998
|
-
},
|
|
5999
|
-
{
|
|
6000
|
-
userId: "9801446",
|
|
6001
|
-
username: "msmith",
|
|
6002
|
-
displayName: "Richard Saunders",
|
|
6003
|
-
email: "sharoncoffey@hunter.com",
|
|
6004
|
-
avatar: "https://i.pravatar.cc/150?img=26"
|
|
6005
|
-
},
|
|
6006
|
-
{
|
|
6007
|
-
userId: "5315126",
|
|
6008
|
-
username: "nguyenkimberly",
|
|
6009
|
-
displayName: "David Odonnell",
|
|
6010
|
-
avatar: "https://i.pravatar.cc/150?img=27"
|
|
6011
|
-
},
|
|
6012
|
-
{
|
|
6013
|
-
userId: "1464038",
|
|
6014
|
-
username: "travis55",
|
|
6015
|
-
displayName: "Kevin Krause",
|
|
6016
|
-
email: "barnesmichael@cross-riley.info",
|
|
6017
|
-
avatar: "https://i.pravatar.cc/150?img=28"
|
|
6018
|
-
},
|
|
6019
|
-
{
|
|
6020
|
-
userId: "2764284",
|
|
6021
|
-
username: "twilson",
|
|
6022
|
-
displayName: "Kelly Phillips",
|
|
6023
|
-
email: "cbarnes@gmail.com",
|
|
6024
|
-
avatar: "https://i.pravatar.cc/150?img=29"
|
|
6025
|
-
},
|
|
6026
|
-
{
|
|
6027
|
-
userId: "8360841",
|
|
6028
|
-
username: "hardingthomas",
|
|
6029
|
-
displayName: "Roger Bowen",
|
|
6030
|
-
avatar: "https://i.pravatar.cc/150?img=30"
|
|
6031
|
-
}
|
|
6032
|
-
];
|
|
6033
|
-
|
|
6034
5348
|
// src/components/VirtualizedList/index.tsx
|
|
6035
5349
|
import React8 from "react";
|
|
6036
5350
|
import { Virtuoso } from "react-virtuoso";
|
|
@@ -6085,7 +5399,10 @@ var getChatDisplayTime = (timestamp) => {
|
|
|
6085
5399
|
};
|
|
6086
5400
|
|
|
6087
5401
|
// src/components/ChatUserList/ChatUserList.tsx
|
|
6088
|
-
function ChatUserList(
|
|
5402
|
+
function ChatUserList({
|
|
5403
|
+
currentUser,
|
|
5404
|
+
onSearchUsers
|
|
5405
|
+
}) {
|
|
6089
5406
|
const [opened, { open, close }] = useDisclosure(false);
|
|
6090
5407
|
const dispatch = useDispatch2();
|
|
6091
5408
|
const chatList = useSelector2(
|
|
@@ -6097,20 +5414,17 @@ function ChatUserList() {
|
|
|
6097
5414
|
const [receiverSearchValue, setReceiverSearchValue] = useState5("");
|
|
6098
5415
|
const [receiverDetails, setReceiverDetails] = useState5();
|
|
6099
5416
|
const [receiverUserDetails, setReceiverUserDetails] = useState5();
|
|
6100
|
-
const [
|
|
6101
|
-
const [
|
|
6102
|
-
const [
|
|
5417
|
+
const [searchResults, setSearchResults] = useState5([]);
|
|
5418
|
+
const [isSearching, setIsSearching] = useState5(false);
|
|
5419
|
+
const [senderDetails, setSenderDetails] = useState5(currentUser);
|
|
6103
5420
|
useEffect5(() => {
|
|
6104
|
-
if (
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
}, [senderUserDetails]);
|
|
5421
|
+
if (!currentUser?.userId) return;
|
|
5422
|
+
setSenderDetails(currentUser);
|
|
5423
|
+
}, [currentUser?.userId]);
|
|
6108
5424
|
useEffect5(() => {
|
|
6109
|
-
if (!
|
|
6110
|
-
dispatch(
|
|
6111
|
-
|
|
6112
|
-
);
|
|
6113
|
-
}, [senderUserDetails]);
|
|
5425
|
+
if (!currentUser?.userId) return;
|
|
5426
|
+
dispatch(fetchMessageListByUserId({ userId: currentUser.userId, page: 0 }));
|
|
5427
|
+
}, [currentUser?.userId, dispatch]);
|
|
6114
5428
|
const handleStartChat = () => {
|
|
6115
5429
|
if (!receiverUserDetails?.userId) return;
|
|
6116
5430
|
const existingChat = chatList?.rows?.data?.find(
|
|
@@ -6146,11 +5460,11 @@ function ChatUserList() {
|
|
|
6146
5460
|
}
|
|
6147
5461
|
}, [senderDetails?.userId]);
|
|
6148
5462
|
useEffect5(() => {
|
|
6149
|
-
if (!
|
|
5463
|
+
if (!senderDetails?.userId) return;
|
|
6150
5464
|
const socket2 = getSocket(senderDetails.userId);
|
|
6151
5465
|
if (!socket2) return;
|
|
6152
5466
|
const handleNewChat = (data2) => {
|
|
6153
|
-
if (data2.sender ===
|
|
5467
|
+
if (data2.sender === senderDetails.userId) return;
|
|
6154
5468
|
dispatch(
|
|
6155
5469
|
addUserToChatList({
|
|
6156
5470
|
message: data2.message,
|
|
@@ -6166,7 +5480,7 @@ function ChatUserList() {
|
|
|
6166
5480
|
return () => {
|
|
6167
5481
|
socket2.off("newChat", handleNewChat);
|
|
6168
5482
|
};
|
|
6169
|
-
}, [senderDetails
|
|
5483
|
+
}, [dispatch, senderDetails?.userId]);
|
|
6170
5484
|
useEffect5(() => {
|
|
6171
5485
|
if (!senderDetails?.userId) return;
|
|
6172
5486
|
const socket2 = getSocket(senderDetails?.userId || "");
|
|
@@ -6209,17 +5523,18 @@ function ChatUserList() {
|
|
|
6209
5523
|
};
|
|
6210
5524
|
}, [chatList, senderDetails?.userId]);
|
|
6211
5525
|
const loadMoreChats = () => {
|
|
6212
|
-
if (!chatList?.hasMore) return;
|
|
5526
|
+
if (!chatList?.hasMore || !currentUser?.userId) return;
|
|
6213
5527
|
const nextPage = page + 1;
|
|
6214
5528
|
setPage(nextPage);
|
|
6215
5529
|
dispatch(
|
|
6216
5530
|
fetchMessageListByUserId({
|
|
6217
|
-
userId:
|
|
5531
|
+
userId: currentUser.userId,
|
|
6218
5532
|
page: nextPage
|
|
6219
5533
|
})
|
|
6220
5534
|
);
|
|
6221
5535
|
};
|
|
6222
5536
|
const handleJoinChat = (item) => {
|
|
5537
|
+
if (!senderDetails?.userId) return;
|
|
6223
5538
|
const socket2 = getSocket(senderDetails.userId);
|
|
6224
5539
|
if (!socket2) return;
|
|
6225
5540
|
setReceiverDetails({
|
|
@@ -6246,12 +5561,45 @@ function ChatUserList() {
|
|
|
6246
5561
|
})
|
|
6247
5562
|
);
|
|
6248
5563
|
};
|
|
5564
|
+
const handleSearchUsers = (value) => {
|
|
5565
|
+
setReceiverSearchValue(value);
|
|
5566
|
+
};
|
|
5567
|
+
useEffect5(() => {
|
|
5568
|
+
if (!receiverSearchValue.trim()) {
|
|
5569
|
+
setSearchResults([]);
|
|
5570
|
+
setIsSearching(false);
|
|
5571
|
+
return;
|
|
5572
|
+
}
|
|
5573
|
+
if (!onSearchUsers) {
|
|
5574
|
+
setSearchResults([]);
|
|
5575
|
+
setIsSearching(false);
|
|
5576
|
+
return;
|
|
5577
|
+
}
|
|
5578
|
+
let isCancelled = false;
|
|
5579
|
+
const timeoutId = setTimeout(async () => {
|
|
5580
|
+
try {
|
|
5581
|
+
setIsSearching(true);
|
|
5582
|
+
setSearchResults([]);
|
|
5583
|
+
const filteredUsers = await Promise.resolve(onSearchUsers(receiverSearchValue));
|
|
5584
|
+
if (isCancelled) return;
|
|
5585
|
+
setSearchResults(filteredUsers);
|
|
5586
|
+
} finally {
|
|
5587
|
+
if (!isCancelled) {
|
|
5588
|
+
setIsSearching(false);
|
|
5589
|
+
}
|
|
5590
|
+
}
|
|
5591
|
+
}, 400);
|
|
5592
|
+
return () => {
|
|
5593
|
+
isCancelled = true;
|
|
5594
|
+
clearTimeout(timeoutId);
|
|
5595
|
+
};
|
|
5596
|
+
}, [receiverSearchValue, onSearchUsers]);
|
|
6249
5597
|
const stripHtml = (html) => {
|
|
6250
5598
|
const div = document.createElement("div");
|
|
6251
5599
|
div.innerHTML = html;
|
|
6252
5600
|
return div.textContent || "";
|
|
6253
5601
|
};
|
|
6254
|
-
const userOptions =
|
|
5602
|
+
const userOptions = searchResults.map((user) => ({
|
|
6255
5603
|
value: user.username,
|
|
6256
5604
|
label: user.displayName || user.username,
|
|
6257
5605
|
user
|
|
@@ -6263,8 +5611,10 @@ function ChatUserList() {
|
|
|
6263
5611
|
onClose: () => {
|
|
6264
5612
|
close();
|
|
6265
5613
|
setReceiverSearchValue("");
|
|
5614
|
+
setSearchResults([]);
|
|
5615
|
+
setIsSearching(false);
|
|
6266
5616
|
},
|
|
6267
|
-
title: "
|
|
5617
|
+
title: "Search User",
|
|
6268
5618
|
centered: true,
|
|
6269
5619
|
withCloseButton: true
|
|
6270
5620
|
},
|
|
@@ -6272,40 +5622,21 @@ function ChatUserList() {
|
|
|
6272
5622
|
Autocomplete,
|
|
6273
5623
|
{
|
|
6274
5624
|
mb: 12,
|
|
6275
|
-
label: "
|
|
6276
|
-
placeholder: "Type username...",
|
|
6277
|
-
limit: 20,
|
|
6278
|
-
data: userOptions,
|
|
6279
|
-
value: senderSearchValue,
|
|
6280
|
-
onChange: setSenderSearchValue,
|
|
6281
|
-
onOptionSubmit: (val) => {
|
|
6282
|
-
const selected = users_list_default.find((u) => u.username === val);
|
|
6283
|
-
if (selected) {
|
|
6284
|
-
setSenderSearchValue("");
|
|
6285
|
-
setSenderUserDetails(selected);
|
|
6286
|
-
}
|
|
6287
|
-
},
|
|
6288
|
-
renderOption: ({ option }) => {
|
|
6289
|
-
const user = option.user;
|
|
6290
|
-
return /* @__PURE__ */ React9.createElement(Group, { gap: "sm" }, /* @__PURE__ */ React9.createElement(Avatar3, { src: user.avatar, size: 36, radius: "xl" }), /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(Text3, { size: "sm" }, user.displayName || user.username), user.displayName && /* @__PURE__ */ React9.createElement(Text3, { size: "xs", opacity: 0.5 }, "@", user.username)));
|
|
6291
|
-
}
|
|
6292
|
-
}
|
|
6293
|
-
),
|
|
6294
|
-
/* @__PURE__ */ React9.createElement(
|
|
6295
|
-
Autocomplete,
|
|
6296
|
-
{
|
|
6297
|
-
mb: 12,
|
|
6298
|
-
label: "Receiver",
|
|
6299
|
-
placeholder: "Type username...",
|
|
5625
|
+
label: "Search User to Chat",
|
|
5626
|
+
placeholder: "Type username to search...",
|
|
6300
5627
|
limit: 20,
|
|
6301
5628
|
data: userOptions,
|
|
6302
5629
|
value: receiverSearchValue,
|
|
6303
|
-
onChange:
|
|
5630
|
+
onChange: handleSearchUsers,
|
|
5631
|
+
rightSection: isSearching ? /* @__PURE__ */ React9.createElement(Loader, { size: "xs" }) : void 0,
|
|
5632
|
+
rightSectionWidth: 28,
|
|
6304
5633
|
onOptionSubmit: (val) => {
|
|
6305
|
-
const selected =
|
|
5634
|
+
const selected = searchResults.find((u) => u.username === val);
|
|
6306
5635
|
if (selected) {
|
|
6307
5636
|
setReceiverSearchValue("");
|
|
6308
5637
|
setReceiverUserDetails(selected);
|
|
5638
|
+
setSearchResults([]);
|
|
5639
|
+
setIsSearching(false);
|
|
6309
5640
|
}
|
|
6310
5641
|
},
|
|
6311
5642
|
renderOption: ({ option }) => {
|
|
@@ -6323,18 +5654,20 @@ function ChatUserList() {
|
|
|
6323
5654
|
},
|
|
6324
5655
|
"Start Chat"
|
|
6325
5656
|
)
|
|
6326
|
-
), /* @__PURE__ */ React9.createElement("div", { className: "mrchat-chatContainer" }, /* @__PURE__ */ React9.createElement("div", { className: "mrchat-sidebar" }, /* @__PURE__ */ React9.createElement("div", { className: "mrchat-sidebarTop" }, /* @__PURE__ */ React9.createElement("div", { className: "mrchat-topBar" }, /* @__PURE__ */ React9.createElement(Text3, { size: "
|
|
5657
|
+
), /* @__PURE__ */ React9.createElement("div", { className: "mrchat-chatContainer" }, /* @__PURE__ */ React9.createElement("div", { className: "mrchat-sidebar" }, /* @__PURE__ */ React9.createElement("div", { className: "mrchat-sidebarTop" }, /* @__PURE__ */ React9.createElement("div", { className: "mrchat-topBar" }, /* @__PURE__ */ React9.createElement(Text3, { size: "xs", c: "dimmed", mt: "sm", mb: "xs", ml: 12 }, "All Messages"), /* @__PURE__ */ React9.createElement("div", { className: "mrchat-topActions" }, /* @__PURE__ */ React9.createElement(
|
|
6327
5658
|
ActionIcon2,
|
|
6328
5659
|
{
|
|
6329
5660
|
variant: "subtle",
|
|
6330
5661
|
onClick: () => {
|
|
6331
5662
|
setReceiverUserDetails(null);
|
|
5663
|
+
setReceiverSearchValue("");
|
|
5664
|
+
setSearchResults([]);
|
|
6332
5665
|
open();
|
|
6333
5666
|
},
|
|
6334
5667
|
radius: "lg"
|
|
6335
5668
|
},
|
|
6336
5669
|
/* @__PURE__ */ React9.createElement(IconPlus, { size: 20, stroke: 3 })
|
|
6337
|
-
)))), /* @__PURE__ */ React9.createElement(
|
|
5670
|
+
)))), /* @__PURE__ */ React9.createElement("div", { className: "mrchat-scrollWrapper" }, /* @__PURE__ */ React9.createElement(
|
|
6338
5671
|
VirtualizedList,
|
|
6339
5672
|
{
|
|
6340
5673
|
data: chatList?.rows?.data || [],
|
|
@@ -6401,10 +5734,19 @@ function ChatUserList() {
|
|
|
6401
5734
|
}
|
|
6402
5735
|
|
|
6403
5736
|
// src/components/MrChat/index.tsx
|
|
6404
|
-
function MrChat(props) {
|
|
6405
|
-
const [primaryColor] = useState6("customBrand");
|
|
5737
|
+
function MrChat({ colorScheme, ...props }) {
|
|
5738
|
+
const [primaryColor, setPrimaryColor] = useState6("customBrand");
|
|
6406
5739
|
const theme = createAppTheme(primaryColor);
|
|
6407
|
-
return /* @__PURE__ */ React10.createElement(ReduxProvider, null, /* @__PURE__ */ React10.createElement(SocketProvider, null, /* @__PURE__ */ React10.createElement(
|
|
5740
|
+
return /* @__PURE__ */ React10.createElement(ReduxProvider, null, /* @__PURE__ */ React10.createElement(SocketProvider, null, /* @__PURE__ */ React10.createElement(
|
|
5741
|
+
MantineProvider,
|
|
5742
|
+
{
|
|
5743
|
+
defaultColorScheme: colorScheme ?? "light",
|
|
5744
|
+
forceColorScheme: colorScheme,
|
|
5745
|
+
theme
|
|
5746
|
+
},
|
|
5747
|
+
/* @__PURE__ */ React10.createElement(Notifications, null),
|
|
5748
|
+
/* @__PURE__ */ React10.createElement(ChatUserList, { ...props })
|
|
5749
|
+
)));
|
|
6408
5750
|
}
|
|
6409
5751
|
export {
|
|
6410
5752
|
MrChat
|