@rpg-engine/long-bow 0.6.851 → 0.7.0
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/ChatRevamp/ChatRevamp.d.ts +2 -2
- package/dist/long-bow.cjs.development.js +89 -68
- 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 +89 -68
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChatRevamp/ChatRevamp.tsx +113 -88
- package/src/components/ChatRevamp/SearchCharacter.tsx +5 -1
- package/src/stories/ChatRevamp.stories.tsx +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ICharacter, IChatMessage, IPrivateChatMessage, ITradeChatMessage } from '@rpg-engine/shared';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { IStyles } from '../Chat/Chat';
|
|
4
4
|
export declare type PrivateChatCharacter = Pick<ICharacter, '_id' | 'name'>;
|
|
5
5
|
export declare type ChatMessage = IChatMessage | IPrivateChatMessage | ITradeChatMessage;
|
|
@@ -30,4 +30,4 @@ export interface IChatRevampProps {
|
|
|
30
30
|
hideSearchCharacterUI: () => void;
|
|
31
31
|
showSearchCharacterUI: () => void;
|
|
32
32
|
}
|
|
33
|
-
export declare const ChatRevamp:
|
|
33
|
+
export declare const ChatRevamp: React.FC<IChatRevampProps>;
|
|
@@ -26461,7 +26461,10 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26461
26461
|
return handleCharacterClick(character);
|
|
26462
26462
|
},
|
|
26463
26463
|
key: character._id
|
|
26464
|
-
},
|
|
26464
|
+
}, React__default.createElement(Ellipsis, {
|
|
26465
|
+
maxWidth: '150px',
|
|
26466
|
+
maxLines: 1
|
|
26467
|
+
}, character.name));
|
|
26465
26468
|
})));
|
|
26466
26469
|
};
|
|
26467
26470
|
var SearchContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
@@ -26525,77 +26528,91 @@ var ChatRevamp = function ChatRevamp(_ref) {
|
|
|
26525
26528
|
setShowRecentChats = _useState[1];
|
|
26526
26529
|
var isPrivate = activeTab === 'private';
|
|
26527
26530
|
var isTrade = activeTab === 'trade';
|
|
26531
|
+
var toggleRecentChats = function toggleRecentChats() {
|
|
26532
|
+
return setShowRecentChats(function (prev) {
|
|
26533
|
+
return !prev;
|
|
26534
|
+
});
|
|
26535
|
+
};
|
|
26528
26536
|
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26529
|
-
|
|
26530
|
-
onPreviousChatCharacterClick(character);
|
|
26537
|
+
onPreviousChatCharacterClick == null ? void 0 : onPreviousChatCharacterClick(character);
|
|
26531
26538
|
hideSearchCharacterUI();
|
|
26532
26539
|
};
|
|
26533
|
-
|
|
26534
|
-
return React__default.createElement(
|
|
26535
|
-
|
|
26536
|
-
|
|
26537
|
-
|
|
26538
|
-
|
|
26539
|
-
|
|
26540
|
-
|
|
26541
|
-
|
|
26540
|
+
var renderTabs = function renderTabs() {
|
|
26541
|
+
return React__default.createElement(TabContainer, null, tabs.map(function (tab, index) {
|
|
26542
|
+
return React__default.createElement(Tab, {
|
|
26543
|
+
key: tab.label + "_" + index,
|
|
26544
|
+
active: tab.id === activeTab,
|
|
26545
|
+
onPointerDown: function onPointerDown() {
|
|
26546
|
+
return onChangeTab(tab.id);
|
|
26547
|
+
}
|
|
26548
|
+
}, tab.label);
|
|
26549
|
+
}));
|
|
26550
|
+
};
|
|
26551
|
+
var renderRecentChatTopBar = function renderRecentChatTopBar() {
|
|
26552
|
+
return React__default.createElement(RecentChatTopBar, null, React__default.createElement(BurgerIconContainer, {
|
|
26553
|
+
onPointerDown: toggleRecentChats,
|
|
26554
|
+
hasUnseenMessages: unseenMessageCharacterIds.length > 0
|
|
26555
|
+
}, React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null)), showRecentChats && React__default.createElement(SearchButton$1, {
|
|
26556
|
+
onPointerDown: showSearchCharacterUI
|
|
26557
|
+
}, React__default.createElement(rx.RxMagnifyingGlass, {
|
|
26558
|
+
size: 16,
|
|
26559
|
+
color: uiColors.white
|
|
26560
|
+
})));
|
|
26561
|
+
};
|
|
26562
|
+
var renderRecentChatList = function renderRecentChatList() {
|
|
26563
|
+
return React__default.createElement(RecentChatLogContainer, {
|
|
26564
|
+
isOpen: showRecentChats
|
|
26565
|
+
}, recentChatCharacters == null ? void 0 : recentChatCharacters.map(function (character) {
|
|
26566
|
+
return React__default.createElement(ListElementContainer, {
|
|
26567
|
+
key: character._id
|
|
26568
|
+
}, React__default.createElement(ListElement$1, {
|
|
26569
|
+
active: character._id === recentSelectedChatCharacterId,
|
|
26570
|
+
onPointerDown: function onPointerDown() {
|
|
26571
|
+
return handlePreviousChatCharacterClick(character);
|
|
26572
|
+
}
|
|
26573
|
+
}, React__default.createElement(StatusDot, {
|
|
26574
|
+
isUnseen: unseenMessageCharacterIds.includes(character._id)
|
|
26575
|
+
}), React__default.createElement(Ellipsis, {
|
|
26576
|
+
maxWidth: "140px",
|
|
26577
|
+
maxLines: 1
|
|
26578
|
+
}, character.name)), React__default.createElement(CloseButton$1, {
|
|
26579
|
+
onPointerDown: function onPointerDown() {
|
|
26580
|
+
return onRemoveRecentChatCharacter == null ? void 0 : onRemoveRecentChatCharacter(character);
|
|
26581
|
+
}
|
|
26582
|
+
}, React__default.createElement(rx.RxCross2, {
|
|
26583
|
+
size: 16
|
|
26584
|
+
})));
|
|
26585
|
+
}));
|
|
26586
|
+
};
|
|
26587
|
+
var renderChatContent = function renderChatContent() {
|
|
26588
|
+
if (isPrivate && searchCharacterUI) {
|
|
26589
|
+
return React__default.createElement(SearchCharacter, {
|
|
26590
|
+
onFocus: onFocus,
|
|
26591
|
+
onBlur: onBlur,
|
|
26592
|
+
onChangeCharacterName: onChangeCharacterName,
|
|
26593
|
+
styles: styles,
|
|
26594
|
+
recentCharacters: privateChatCharacters,
|
|
26595
|
+
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26596
|
+
onCharacterClick: onCharacterClick
|
|
26597
|
+
});
|
|
26598
|
+
}
|
|
26599
|
+
return React__default.createElement(Chat, {
|
|
26600
|
+
chatMessages: chatMessages,
|
|
26601
|
+
onSendChatMessage: isPrivate ? onSendPrivateChatMessage : isTrade ? onSendTradeMessage : onSendGlobalChatMessage,
|
|
26602
|
+
sendMessage: true,
|
|
26603
|
+
onCloseButton: onCloseButton,
|
|
26604
|
+
styles: styles,
|
|
26605
|
+
onFocus: onFocus,
|
|
26606
|
+
onBlur: onBlur
|
|
26607
|
+
});
|
|
26608
|
+
};
|
|
26609
|
+
return React__default.createElement(React__default.Fragment, null, renderTabs(), React__default.createElement(PrivateChatContainer, {
|
|
26542
26610
|
width: (styles == null ? void 0 : styles.width) || '80%',
|
|
26543
26611
|
height: (styles == null ? void 0 : styles.height) || 'auto'
|
|
26544
26612
|
}, React__default.createElement(RecentChatTabContainer, {
|
|
26545
26613
|
isPrivate: isPrivate,
|
|
26546
26614
|
isOpen: showRecentChats
|
|
26547
|
-
},
|
|
26548
|
-
isOpen: showRecentChats
|
|
26549
|
-
}, React__default.createElement(BurgerIconContainer, {
|
|
26550
|
-
onPointerDown: function onPointerDown() {
|
|
26551
|
-
return setShowRecentChats(function (t) {
|
|
26552
|
-
return !t;
|
|
26553
|
-
});
|
|
26554
|
-
},
|
|
26555
|
-
hasUnseenMessages: (unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.length) > 0 || false
|
|
26556
|
-
}, React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null)), showRecentChats && React__default.createElement(SearchButton$1, {
|
|
26557
|
-
onPointerDown: function onPointerDown() {
|
|
26558
|
-
return showSearchCharacterUI();
|
|
26559
|
-
}
|
|
26560
|
-
}, React__default.createElement(rx.RxMagnifyingGlass, {
|
|
26561
|
-
size: 16,
|
|
26562
|
-
color: uiColors.white
|
|
26563
|
-
}))), React__default.createElement(RecentChatLogContainer, {
|
|
26564
|
-
isOpen: showRecentChats
|
|
26565
|
-
}, recentChatCharacters == null ? void 0 : recentChatCharacters.map(function (character) {
|
|
26566
|
-
return React__default.createElement(ListElementContainer, {
|
|
26567
|
-
key: character._id
|
|
26568
|
-
}, React__default.createElement(ListElement$1, {
|
|
26569
|
-
active: character._id === recentSelectedChatCharacterId,
|
|
26570
|
-
onPointerDown: function onPointerDown() {
|
|
26571
|
-
return handlePreviousChatCharacterClick(character);
|
|
26572
|
-
}
|
|
26573
|
-
}, React__default.createElement(StatusDot, {
|
|
26574
|
-
isUnseen: (unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.includes(character._id)) || false
|
|
26575
|
-
}), character.name), React__default.createElement(CloseButton$1, {
|
|
26576
|
-
onPointerDown: function onPointerDown() {
|
|
26577
|
-
return onRemoveRecentChatCharacter == null ? void 0 : onRemoveRecentChatCharacter(character);
|
|
26578
|
-
}
|
|
26579
|
-
}, React__default.createElement(rx.RxCross2, {
|
|
26580
|
-
size: 16
|
|
26581
|
-
})));
|
|
26582
|
-
}))), isPrivate && searchCharacterUI ? React__default.createElement(SearchCharacter, {
|
|
26583
|
-
onFocus: onFocus,
|
|
26584
|
-
onBlur: onBlur,
|
|
26585
|
-
onChangeCharacterName: onChangeCharacterName,
|
|
26586
|
-
styles: styles,
|
|
26587
|
-
recentCharacters: privateChatCharacters,
|
|
26588
|
-
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26589
|
-
onCharacterClick: onCharacterClick
|
|
26590
|
-
}) : React__default.createElement(Chat, {
|
|
26591
|
-
chatMessages: chatMessages,
|
|
26592
|
-
onSendChatMessage: isPrivate ? onSendPrivateChatMessage : isTrade ? onSendTradeMessage : onSendGlobalChatMessage,
|
|
26593
|
-
sendMessage: true,
|
|
26594
|
-
onCloseButton: onCloseButton,
|
|
26595
|
-
styles: styles,
|
|
26596
|
-
onFocus: onFocus,
|
|
26597
|
-
onBlur: onBlur
|
|
26598
|
-
})));
|
|
26615
|
+
}, renderRecentChatTopBar(), renderRecentChatList()), renderChatContent()));
|
|
26599
26616
|
};
|
|
26600
26617
|
var TabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26601
26618
|
displayName: "ChatRevamp__TabContainer",
|
|
@@ -26624,12 +26641,16 @@ var PrivateChatContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
26624
26641
|
var RecentChatTabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26625
26642
|
displayName: "ChatRevamp__RecentChatTabContainer",
|
|
26626
26643
|
componentId: "sc-1sdiknw-3"
|
|
26627
|
-
})(["display:", ";flex-direction:column;border-right:1px solid ", ";outline:none;width:", "
|
|
26644
|
+
})(["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;@media (max-width:768px){width:", ";min-width:", ";}"], function (props) {
|
|
26628
26645
|
return props.isPrivate ? 'flex' : 'none';
|
|
26629
26646
|
}, uiColors.gray, function (props) {
|
|
26630
|
-
return props.isOpen ? '
|
|
26647
|
+
return props.isOpen ? '25%' : '30px';
|
|
26648
|
+
}, function (props) {
|
|
26649
|
+
return props.isOpen ? '180px' : '30px';
|
|
26650
|
+
}, function (props) {
|
|
26651
|
+
return props.isOpen ? '50%' : '30px';
|
|
26631
26652
|
}, function (props) {
|
|
26632
|
-
return props.isOpen ? '
|
|
26653
|
+
return props.isOpen ? '150px' : '30px';
|
|
26633
26654
|
});
|
|
26634
26655
|
var RecentChatTopBar = /*#__PURE__*/styled__default.div.withConfig({
|
|
26635
26656
|
displayName: "ChatRevamp__RecentChatTopBar",
|
|
@@ -26662,7 +26683,7 @@ var ListElementContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
26662
26683
|
var ListElement$1 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26663
26684
|
displayName: "ChatRevamp__ListElement",
|
|
26664
26685
|
componentId: "sc-1sdiknw-10"
|
|
26665
|
-
})(["margin:0.5rem 0 !important;font-size:", " !important;padding:2px;all:unset;color:", ";width:100%;position:relative;display:flex;align-items:center;gap:4px;&:hover{color:#ff0;}"], uiFonts.size.small, function (props) {
|
|
26686
|
+
})(["margin:0.5rem 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) {
|
|
26666
26687
|
return props.active ? uiColors.yellow : uiColors.white;
|
|
26667
26688
|
});
|
|
26668
26689
|
var StatusDot = /*#__PURE__*/styled__default.span.withConfig({
|