mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
start upgrading eslint
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import compactArray from 'lodash/compact';
|
||||
import getItemInfo from './getItemInfo';
|
||||
import shops from './shops';
|
||||
import getOfficialPinnedItems from './getOfficialPinnedItems';
|
||||
import compactArray from 'lodash/compact';
|
||||
|
||||
import getItemByPathAndType from './getItemByPathAndType';
|
||||
import {checkPinnedAreasForNullEntries} from '../ops/pinnedGearUtils';
|
||||
import { checkPinnedAreasForNullEntries } from '../ops/pinnedGearUtils';
|
||||
|
||||
/**
|
||||
* Orders the pinned items so we always get our inAppRewards in the order
|
||||
@@ -15,12 +15,12 @@ import {checkPinnedAreasForNullEntries} from '../ops/pinnedGearUtils';
|
||||
* @return items of ordered inAppRewards
|
||||
*/
|
||||
function sortInAppRewards (user, items) {
|
||||
let pinnedItemsOrder = user.pinnedItemsOrder;
|
||||
const { pinnedItemsOrder } = user;
|
||||
let orderedItems = [];
|
||||
let unorderedItems = []; // what we want to add later
|
||||
const unorderedItems = []; // what we want to add later
|
||||
|
||||
items.forEach((item, index) => {
|
||||
let i = pinnedItemsOrder[index] === item.path ? index : pinnedItemsOrder.indexOf(item.path);
|
||||
const i = pinnedItemsOrder[index] === item.path ? index : pinnedItemsOrder.indexOf(item.path);
|
||||
if (i === -1) {
|
||||
unorderedItems.push(item);
|
||||
} else {
|
||||
@@ -35,7 +35,7 @@ function sortInAppRewards (user, items) {
|
||||
export default function getPinnedItems (user) {
|
||||
checkPinnedAreasForNullEntries(user);
|
||||
|
||||
let officialPinnedItems = getOfficialPinnedItems(user);
|
||||
const officialPinnedItems = getOfficialPinnedItems(user);
|
||||
|
||||
const officialPinnedItemsNotUnpinned = officialPinnedItems.filter(officialPin => {
|
||||
const isUnpinned = user.unpinnedItems.findIndex(unpinned => unpinned.path === officialPin.path) > -1;
|
||||
@@ -44,15 +44,15 @@ export default function getPinnedItems (user) {
|
||||
|
||||
const pinnedItems = officialPinnedItemsNotUnpinned.concat(user.pinnedItems);
|
||||
|
||||
let items = pinnedItems
|
||||
.map(({type, path}) => {
|
||||
let item = getItemByPathAndType(type, path);
|
||||
const items = pinnedItems
|
||||
.map(({ type, path }) => {
|
||||
const item = getItemByPathAndType(type, path);
|
||||
|
||||
return getItemInfo(user, type, item, officialPinnedItems);
|
||||
});
|
||||
|
||||
shops.checkMarketGearLocked(user, items);
|
||||
|
||||
let orderedItems = sortInAppRewards(user, items);
|
||||
const orderedItems = sortInAppRewards(user, items);
|
||||
return orderedItems;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user