Files
habitica/website/common/script/libs/inAppRewards.js
negue c56c69d464 market fixes 28th nov (#9593)
* list special gear by the `specialClass` - fixes #9485

* only disable the currencly label + value not the amount input - fixes #9492

* disable transformations on equipment previews - fixes #9497

* show boss strength - fixes #9522

* pin time travelers animals - closes #9382

* clean up + package-lock ?

* fix quest info
2017-12-05 14:09:34 -06:00

27 lines
839 B
JavaScript

import getItemInfo from './getItemInfo';
import shops from './shops';
import getOfficialPinnedItems from './getOfficialPinnedItems';
import getItemByPathAndType from './getItemByPathAndType';
module.exports = function getPinnedItems (user) {
let officialPinnedItems = getOfficialPinnedItems(user);
const officialPinnedItemsNotUnpinned = officialPinnedItems.filter(officialPin => {
const isUnpinned = user.unpinnedItems.findIndex(unpinned => unpinned.path === officialPin.path) > -1;
return !isUnpinned;
});
const pinnedItems = officialPinnedItemsNotUnpinned.concat(user.pinnedItems);
let items = pinnedItems.map(({type, path}) => {
let item = getItemByPathAndType(type, path);
return getItemInfo(user, type, item, officialPinnedItems);
});
shops.checkMarketGearLocked(user, items);
return items;
};