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