Files
habitica/website/common/script/libs/shops-seasonal.config.js
2021-03-23 11:58:21 -05:00

54 lines
1.2 KiB
JavaScript

import find from 'lodash/find';
import upperFirst from 'lodash/upperFirst';
import moment from 'moment';
import {
EVENTS,
SEASONAL_SETS,
} from '../content/constants';
const CURRENT_EVENT = find(
EVENTS, event => moment().isBetween(event.start, event.end) && Boolean(event.season),
);
const SHOP_OPEN = CURRENT_EVENT && ['winter', 'spring', 'summer', 'fall'].includes(CURRENT_EVENT.season);
export default {
opened: SHOP_OPEN,
currentSeason: SHOP_OPEN ? upperFirst(CURRENT_EVENT.season) : 'Closed',
dateRange: {
start: moment(CURRENT_EVENT.start).format('YYYY-MM-DD'),
end: moment(CURRENT_EVENT.end).format('YYYY-MM-DD'),
},
availableSets: SHOP_OPEN
? [
...SEASONAL_SETS[CURRENT_EVENT.season],
]
: [],
pinnedSets: SHOP_OPEN
? {
healer: 'spring2021WillowHealerSet',
rogue: 'spring2021TwinFlowerRogueSet',
warrior: 'spring2021SunstoneWarriorSet',
wizard: 'spring2021SwanMageSet',
}
: {},
availableSpells: moment().isBetween('2021-04-06T08:00-05:00', '2021-04-30T20:00-05:00')
? [
'shinySeed',
]
: [],
availableQuests: SHOP_OPEN && moment().isAfter('2021-03-30T08:00-05:00')
? [
'egg',
]
: [],
featuredSet: 'spring2020PuddleMageSet',
};