@rpg-engine/long-bow 0.8.72 → 0.8.73
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/hooks/useCharacterSkinNavigation.d.ts +7 -0
- package/dist/hooks/usePackFiltering.d.ts +7 -0
- package/dist/hooks/useQuantityControl.d.ts +10 -0
- package/dist/hooks/useStoreFiltering.d.ts +11 -0
- package/dist/long-bow.cjs.development.js +211 -75
- 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 +211 -75
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Store/StoreCharacterSkinRow.tsx +63 -45
- package/src/components/Store/StoreItemRow.tsx +51 -53
- package/src/components/Store/sections/StoreItemsSection.tsx +72 -21
- package/src/components/Store/sections/StorePacksSection.tsx +5 -10
- package/src/hooks/useCharacterSkinNavigation.ts +34 -0
- package/src/hooks/usePackFiltering.ts +20 -0
- package/src/hooks/useQuantityControl.ts +41 -0
- package/src/hooks/useStoreFiltering.ts +51 -0
- package/src/mocks/dailyTasks.mocks.ts +6 -6
- package/src/stories/Features/store/Store.stories.tsx +35 -8
package/dist/long-bow.esm.js
CHANGED
|
@@ -57963,25 +57963,13 @@ var EmptyMessage$1 = /*#__PURE__*/styled.div.withConfig({
|
|
|
57963
57963
|
componentId: "sc-xhh2um-8"
|
|
57964
57964
|
})(["text-align:center;color:#9ca3af;padding:2rem;flex:1;display:flex;align-items:center;justify-content:center;"]);
|
|
57965
57965
|
|
|
57966
|
-
var
|
|
57967
|
-
var _item$metadataConfig, _item$metadataConfig2, _item$metadataConfig3, _item$requiredAccount;
|
|
57968
|
-
var item = _ref.item,
|
|
57969
|
-
atlasJSON = _ref.atlasJSON,
|
|
57970
|
-
atlasIMG = _ref.atlasIMG,
|
|
57971
|
-
onAddToCart = _ref.onAddToCart,
|
|
57972
|
-
userAccountType = _ref.userAccountType;
|
|
57966
|
+
var useCharacterSkinNavigation = function useCharacterSkinNavigation(availableCharacters, itemKey) {
|
|
57973
57967
|
var _useState = useState(0),
|
|
57974
57968
|
currentIndex = _useState[0],
|
|
57975
57969
|
setCurrentIndex = _useState[1];
|
|
57976
|
-
// Get available characters from metadata
|
|
57977
|
-
var availableCharacters = item.metadataType === MetadataType.CharacterSkin && ((_item$metadataConfig = item.metadataConfig) == null ? void 0 : _item$metadataConfig.availableCharacters) || [];
|
|
57978
|
-
// Get the active character entity atlas info
|
|
57979
|
-
var entityAtlasJSON = (_item$metadataConfig2 = item.metadataConfig) == null ? void 0 : _item$metadataConfig2.atlasJSON;
|
|
57980
|
-
var entityAtlasIMG = (_item$metadataConfig3 = item.metadataConfig) == null ? void 0 : _item$metadataConfig3.atlasIMG;
|
|
57981
|
-
// Effect to reset currentIndex when switching items
|
|
57982
57970
|
useEffect(function () {
|
|
57983
57971
|
setCurrentIndex(0);
|
|
57984
|
-
}, [
|
|
57972
|
+
}, [itemKey]);
|
|
57985
57973
|
var handlePreviousSkin = function handlePreviousSkin() {
|
|
57986
57974
|
setCurrentIndex(function (prevIndex) {
|
|
57987
57975
|
return prevIndex === 0 ? availableCharacters.length - 1 : prevIndex - 1;
|
|
@@ -57992,6 +57980,31 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
57992
57980
|
return prevIndex === availableCharacters.length - 1 ? 0 : prevIndex + 1;
|
|
57993
57981
|
});
|
|
57994
57982
|
};
|
|
57983
|
+
var currentCharacter = availableCharacters[currentIndex];
|
|
57984
|
+
return {
|
|
57985
|
+
currentIndex: currentIndex,
|
|
57986
|
+
currentCharacter: currentCharacter,
|
|
57987
|
+
handlePreviousSkin: handlePreviousSkin,
|
|
57988
|
+
handleNextSkin: handleNextSkin
|
|
57989
|
+
};
|
|
57990
|
+
};
|
|
57991
|
+
|
|
57992
|
+
var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
57993
|
+
var _item$metadataConfig, _item$metadataConfig2, _item$metadataConfig3, _item$requiredAccount, _item$store;
|
|
57994
|
+
var item = _ref.item,
|
|
57995
|
+
atlasJSON = _ref.atlasJSON,
|
|
57996
|
+
atlasIMG = _ref.atlasIMG,
|
|
57997
|
+
onAddToCart = _ref.onAddToCart,
|
|
57998
|
+
userAccountType = _ref.userAccountType;
|
|
57999
|
+
// Get available characters from metadata
|
|
58000
|
+
var availableCharacters = item.metadataType === MetadataType.CharacterSkin && ((_item$metadataConfig = item.metadataConfig) == null ? void 0 : _item$metadataConfig.availableCharacters) || [];
|
|
58001
|
+
// Get the active character entity atlas info
|
|
58002
|
+
var entityAtlasJSON = (_item$metadataConfig2 = item.metadataConfig) == null ? void 0 : _item$metadataConfig2.atlasJSON;
|
|
58003
|
+
var entityAtlasIMG = (_item$metadataConfig3 = item.metadataConfig) == null ? void 0 : _item$metadataConfig3.atlasIMG;
|
|
58004
|
+
var _useCharacterSkinNavi = useCharacterSkinNavigation(availableCharacters, item.key),
|
|
58005
|
+
currentCharacter = _useCharacterSkinNavi.currentCharacter,
|
|
58006
|
+
handlePreviousSkin = _useCharacterSkinNavi.handlePreviousSkin,
|
|
58007
|
+
handleNextSkin = _useCharacterSkinNavi.handleNextSkin;
|
|
57995
58008
|
var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
|
|
57996
58009
|
var handleAddToCart = function handleAddToCart() {
|
|
57997
58010
|
if (!hasRequiredAccount) return;
|
|
@@ -58008,8 +58021,9 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
58008
58021
|
var getSpriteKey = function getSpriteKey(textureKey) {
|
|
58009
58022
|
return textureKey + '/down/standing/0.png';
|
|
58010
58023
|
};
|
|
58011
|
-
|
|
58012
|
-
|
|
58024
|
+
return React.createElement(ItemWrapper, {
|
|
58025
|
+
"$isHighlighted": ((_item$store = item.store) == null ? void 0 : _item$store.isHighlighted) || false
|
|
58026
|
+
}, React.createElement(ItemIconContainer$2, null, entityAtlasJSON && entityAtlasIMG && currentCharacter ? React.createElement(SpriteFromAtlas, {
|
|
58013
58027
|
atlasJSON: entityAtlasJSON,
|
|
58014
58028
|
atlasIMG: entityAtlasIMG,
|
|
58015
58029
|
spriteKey: getSpriteKey(currentCharacter.textureKey),
|
|
@@ -58017,7 +58031,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
58017
58031
|
height: 32,
|
|
58018
58032
|
imgScale: 2,
|
|
58019
58033
|
centered: true
|
|
58020
|
-
}) : React.createElement(SpriteFromAtlas, {
|
|
58034
|
+
}) : item.texturePath ? React.createElement(SpriteFromAtlas, {
|
|
58021
58035
|
atlasJSON: atlasJSON,
|
|
58022
58036
|
atlasIMG: atlasIMG,
|
|
58023
58037
|
spriteKey: item.texturePath,
|
|
@@ -58025,7 +58039,7 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
58025
58039
|
height: 32,
|
|
58026
58040
|
imgScale: 2,
|
|
58027
58041
|
centered: true
|
|
58028
|
-
})), React.createElement(ItemDetails$1, null, React.createElement(Header$8, null, React.createElement(ItemName$1, null, item.name)), availableCharacters.length > 0 && currentCharacter && React.createElement(SelectedSkinNav, null, React.createElement(SelectedSkin, null, "Selected:"), React.createElement(SkinNavArrow, {
|
|
58042
|
+
}) : React.createElement(DefaultIcon, null, "\uD83D\uDC64")), React.createElement(ItemDetails$1, null, React.createElement(Header$8, null, React.createElement(ItemName$1, null, item.name)), availableCharacters.length > 0 && currentCharacter && React.createElement(SelectedSkinNav, null, React.createElement(SelectedSkin, null, "Selected:"), React.createElement(SkinNavArrow, {
|
|
58029
58043
|
direction: "left",
|
|
58030
58044
|
onPointerDown: handlePreviousSkin,
|
|
58031
58045
|
size: 24
|
|
@@ -58043,7 +58057,11 @@ var StoreCharacterSkinRow = function StoreCharacterSkinRow(_ref) {
|
|
|
58043
58057
|
var ItemWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
58044
58058
|
displayName: "StoreCharacterSkinRow__ItemWrapper",
|
|
58045
58059
|
componentId: "sc-81xqsx-0"
|
|
58046
|
-
})(["display:flex;align-items:center;gap:
|
|
58060
|
+
})(["display:flex;align-items:center;gap:0.75rem;padding:0.5rem 1rem;border-bottom:1px solid rgba(255,255,255,0.1);background:", ";border-left:", ";&:last-child{border-bottom:none;}"], function (props) {
|
|
58061
|
+
return props.$isHighlighted ? 'rgba(255, 215, 0, 0.1)' : 'transparent';
|
|
58062
|
+
}, function (props) {
|
|
58063
|
+
return props.$isHighlighted ? '3px solid #ffd700' : '3px solid transparent';
|
|
58064
|
+
});
|
|
58047
58065
|
var ItemIconContainer$2 = /*#__PURE__*/styled.div.withConfig({
|
|
58048
58066
|
displayName: "StoreCharacterSkinRow__ItemIconContainer",
|
|
58049
58067
|
componentId: "sc-81xqsx-1"
|
|
@@ -58051,23 +58069,23 @@ var ItemIconContainer$2 = /*#__PURE__*/styled.div.withConfig({
|
|
|
58051
58069
|
var ItemDetails$1 = /*#__PURE__*/styled.div.withConfig({
|
|
58052
58070
|
displayName: "StoreCharacterSkinRow__ItemDetails",
|
|
58053
58071
|
componentId: "sc-81xqsx-2"
|
|
58054
|
-
})(["flex:1;display:flex;flex-direction:column;gap:0.
|
|
58072
|
+
})(["flex:1;display:flex;flex-direction:column;gap:0.25rem;"]);
|
|
58055
58073
|
var ItemName$1 = /*#__PURE__*/styled.div.withConfig({
|
|
58056
58074
|
displayName: "StoreCharacterSkinRow__ItemName",
|
|
58057
58075
|
componentId: "sc-81xqsx-3"
|
|
58058
|
-
})(["font-family:'Press Start 2P',cursive;font-size:0.
|
|
58076
|
+
})(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;"]);
|
|
58059
58077
|
var SelectedSkin = /*#__PURE__*/styled.div.withConfig({
|
|
58060
58078
|
displayName: "StoreCharacterSkinRow__SelectedSkin",
|
|
58061
58079
|
componentId: "sc-81xqsx-4"
|
|
58062
|
-
})(["font-family:'Press Start 2P',cursive;font-size:0.
|
|
58080
|
+
})(["font-family:'Press Start 2P',cursive;font-size:0.5rem;color:#fef08a;"]);
|
|
58063
58081
|
var ItemPrice = /*#__PURE__*/styled.div.withConfig({
|
|
58064
58082
|
displayName: "StoreCharacterSkinRow__ItemPrice",
|
|
58065
58083
|
componentId: "sc-81xqsx-5"
|
|
58066
|
-
})(["font-family:'Press Start 2P',cursive;font-size:0.
|
|
58084
|
+
})(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:#fef08a;"]);
|
|
58067
58085
|
var Controls = /*#__PURE__*/styled.div.withConfig({
|
|
58068
58086
|
displayName: "StoreCharacterSkinRow__Controls",
|
|
58069
58087
|
componentId: "sc-81xqsx-6"
|
|
58070
|
-
})(["display:flex;align-items:center;gap:
|
|
58088
|
+
})(["display:flex;align-items:center;gap:0.5rem;min-width:fit-content;"]);
|
|
58071
58089
|
// Styled arrow override for inline nav arrows
|
|
58072
58090
|
var SkinNavArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
|
|
58073
58091
|
displayName: "StoreCharacterSkinRow__SkinNavArrow",
|
|
@@ -58081,42 +58099,77 @@ var SelectedSkinNav = /*#__PURE__*/styled.div.withConfig({
|
|
|
58081
58099
|
displayName: "StoreCharacterSkinRow__SelectedSkinNav",
|
|
58082
58100
|
componentId: "sc-81xqsx-9"
|
|
58083
58101
|
})(["display:flex;align-items:center;gap:0.5rem;"]);
|
|
58102
|
+
var DefaultIcon = /*#__PURE__*/styled.div.withConfig({
|
|
58103
|
+
displayName: "StoreCharacterSkinRow__DefaultIcon",
|
|
58104
|
+
componentId: "sc-81xqsx-10"
|
|
58105
|
+
})(["font-size:1.5rem;display:flex;align-items:center;justify-content:center;width:32px;height:32px;"]);
|
|
58084
58106
|
|
|
58085
|
-
var
|
|
58086
|
-
|
|
58087
|
-
|
|
58088
|
-
|
|
58089
|
-
|
|
58090
|
-
|
|
58091
|
-
|
|
58092
|
-
|
|
58093
|
-
|
|
58094
|
-
|
|
58095
|
-
|
|
58096
|
-
var _useState = useState(1),
|
|
58107
|
+
var useQuantityControl = function useQuantityControl(initialQuantity, min, max) {
|
|
58108
|
+
if (initialQuantity === void 0) {
|
|
58109
|
+
initialQuantity = 1;
|
|
58110
|
+
}
|
|
58111
|
+
if (min === void 0) {
|
|
58112
|
+
min = 1;
|
|
58113
|
+
}
|
|
58114
|
+
if (max === void 0) {
|
|
58115
|
+
max = 99;
|
|
58116
|
+
}
|
|
58117
|
+
var _useState = useState(initialQuantity),
|
|
58097
58118
|
quantity = _useState[0],
|
|
58098
58119
|
setQuantity = _useState[1];
|
|
58099
|
-
var _useState2 = useState(''),
|
|
58100
|
-
textInputValue = _useState2[0],
|
|
58101
|
-
setTextInputValue = _useState2[1];
|
|
58102
58120
|
var handleQuantityChange = function handleQuantityChange(e) {
|
|
58103
|
-
var value = parseInt(e.target.value) ||
|
|
58104
|
-
setQuantity(Math.min(Math.max(
|
|
58121
|
+
var value = parseInt(e.target.value) || min;
|
|
58122
|
+
setQuantity(Math.min(Math.max(min, value), max));
|
|
58105
58123
|
};
|
|
58106
58124
|
var handleBlur = function handleBlur() {
|
|
58107
|
-
if (quantity <
|
|
58108
|
-
if (quantity >
|
|
58125
|
+
if (quantity < min) setQuantity(min);
|
|
58126
|
+
if (quantity > max) setQuantity(max);
|
|
58109
58127
|
};
|
|
58110
58128
|
var incrementQuantity = function incrementQuantity() {
|
|
58111
58129
|
setQuantity(function (prev) {
|
|
58112
|
-
return Math.min(prev + 1,
|
|
58130
|
+
return Math.min(prev + 1, max);
|
|
58113
58131
|
});
|
|
58114
58132
|
};
|
|
58115
58133
|
var decrementQuantity = function decrementQuantity() {
|
|
58116
58134
|
setQuantity(function (prev) {
|
|
58117
|
-
return Math.max(
|
|
58135
|
+
return Math.max(min, prev - 1);
|
|
58118
58136
|
});
|
|
58119
58137
|
};
|
|
58138
|
+
var resetQuantity = function resetQuantity() {
|
|
58139
|
+
setQuantity(initialQuantity);
|
|
58140
|
+
};
|
|
58141
|
+
return {
|
|
58142
|
+
quantity: quantity,
|
|
58143
|
+
setQuantity: setQuantity,
|
|
58144
|
+
handleQuantityChange: handleQuantityChange,
|
|
58145
|
+
handleBlur: handleBlur,
|
|
58146
|
+
incrementQuantity: incrementQuantity,
|
|
58147
|
+
decrementQuantity: decrementQuantity,
|
|
58148
|
+
resetQuantity: resetQuantity
|
|
58149
|
+
};
|
|
58150
|
+
};
|
|
58151
|
+
|
|
58152
|
+
var StoreItemRow = function StoreItemRow(_ref) {
|
|
58153
|
+
var _item$requiredAccount, _item$store;
|
|
58154
|
+
var item = _ref.item,
|
|
58155
|
+
atlasJSON = _ref.atlasJSON,
|
|
58156
|
+
atlasIMG = _ref.atlasIMG,
|
|
58157
|
+
onAddToCart = _ref.onAddToCart,
|
|
58158
|
+
userAccountType = _ref.userAccountType,
|
|
58159
|
+
_ref$showTextInput = _ref.showTextInput,
|
|
58160
|
+
showTextInput = _ref$showTextInput === void 0 ? false : _ref$showTextInput,
|
|
58161
|
+
_ref$textInputPlaceho = _ref.textInputPlaceholder,
|
|
58162
|
+
textInputPlaceholder = _ref$textInputPlaceho === void 0 ? item.inputPlaceholder : _ref$textInputPlaceho;
|
|
58163
|
+
var _useState = useState(''),
|
|
58164
|
+
textInputValue = _useState[0],
|
|
58165
|
+
setTextInputValue = _useState[1];
|
|
58166
|
+
var _useQuantityControl = useQuantityControl(),
|
|
58167
|
+
quantity = _useQuantityControl.quantity,
|
|
58168
|
+
handleQuantityChange = _useQuantityControl.handleQuantityChange,
|
|
58169
|
+
handleBlur = _useQuantityControl.handleBlur,
|
|
58170
|
+
incrementQuantity = _useQuantityControl.incrementQuantity,
|
|
58171
|
+
decrementQuantity = _useQuantityControl.decrementQuantity,
|
|
58172
|
+
resetQuantity = _useQuantityControl.resetQuantity;
|
|
58120
58173
|
var hasRequiredAccount = !((_item$requiredAccount = item.requiredAccountType) != null && _item$requiredAccount.length) || item.requiredAccountType.includes(userAccountType);
|
|
58121
58174
|
var handleAddToCartInternal = function handleAddToCartInternal() {
|
|
58122
58175
|
if (!hasRequiredAccount) return;
|
|
@@ -58127,10 +58180,12 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58127
58180
|
setTextInputValue('');
|
|
58128
58181
|
} else {
|
|
58129
58182
|
onAddToCart(item, quantity);
|
|
58130
|
-
|
|
58183
|
+
resetQuantity();
|
|
58131
58184
|
}
|
|
58132
58185
|
};
|
|
58133
|
-
return React.createElement(ItemWrapper$1,
|
|
58186
|
+
return React.createElement(ItemWrapper$1, {
|
|
58187
|
+
"$isHighlighted": ((_item$store = item.store) == null ? void 0 : _item$store.isHighlighted) || false
|
|
58188
|
+
}, React.createElement(ItemIconContainer$3, null, React.createElement(SpriteFromAtlas, {
|
|
58134
58189
|
atlasJSON: atlasJSON,
|
|
58135
58190
|
atlasIMG: atlasIMG,
|
|
58136
58191
|
spriteKey: item.texturePath,
|
|
@@ -58172,7 +58227,11 @@ var StoreItemRow = function StoreItemRow(_ref) {
|
|
|
58172
58227
|
var ItemWrapper$1 = /*#__PURE__*/styled.div.withConfig({
|
|
58173
58228
|
displayName: "StoreItemRow__ItemWrapper",
|
|
58174
58229
|
componentId: "sc-ptotuo-0"
|
|
58175
|
-
})(["display:flex;align-items:center;gap:
|
|
58230
|
+
})(["display:flex;align-items:center;gap:0.75rem;padding:0.5rem 1rem;border-bottom:1px solid rgba(255,255,255,0.1);background:", ";border-left:", ";&:last-child{border-bottom:none;}"], function (props) {
|
|
58231
|
+
return props.$isHighlighted ? 'rgba(255, 215, 0, 0.1)' : 'transparent';
|
|
58232
|
+
}, function (props) {
|
|
58233
|
+
return props.$isHighlighted ? '3px solid #ffd700' : '3px solid transparent';
|
|
58234
|
+
});
|
|
58176
58235
|
var ItemIconContainer$3 = /*#__PURE__*/styled.div.withConfig({
|
|
58177
58236
|
displayName: "StoreItemRow__ItemIconContainer",
|
|
58178
58237
|
componentId: "sc-ptotuo-1"
|
|
@@ -58180,15 +58239,15 @@ var ItemIconContainer$3 = /*#__PURE__*/styled.div.withConfig({
|
|
|
58180
58239
|
var ItemDetails$2 = /*#__PURE__*/styled.div.withConfig({
|
|
58181
58240
|
displayName: "StoreItemRow__ItemDetails",
|
|
58182
58241
|
componentId: "sc-ptotuo-2"
|
|
58183
|
-
})(["flex:1;display:flex;flex-direction:column;gap:0.
|
|
58242
|
+
})(["flex:1;display:flex;flex-direction:column;gap:0.25rem;"]);
|
|
58184
58243
|
var ItemName$2 = /*#__PURE__*/styled.div.withConfig({
|
|
58185
58244
|
displayName: "StoreItemRow__ItemName",
|
|
58186
58245
|
componentId: "sc-ptotuo-3"
|
|
58187
|
-
})(["font-family:'Press Start 2P',cursive;font-size:0.
|
|
58246
|
+
})(["font-family:'Press Start 2P',cursive;font-size:0.75rem;color:#ffffff;"]);
|
|
58188
58247
|
var ItemPrice$1 = /*#__PURE__*/styled.div.withConfig({
|
|
58189
58248
|
displayName: "StoreItemRow__ItemPrice",
|
|
58190
58249
|
componentId: "sc-ptotuo-4"
|
|
58191
|
-
})(["font-family:'Press Start 2P',cursive;font-size:0.
|
|
58250
|
+
})(["font-family:'Press Start 2P',cursive;font-size:0.625rem;color:#fef08a;"]);
|
|
58192
58251
|
var ItemDescription = /*#__PURE__*/styled.div.withConfig({
|
|
58193
58252
|
displayName: "StoreItemRow__ItemDescription",
|
|
58194
58253
|
componentId: "sc-ptotuo-5"
|
|
@@ -58196,7 +58255,7 @@ var ItemDescription = /*#__PURE__*/styled.div.withConfig({
|
|
|
58196
58255
|
var Controls$1 = /*#__PURE__*/styled.div.withConfig({
|
|
58197
58256
|
displayName: "StoreItemRow__Controls",
|
|
58198
58257
|
componentId: "sc-ptotuo-6"
|
|
58199
|
-
})(["display:flex;align-items:center;gap:
|
|
58258
|
+
})(["display:flex;align-items:center;gap:0.5rem;min-width:fit-content;"]);
|
|
58200
58259
|
var ArrowsContainer = /*#__PURE__*/styled.div.withConfig({
|
|
58201
58260
|
displayName: "StoreItemRow__ArrowsContainer",
|
|
58202
58261
|
componentId: "sc-ptotuo-7"
|
|
@@ -58210,6 +58269,50 @@ var TextInput = /*#__PURE__*/styled.input.withConfig({
|
|
|
58210
58269
|
componentId: "sc-ptotuo-9"
|
|
58211
58270
|
})(["width:120px;text-align:center;margin:0 auto;font-size:0.875rem;background:rgba(0,0,0,0.2);color:#ffffff;border:none;padding:0.25rem;"]);
|
|
58212
58271
|
|
|
58272
|
+
var useStoreFiltering = function useStoreFiltering(items) {
|
|
58273
|
+
var _useState = useState(''),
|
|
58274
|
+
searchQuery = _useState[0],
|
|
58275
|
+
setSearchQuery = _useState[1];
|
|
58276
|
+
var _useState2 = useState('all'),
|
|
58277
|
+
selectedCategory = _useState2[0],
|
|
58278
|
+
setSelectedCategory = _useState2[1];
|
|
58279
|
+
var categoryOptions = useMemo(function () {
|
|
58280
|
+
var uniqueCategories = Array.from(new Set(items.map(function (item) {
|
|
58281
|
+
return item.itemType;
|
|
58282
|
+
})));
|
|
58283
|
+
var allCategories = ['all'].concat(uniqueCategories);
|
|
58284
|
+
return allCategories.map(function (category, index) {
|
|
58285
|
+
return {
|
|
58286
|
+
id: index,
|
|
58287
|
+
value: category,
|
|
58288
|
+
option: category === 'all' ? 'All' : category
|
|
58289
|
+
};
|
|
58290
|
+
});
|
|
58291
|
+
}, [items]);
|
|
58292
|
+
var filteredItems = useMemo(function () {
|
|
58293
|
+
return items.filter(function (item) {
|
|
58294
|
+
var matchesSearch = item.name.toLowerCase().includes(searchQuery.toLowerCase());
|
|
58295
|
+
var matchesCategory = selectedCategory === 'all' || item.itemType === selectedCategory;
|
|
58296
|
+
return matchesSearch && matchesCategory;
|
|
58297
|
+
}).sort(function (a, b) {
|
|
58298
|
+
var _a$store, _b$store;
|
|
58299
|
+
var aHighlighted = ((_a$store = a.store) == null ? void 0 : _a$store.isHighlighted) || false;
|
|
58300
|
+
var bHighlighted = ((_b$store = b.store) == null ? void 0 : _b$store.isHighlighted) || false;
|
|
58301
|
+
if (aHighlighted && !bHighlighted) return -1;
|
|
58302
|
+
if (!aHighlighted && bHighlighted) return 1;
|
|
58303
|
+
return 0;
|
|
58304
|
+
});
|
|
58305
|
+
}, [items, searchQuery, selectedCategory]);
|
|
58306
|
+
return {
|
|
58307
|
+
searchQuery: searchQuery,
|
|
58308
|
+
setSearchQuery: setSearchQuery,
|
|
58309
|
+
selectedCategory: selectedCategory,
|
|
58310
|
+
setSelectedCategory: setSelectedCategory,
|
|
58311
|
+
categoryOptions: categoryOptions,
|
|
58312
|
+
filteredItems: filteredItems
|
|
58313
|
+
};
|
|
58314
|
+
};
|
|
58315
|
+
|
|
58213
58316
|
var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
58214
58317
|
var items = _ref.items,
|
|
58215
58318
|
onAddToCart = _ref.onAddToCart,
|
|
@@ -58218,12 +58321,12 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
58218
58321
|
userAccountType = _ref.userAccountType,
|
|
58219
58322
|
_ref$textInputItemKey = _ref.textInputItemKeys,
|
|
58220
58323
|
textInputItemKeys = _ref$textInputItemKey === void 0 ? [] : _ref$textInputItemKey;
|
|
58221
|
-
var
|
|
58222
|
-
searchQuery =
|
|
58223
|
-
setSearchQuery =
|
|
58224
|
-
|
|
58225
|
-
|
|
58226
|
-
|
|
58324
|
+
var _useStoreFiltering = useStoreFiltering(items),
|
|
58325
|
+
searchQuery = _useStoreFiltering.searchQuery,
|
|
58326
|
+
setSearchQuery = _useStoreFiltering.setSearchQuery,
|
|
58327
|
+
setSelectedCategory = _useStoreFiltering.setSelectedCategory,
|
|
58328
|
+
categoryOptions = _useStoreFiltering.categoryOptions,
|
|
58329
|
+
filteredItems = _useStoreFiltering.filteredItems;
|
|
58227
58330
|
var renderStoreItem = function renderStoreItem(item) {
|
|
58228
58331
|
// Prefer a specialized character skin row when needed
|
|
58229
58332
|
if (item.metadataType === MetadataType.CharacterSkin) {
|
|
@@ -58258,19 +58361,40 @@ var StoreItemsSection = function StoreItemsSection(_ref) {
|
|
|
58258
58361
|
userAccountType: userAccountType || UserAccountTypes.Free
|
|
58259
58362
|
});
|
|
58260
58363
|
};
|
|
58261
|
-
return React.createElement(
|
|
58364
|
+
return React.createElement(StoreContainer, null, React.createElement(SearchHeader$1, null, React.createElement(SearchBarContainer, null, React.createElement(SearchBar, {
|
|
58365
|
+
value: searchQuery,
|
|
58366
|
+
onChange: setSearchQuery,
|
|
58367
|
+
placeholder: "Search items..."
|
|
58368
|
+
})), React.createElement(DropdownContainer$1, null, React.createElement(Dropdown, {
|
|
58369
|
+
options: categoryOptions,
|
|
58370
|
+
onChange: function onChange(value) {
|
|
58371
|
+
return setSelectedCategory(value);
|
|
58372
|
+
},
|
|
58373
|
+
width: "100%"
|
|
58374
|
+
}))), React.createElement(ScrollableContent, {
|
|
58262
58375
|
items: filteredItems,
|
|
58263
58376
|
renderItem: renderStoreItem,
|
|
58264
|
-
emptyMessage: "No items
|
|
58265
|
-
searchOptions: {
|
|
58266
|
-
value: searchQuery,
|
|
58267
|
-
onChange: setSearchQuery,
|
|
58268
|
-
placeholder: 'Search items...'
|
|
58269
|
-
},
|
|
58377
|
+
emptyMessage: "No items match your filters.",
|
|
58270
58378
|
layout: "list",
|
|
58271
|
-
maxHeight: "
|
|
58272
|
-
});
|
|
58379
|
+
maxHeight: "350px"
|
|
58380
|
+
}));
|
|
58273
58381
|
};
|
|
58382
|
+
var StoreContainer = /*#__PURE__*/styled.div.withConfig({
|
|
58383
|
+
displayName: "StoreItemsSection__StoreContainer",
|
|
58384
|
+
componentId: "sc-l6f466-0"
|
|
58385
|
+
})(["display:flex;flex-direction:column;height:100%;gap:0.5rem;"]);
|
|
58386
|
+
var SearchHeader$1 = /*#__PURE__*/styled.div.withConfig({
|
|
58387
|
+
displayName: "StoreItemsSection__SearchHeader",
|
|
58388
|
+
componentId: "sc-l6f466-1"
|
|
58389
|
+
})(["display:flex;gap:0.5rem;align-items:center;padding-top:0.25rem;"]);
|
|
58390
|
+
var SearchBarContainer = /*#__PURE__*/styled.div.withConfig({
|
|
58391
|
+
displayName: "StoreItemsSection__SearchBarContainer",
|
|
58392
|
+
componentId: "sc-l6f466-2"
|
|
58393
|
+
})(["flex:0.75;"]);
|
|
58394
|
+
var DropdownContainer$1 = /*#__PURE__*/styled.div.withConfig({
|
|
58395
|
+
displayName: "StoreItemsSection__DropdownContainer",
|
|
58396
|
+
componentId: "sc-l6f466-3"
|
|
58397
|
+
})(["flex:0.25;min-width:140px;"]);
|
|
58274
58398
|
|
|
58275
58399
|
var ShoppingCardHorizontal = function ShoppingCardHorizontal(_ref) {
|
|
58276
58400
|
var title = _ref.title,
|
|
@@ -58335,13 +58459,30 @@ var CardFooter = /*#__PURE__*/styled.div.withConfig({
|
|
|
58335
58459
|
componentId: "sc-ngkh06-6"
|
|
58336
58460
|
})(["margin-top:auto;padding-top:8px;border-top:1px solid rgba(255,255,255,0.1);"]);
|
|
58337
58461
|
|
|
58462
|
+
var usePackFiltering = function usePackFiltering(packs) {
|
|
58463
|
+
var _useState = useState(''),
|
|
58464
|
+
searchQuery = _useState[0],
|
|
58465
|
+
setSearchQuery = _useState[1];
|
|
58466
|
+
var filteredPacks = useMemo(function () {
|
|
58467
|
+
return packs.filter(function (pack) {
|
|
58468
|
+
return pack.title.toLowerCase().includes(searchQuery.toLowerCase());
|
|
58469
|
+
});
|
|
58470
|
+
}, [packs, searchQuery]);
|
|
58471
|
+
return {
|
|
58472
|
+
searchQuery: searchQuery,
|
|
58473
|
+
setSearchQuery: setSearchQuery,
|
|
58474
|
+
filteredPacks: filteredPacks
|
|
58475
|
+
};
|
|
58476
|
+
};
|
|
58477
|
+
|
|
58338
58478
|
var StorePacksSection = function StorePacksSection(_ref) {
|
|
58339
58479
|
var packs = _ref.packs,
|
|
58340
58480
|
onAddToCart = _ref.onAddToCart,
|
|
58341
58481
|
onSelectPack = _ref.onSelectPack;
|
|
58342
|
-
var
|
|
58343
|
-
searchQuery =
|
|
58344
|
-
setSearchQuery =
|
|
58482
|
+
var _usePackFiltering = usePackFiltering(packs),
|
|
58483
|
+
searchQuery = _usePackFiltering.searchQuery,
|
|
58484
|
+
setSearchQuery = _usePackFiltering.setSearchQuery,
|
|
58485
|
+
filteredPacks = _usePackFiltering.filteredPacks;
|
|
58345
58486
|
var renderPackFooter = useCallback(function (pack) {
|
|
58346
58487
|
return React.createElement(FooterContainer, null, React.createElement(Price, null, "$", pack.priceUSD), React.createElement(CTAButton, {
|
|
58347
58488
|
icon: React.createElement(FaCartPlus, null),
|
|
@@ -58364,11 +58505,6 @@ var StorePacksSection = function StorePacksSection(_ref) {
|
|
|
58364
58505
|
}
|
|
58365
58506
|
});
|
|
58366
58507
|
}, [onSelectPack, renderPackFooter]);
|
|
58367
|
-
var filteredPacks = useMemo(function () {
|
|
58368
|
-
return packs.filter(function (pack) {
|
|
58369
|
-
return pack.title.toLowerCase().includes(searchQuery.toLowerCase());
|
|
58370
|
-
});
|
|
58371
|
-
}, [packs, searchQuery]);
|
|
58372
58508
|
return React.createElement(ScrollableContent, {
|
|
58373
58509
|
items: filteredPacks,
|
|
58374
58510
|
renderItem: renderPack,
|