@rpg-engine/long-bow 0.5.6 → 0.5.8
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/Leaderboard/Leaderboard.d.ts +11 -0
- package/dist/components/Leaderboard/LeaderboardTable.d.ts +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +130 -10
- 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 +130 -11
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/mocks/leaderboard.mocks.d.ts +4 -0
- package/dist/stories/Leaderboard.stories.d.ts +7 -0
- package/package.json +2 -2
- package/src/components/Leaderboard/Leaderboard.tsx +111 -0
- package/src/components/Leaderboard/LeaderboardTable.tsx +97 -0
- package/src/components/shared/SpriteFromAtlas.tsx +6 -1
- package/src/index.tsx +1 -0
- package/src/mocks/leaderboard.mocks.ts +110 -0
- package/src/stories/Leaderboard.stories.tsx +57 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TopCharacterEntry, TopSkillEntry } from '@rpg-engine/shared';
|
|
3
|
+
export interface ILeaderboardProps {
|
|
4
|
+
items: Set<TopCharacterEntry> | Set<TopSkillEntry> | null;
|
|
5
|
+
onChangeClassType: (value: string) => void;
|
|
6
|
+
onChangeRankType: (value: string) => void;
|
|
7
|
+
onChangeSkillType: (value: string) => void;
|
|
8
|
+
skills: string[];
|
|
9
|
+
rankType: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const Leaderboard: (props: ILeaderboardProps) => JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TopCharacterEntry, TopSkillEntry } from '@rpg-engine/shared';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface ILeaderboardLevelProps {
|
|
4
|
+
items: Set<TopCharacterEntry> | Set<TopSkillEntry> | null;
|
|
5
|
+
rankType: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const LeaderboardTable: React.FC<ILeaderboardLevelProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './components/Input';
|
|
|
15
15
|
export { ErrorBoundary } from './components/Item/Inventory/ErrorBoundary';
|
|
16
16
|
export * from './components/Item/Inventory/ItemContainer';
|
|
17
17
|
export * from './components/Item/Inventory/ItemSlot';
|
|
18
|
+
export * from './components/Leaderboard/Leaderboard';
|
|
18
19
|
export * from './components/ListMenu';
|
|
19
20
|
export * from './components/Marketplace/Marketplace';
|
|
20
21
|
export * from './components/Marketplace/MarketplaceRows';
|
|
@@ -124,7 +124,10 @@ var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
|
|
|
124
124
|
//! If an item is not showing, remember that you MUST run yarn atlas:copy everytime you add a new item to the atlas (it will sync our public folder atlas with src/atlas).
|
|
125
125
|
//!Due to React's limitations, we cannot import it from the public folder directly!
|
|
126
126
|
var spriteData = (atlasJSON == null ? void 0 : (_atlasJSON$frames = atlasJSON.frames) == null ? void 0 : _atlasJSON$frames[spriteKey]) || (atlasJSON == null ? void 0 : (_atlasJSON$frames2 = atlasJSON.frames) == null ? void 0 : _atlasJSON$frames2['others/no-image.png']);
|
|
127
|
-
if (!spriteData)
|
|
127
|
+
if (!spriteData) {
|
|
128
|
+
console.error("SpriteFromAtlas: Could not find sprite with key " + spriteKey + " in atlasJSON.");
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
128
131
|
return React__default.createElement(Container, {
|
|
129
132
|
width: width,
|
|
130
133
|
height: height,
|
|
@@ -15691,6 +15694,122 @@ var QuantitySelectorContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
15691
15694
|
componentId: "sc-15y5p9l-1"
|
|
15692
15695
|
})(["position:absolute;top:0;left:0;width:100vw;height:100vh;z-index:100;display:flex;justify-content:center;align-items:center;background-color:rgba(0,0,0,0.5);"]);
|
|
15693
15696
|
|
|
15697
|
+
var LeaderboardTable = function LeaderboardTable(props) {
|
|
15698
|
+
var items = props.items,
|
|
15699
|
+
rankType = props.rankType;
|
|
15700
|
+
if (!items) return null;
|
|
15701
|
+
function isTopSkillEntry(entry) {
|
|
15702
|
+
return 'skill' in entry;
|
|
15703
|
+
}
|
|
15704
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("thead", null, React__default.createElement(TableRowWrapper, null, React__default.createElement(TableRowValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {
|
|
15705
|
+
maxLines: 1,
|
|
15706
|
+
maxWidth: "200px",
|
|
15707
|
+
fontSize: "14px"
|
|
15708
|
+
}, "Name"))), rankType === 'Skill' ? React__default.createElement(TableRowValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {
|
|
15709
|
+
maxLines: 1,
|
|
15710
|
+
maxWidth: "200px",
|
|
15711
|
+
fontSize: "14px"
|
|
15712
|
+
}, "Skill"))) : null, React__default.createElement(TableRowValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {
|
|
15713
|
+
maxLines: 1,
|
|
15714
|
+
maxWidth: "200px",
|
|
15715
|
+
fontSize: "14px"
|
|
15716
|
+
}, "Level"))))), React__default.createElement("tbody", null, Array.from(items).map(function (entry) {
|
|
15717
|
+
return React__default.createElement(TableRowWrapper, {
|
|
15718
|
+
key: entry.name
|
|
15719
|
+
}, React__default.createElement(TableRowValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {
|
|
15720
|
+
maxLines: 1,
|
|
15721
|
+
maxWidth: "200px",
|
|
15722
|
+
fontSize: "10px"
|
|
15723
|
+
}, entry.name))), isTopSkillEntry(entry) ? React__default.createElement(TableRowValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {
|
|
15724
|
+
maxLines: 1,
|
|
15725
|
+
maxWidth: "200px",
|
|
15726
|
+
fontSize: "10px"
|
|
15727
|
+
}, entry.skill))) : null, React__default.createElement(TableRowValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {
|
|
15728
|
+
maxLines: 1,
|
|
15729
|
+
maxWidth: "200px",
|
|
15730
|
+
fontSize: "10px"
|
|
15731
|
+
}, entry.level))));
|
|
15732
|
+
})));
|
|
15733
|
+
};
|
|
15734
|
+
var TableRowWrapper = /*#__PURE__*/styled.tr.withConfig({
|
|
15735
|
+
displayName: "LeaderboardTable__TableRowWrapper",
|
|
15736
|
+
componentId: "sc-kk017f-0"
|
|
15737
|
+
})(["margin:auto;padding:0.5rem;&:hover{background-color:", ";}p{font-size:0.8rem;}"], uiColors.darkGray);
|
|
15738
|
+
var TableRowValue = /*#__PURE__*/styled.td.withConfig({
|
|
15739
|
+
displayName: "LeaderboardTable__TableRowValue",
|
|
15740
|
+
componentId: "sc-kk017f-1"
|
|
15741
|
+
})(["padding:0 20px;"]);
|
|
15742
|
+
|
|
15743
|
+
var rankTypeOptions = /*#__PURE__*/['Level', 'Class', 'Skill'].map(function (itemType, index) {
|
|
15744
|
+
return {
|
|
15745
|
+
id: index + 1,
|
|
15746
|
+
value: itemType,
|
|
15747
|
+
option: itemType
|
|
15748
|
+
};
|
|
15749
|
+
});
|
|
15750
|
+
var classTypeOptions = /*#__PURE__*/Object.keys(shared.CharacterClass).map(function (itemType, index) {
|
|
15751
|
+
return {
|
|
15752
|
+
id: index + 1,
|
|
15753
|
+
value: itemType,
|
|
15754
|
+
option: itemType
|
|
15755
|
+
};
|
|
15756
|
+
});
|
|
15757
|
+
var Leaderboard = function Leaderboard(props) {
|
|
15758
|
+
var items = props.items,
|
|
15759
|
+
onChangeRankType = props.onChangeRankType,
|
|
15760
|
+
onChangeClassType = props.onChangeClassType,
|
|
15761
|
+
rankType = props.rankType,
|
|
15762
|
+
skills = props.skills,
|
|
15763
|
+
onChangeSkillType = props.onChangeSkillType;
|
|
15764
|
+
var itemsContainer = React.useRef(null);
|
|
15765
|
+
React.useEffect(function () {
|
|
15766
|
+
var _itemsContainer$curre;
|
|
15767
|
+
(_itemsContainer$curre = itemsContainer.current) == null ? void 0 : _itemsContainer$curre.scrollTo(0, 0);
|
|
15768
|
+
}, []);
|
|
15769
|
+
var skillTypeOptions = skills.map(function (itemType, index) {
|
|
15770
|
+
return {
|
|
15771
|
+
id: index + 1,
|
|
15772
|
+
value: itemType,
|
|
15773
|
+
option: itemType
|
|
15774
|
+
};
|
|
15775
|
+
});
|
|
15776
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(WrapperContainer, null, React__default.createElement(StyledDropdown, {
|
|
15777
|
+
options: rankTypeOptions,
|
|
15778
|
+
onChange: onChangeRankType,
|
|
15779
|
+
width: "80%"
|
|
15780
|
+
}), rankType === 'Class' ? React__default.createElement(StyledDropdown, {
|
|
15781
|
+
options: classTypeOptions,
|
|
15782
|
+
onChange: onChangeClassType,
|
|
15783
|
+
width: "100%"
|
|
15784
|
+
}) : null, rankType === 'Skill' ? React__default.createElement(StyledDropdown, {
|
|
15785
|
+
options: skillTypeOptions,
|
|
15786
|
+
onChange: onChangeSkillType,
|
|
15787
|
+
width: "100%"
|
|
15788
|
+
}) : null), React__default.createElement(ItemComponentScrollWrapper, {
|
|
15789
|
+
id: "LeaderboardContainer",
|
|
15790
|
+
ref: itemsContainer
|
|
15791
|
+
}, React__default.createElement(TableWrapper, null, React__default.createElement(LeaderboardTable, {
|
|
15792
|
+
items: items,
|
|
15793
|
+
rankType: rankType
|
|
15794
|
+
}))));
|
|
15795
|
+
};
|
|
15796
|
+
var WrapperContainer = /*#__PURE__*/styled.div.withConfig({
|
|
15797
|
+
displayName: "Leaderboard__WrapperContainer",
|
|
15798
|
+
componentId: "sc-1wdsq7i-0"
|
|
15799
|
+
})(["display:grid;grid-template-columns:50% 50%;justify-content:space-between;width:calc(100% - 40px);margin-left:10px;.rpgui-content .rpgui-dropdown-imp-header{padding:0px 10px 0 !important;}"]);
|
|
15800
|
+
var StyledDropdown = /*#__PURE__*/styled(Dropdown).withConfig({
|
|
15801
|
+
displayName: "Leaderboard__StyledDropdown",
|
|
15802
|
+
componentId: "sc-1wdsq7i-1"
|
|
15803
|
+
})(["margin:3px !important;width:170px !important;"]);
|
|
15804
|
+
var ItemComponentScrollWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
15805
|
+
displayName: "Leaderboard__ItemComponentScrollWrapper",
|
|
15806
|
+
componentId: "sc-1wdsq7i-2"
|
|
15807
|
+
})(["overflow-y:scroll;height:390px;width:100%;margin-top:1rem;@media (max-width:950px){height:250px;}"]);
|
|
15808
|
+
var TableWrapper = /*#__PURE__*/styled.table.withConfig({
|
|
15809
|
+
displayName: "Leaderboard__TableWrapper",
|
|
15810
|
+
componentId: "sc-1wdsq7i-3"
|
|
15811
|
+
})(["margin:auto;width:100%;"]);
|
|
15812
|
+
|
|
15694
15813
|
var ListMenu = function ListMenu(_ref) {
|
|
15695
15814
|
var options = _ref.options,
|
|
15696
15815
|
onSelected = _ref.onSelected,
|
|
@@ -16051,19 +16170,19 @@ var BuyPanel = function BuyPanel(_ref) {
|
|
|
16051
16170
|
className: "big-input",
|
|
16052
16171
|
onBlur: enableHotkeys,
|
|
16053
16172
|
onFocus: disableHotkeys
|
|
16054
|
-
}))), React__default.createElement(WrapperContainer, null, React__default.createElement(StyledDropdown, {
|
|
16173
|
+
}))), React__default.createElement(WrapperContainer$1, null, React__default.createElement(StyledDropdown$1, {
|
|
16055
16174
|
options: itemTypeOptions,
|
|
16056
16175
|
onChange: onChangeType,
|
|
16057
16176
|
width: "95%"
|
|
16058
|
-
}), React__default.createElement(StyledDropdown, {
|
|
16177
|
+
}), React__default.createElement(StyledDropdown$1, {
|
|
16059
16178
|
options: itemRarityOptions,
|
|
16060
16179
|
onChange: onChangeRarity,
|
|
16061
16180
|
width: "95%"
|
|
16062
|
-
}), React__default.createElement(StyledDropdown, {
|
|
16181
|
+
}), React__default.createElement(StyledDropdown$1, {
|
|
16063
16182
|
options: orderByOptions,
|
|
16064
16183
|
onChange: onChangeOrder,
|
|
16065
16184
|
width: "100%"
|
|
16066
|
-
}))), React__default.createElement(ItemComponentScrollWrapper, {
|
|
16185
|
+
}))), React__default.createElement(ItemComponentScrollWrapper$1, {
|
|
16067
16186
|
id: "MarketContainer",
|
|
16068
16187
|
ref: itemsContainer
|
|
16069
16188
|
}, items == null ? void 0 : items.map(function (_ref2, index) {
|
|
@@ -16095,15 +16214,15 @@ var FilterInputsWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
16095
16214
|
displayName: "BuyPanel__FilterInputsWrapper",
|
|
16096
16215
|
componentId: "sc-1si8t7i-2"
|
|
16097
16216
|
})(["width:95%;display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;margin-left:10px;gap:5px;color:white;flex-wrap:wrap;p{width:auto;margin:0;}input{width:75px;height:10px;}.big-input{width:130px;}"]);
|
|
16098
|
-
var WrapperContainer = /*#__PURE__*/styled.div.withConfig({
|
|
16217
|
+
var WrapperContainer$1 = /*#__PURE__*/styled.div.withConfig({
|
|
16099
16218
|
displayName: "BuyPanel__WrapperContainer",
|
|
16100
16219
|
componentId: "sc-1si8t7i-3"
|
|
16101
16220
|
})(["display:grid;grid-template-columns:40% 30% 30%;justify-content:space-between;width:calc(100% - 40px);margin-left:10px;.rpgui-content .rpgui-dropdown-imp-header{padding:0px 10px 0 !important;}"]);
|
|
16102
|
-
var ItemComponentScrollWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
16221
|
+
var ItemComponentScrollWrapper$1 = /*#__PURE__*/styled.div.withConfig({
|
|
16103
16222
|
displayName: "BuyPanel__ItemComponentScrollWrapper",
|
|
16104
16223
|
componentId: "sc-1si8t7i-4"
|
|
16105
16224
|
})(["overflow-y:scroll;height:390px;width:100%;margin-top:1rem;@media (max-width:950px){height:250px;}"]);
|
|
16106
|
-
var StyledDropdown = /*#__PURE__*/styled(Dropdown).withConfig({
|
|
16225
|
+
var StyledDropdown$1 = /*#__PURE__*/styled(Dropdown).withConfig({
|
|
16107
16226
|
displayName: "BuyPanel__StyledDropdown",
|
|
16108
16227
|
componentId: "sc-1si8t7i-5"
|
|
16109
16228
|
})(["margin:3px !important;width:170px !important;"]);
|
|
@@ -16205,7 +16324,7 @@ var ManagmentPanel = function ManagmentPanel(_ref) {
|
|
|
16205
16324
|
onPointerDown: function onPointerDown() {
|
|
16206
16325
|
return availableGold > 0 && onMoneyWithdraw();
|
|
16207
16326
|
}
|
|
16208
|
-
}, "Withdraw")))), React__default.createElement(ItemComponentScrollWrapper$
|
|
16327
|
+
}, "Withdraw")))), React__default.createElement(ItemComponentScrollWrapper$2, {
|
|
16209
16328
|
id: "MarketContainer",
|
|
16210
16329
|
ref: itemsContainer
|
|
16211
16330
|
}, items == null ? void 0 : items.map(function (_ref2, index) {
|
|
@@ -16239,7 +16358,7 @@ var InnerOptionsWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
16239
16358
|
displayName: "ManagmentPanel__InnerOptionsWrapper",
|
|
16240
16359
|
componentId: "sc-1yyi6jn-3"
|
|
16241
16360
|
})(["display:flex;justify-content:space-between;flex-direction:column;height:100%;"]);
|
|
16242
|
-
var ItemComponentScrollWrapper$
|
|
16361
|
+
var ItemComponentScrollWrapper$2 = /*#__PURE__*/styled.div.withConfig({
|
|
16243
16362
|
displayName: "ManagmentPanel__ItemComponentScrollWrapper",
|
|
16244
16363
|
componentId: "sc-1yyi6jn-4"
|
|
16245
16364
|
})(["overflow-y:scroll;height:390px;width:100%;margin-top:1rem;@media (max-width:950px){height:250px;}"]);
|
|
@@ -18188,6 +18307,7 @@ exports.InputRadio = InputRadio$1;
|
|
|
18188
18307
|
exports.ItemContainer = ItemContainer$1;
|
|
18189
18308
|
exports.ItemSelector = ItemSelector;
|
|
18190
18309
|
exports.ItemSlot = ItemSlot;
|
|
18310
|
+
exports.Leaderboard = Leaderboard;
|
|
18191
18311
|
exports.ListMenu = ListMenu;
|
|
18192
18312
|
exports.Marketplace = Marketplace;
|
|
18193
18313
|
exports.MarketplaceRows = MarketplaceRows;
|