Merge branch 'sabrecat/cshop' into subs-private

This commit is contained in:
Sabe Jones
2024-04-23 10:52:05 -05:00
5 changed files with 18 additions and 9 deletions

View File

@@ -35,13 +35,9 @@
/> />
</a> </a>
<a <a
class="topbar-dropdown-item dropdown-item" class="topbar-dropdown-item dropdown-item dropdown-separated"
@click="showAvatar('body', 'size')" @click="showAvatar('body', 'size')"
>{{ $t('editAvatar') }}</a> >{{ $t('editAvatar') }}</a>
<a
class="topbar-dropdown-item dropdown-item dropdown-separated"
@click="showAvatar('backgrounds', '2024')"
>{{ $t('backgrounds') }}</a>
<a <a
class="topbar-dropdown-item dropdown-item" class="topbar-dropdown-item dropdown-item"
@click="showProfile('profile')" @click="showProfile('profile')"

View File

@@ -132,7 +132,7 @@ export default {
}, },
methods: { methods: {
getKeyProp (item) { getKeyProp (item) {
return this.keyProp ? item[this.keyProp] : item; return this.keyProp ? item[this.keyProp] : item.key;
}, },
isDisabled (item) { isDisabled (item) {
return typeof item[this.disabledProp] === 'undefined' ? false : item[this.disabledProp]; return typeof item[this.disabledProp] === 'undefined' ? false : item[this.disabledProp];

View File

@@ -24,7 +24,7 @@ function inListMatcher (list) {
}; };
} }
const ALWAYS_AVAILABLE_CUSTOMIZATIONS = [ export const ALWAYS_AVAILABLE_CUSTOMIZATIONS = [
'animalSkins', 'animalSkins',
'rainbowSkins', 'rainbowSkins',
'rainbowHairColors', 'rainbowHairColors',
@@ -843,16 +843,23 @@ export function getScheduleMatchingGroup (type, date) {
const checkedDate = date || new Date(); const checkedDate = date || new Date();
if (cacheDate !== null && (getDay(checkedDate) !== getDay(cacheDate) if (cacheDate !== null && (getDay(checkedDate) !== getDay(cacheDate)
|| getMonth(checkedDate) !== getMonth(cacheDate))) { || getMonth(checkedDate) !== getMonth(cacheDate))) {
// Clear cached matchers, since they are old
cacheDate = null; cacheDate = null;
cachedScheduleMatchers = null; cachedScheduleMatchers = null;
} }
if (!cachedScheduleMatchers) { if (!cachedScheduleMatchers) {
// No matchers exist, make new ones
cacheDate = new Date(); cacheDate = new Date();
cachedScheduleMatchers = {}; cachedScheduleMatchers = {};
assembleScheduledMatchers(checkedDate).forEach(matcher => { assembleScheduledMatchers(checkedDate).forEach(matcher => {
if (!cachedScheduleMatchers[matcher.type]) { if (!cachedScheduleMatchers[matcher.type]) {
cachedScheduleMatchers[matcher.type] = makeMatcherClass(); cachedScheduleMatchers[matcher.type] = makeMatcherClass();
} }
let end = moment(checkedDate);
end.date(TYPE_SCHEDULE[type]);
if (end.date() <= moment(checkedDate).date()) {
end = moment(end).add(1, 'months');
}
cachedScheduleMatchers[matcher.type].end = end.toDate(); cachedScheduleMatchers[matcher.type].end = end.toDate();
if (matcher.matcher instanceof Function) { if (matcher.matcher instanceof Function) {
cachedScheduleMatchers[matcher.type].matchers.push(matcher.matcher); cachedScheduleMatchers[matcher.type].matchers.push(matcher.matcher);
@@ -862,6 +869,7 @@ export function getScheduleMatchingGroup (type, date) {
}); });
} }
if (!cachedScheduleMatchers[type]) { if (!cachedScheduleMatchers[type]) {
// No matchers exist for this type
return { return {
items: [], items: [],
match () { match () {

View File

@@ -8,6 +8,8 @@ import isPinned from './isPinned';
import isFreeRebirth from './isFreeRebirth'; import isFreeRebirth from './isFreeRebirth';
import getOfficialPinnedItems from './getOfficialPinnedItems'; import getOfficialPinnedItems from './getOfficialPinnedItems';
import { ALWAYS_AVAILABLE_CUSTOMIZATIONS } from '../content/constants/schedule';
function lockQuest (quest, user) { function lockQuest (quest, user) {
// checks series quests, including Masterclasser // checks series quests, including Masterclasser
if (quest.prereqQuests) { if (quest.prereqQuests) {
@@ -490,8 +492,8 @@ export default function getItemInfo (user, type, item, officialPinnedItems, lang
throw new BadRequest(i18n.t('wrongItemType', { type }, language)); throw new BadRequest(i18n.t('wrongItemType', { type }, language));
} }
if (matcher) { if (matcher && (!itemInfo.set || ALWAYS_AVAILABLE_CUSTOMIZATIONS.indexOf(itemInfo.set.key) === -1)) {
itemInfo.end = { matcher }; itemInfo.end = matcher.end;
} }
return itemInfo; return itemInfo;

View File

@@ -582,6 +582,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
bg, bg,
officialPinnedItems, officialPinnedItems,
language, language,
matchers,
); );
backgroundCategory.items.push(item); backgroundCategory.items.push(item);
} }
@@ -617,6 +618,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
hairStyle, hairStyle,
officialPinnedItems, officialPinnedItems,
language, language,
hairType === 'color' ? customizationMatcher : null,
); );
category.items.push(item); category.items.push(item);
} }
@@ -642,6 +644,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
appearance, appearance,
officialPinnedItems, officialPinnedItems,
language, language,
type === 'skin' ? customizationMatcher : null,
); );
category.items.push(item); category.items.push(item);
} }