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