feat(content): magic options

This commit is contained in:
Sabe Jones
2021-05-11 16:07:44 -05:00
parent 8a118c562b
commit 719b4ca3ea
3 changed files with 21 additions and 6 deletions

View File

@@ -10,11 +10,17 @@ const gemsPromo = {
export const EVENTS = { export const EVENTS = {
noCurrentEvent2021: { noCurrentEvent2021: {
start: '2021-04-30T20:00-05:00', start: '2021-05-31T20:00-05:00',
end: '2021-08-23T08:00-05:00', end: '2021-08-23T08:00-05:00',
season: 'normal', season: 'normal',
npcImageSuffix: '', npcImageSuffix: '',
}, },
potions202105: {
start: '2021-05-11T08:00-05:00',
end: '2021-05-31T20:00-05:00',
season: 'normal',
npcImageSuffix: '',
},
spring2021: { spring2021: {
start: '2021-03-23T08:00-05:00', start: '2021-03-23T08:00-05:00',
end: '2021-04-30T20:00-05:00', end: '2021-04-30T20:00-05:00',

View File

@@ -86,18 +86,27 @@ const premium = {
value: 2, value: 2,
text: t('hatchingPotionFairy'), text: t('hatchingPotionFairy'),
limited: true, limited: true,
event: EVENTS.potions202105,
_addlNotes: t('eventAvailabilityReturning', { _addlNotes: t('eventAvailabilityReturning', {
availableDate: t('dateEndMay'), availableDate: t('dateEndMay'),
previousDate: t('mayYYYY', { year: 2017 }), previousDate: t('mayYYYY', { year: 2020 }),
}), }),
canBuy () { canBuy () {
return moment().isBefore('2020-06-02'); return moment().isBefore(EVENTS.potions202105.end);
}, },
}, },
Floral: { Floral: {
value: 2, value: 2,
text: t('hatchingPotionFloral'), text: t('hatchingPotionFloral'),
limited: true, limited: true,
event: EVENTS.potions202105,
_addlNotes: t('eventAvailabilityReturning', {
availableDate: t('dateEndMay'),
previousDate: t('mayYYYY', { year: 2016 }),
}),
canBuy () {
return moment().isBefore(EVENTS.potions202105.end);
},
}, },
Aquatic: { Aquatic: {
value: 2, value: 2,

View File

@@ -7,7 +7,7 @@ import {
} from '../content/constants'; } from '../content/constants';
const CURRENT_EVENT = find( const CURRENT_EVENT = find(
EVENTS, event => moment().isBetween(event.start, event.end) && Boolean(event.season), EVENTS, event => moment().isBetween(event.start, event.end),
); );
const SHOP_OPEN = CURRENT_EVENT && ['winter', 'spring', 'summer', 'fall'].includes(CURRENT_EVENT.season); const SHOP_OPEN = CURRENT_EVENT && ['winter', 'spring', 'summer', 'fall'].includes(CURRENT_EVENT.season);
@@ -18,8 +18,8 @@ export default {
currentSeason: SHOP_OPEN ? upperFirst(CURRENT_EVENT.season) : 'Closed', currentSeason: SHOP_OPEN ? upperFirst(CURRENT_EVENT.season) : 'Closed',
dateRange: { dateRange: {
start: SHOP_OPEN ? moment(CURRENT_EVENT.start) : moment().subtract(1, 'days').toDate(), start: CURRENT_EVENT ? moment(CURRENT_EVENT.start) : moment().subtract(1, 'days').toDate(),
end: SHOP_OPEN ? moment(CURRENT_EVENT.end) : moment().subtract(1, 'seconds').toDate(), end: CURRENT_EVENT ? moment(CURRENT_EVENT.end) : moment().subtract(1, 'seconds').toDate(),
}, },
availableSets: SHOP_OPEN availableSets: SHOP_OPEN