mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
WIP(shop): more CSS, add hair styles
This commit is contained in:
@@ -217,9 +217,7 @@
|
|||||||
|
|
||||||
.btn-show-more {
|
.btn-show-more {
|
||||||
display: block;
|
display: block;
|
||||||
width: 50%;
|
width: 100%;
|
||||||
max-width: 448px;
|
|
||||||
margin: 0 auto;
|
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|||||||
@@ -87,6 +87,14 @@
|
|||||||
height: 216px;
|
height: 216px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-rows {
|
||||||
|
max-width: 920px;
|
||||||
|
|
||||||
|
.items > div:nth-of-type(8n) {
|
||||||
|
margin-right: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.npc {
|
.npc {
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,6 +388,33 @@ export default function getItemInfo (user, type, item, officialPinnedItems, lang
|
|||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'hairBase': {
|
||||||
|
itemInfo = {
|
||||||
|
key: `hair-base-${item.key}`,
|
||||||
|
class: `hair hair_base_${item.key}_${user.preferences.hair.color}`,
|
||||||
|
value: item.price,
|
||||||
|
currency: 'gems',
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'mustache': {
|
||||||
|
itemInfo = {
|
||||||
|
key: `mustache-${item.key}`,
|
||||||
|
class: `hair hair_mustache_${item.key}_${user.preferences.hair.color}`,
|
||||||
|
value: item.price,
|
||||||
|
currency: 'gems',
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'beard': {
|
||||||
|
itemInfo = {
|
||||||
|
key: `beard-${item.key}`,
|
||||||
|
class: `hair hair_beard_${item.key}_${user.preferences.hair.color}`,
|
||||||
|
value: item.price,
|
||||||
|
currency: 'gems',
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemInfo) {
|
if (itemInfo) {
|
||||||
|
|||||||
@@ -573,7 +573,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
|||||||
return moment().isBetween(color.set.availableFrom, color.set.availableUntil);
|
return moment().isBetween(color.set.availableFrom, color.set.availableUntil);
|
||||||
}
|
}
|
||||||
if (color.set.availableUntil) {
|
if (color.set.availableUntil) {
|
||||||
return moment().isBefore(color.set.availableTo);
|
return moment().isBefore(color.set.availableUntil);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -585,10 +585,71 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
|||||||
const hairStylesCategory = {
|
const hairStylesCategory = {
|
||||||
identifier: 'hairStyles',
|
identifier: 'hairStyles',
|
||||||
text: i18n.t('hairStyles', language),
|
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);
|
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 = {
|
const skinsCategory = {
|
||||||
identifier: 'skins',
|
identifier: 'skins',
|
||||||
text: i18n.t('skins', language),
|
text: i18n.t('skins', language),
|
||||||
@@ -617,13 +678,6 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
|||||||
};
|
};
|
||||||
categories.push(shirtsCategory);
|
categories.push(shirtsCategory);
|
||||||
|
|
||||||
const facialHairCategory = {
|
|
||||||
identifier: 'facialHair',
|
|
||||||
text: i18n.t('facialHairs', language),
|
|
||||||
items: [],
|
|
||||||
};
|
|
||||||
categories.push(facialHairCategory);
|
|
||||||
|
|
||||||
return categories;
|
return categories;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user