WIP(shop): more CSS, add hair styles

This commit is contained in:
Sabe Jones
2024-02-22 17:03:07 -06:00
parent 1f8aa7d778
commit 33b54a734e
4 changed files with 99 additions and 12 deletions

View File

@@ -573,7 +573,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
return moment().isBetween(color.set.availableFrom, color.set.availableUntil);
}
if (color.set.availableUntil) {
return moment().isBefore(color.set.availableTo);
return moment().isBefore(color.set.availableUntil);
}
return true;
}
@@ -585,10 +585,71 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
const hairStylesCategory = {
identifier: 'hairStyles',
text: i18n.t('hairStyles', language),
items: [],
};
hairStylesCategory.items = values(content.appearances.hair.base)
.filter(style => {
const { hair } = user.purchased;
if (hair && hair.base && hair.base[style.key]) {
return false;
}
if (style.set) {
if (style.set.availableFrom) {
return moment().isBetween(style.set.availableFrom, style.set.availableUntil);
}
if (style.set.availableUntil) {
return moment().isBefore(style.set.availableUntil);
}
return true;
}
return false;
})
.map(style => getItemInfo(user, 'hairBase', style, officialPinnedItems, language));
categories.push(hairStylesCategory);
const facialHairCategory = {
identifier: 'facialHair',
text: i18n.t('facialHairs', language),
};
facialHairCategory.items = values(content.appearances.hair.mustache)
.filter(style => {
const { hair } = user.purchased;
if (hair && hair.mustache && hair.mustache[style.key]) {
return false;
}
if (style.set) {
if (style.set.availableFrom) {
return moment().isBetween(style.set.availableFrom, style.set.availableUntil);
}
if (style.set.availableUntil) {
return moment().isBefore(style.set.availableUntil);
}
return true;
}
return false;
})
.map(style => getItemInfo(user, 'mustache', style, officialPinnedItems, language))
.concat(
values(content.appearances.hair.beard)
.filter(style => {
const { hair } = user.purchased;
if (hair && hair.beard && hair.beard[style.key]) {
return false;
}
if (style.set) {
if (style.set.availableFrom) {
return moment().isBetween(style.set.availableFrom, style.set.availableUntil);
}
if (style.set.availableUntil) {
return moment().isBefore(style.set.availableUntil);
}
return true;
}
return false;
})
.map(style => getItemInfo(user, 'beard', style, officialPinnedItems, language)),
);
categories.push(facialHairCategory);
const skinsCategory = {
identifier: 'skins',
text: i18n.t('skins', language),
@@ -617,13 +678,6 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
};
categories.push(shirtsCategory);
const facialHairCategory = {
identifier: 'facialHair',
text: i18n.t('facialHairs', language),
items: [],
};
categories.push(facialHairCategory);
return categories;
};