@rpg-engine/long-bow 0.7.22 → 0.7.23
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/components/Chat/Chat.d.ts +1 -1
- package/dist/components/ChatRevamp/ChatContent.d.ts +24 -0
- package/dist/components/ChatRevamp/ChatRevamp.d.ts +1 -33
- package/dist/components/ChatRevamp/ChatTabs.d.ts +11 -0
- package/dist/components/ChatRevamp/ExpandButton.d.ts +7 -0
- package/dist/components/ChatRevamp/RecentChats.d.ts +16 -0
- package/dist/components/ChatRevamp/SearchCharacter.d.ts +1 -1
- package/dist/components/ChatRevamp/types.d.ts +33 -0
- package/dist/hooks/useChat.d.ts +12 -0
- package/dist/long-bow.cjs.development.js +331 -212
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +331 -212
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/ChatRevamp.stories.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Chat/Chat.tsx +1 -1
- package/src/components/ChatRevamp/ChatContent.tsx +94 -0
- package/src/components/ChatRevamp/ChatRevamp.tsx +119 -433
- package/src/components/ChatRevamp/ChatTabs.tsx +51 -0
- package/src/components/ChatRevamp/ExpandButton.tsx +40 -0
- package/src/components/ChatRevamp/RecentChats.tsx +239 -0
- package/src/components/ChatRevamp/SearchCharacter.tsx +17 -20
- package/src/components/ChatRevamp/types.ts +41 -0
- package/src/hooks/useChat.ts +62 -0
- package/src/stories/Chat.stories.tsx +1 -0
- package/src/stories/ChatRevamp.stories.tsx +18 -89
|
@@ -14,8 +14,8 @@ var shared = require('@rpg-engine/shared');
|
|
|
14
14
|
var dayjs = _interopDefault(require('dayjs'));
|
|
15
15
|
var reactErrorBoundary = require('react-error-boundary');
|
|
16
16
|
var fa = require('react-icons/fa');
|
|
17
|
-
var io = require('react-icons/io');
|
|
18
17
|
var rx = require('react-icons/rx');
|
|
18
|
+
var io = require('react-icons/io');
|
|
19
19
|
var Draggable = _interopDefault(require('react-draggable'));
|
|
20
20
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
21
21
|
var lodash = require('lodash');
|
|
@@ -26392,6 +26392,55 @@ var MessageText = /*#__PURE__*/styled__default.p.withConfig({
|
|
|
26392
26392
|
componentId: "sc-fuuod3-5"
|
|
26393
26393
|
})(["display:block !important;width:100%;font-size:", " !important;overflow-y:auto;margin:0;"], uiFonts.size.xsmall);
|
|
26394
26394
|
|
|
26395
|
+
var useChat = function useChat(_ref) {
|
|
26396
|
+
var minimizedByDefault = _ref.minimizedByDefault,
|
|
26397
|
+
isPrivate = _ref.isPrivate,
|
|
26398
|
+
onChangeTab = _ref.onChangeTab,
|
|
26399
|
+
onPreviousChatCharacterClick = _ref.onPreviousChatCharacterClick,
|
|
26400
|
+
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26401
|
+
unseenMessageCharacterIds = _ref.unseenMessageCharacterIds;
|
|
26402
|
+
var _useState = React.useState(false),
|
|
26403
|
+
showRecentChats = _useState[0],
|
|
26404
|
+
setShowRecentChats = _useState[1];
|
|
26405
|
+
var _useState2 = React.useState(!minimizedByDefault),
|
|
26406
|
+
isExpanded = _useState2[0],
|
|
26407
|
+
setIsExpanded = _useState2[1];
|
|
26408
|
+
React.useEffect(function () {
|
|
26409
|
+
if (isPrivate) {
|
|
26410
|
+
setIsExpanded(true);
|
|
26411
|
+
}
|
|
26412
|
+
}, [isPrivate]);
|
|
26413
|
+
var toggleExpand = function toggleExpand() {
|
|
26414
|
+
return setIsExpanded(function (prev) {
|
|
26415
|
+
return !prev;
|
|
26416
|
+
});
|
|
26417
|
+
};
|
|
26418
|
+
var toggleRecentChats = function toggleRecentChats() {
|
|
26419
|
+
return setShowRecentChats(function (prev) {
|
|
26420
|
+
return !prev;
|
|
26421
|
+
});
|
|
26422
|
+
};
|
|
26423
|
+
var handleTabChange = function handleTabChange(tabId) {
|
|
26424
|
+
if (tabId === 'private') {
|
|
26425
|
+
setIsExpanded(true);
|
|
26426
|
+
}
|
|
26427
|
+
onChangeTab(tabId);
|
|
26428
|
+
};
|
|
26429
|
+
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26430
|
+
onPreviousChatCharacterClick == null ? void 0 : onPreviousChatCharacterClick(character);
|
|
26431
|
+
hideSearchCharacterUI();
|
|
26432
|
+
};
|
|
26433
|
+
return {
|
|
26434
|
+
showRecentChats: showRecentChats,
|
|
26435
|
+
isExpanded: isExpanded,
|
|
26436
|
+
toggleExpand: toggleExpand,
|
|
26437
|
+
toggleRecentChats: toggleRecentChats,
|
|
26438
|
+
handleTabChange: handleTabChange,
|
|
26439
|
+
handlePreviousChatCharacterClick: handlePreviousChatCharacterClick,
|
|
26440
|
+
hasUnseenMessages: unseenMessageCharacterIds && (unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.length) > 0
|
|
26441
|
+
};
|
|
26442
|
+
};
|
|
26443
|
+
|
|
26395
26444
|
var SearchCharacter = function SearchCharacter(_ref) {
|
|
26396
26445
|
var onChangeCharacterName = _ref.onChangeCharacterName,
|
|
26397
26446
|
onBlur = _ref.onBlur,
|
|
@@ -26440,12 +26489,12 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26440
26489
|
value: characterName,
|
|
26441
26490
|
ref: searchCharacterRef,
|
|
26442
26491
|
id: "characterName",
|
|
26443
|
-
name:
|
|
26492
|
+
name: "characterName",
|
|
26444
26493
|
onChange: function onChange(e) {
|
|
26445
26494
|
setCharacterName(e.target.value);
|
|
26446
26495
|
onChangeCharacterName(e.target.value);
|
|
26447
26496
|
},
|
|
26448
|
-
placeholder:
|
|
26497
|
+
placeholder: "Search for a character...",
|
|
26449
26498
|
height: 20,
|
|
26450
26499
|
type: "text",
|
|
26451
26500
|
autoComplete: "off",
|
|
@@ -26455,7 +26504,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26455
26504
|
})), React__default.createElement(Column, {
|
|
26456
26505
|
justifyContent: "flex-end"
|
|
26457
26506
|
}, React__default.createElement(SearchButton, {
|
|
26458
|
-
type:
|
|
26507
|
+
type: "submit",
|
|
26459
26508
|
buttonColor: (styles == null ? void 0 : styles.buttonColor) || '#005b96',
|
|
26460
26509
|
buttonBackgroundColor: (styles == null ? void 0 : styles.buttonBackgroundColor) || 'rgba(0,0,0,.5)',
|
|
26461
26510
|
id: "chat-send-button",
|
|
@@ -26471,7 +26520,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26471
26520
|
},
|
|
26472
26521
|
key: character._id
|
|
26473
26522
|
}, React__default.createElement(Ellipsis, {
|
|
26474
|
-
maxWidth:
|
|
26523
|
+
maxWidth: "150px",
|
|
26475
26524
|
maxLines: 1
|
|
26476
26525
|
}, character.name));
|
|
26477
26526
|
})));
|
|
@@ -26507,186 +26556,83 @@ var ListElement = /*#__PURE__*/styled__default.li.withConfig({
|
|
|
26507
26556
|
componentId: "sc-172lyfr-5"
|
|
26508
26557
|
})(["margin:0.5rem 0 !important;font-size:", ";padding:0.5rem 2px;&:hover{color:#ff0;background-color:", ";}button{all:unset;}"], uiFonts.size.small, uiColors.darkGray);
|
|
26509
26558
|
|
|
26510
|
-
var
|
|
26511
|
-
var
|
|
26559
|
+
var ChatContent = function ChatContent(_ref) {
|
|
26560
|
+
var isPrivate = _ref.isPrivate,
|
|
26561
|
+
isTrade = _ref.isTrade,
|
|
26562
|
+
searchCharacterUI = _ref.searchCharacterUI,
|
|
26563
|
+
chatMessages = _ref.chatMessages,
|
|
26512
26564
|
onSendGlobalChatMessage = _ref.onSendGlobalChatMessage,
|
|
26513
|
-
|
|
26514
|
-
|
|
26515
|
-
onBlur = _ref.onBlur,
|
|
26565
|
+
onSendPrivateChatMessage = _ref.onSendPrivateChatMessage,
|
|
26566
|
+
onSendTradeMessage = _ref.onSendTradeMessage,
|
|
26516
26567
|
onCloseButton = _ref.onCloseButton,
|
|
26517
26568
|
styles = _ref.styles,
|
|
26518
|
-
|
|
26519
|
-
|
|
26520
|
-
|
|
26569
|
+
onFocus = _ref.onFocus,
|
|
26570
|
+
onBlur = _ref.onBlur,
|
|
26571
|
+
isExpanded = _ref.isExpanded,
|
|
26572
|
+
autoCloseOnSend = _ref.autoCloseOnSend,
|
|
26573
|
+
onChangeCharacterName = _ref.onChangeCharacterName,
|
|
26521
26574
|
privateChatCharacters = _ref.privateChatCharacters,
|
|
26522
|
-
onCharacterClick = _ref.onCharacterClick,
|
|
26523
|
-
onSendPrivateChatMessage = _ref.onSendPrivateChatMessage,
|
|
26524
|
-
recentChatCharacters = _ref.recentChatCharacters,
|
|
26525
|
-
_ref$recentSelectedCh = _ref.recentSelectedChatCharacterId,
|
|
26526
|
-
recentSelectedChatCharacterId = _ref$recentSelectedCh === void 0 ? '' : _ref$recentSelectedCh,
|
|
26527
|
-
onPreviousChatCharacterClick = _ref.onPreviousChatCharacterClick,
|
|
26528
|
-
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26529
|
-
_ref$unseenMessageCha = _ref.unseenMessageCharacterIds,
|
|
26530
|
-
unseenMessageCharacterIds = _ref$unseenMessageCha === void 0 ? [] : _ref$unseenMessageCha,
|
|
26531
|
-
onSendTradeMessage = _ref.onSendTradeMessage,
|
|
26532
|
-
searchCharacterUI = _ref.searchCharacterUI,
|
|
26533
26575
|
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26534
|
-
|
|
26535
|
-
|
|
26536
|
-
|
|
26537
|
-
_ref$autoCloseOnSend = _ref.autoCloseOnSend,
|
|
26538
|
-
autoCloseOnSend = _ref$autoCloseOnSend === void 0 ? false : _ref$autoCloseOnSend;
|
|
26539
|
-
var _useState = React.useState(false),
|
|
26540
|
-
showRecentChats = _useState[0],
|
|
26541
|
-
setShowRecentChats = _useState[1];
|
|
26542
|
-
var _useState2 = React.useState(!minimizedByDefault),
|
|
26543
|
-
isExpanded = _useState2[0],
|
|
26544
|
-
setIsExpanded = _useState2[1];
|
|
26545
|
-
var isPrivate = activeTab === 'private';
|
|
26546
|
-
var isTrade = activeTab === 'trade';
|
|
26547
|
-
React.useEffect(function () {
|
|
26548
|
-
if (isPrivate) {
|
|
26549
|
-
setIsExpanded(true);
|
|
26550
|
-
}
|
|
26551
|
-
}, [isPrivate]);
|
|
26552
|
-
var toggleExpand = function toggleExpand() {
|
|
26553
|
-
return setIsExpanded(function (prev) {
|
|
26554
|
-
return !prev;
|
|
26555
|
-
});
|
|
26556
|
-
};
|
|
26557
|
-
var toggleRecentChats = function toggleRecentChats() {
|
|
26558
|
-
return setShowRecentChats(function (prev) {
|
|
26559
|
-
return !prev;
|
|
26560
|
-
});
|
|
26561
|
-
};
|
|
26562
|
-
var handleTabChange = function handleTabChange(tabId) {
|
|
26563
|
-
if (tabId === 'private') {
|
|
26564
|
-
setIsExpanded(true);
|
|
26565
|
-
}
|
|
26566
|
-
onChangeTab(tabId);
|
|
26567
|
-
};
|
|
26568
|
-
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26569
|
-
onPreviousChatCharacterClick == null ? void 0 : onPreviousChatCharacterClick(character);
|
|
26570
|
-
hideSearchCharacterUI();
|
|
26571
|
-
};
|
|
26572
|
-
var renderTabs = function renderTabs() {
|
|
26573
|
-
return React__default.createElement(TabContainer, null, tabs.map(function (tab, index) {
|
|
26574
|
-
return React__default.createElement(Tab, {
|
|
26575
|
-
key: tab.label + "_" + index,
|
|
26576
|
-
active: tab.id === activeTab,
|
|
26577
|
-
onPointerDown: function onPointerDown() {
|
|
26578
|
-
return handleTabChange(tab.id);
|
|
26579
|
-
}
|
|
26580
|
-
}, tab.label);
|
|
26581
|
-
}));
|
|
26582
|
-
};
|
|
26583
|
-
var renderRecentChatTopBar = function renderRecentChatTopBar() {
|
|
26584
|
-
return React__default.createElement(RecentChatTopBar, null, React__default.createElement(BurgerIconContainer, {
|
|
26585
|
-
onPointerDown: toggleRecentChats,
|
|
26586
|
-
hasUnseenMessages: unseenMessageCharacterIds.length > 0
|
|
26587
|
-
}, React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null)), showRecentChats && React__default.createElement(SearchButton$1, {
|
|
26588
|
-
onPointerDown: showSearchCharacterUI
|
|
26589
|
-
}, React__default.createElement(rx.RxMagnifyingGlass, {
|
|
26590
|
-
size: 16,
|
|
26591
|
-
color: uiColors.white
|
|
26592
|
-
})));
|
|
26593
|
-
};
|
|
26594
|
-
var renderRecentChatList = function renderRecentChatList() {
|
|
26595
|
-
return React__default.createElement(RecentChatLogContainer, {
|
|
26596
|
-
isOpen: showRecentChats
|
|
26597
|
-
}, recentChatCharacters == null ? void 0 : recentChatCharacters.map(function (character) {
|
|
26598
|
-
return React__default.createElement(ListElementContainer, {
|
|
26599
|
-
key: character._id
|
|
26600
|
-
}, React__default.createElement(ListElement$1, {
|
|
26601
|
-
active: character._id === recentSelectedChatCharacterId,
|
|
26602
|
-
onPointerDown: function onPointerDown() {
|
|
26603
|
-
return handlePreviousChatCharacterClick(character);
|
|
26604
|
-
}
|
|
26605
|
-
}, React__default.createElement(StatusDot, {
|
|
26606
|
-
isUnseen: unseenMessageCharacterIds.includes(character._id)
|
|
26607
|
-
}), React__default.createElement(Ellipsis, {
|
|
26608
|
-
maxWidth: "140px",
|
|
26609
|
-
maxLines: 1
|
|
26610
|
-
}, character.name)), React__default.createElement(CloseButton$2, {
|
|
26611
|
-
className: "close-button",
|
|
26612
|
-
onPointerDown: function onPointerDown() {
|
|
26613
|
-
return onRemoveRecentChatCharacter == null ? void 0 : onRemoveRecentChatCharacter(character);
|
|
26614
|
-
}
|
|
26615
|
-
}, React__default.createElement(rx.RxCross2, {
|
|
26616
|
-
size: 16
|
|
26617
|
-
})));
|
|
26618
|
-
}));
|
|
26619
|
-
};
|
|
26620
|
-
var renderChatContent = function renderChatContent() {
|
|
26621
|
-
if (isPrivate && searchCharacterUI) {
|
|
26622
|
-
return React__default.createElement(SearchCharacter, {
|
|
26623
|
-
onFocus: onFocus,
|
|
26624
|
-
onBlur: onBlur,
|
|
26625
|
-
onChangeCharacterName: onChangeCharacterName,
|
|
26626
|
-
styles: styles,
|
|
26627
|
-
recentCharacters: privateChatCharacters,
|
|
26628
|
-
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26629
|
-
onCharacterClick: onCharacterClick
|
|
26630
|
-
});
|
|
26631
|
-
}
|
|
26632
|
-
return React__default.createElement(Chat, {
|
|
26633
|
-
chatMessages: chatMessages,
|
|
26634
|
-
onSendChatMessage: function onSendChatMessage() {
|
|
26635
|
-
if (autoCloseOnSend) {
|
|
26636
|
-
onCloseButton();
|
|
26637
|
-
}
|
|
26638
|
-
if (isPrivate) {
|
|
26639
|
-
return onSendPrivateChatMessage;
|
|
26640
|
-
} else if (isTrade) {
|
|
26641
|
-
return onSendTradeMessage;
|
|
26642
|
-
} else {
|
|
26643
|
-
return onSendGlobalChatMessage;
|
|
26644
|
-
}
|
|
26645
|
-
},
|
|
26646
|
-
sendMessage: true,
|
|
26647
|
-
onCloseButton: onCloseButton,
|
|
26648
|
-
styles: styles,
|
|
26576
|
+
onCharacterClick = _ref.onCharacterClick;
|
|
26577
|
+
if (isPrivate && searchCharacterUI) {
|
|
26578
|
+
return React__default.createElement(SearchCharacter, {
|
|
26649
26579
|
onFocus: onFocus,
|
|
26650
26580
|
onBlur: onBlur,
|
|
26651
|
-
|
|
26581
|
+
onChangeCharacterName: onChangeCharacterName,
|
|
26582
|
+
styles: styles,
|
|
26583
|
+
recentCharacters: privateChatCharacters,
|
|
26584
|
+
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26585
|
+
onCharacterClick: onCharacterClick
|
|
26652
26586
|
});
|
|
26653
|
-
}
|
|
26654
|
-
return React__default.createElement(
|
|
26655
|
-
|
|
26656
|
-
|
|
26657
|
-
|
|
26658
|
-
|
|
26659
|
-
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
|
|
26663
|
-
|
|
26664
|
-
|
|
26665
|
-
|
|
26587
|
+
}
|
|
26588
|
+
return React__default.createElement(ChatWrapper, null, React__default.createElement(Chat, {
|
|
26589
|
+
chatMessages: chatMessages,
|
|
26590
|
+
onSendChatMessage: function onSendChatMessage() {
|
|
26591
|
+
if (autoCloseOnSend) {
|
|
26592
|
+
onCloseButton();
|
|
26593
|
+
}
|
|
26594
|
+
if (isPrivate) {
|
|
26595
|
+
return onSendPrivateChatMessage;
|
|
26596
|
+
} else if (isTrade) {
|
|
26597
|
+
return onSendTradeMessage;
|
|
26598
|
+
} else {
|
|
26599
|
+
return onSendGlobalChatMessage;
|
|
26600
|
+
}
|
|
26601
|
+
},
|
|
26602
|
+
sendMessage: true,
|
|
26603
|
+
onCloseButton: onCloseButton,
|
|
26604
|
+
styles: styles,
|
|
26605
|
+
onFocus: onFocus,
|
|
26606
|
+
onBlur: onBlur,
|
|
26666
26607
|
isExpanded: isExpanded
|
|
26667
|
-
}
|
|
26668
|
-
|
|
26669
|
-
|
|
26670
|
-
|
|
26608
|
+
}));
|
|
26609
|
+
};
|
|
26610
|
+
var ChatWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
26611
|
+
displayName: "ChatContent__ChatWrapper",
|
|
26612
|
+
componentId: "sc-1380qen-0"
|
|
26613
|
+
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;position:relative;"]);
|
|
26614
|
+
|
|
26615
|
+
var ChatTabs = function ChatTabs(_ref) {
|
|
26616
|
+
var tabs = _ref.tabs,
|
|
26617
|
+
activeTab = _ref.activeTab,
|
|
26618
|
+
onChangeTab = _ref.onChangeTab;
|
|
26619
|
+
return React__default.createElement(TabContainer, null, tabs.map(function (tab, index) {
|
|
26620
|
+
return React__default.createElement(Tab, {
|
|
26621
|
+
key: tab.label + "_" + index,
|
|
26622
|
+
active: tab.id === activeTab,
|
|
26623
|
+
onPointerDown: function onPointerDown() {
|
|
26624
|
+
return onChangeTab(tab.id);
|
|
26625
|
+
}
|
|
26626
|
+
}, tab.label);
|
|
26627
|
+
}));
|
|
26671
26628
|
};
|
|
26672
|
-
var ChatRevampContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26673
|
-
displayName: "ChatRevamp__ChatRevampContainer",
|
|
26674
|
-
componentId: "sc-1sdiknw-0"
|
|
26675
|
-
})(["display:flex;flex-direction:column;width:100%;position:relative;"]);
|
|
26676
|
-
var TopBar = /*#__PURE__*/styled__default.div.withConfig({
|
|
26677
|
-
displayName: "ChatRevamp__TopBar",
|
|
26678
|
-
componentId: "sc-1sdiknw-1"
|
|
26679
|
-
})(["display:flex;align-items:center;justify-content:flex-start;", ""], function (_ref2) {
|
|
26680
|
-
var isExpanded = _ref2.isExpanded;
|
|
26681
|
-
return !isExpanded && styled.css(["min-height:32px;"]);
|
|
26682
|
-
});
|
|
26683
26629
|
var TabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26684
|
-
displayName: "
|
|
26685
|
-
componentId: "sc-
|
|
26630
|
+
displayName: "ChatTabs__TabContainer",
|
|
26631
|
+
componentId: "sc-rcifrl-0"
|
|
26686
26632
|
})(["display:flex;gap:10px;align-items:center;flex-grow:1;"]);
|
|
26687
26633
|
var Tab = /*#__PURE__*/styled__default.button.withConfig({
|
|
26688
|
-
displayName: "
|
|
26689
|
-
componentId: "sc-
|
|
26634
|
+
displayName: "ChatTabs__Tab",
|
|
26635
|
+
componentId: "sc-rcifrl-1"
|
|
26690
26636
|
})(["width:120px;color:white;font-size:0.8rem;all:unset;padding:0.6rem;font-size:0.8rem;border-radius:5px 5px 0 0;border-width:0.25rem 0.25rem 0 0.25rem;border-style:solid;border-color:", ";background-color:", ";color:", ";"], function (props) {
|
|
26691
26637
|
return props.active ? 'rgba(198, 81, 2, 0.5)' : 'rgba(128, 128, 128, 0.5)';
|
|
26692
26638
|
}, function (props) {
|
|
@@ -26694,27 +26640,78 @@ var Tab = /*#__PURE__*/styled__default.button.withConfig({
|
|
|
26694
26640
|
}, function (props) {
|
|
26695
26641
|
return props.active ? 'white' : uiColors.darkGray;
|
|
26696
26642
|
});
|
|
26697
|
-
|
|
26698
|
-
|
|
26699
|
-
|
|
26700
|
-
|
|
26701
|
-
|
|
26643
|
+
|
|
26644
|
+
var ExpandButton = function ExpandButton(_ref) {
|
|
26645
|
+
var isExpanded = _ref.isExpanded,
|
|
26646
|
+
onClick = _ref.onClick;
|
|
26647
|
+
return React__default.createElement(StyledExpandButton, {
|
|
26648
|
+
isExpanded: isExpanded,
|
|
26649
|
+
onClick: onClick
|
|
26650
|
+
}, isExpanded ? React__default.createElement(io.IoMdContract, {
|
|
26651
|
+
size: 20
|
|
26652
|
+
}) : React__default.createElement(io.IoMdExpand, {
|
|
26653
|
+
size: 20
|
|
26654
|
+
}));
|
|
26655
|
+
};
|
|
26656
|
+
var StyledExpandButton = /*#__PURE__*/styled__default.button.withConfig({
|
|
26657
|
+
displayName: "ExpandButton__StyledExpandButton",
|
|
26658
|
+
componentId: "sc-vdxez5-0"
|
|
26659
|
+
})(["position:absolute;top:0;", ";width:30px;height:30px;background-color:", ";color:white;border:none;border-radius:50%;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all 0.3s ease;z-index:10;&:hover{background-color:", ";}"], function (_ref2) {
|
|
26660
|
+
var isExpanded = _ref2.isExpanded;
|
|
26702
26661
|
return isExpanded ? 'right: 0' : 'left: 0';
|
|
26703
26662
|
}, uiColors.orange, uiColors.orange);
|
|
26704
|
-
|
|
26705
|
-
|
|
26706
|
-
|
|
26707
|
-
|
|
26708
|
-
|
|
26709
|
-
|
|
26710
|
-
|
|
26711
|
-
|
|
26712
|
-
|
|
26713
|
-
|
|
26714
|
-
|
|
26663
|
+
|
|
26664
|
+
var RecentChats = function RecentChats(_ref) {
|
|
26665
|
+
var showRecentChats = _ref.showRecentChats,
|
|
26666
|
+
toggleRecentChats = _ref.toggleRecentChats,
|
|
26667
|
+
hasUnseenMessages = _ref.hasUnseenMessages,
|
|
26668
|
+
showSearchCharacterUI = _ref.showSearchCharacterUI,
|
|
26669
|
+
recentChatCharacters = _ref.recentChatCharacters,
|
|
26670
|
+
recentSelectedChatCharacterId = _ref.recentSelectedChatCharacterId,
|
|
26671
|
+
unseenMessageCharacterIds = _ref.unseenMessageCharacterIds,
|
|
26672
|
+
onPreviousChatCharacterClick = _ref.onPreviousChatCharacterClick,
|
|
26673
|
+
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26674
|
+
isPrivate = _ref.isPrivate;
|
|
26675
|
+
return React__default.createElement(RecentChatTabContainer, {
|
|
26676
|
+
isOpen: showRecentChats,
|
|
26677
|
+
isPrivate: isPrivate
|
|
26678
|
+
}, React__default.createElement(RecentChatTopBar, null, React__default.createElement(BurgerIconContainer, {
|
|
26679
|
+
onPointerDown: toggleRecentChats,
|
|
26680
|
+
hasUnseenMessages: hasUnseenMessages
|
|
26681
|
+
}, React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null)), showRecentChats && React__default.createElement(SearchButton$1, {
|
|
26682
|
+
onPointerDown: showSearchCharacterUI
|
|
26683
|
+
}, React__default.createElement(rx.RxMagnifyingGlass, {
|
|
26684
|
+
size: 16,
|
|
26685
|
+
color: uiColors.white
|
|
26686
|
+
}))), React__default.createElement(RecentChatLogContainer, {
|
|
26687
|
+
isOpen: showRecentChats
|
|
26688
|
+
}, recentChatCharacters == null ? void 0 : recentChatCharacters.map(function (character) {
|
|
26689
|
+
var _unseenMessageCharact;
|
|
26690
|
+
return React__default.createElement(ListElementContainer, {
|
|
26691
|
+
key: character._id
|
|
26692
|
+
}, React__default.createElement(ListElement$1, {
|
|
26693
|
+
active: character._id === recentSelectedChatCharacterId,
|
|
26694
|
+
onPointerDown: function onPointerDown() {
|
|
26695
|
+
return onPreviousChatCharacterClick(character);
|
|
26696
|
+
}
|
|
26697
|
+
}, React__default.createElement(StatusDot, {
|
|
26698
|
+
isUnseen: (_unseenMessageCharact = unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.includes(character._id)) != null ? _unseenMessageCharact : false
|
|
26699
|
+
}), React__default.createElement(Ellipsis, {
|
|
26700
|
+
maxWidth: "140px",
|
|
26701
|
+
maxLines: 1
|
|
26702
|
+
}, character.name)), React__default.createElement(CloseButton$2, {
|
|
26703
|
+
className: "close-button",
|
|
26704
|
+
onPointerDown: function onPointerDown() {
|
|
26705
|
+
return onRemoveRecentChatCharacter == null ? void 0 : onRemoveRecentChatCharacter(character);
|
|
26706
|
+
}
|
|
26707
|
+
}, React__default.createElement(rx.RxCross2, {
|
|
26708
|
+
size: 16
|
|
26709
|
+
})));
|
|
26710
|
+
})));
|
|
26711
|
+
};
|
|
26715
26712
|
var RecentChatTabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26716
|
-
displayName: "
|
|
26717
|
-
componentId: "sc-
|
|
26713
|
+
displayName: "RecentChats__RecentChatTabContainer",
|
|
26714
|
+
componentId: "sc-uzad2m-0"
|
|
26718
26715
|
})(["display:", ";flex-direction:column;border-right:1px solid ", ";outline:none;width:", ";max-width:200px;min-width:", ";transition:all 0.3s ease-in-out;overflow:hidden;height:100%;@media (max-width:768px){width:", ";min-width:", ";}"], function (props) {
|
|
26719
26716
|
return props.isPrivate ? 'flex' : 'none';
|
|
26720
26717
|
}, uiColors.gray, function (props) {
|
|
@@ -26727,55 +26724,177 @@ var RecentChatTabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
26727
26724
|
return props.isOpen ? '150px' : '30px';
|
|
26728
26725
|
});
|
|
26729
26726
|
var RecentChatTopBar = /*#__PURE__*/styled__default.div.withConfig({
|
|
26730
|
-
displayName: "
|
|
26731
|
-
componentId: "sc-
|
|
26727
|
+
displayName: "RecentChats__RecentChatTopBar",
|
|
26728
|
+
componentId: "sc-uzad2m-1"
|
|
26732
26729
|
})(["display:flex;align-items:center;justify-content:space-between;height:30px;flex-shrink:0;"]);
|
|
26733
26730
|
var SearchButton$1 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26734
|
-
displayName: "
|
|
26735
|
-
componentId: "sc-
|
|
26731
|
+
displayName: "RecentChats__SearchButton",
|
|
26732
|
+
componentId: "sc-uzad2m-2"
|
|
26736
26733
|
})(["border:none;background-color:transparent;display:flex;flex-direction:column;align-items:flex-end;gap:2px;padding:4px;position:relative;"]);
|
|
26737
26734
|
var BurgerIconContainer = /*#__PURE__*/styled__default.button.withConfig({
|
|
26738
|
-
displayName: "
|
|
26739
|
-
componentId: "sc-
|
|
26735
|
+
displayName: "RecentChats__BurgerIconContainer",
|
|
26736
|
+
componentId: "sc-uzad2m-3"
|
|
26740
26737
|
})(["border:none;background-color:transparent;display:flex;flex-direction:column;align-items:flex-end;padding:4px;gap:2px;position:relative;&:after{content:'';width:6px;height:6px;position:absolute;top:0;right:2px;border-radius:50%;background-color:", ";display:", ";}"], uiColors.lightGreen, function (props) {
|
|
26741
26738
|
return props.hasUnseenMessages ? 'block' : 'none';
|
|
26742
26739
|
});
|
|
26743
26740
|
var BurgerLineIcon = /*#__PURE__*/styled__default.span.withConfig({
|
|
26744
|
-
displayName: "
|
|
26745
|
-
componentId: "sc-
|
|
26741
|
+
displayName: "RecentChats__BurgerLineIcon",
|
|
26742
|
+
componentId: "sc-uzad2m-4"
|
|
26746
26743
|
})(["width:1rem;height:2px;background-color:#ffffff;"]);
|
|
26747
26744
|
var RecentChatLogContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26748
|
-
displayName: "
|
|
26749
|
-
componentId: "sc-
|
|
26745
|
+
displayName: "RecentChats__RecentChatLogContainer",
|
|
26746
|
+
componentId: "sc-uzad2m-5"
|
|
26750
26747
|
})(["display:", ";opacity:", ";flex-direction:column;gap:0.25rem;transition:opacity 0.3s ease-in-out;padding:0;margin:0;overflow-y:auto;flex-grow:1;height:0;scrollbar-width:thin;scrollbar-color:rgba(51,51,51,0.4) rgba(30,30,30,0.4);&::-webkit-scrollbar{width:8px;height:8px;}&::-webkit-scrollbar-track{background:rgba(30,30,30,0.2);border-radius:4px;}&::-webkit-scrollbar-thumb{background-color:rgba(255,102,0,0.5);border-radius:4px;border:2px solid rgba(30,30,30,0.2);}&::-webkit-scrollbar-thumb:hover{background-color:rgba(255,102,0,0.7);}"], function (props) {
|
|
26751
26748
|
return props.isOpen ? 'flex' : 'none';
|
|
26752
26749
|
}, function (props) {
|
|
26753
26750
|
return props.isOpen ? 1 : 0;
|
|
26754
26751
|
});
|
|
26755
26752
|
var ListElementContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26756
|
-
displayName: "
|
|
26757
|
-
componentId: "sc-
|
|
26753
|
+
displayName: "RecentChats__ListElementContainer",
|
|
26754
|
+
componentId: "sc-uzad2m-6"
|
|
26758
26755
|
})(["display:flex;justify-content:space-between;align-items:center;padding:2px 0;"]);
|
|
26759
26756
|
var ListElement$1 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26760
|
-
displayName: "
|
|
26761
|
-
componentId: "sc-
|
|
26757
|
+
displayName: "RecentChats__ListElement",
|
|
26758
|
+
componentId: "sc-uzad2m-7"
|
|
26762
26759
|
})(["margin:0 !important;font-size:", " !important;padding:2px;all:unset;color:", ";width:100%;position:relative;display:flex;align-items:center;gap:4px;&:hover{color:#ff0;}max-width:calc(100% - 24px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"], uiFonts.size.small, function (props) {
|
|
26763
26760
|
return props.active ? uiColors.yellow : uiColors.white;
|
|
26764
26761
|
});
|
|
26765
26762
|
var StatusDot = /*#__PURE__*/styled__default.span.withConfig({
|
|
26766
|
-
displayName: "
|
|
26767
|
-
componentId: "sc-
|
|
26763
|
+
displayName: "RecentChats__StatusDot",
|
|
26764
|
+
componentId: "sc-uzad2m-8"
|
|
26768
26765
|
})(["width:6px;height:6px;border-radius:50%;background-color:", ";display:inline-block;margin-right:6px;"], function (props) {
|
|
26769
26766
|
return props.isUnseen ? uiColors.lightGreen : uiColors.gray;
|
|
26770
26767
|
});
|
|
26771
26768
|
var CloseButton$2 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26772
|
-
displayName: "
|
|
26773
|
-
componentId: "sc-
|
|
26769
|
+
displayName: "RecentChats__CloseButton",
|
|
26770
|
+
componentId: "sc-uzad2m-9"
|
|
26774
26771
|
})(["all:unset;font-size:", ";margin:0 0.5rem;transition:all 0.2s ease-in-out;background-color:", ";color:", ";width:16px;height:16px;border-radius:50%;display:flex;justify-content:center;align-items:center;&:hover{background-color:", ";color:", ";}"], uiFonts.size.xxsmall, uiColors.red, uiColors.white, uiColors.white, uiColors.red);
|
|
26775
|
-
|
|
26776
|
-
|
|
26777
|
-
|
|
26778
|
-
|
|
26772
|
+
|
|
26773
|
+
var ChatRevamp = function ChatRevamp(props) {
|
|
26774
|
+
var chatMessages = props.chatMessages,
|
|
26775
|
+
onSendGlobalChatMessage = props.onSendGlobalChatMessage,
|
|
26776
|
+
onChangeCharacterName = props.onChangeCharacterName,
|
|
26777
|
+
onFocus = props.onFocus,
|
|
26778
|
+
onBlur = props.onBlur,
|
|
26779
|
+
onCloseButton = props.onCloseButton,
|
|
26780
|
+
styles = props.styles,
|
|
26781
|
+
tabs = props.tabs,
|
|
26782
|
+
onChangeTab = props.onChangeTab,
|
|
26783
|
+
activeTab = props.activeTab,
|
|
26784
|
+
privateChatCharacters = props.privateChatCharacters,
|
|
26785
|
+
onCharacterClick = props.onCharacterClick,
|
|
26786
|
+
onSendPrivateChatMessage = props.onSendPrivateChatMessage,
|
|
26787
|
+
recentChatCharacters = props.recentChatCharacters,
|
|
26788
|
+
recentSelectedChatCharacterId = props.recentSelectedChatCharacterId,
|
|
26789
|
+
onPreviousChatCharacterClick = props.onPreviousChatCharacterClick,
|
|
26790
|
+
onRemoveRecentChatCharacter = props.onRemoveRecentChatCharacter,
|
|
26791
|
+
unseenMessageCharacterIds = props.unseenMessageCharacterIds,
|
|
26792
|
+
onSendTradeMessage = props.onSendTradeMessage,
|
|
26793
|
+
searchCharacterUI = props.searchCharacterUI,
|
|
26794
|
+
hideSearchCharacterUI = props.hideSearchCharacterUI,
|
|
26795
|
+
showSearchCharacterUI = props.showSearchCharacterUI,
|
|
26796
|
+
minimizedByDefault = props.minimizedByDefault,
|
|
26797
|
+
autoCloseOnSend = props.autoCloseOnSend;
|
|
26798
|
+
var isPrivate = activeTab === 'private';
|
|
26799
|
+
var isTrade = activeTab === 'trade';
|
|
26800
|
+
var chatHook = useChat({
|
|
26801
|
+
activeTab: activeTab,
|
|
26802
|
+
minimizedByDefault: minimizedByDefault,
|
|
26803
|
+
isPrivate: isPrivate,
|
|
26804
|
+
onChangeTab: onChangeTab,
|
|
26805
|
+
onPreviousChatCharacterClick: onPreviousChatCharacterClick,
|
|
26806
|
+
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26807
|
+
unseenMessageCharacterIds: unseenMessageCharacterIds
|
|
26808
|
+
});
|
|
26809
|
+
return React__default.createElement(ChatRevampContainer, null, React__default.createElement(TopBar, {
|
|
26810
|
+
isExpanded: chatHook.isExpanded
|
|
26811
|
+
}, chatHook.isExpanded && React__default.createElement(ChatTabs, {
|
|
26812
|
+
tabs: tabs,
|
|
26813
|
+
activeTab: activeTab,
|
|
26814
|
+
onChangeTab: chatHook.handleTabChange
|
|
26815
|
+
}), React__default.createElement(ExpandButton, {
|
|
26816
|
+
isExpanded: chatHook.isExpanded,
|
|
26817
|
+
onClick: chatHook.toggleExpand
|
|
26818
|
+
})), React__default.createElement(PrivateChatContainer, {
|
|
26819
|
+
width: (styles == null ? void 0 : styles.width) || '80%',
|
|
26820
|
+
height: (styles == null ? void 0 : styles.height) || 'auto',
|
|
26821
|
+
isExpanded: chatHook.isExpanded
|
|
26822
|
+
}, chatHook.isExpanded ? React__default.createElement(React__default.Fragment, null, isPrivate && React__default.createElement(RecentChats, {
|
|
26823
|
+
showRecentChats: chatHook.showRecentChats,
|
|
26824
|
+
toggleRecentChats: chatHook.toggleRecentChats,
|
|
26825
|
+
hasUnseenMessages: chatHook.hasUnseenMessages || false,
|
|
26826
|
+
showSearchCharacterUI: showSearchCharacterUI,
|
|
26827
|
+
recentChatCharacters: recentChatCharacters,
|
|
26828
|
+
recentSelectedChatCharacterId: recentSelectedChatCharacterId,
|
|
26829
|
+
unseenMessageCharacterIds: unseenMessageCharacterIds,
|
|
26830
|
+
onPreviousChatCharacterClick: function onPreviousChatCharacterClick(character) {
|
|
26831
|
+
return chatHook.handlePreviousChatCharacterClick(character);
|
|
26832
|
+
},
|
|
26833
|
+
onRemoveRecentChatCharacter: onRemoveRecentChatCharacter,
|
|
26834
|
+
isPrivate: isPrivate
|
|
26835
|
+
}), React__default.createElement(ChatContentWrapper, {
|
|
26836
|
+
isPrivate: isPrivate
|
|
26837
|
+
}, React__default.createElement(ChatContent, {
|
|
26838
|
+
isPrivate: isPrivate,
|
|
26839
|
+
isTrade: isTrade,
|
|
26840
|
+
searchCharacterUI: searchCharacterUI,
|
|
26841
|
+
chatMessages: chatMessages,
|
|
26842
|
+
onSendGlobalChatMessage: onSendGlobalChatMessage,
|
|
26843
|
+
onSendPrivateChatMessage: onSendPrivateChatMessage,
|
|
26844
|
+
onSendTradeMessage: onSendTradeMessage,
|
|
26845
|
+
onCloseButton: onCloseButton,
|
|
26846
|
+
styles: styles,
|
|
26847
|
+
onFocus: onFocus,
|
|
26848
|
+
onBlur: onBlur,
|
|
26849
|
+
isExpanded: chatHook.isExpanded,
|
|
26850
|
+
autoCloseOnSend: autoCloseOnSend || false,
|
|
26851
|
+
onChangeCharacterName: onChangeCharacterName,
|
|
26852
|
+
privateChatCharacters: privateChatCharacters,
|
|
26853
|
+
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26854
|
+
onCharacterClick: onCharacterClick
|
|
26855
|
+
}))) : React__default.createElement(CollapsedChatInput, null, React__default.createElement(Chat, {
|
|
26856
|
+
chatMessages: [],
|
|
26857
|
+
onSendChatMessage: onSendGlobalChatMessage,
|
|
26858
|
+
sendMessage: true,
|
|
26859
|
+
onCloseButton: onCloseButton,
|
|
26860
|
+
styles: styles,
|
|
26861
|
+
onFocus: onFocus,
|
|
26862
|
+
onBlur: onBlur,
|
|
26863
|
+
isExpanded: false
|
|
26864
|
+
}))));
|
|
26865
|
+
};
|
|
26866
|
+
var ChatRevampContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26867
|
+
displayName: "ChatRevamp__ChatRevampContainer",
|
|
26868
|
+
componentId: "sc-1sdiknw-0"
|
|
26869
|
+
})(["display:flex;flex-direction:column;width:100%;position:relative;"]);
|
|
26870
|
+
var TopBar = /*#__PURE__*/styled__default.div.withConfig({
|
|
26871
|
+
displayName: "ChatRevamp__TopBar",
|
|
26872
|
+
componentId: "sc-1sdiknw-1"
|
|
26873
|
+
})(["display:flex;align-items:center;justify-content:flex-start;min-height:", ";"], function (_ref) {
|
|
26874
|
+
var isExpanded = _ref.isExpanded;
|
|
26875
|
+
return isExpanded ? 'auto' : '32px';
|
|
26876
|
+
});
|
|
26877
|
+
var PrivateChatContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26878
|
+
displayName: "ChatRevamp__PrivateChatContainer",
|
|
26879
|
+
componentId: "sc-1sdiknw-2"
|
|
26880
|
+
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;flex-wrap:wrap;"], function (_ref2) {
|
|
26881
|
+
var width = _ref2.width;
|
|
26882
|
+
return width;
|
|
26883
|
+
}, function (_ref3) {
|
|
26884
|
+
var height = _ref3.height,
|
|
26885
|
+
isExpanded = _ref3.isExpanded;
|
|
26886
|
+
return isExpanded ? height : 'auto';
|
|
26887
|
+
});
|
|
26888
|
+
var ChatContentWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
26889
|
+
displayName: "ChatRevamp__ChatContentWrapper",
|
|
26890
|
+
componentId: "sc-1sdiknw-3"
|
|
26891
|
+
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;position:relative;width:", ";"], function (props) {
|
|
26892
|
+
return props.isPrivate ? 'calc(75% - 10px)' : '100%';
|
|
26893
|
+
});
|
|
26894
|
+
var CollapsedChatInput = /*#__PURE__*/styled__default.div.withConfig({
|
|
26895
|
+
displayName: "ChatRevamp__CollapsedChatInput",
|
|
26896
|
+
componentId: "sc-1sdiknw-4"
|
|
26897
|
+
})(["width:100%;height:100%;display:flex;align-items:center;"]);
|
|
26779
26898
|
|
|
26780
26899
|
var CheckButton = function CheckButton(_ref) {
|
|
26781
26900
|
var items = _ref.items,
|