@rpg-engine/long-bow 0.7.22 → 0.7.24
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 +17 -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 +19 -0
- package/dist/long-bow.cjs.development.js +341 -209
- 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 +341 -209
- 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 +96 -0
- package/src/components/ChatRevamp/ChatRevamp.tsx +97 -408
- package/src/components/ChatRevamp/ChatTabs.tsx +51 -0
- package/src/components/ChatRevamp/ExpandButton.tsx +40 -0
- package/src/components/ChatRevamp/RecentChats.tsx +250 -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 +56 -99
|
@@ -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,59 @@ 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
|
+
if (onPreviousChatCharacterClick) {
|
|
26431
|
+
onPreviousChatCharacterClick(character);
|
|
26432
|
+
}
|
|
26433
|
+
if (hideSearchCharacterUI) {
|
|
26434
|
+
hideSearchCharacterUI();
|
|
26435
|
+
}
|
|
26436
|
+
};
|
|
26437
|
+
return {
|
|
26438
|
+
showRecentChats: showRecentChats,
|
|
26439
|
+
isExpanded: isExpanded,
|
|
26440
|
+
toggleExpand: toggleExpand,
|
|
26441
|
+
toggleRecentChats: toggleRecentChats,
|
|
26442
|
+
handleTabChange: handleTabChange,
|
|
26443
|
+
handlePreviousChatCharacterClick: handlePreviousChatCharacterClick,
|
|
26444
|
+
hasUnseenMessages: unseenMessageCharacterIds && (unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.length) > 0
|
|
26445
|
+
};
|
|
26446
|
+
};
|
|
26447
|
+
|
|
26395
26448
|
var SearchCharacter = function SearchCharacter(_ref) {
|
|
26396
26449
|
var onChangeCharacterName = _ref.onChangeCharacterName,
|
|
26397
26450
|
onBlur = _ref.onBlur,
|
|
@@ -26440,12 +26493,12 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26440
26493
|
value: characterName,
|
|
26441
26494
|
ref: searchCharacterRef,
|
|
26442
26495
|
id: "characterName",
|
|
26443
|
-
name:
|
|
26496
|
+
name: "characterName",
|
|
26444
26497
|
onChange: function onChange(e) {
|
|
26445
26498
|
setCharacterName(e.target.value);
|
|
26446
26499
|
onChangeCharacterName(e.target.value);
|
|
26447
26500
|
},
|
|
26448
|
-
placeholder:
|
|
26501
|
+
placeholder: "Search for a character...",
|
|
26449
26502
|
height: 20,
|
|
26450
26503
|
type: "text",
|
|
26451
26504
|
autoComplete: "off",
|
|
@@ -26455,7 +26508,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26455
26508
|
})), React__default.createElement(Column, {
|
|
26456
26509
|
justifyContent: "flex-end"
|
|
26457
26510
|
}, React__default.createElement(SearchButton, {
|
|
26458
|
-
type:
|
|
26511
|
+
type: "submit",
|
|
26459
26512
|
buttonColor: (styles == null ? void 0 : styles.buttonColor) || '#005b96',
|
|
26460
26513
|
buttonBackgroundColor: (styles == null ? void 0 : styles.buttonBackgroundColor) || 'rgba(0,0,0,.5)',
|
|
26461
26514
|
id: "chat-send-button",
|
|
@@ -26471,7 +26524,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26471
26524
|
},
|
|
26472
26525
|
key: character._id
|
|
26473
26526
|
}, React__default.createElement(Ellipsis, {
|
|
26474
|
-
maxWidth:
|
|
26527
|
+
maxWidth: "150px",
|
|
26475
26528
|
maxLines: 1
|
|
26476
26529
|
}, character.name));
|
|
26477
26530
|
})));
|
|
@@ -26507,186 +26560,84 @@ var ListElement = /*#__PURE__*/styled__default.li.withConfig({
|
|
|
26507
26560
|
componentId: "sc-172lyfr-5"
|
|
26508
26561
|
})(["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
26562
|
|
|
26510
|
-
var
|
|
26511
|
-
var
|
|
26563
|
+
var ChatContent = function ChatContent(_ref) {
|
|
26564
|
+
var isPrivate = _ref.isPrivate,
|
|
26565
|
+
isTrade = _ref.isTrade,
|
|
26566
|
+
searchCharacterUI = _ref.searchCharacterUI,
|
|
26567
|
+
chatMessages = _ref.chatMessages,
|
|
26512
26568
|
onSendGlobalChatMessage = _ref.onSendGlobalChatMessage,
|
|
26513
|
-
|
|
26514
|
-
|
|
26515
|
-
onBlur = _ref.onBlur,
|
|
26569
|
+
onSendPrivateChatMessage = _ref.onSendPrivateChatMessage,
|
|
26570
|
+
onSendTradeMessage = _ref.onSendTradeMessage,
|
|
26516
26571
|
onCloseButton = _ref.onCloseButton,
|
|
26517
26572
|
styles = _ref.styles,
|
|
26518
|
-
|
|
26519
|
-
|
|
26520
|
-
|
|
26573
|
+
onFocus = _ref.onFocus,
|
|
26574
|
+
onBlur = _ref.onBlur,
|
|
26575
|
+
isExpanded = _ref.isExpanded,
|
|
26576
|
+
autoCloseOnSend = _ref.autoCloseOnSend,
|
|
26577
|
+
onChangeCharacterName = _ref.onChangeCharacterName,
|
|
26521
26578
|
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
26579
|
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26534
|
-
|
|
26535
|
-
|
|
26536
|
-
|
|
26537
|
-
|
|
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);
|
|
26580
|
+
onCharacterClick = _ref.onCharacterClick;
|
|
26581
|
+
var handleSendMessage = function handleSendMessage(message) {
|
|
26582
|
+
if (autoCloseOnSend) {
|
|
26583
|
+
onCloseButton();
|
|
26550
26584
|
}
|
|
26551
|
-
|
|
26552
|
-
|
|
26553
|
-
|
|
26554
|
-
|
|
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);
|
|
26585
|
+
if (isPrivate) {
|
|
26586
|
+
onSendPrivateChatMessage(message);
|
|
26587
|
+
} else if (isTrade) {
|
|
26588
|
+
onSendTradeMessage(message);
|
|
26589
|
+
} else {
|
|
26590
|
+
onSendGlobalChatMessage(message);
|
|
26565
26591
|
}
|
|
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
26592
|
};
|
|
26594
|
-
|
|
26595
|
-
return React__default.createElement(
|
|
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,
|
|
26593
|
+
if (isPrivate && searchCharacterUI) {
|
|
26594
|
+
return React__default.createElement(SearchCharacter, {
|
|
26649
26595
|
onFocus: onFocus,
|
|
26650
26596
|
onBlur: onBlur,
|
|
26651
|
-
|
|
26597
|
+
onChangeCharacterName: onChangeCharacterName,
|
|
26598
|
+
styles: styles,
|
|
26599
|
+
recentCharacters: privateChatCharacters,
|
|
26600
|
+
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26601
|
+
onCharacterClick: onCharacterClick
|
|
26652
26602
|
});
|
|
26653
|
-
}
|
|
26654
|
-
return React__default.createElement(
|
|
26655
|
-
|
|
26656
|
-
|
|
26657
|
-
|
|
26658
|
-
|
|
26659
|
-
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
size: 20
|
|
26663
|
-
}))), React__default.createElement(PrivateChatContainer, {
|
|
26664
|
-
width: (styles == null ? void 0 : styles.width) || '80%',
|
|
26665
|
-
height: (styles == null ? void 0 : styles.height) || 'auto',
|
|
26603
|
+
}
|
|
26604
|
+
return React__default.createElement(ChatWrapper, null, React__default.createElement(Chat, {
|
|
26605
|
+
chatMessages: chatMessages,
|
|
26606
|
+
onSendChatMessage: handleSendMessage,
|
|
26607
|
+
sendMessage: true,
|
|
26608
|
+
onCloseButton: onCloseButton,
|
|
26609
|
+
styles: styles,
|
|
26610
|
+
onFocus: onFocus,
|
|
26611
|
+
onBlur: onBlur,
|
|
26666
26612
|
isExpanded: isExpanded
|
|
26667
|
-
}
|
|
26668
|
-
|
|
26669
|
-
|
|
26670
|
-
|
|
26613
|
+
}));
|
|
26614
|
+
};
|
|
26615
|
+
var ChatWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
26616
|
+
displayName: "ChatContent__ChatWrapper",
|
|
26617
|
+
componentId: "sc-1380qen-0"
|
|
26618
|
+
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;position:relative;"]);
|
|
26619
|
+
|
|
26620
|
+
var ChatTabs = function ChatTabs(_ref) {
|
|
26621
|
+
var tabs = _ref.tabs,
|
|
26622
|
+
activeTab = _ref.activeTab,
|
|
26623
|
+
onChangeTab = _ref.onChangeTab;
|
|
26624
|
+
return React__default.createElement(TabContainer, null, tabs.map(function (tab, index) {
|
|
26625
|
+
return React__default.createElement(Tab, {
|
|
26626
|
+
key: tab.label + "_" + index,
|
|
26627
|
+
active: tab.id === activeTab,
|
|
26628
|
+
onPointerDown: function onPointerDown() {
|
|
26629
|
+
return onChangeTab(tab.id);
|
|
26630
|
+
}
|
|
26631
|
+
}, tab.label);
|
|
26632
|
+
}));
|
|
26671
26633
|
};
|
|
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
26634
|
var TabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26684
|
-
displayName: "
|
|
26685
|
-
componentId: "sc-
|
|
26635
|
+
displayName: "ChatTabs__TabContainer",
|
|
26636
|
+
componentId: "sc-rcifrl-0"
|
|
26686
26637
|
})(["display:flex;gap:10px;align-items:center;flex-grow:1;"]);
|
|
26687
26638
|
var Tab = /*#__PURE__*/styled__default.button.withConfig({
|
|
26688
|
-
displayName: "
|
|
26689
|
-
componentId: "sc-
|
|
26639
|
+
displayName: "ChatTabs__Tab",
|
|
26640
|
+
componentId: "sc-rcifrl-1"
|
|
26690
26641
|
})(["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
26642
|
return props.active ? 'rgba(198, 81, 2, 0.5)' : 'rgba(128, 128, 128, 0.5)';
|
|
26692
26643
|
}, function (props) {
|
|
@@ -26694,27 +26645,83 @@ var Tab = /*#__PURE__*/styled__default.button.withConfig({
|
|
|
26694
26645
|
}, function (props) {
|
|
26695
26646
|
return props.active ? 'white' : uiColors.darkGray;
|
|
26696
26647
|
});
|
|
26697
|
-
|
|
26698
|
-
|
|
26699
|
-
|
|
26700
|
-
|
|
26701
|
-
|
|
26648
|
+
|
|
26649
|
+
var ExpandButton = function ExpandButton(_ref) {
|
|
26650
|
+
var isExpanded = _ref.isExpanded,
|
|
26651
|
+
onClick = _ref.onClick;
|
|
26652
|
+
return React__default.createElement(StyledExpandButton, {
|
|
26653
|
+
isExpanded: isExpanded,
|
|
26654
|
+
onClick: onClick
|
|
26655
|
+
}, isExpanded ? React__default.createElement(io.IoMdContract, {
|
|
26656
|
+
size: 20
|
|
26657
|
+
}) : React__default.createElement(io.IoMdExpand, {
|
|
26658
|
+
size: 20
|
|
26659
|
+
}));
|
|
26660
|
+
};
|
|
26661
|
+
var StyledExpandButton = /*#__PURE__*/styled__default.button.withConfig({
|
|
26662
|
+
displayName: "ExpandButton__StyledExpandButton",
|
|
26663
|
+
componentId: "sc-vdxez5-0"
|
|
26664
|
+
})(["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) {
|
|
26665
|
+
var isExpanded = _ref2.isExpanded;
|
|
26702
26666
|
return isExpanded ? 'right: 0' : 'left: 0';
|
|
26703
26667
|
}, uiColors.orange, uiColors.orange);
|
|
26704
|
-
|
|
26705
|
-
|
|
26706
|
-
|
|
26707
|
-
|
|
26708
|
-
|
|
26709
|
-
|
|
26710
|
-
|
|
26711
|
-
|
|
26712
|
-
|
|
26713
|
-
|
|
26714
|
-
|
|
26668
|
+
|
|
26669
|
+
var RecentChats = function RecentChats(_ref) {
|
|
26670
|
+
var showRecentChats = _ref.showRecentChats,
|
|
26671
|
+
toggleRecentChats = _ref.toggleRecentChats,
|
|
26672
|
+
hasUnseenMessages = _ref.hasUnseenMessages,
|
|
26673
|
+
showSearchCharacterUI = _ref.showSearchCharacterUI,
|
|
26674
|
+
recentChatCharacters = _ref.recentChatCharacters,
|
|
26675
|
+
recentSelectedChatCharacterId = _ref.recentSelectedChatCharacterId,
|
|
26676
|
+
unseenMessageCharacterIds = _ref.unseenMessageCharacterIds,
|
|
26677
|
+
onPreviousChatCharacterClick = _ref.onPreviousChatCharacterClick,
|
|
26678
|
+
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26679
|
+
isPrivate = _ref.isPrivate,
|
|
26680
|
+
hideSearchCharacterUI = _ref.hideSearchCharacterUI;
|
|
26681
|
+
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26682
|
+
onPreviousChatCharacterClick(character);
|
|
26683
|
+
hideSearchCharacterUI(); // Call hideSearchCharacterUI here
|
|
26684
|
+
};
|
|
26685
|
+
return React__default.createElement(RecentChatTabContainer, {
|
|
26686
|
+
isOpen: showRecentChats,
|
|
26687
|
+
isPrivate: isPrivate
|
|
26688
|
+
}, React__default.createElement(RecentChatTopBar, null, React__default.createElement(BurgerIconContainer, {
|
|
26689
|
+
onPointerDown: toggleRecentChats,
|
|
26690
|
+
hasUnseenMessages: hasUnseenMessages
|
|
26691
|
+
}, React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null)), showRecentChats && React__default.createElement(SearchButton$1, {
|
|
26692
|
+
onPointerDown: showSearchCharacterUI
|
|
26693
|
+
}, React__default.createElement(rx.RxMagnifyingGlass, {
|
|
26694
|
+
size: 16,
|
|
26695
|
+
color: uiColors.white
|
|
26696
|
+
}))), React__default.createElement(RecentChatLogContainer, {
|
|
26697
|
+
isOpen: showRecentChats
|
|
26698
|
+
}, recentChatCharacters == null ? void 0 : recentChatCharacters.map(function (character) {
|
|
26699
|
+
var _unseenMessageCharact;
|
|
26700
|
+
return React__default.createElement(ListElementContainer, {
|
|
26701
|
+
key: character._id
|
|
26702
|
+
}, React__default.createElement(ListElement$1, {
|
|
26703
|
+
active: character._id === recentSelectedChatCharacterId,
|
|
26704
|
+
onPointerDown: function onPointerDown() {
|
|
26705
|
+
return handlePreviousChatCharacterClick(character);
|
|
26706
|
+
}
|
|
26707
|
+
}, React__default.createElement(StatusDot, {
|
|
26708
|
+
isUnseen: (_unseenMessageCharact = unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.includes(character._id)) != null ? _unseenMessageCharact : false
|
|
26709
|
+
}), React__default.createElement(Ellipsis, {
|
|
26710
|
+
maxWidth: "140px",
|
|
26711
|
+
maxLines: 1
|
|
26712
|
+
}, character.name)), React__default.createElement(CloseButton$2, {
|
|
26713
|
+
className: "close-button",
|
|
26714
|
+
onPointerDown: function onPointerDown() {
|
|
26715
|
+
return onRemoveRecentChatCharacter == null ? void 0 : onRemoveRecentChatCharacter(character);
|
|
26716
|
+
}
|
|
26717
|
+
}, React__default.createElement(rx.RxCross2, {
|
|
26718
|
+
size: 16
|
|
26719
|
+
})));
|
|
26720
|
+
})));
|
|
26721
|
+
};
|
|
26715
26722
|
var RecentChatTabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26716
|
-
displayName: "
|
|
26717
|
-
componentId: "sc-
|
|
26723
|
+
displayName: "RecentChats__RecentChatTabContainer",
|
|
26724
|
+
componentId: "sc-uzad2m-0"
|
|
26718
26725
|
})(["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
26726
|
return props.isPrivate ? 'flex' : 'none';
|
|
26720
26727
|
}, uiColors.gray, function (props) {
|
|
@@ -26727,55 +26734,180 @@ var RecentChatTabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
26727
26734
|
return props.isOpen ? '150px' : '30px';
|
|
26728
26735
|
});
|
|
26729
26736
|
var RecentChatTopBar = /*#__PURE__*/styled__default.div.withConfig({
|
|
26730
|
-
displayName: "
|
|
26731
|
-
componentId: "sc-
|
|
26737
|
+
displayName: "RecentChats__RecentChatTopBar",
|
|
26738
|
+
componentId: "sc-uzad2m-1"
|
|
26732
26739
|
})(["display:flex;align-items:center;justify-content:space-between;height:30px;flex-shrink:0;"]);
|
|
26733
26740
|
var SearchButton$1 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26734
|
-
displayName: "
|
|
26735
|
-
componentId: "sc-
|
|
26741
|
+
displayName: "RecentChats__SearchButton",
|
|
26742
|
+
componentId: "sc-uzad2m-2"
|
|
26736
26743
|
})(["border:none;background-color:transparent;display:flex;flex-direction:column;align-items:flex-end;gap:2px;padding:4px;position:relative;"]);
|
|
26737
26744
|
var BurgerIconContainer = /*#__PURE__*/styled__default.button.withConfig({
|
|
26738
|
-
displayName: "
|
|
26739
|
-
componentId: "sc-
|
|
26745
|
+
displayName: "RecentChats__BurgerIconContainer",
|
|
26746
|
+
componentId: "sc-uzad2m-3"
|
|
26740
26747
|
})(["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
26748
|
return props.hasUnseenMessages ? 'block' : 'none';
|
|
26742
26749
|
});
|
|
26743
26750
|
var BurgerLineIcon = /*#__PURE__*/styled__default.span.withConfig({
|
|
26744
|
-
displayName: "
|
|
26745
|
-
componentId: "sc-
|
|
26751
|
+
displayName: "RecentChats__BurgerLineIcon",
|
|
26752
|
+
componentId: "sc-uzad2m-4"
|
|
26746
26753
|
})(["width:1rem;height:2px;background-color:#ffffff;"]);
|
|
26747
26754
|
var RecentChatLogContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26748
|
-
displayName: "
|
|
26749
|
-
componentId: "sc-
|
|
26755
|
+
displayName: "RecentChats__RecentChatLogContainer",
|
|
26756
|
+
componentId: "sc-uzad2m-5"
|
|
26750
26757
|
})(["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
26758
|
return props.isOpen ? 'flex' : 'none';
|
|
26752
26759
|
}, function (props) {
|
|
26753
26760
|
return props.isOpen ? 1 : 0;
|
|
26754
26761
|
});
|
|
26755
26762
|
var ListElementContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26756
|
-
displayName: "
|
|
26757
|
-
componentId: "sc-
|
|
26763
|
+
displayName: "RecentChats__ListElementContainer",
|
|
26764
|
+
componentId: "sc-uzad2m-6"
|
|
26758
26765
|
})(["display:flex;justify-content:space-between;align-items:center;padding:2px 0;"]);
|
|
26759
26766
|
var ListElement$1 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26760
|
-
displayName: "
|
|
26761
|
-
componentId: "sc-
|
|
26767
|
+
displayName: "RecentChats__ListElement",
|
|
26768
|
+
componentId: "sc-uzad2m-7"
|
|
26762
26769
|
})(["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
26770
|
return props.active ? uiColors.yellow : uiColors.white;
|
|
26764
26771
|
});
|
|
26765
26772
|
var StatusDot = /*#__PURE__*/styled__default.span.withConfig({
|
|
26766
|
-
displayName: "
|
|
26767
|
-
componentId: "sc-
|
|
26773
|
+
displayName: "RecentChats__StatusDot",
|
|
26774
|
+
componentId: "sc-uzad2m-8"
|
|
26768
26775
|
})(["width:6px;height:6px;border-radius:50%;background-color:", ";display:inline-block;margin-right:6px;"], function (props) {
|
|
26769
26776
|
return props.isUnseen ? uiColors.lightGreen : uiColors.gray;
|
|
26770
26777
|
});
|
|
26771
26778
|
var CloseButton$2 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26772
|
-
displayName: "
|
|
26773
|
-
componentId: "sc-
|
|
26779
|
+
displayName: "RecentChats__CloseButton",
|
|
26780
|
+
componentId: "sc-uzad2m-9"
|
|
26774
26781
|
})(["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
|
-
|
|
26782
|
+
|
|
26783
|
+
var ChatRevamp = function ChatRevamp(_ref) {
|
|
26784
|
+
var chatMessages = _ref.chatMessages,
|
|
26785
|
+
onSendGlobalChatMessage = _ref.onSendGlobalChatMessage,
|
|
26786
|
+
onChangeCharacterName = _ref.onChangeCharacterName,
|
|
26787
|
+
onFocus = _ref.onFocus,
|
|
26788
|
+
onBlur = _ref.onBlur,
|
|
26789
|
+
onCloseButton = _ref.onCloseButton,
|
|
26790
|
+
styles = _ref.styles,
|
|
26791
|
+
tabs = _ref.tabs,
|
|
26792
|
+
onChangeTab = _ref.onChangeTab,
|
|
26793
|
+
_ref$activeTab = _ref.activeTab,
|
|
26794
|
+
activeTab = _ref$activeTab === void 0 ? 'global' : _ref$activeTab,
|
|
26795
|
+
privateChatCharacters = _ref.privateChatCharacters,
|
|
26796
|
+
onCharacterClick = _ref.onCharacterClick,
|
|
26797
|
+
onSendPrivateChatMessage = _ref.onSendPrivateChatMessage,
|
|
26798
|
+
recentChatCharacters = _ref.recentChatCharacters,
|
|
26799
|
+
recentSelectedChatCharacterId = _ref.recentSelectedChatCharacterId,
|
|
26800
|
+
onPreviousChatCharacterClick = _ref.onPreviousChatCharacterClick,
|
|
26801
|
+
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26802
|
+
unseenMessageCharacterIds = _ref.unseenMessageCharacterIds,
|
|
26803
|
+
onSendTradeMessage = _ref.onSendTradeMessage,
|
|
26804
|
+
searchCharacterUI = _ref.searchCharacterUI,
|
|
26805
|
+
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26806
|
+
showSearchCharacterUI = _ref.showSearchCharacterUI,
|
|
26807
|
+
_ref$minimizedByDefau = _ref.minimizedByDefault,
|
|
26808
|
+
minimizedByDefault = _ref$minimizedByDefau === void 0 ? false : _ref$minimizedByDefau,
|
|
26809
|
+
autoCloseOnSend = _ref.autoCloseOnSend;
|
|
26810
|
+
var isPrivate = activeTab === 'private';
|
|
26811
|
+
var isTrade = activeTab === 'trade';
|
|
26812
|
+
var chatHook = useChat({
|
|
26813
|
+
minimizedByDefault: minimizedByDefault,
|
|
26814
|
+
isPrivate: isPrivate,
|
|
26815
|
+
onChangeTab: onChangeTab,
|
|
26816
|
+
onPreviousChatCharacterClick: onPreviousChatCharacterClick,
|
|
26817
|
+
unseenMessageCharacterIds: unseenMessageCharacterIds
|
|
26818
|
+
});
|
|
26819
|
+
return React__default.createElement(ChatRevampContainer, null, React__default.createElement(TopBar, {
|
|
26820
|
+
isExpanded: chatHook.isExpanded
|
|
26821
|
+
}, chatHook.isExpanded && React__default.createElement(ChatTabs, {
|
|
26822
|
+
tabs: tabs,
|
|
26823
|
+
activeTab: activeTab,
|
|
26824
|
+
onChangeTab: chatHook.handleTabChange
|
|
26825
|
+
}), React__default.createElement(ExpandButton, {
|
|
26826
|
+
isExpanded: chatHook.isExpanded,
|
|
26827
|
+
onClick: chatHook.toggleExpand
|
|
26828
|
+
})), React__default.createElement(PrivateChatContainer, {
|
|
26829
|
+
width: (styles == null ? void 0 : styles.width) || '80%',
|
|
26830
|
+
height: (styles == null ? void 0 : styles.height) || 'auto',
|
|
26831
|
+
isExpanded: chatHook.isExpanded
|
|
26832
|
+
}, chatHook.isExpanded ? React__default.createElement(ExpandedChatContent, null, isPrivate && React__default.createElement(RecentChats, {
|
|
26833
|
+
showRecentChats: chatHook.showRecentChats,
|
|
26834
|
+
toggleRecentChats: chatHook.toggleRecentChats,
|
|
26835
|
+
hasUnseenMessages: chatHook.hasUnseenMessages || false,
|
|
26836
|
+
showSearchCharacterUI: showSearchCharacterUI,
|
|
26837
|
+
recentChatCharacters: recentChatCharacters,
|
|
26838
|
+
recentSelectedChatCharacterId: recentSelectedChatCharacterId,
|
|
26839
|
+
unseenMessageCharacterIds: unseenMessageCharacterIds,
|
|
26840
|
+
onPreviousChatCharacterClick: chatHook.handlePreviousChatCharacterClick,
|
|
26841
|
+
onRemoveRecentChatCharacter: onRemoveRecentChatCharacter,
|
|
26842
|
+
isPrivate: isPrivate,
|
|
26843
|
+
hideSearchCharacterUI: hideSearchCharacterUI
|
|
26844
|
+
}), React__default.createElement(ChatContentWrapper, {
|
|
26845
|
+
isPrivate: isPrivate
|
|
26846
|
+
}, React__default.createElement(ChatContent, {
|
|
26847
|
+
isPrivate: isPrivate,
|
|
26848
|
+
isTrade: isTrade,
|
|
26849
|
+
searchCharacterUI: searchCharacterUI,
|
|
26850
|
+
chatMessages: chatMessages,
|
|
26851
|
+
onSendGlobalChatMessage: onSendGlobalChatMessage,
|
|
26852
|
+
onSendPrivateChatMessage: onSendPrivateChatMessage,
|
|
26853
|
+
onSendTradeMessage: onSendTradeMessage,
|
|
26854
|
+
onCloseButton: onCloseButton,
|
|
26855
|
+
styles: styles,
|
|
26856
|
+
onFocus: onFocus,
|
|
26857
|
+
onBlur: onBlur,
|
|
26858
|
+
isExpanded: chatHook.isExpanded,
|
|
26859
|
+
autoCloseOnSend: autoCloseOnSend || false,
|
|
26860
|
+
onChangeCharacterName: onChangeCharacterName,
|
|
26861
|
+
privateChatCharacters: privateChatCharacters,
|
|
26862
|
+
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26863
|
+
onCharacterClick: onCharacterClick
|
|
26864
|
+
}))) : React__default.createElement(CollapsedChatInput, null, React__default.createElement(Chat, {
|
|
26865
|
+
chatMessages: [],
|
|
26866
|
+
onSendChatMessage: onSendGlobalChatMessage,
|
|
26867
|
+
sendMessage: true,
|
|
26868
|
+
onCloseButton: onCloseButton,
|
|
26869
|
+
styles: styles,
|
|
26870
|
+
onFocus: onFocus,
|
|
26871
|
+
onBlur: onBlur,
|
|
26872
|
+
isExpanded: false
|
|
26873
|
+
}))));
|
|
26874
|
+
};
|
|
26875
|
+
var ChatRevampContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26876
|
+
displayName: "ChatRevamp__ChatRevampContainer",
|
|
26877
|
+
componentId: "sc-1sdiknw-0"
|
|
26878
|
+
})(["display:flex;flex-direction:column;width:100%;position:relative;"]);
|
|
26879
|
+
var TopBar = /*#__PURE__*/styled__default.div.withConfig({
|
|
26880
|
+
displayName: "ChatRevamp__TopBar",
|
|
26881
|
+
componentId: "sc-1sdiknw-1"
|
|
26882
|
+
})(["display:flex;align-items:center;justify-content:flex-start;min-height:", ";"], function (_ref2) {
|
|
26883
|
+
var isExpanded = _ref2.isExpanded;
|
|
26884
|
+
return isExpanded ? 'auto' : '32px';
|
|
26885
|
+
});
|
|
26886
|
+
var PrivateChatContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26887
|
+
displayName: "ChatRevamp__PrivateChatContainer",
|
|
26888
|
+
componentId: "sc-1sdiknw-2"
|
|
26889
|
+
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;flex-wrap:wrap;"], function (_ref3) {
|
|
26890
|
+
var width = _ref3.width;
|
|
26891
|
+
return width;
|
|
26892
|
+
}, function (_ref4) {
|
|
26893
|
+
var height = _ref4.height,
|
|
26894
|
+
isExpanded = _ref4.isExpanded;
|
|
26895
|
+
return isExpanded ? height : 'auto';
|
|
26896
|
+
});
|
|
26897
|
+
var ChatContentWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
26898
|
+
displayName: "ChatRevamp__ChatContentWrapper",
|
|
26899
|
+
componentId: "sc-1sdiknw-3"
|
|
26900
|
+
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;position:relative;width:", ";"], function (props) {
|
|
26901
|
+
return props.isPrivate ? '75%' : '100%';
|
|
26902
|
+
});
|
|
26903
|
+
var CollapsedChatInput = /*#__PURE__*/styled__default.div.withConfig({
|
|
26904
|
+
displayName: "ChatRevamp__CollapsedChatInput",
|
|
26905
|
+
componentId: "sc-1sdiknw-4"
|
|
26906
|
+
})(["width:100%;height:100%;display:flex;align-items:center;"]);
|
|
26907
|
+
var ExpandedChatContent = /*#__PURE__*/styled__default.div.withConfig({
|
|
26908
|
+
displayName: "ChatRevamp__ExpandedChatContent",
|
|
26909
|
+
componentId: "sc-1sdiknw-5"
|
|
26910
|
+
})(["display:flex;width:100%;height:100%;"]);
|
|
26779
26911
|
|
|
26780
26912
|
var CheckButton = function CheckButton(_ref) {
|
|
26781
26913
|
var items = _ref.items,
|