habitica/website/common/script/libs/achievements.js

358 lines
11 KiB
JavaScript
Raw Normal View History

2019-10-08 14:57:10 +00:00
import get from 'lodash/get';
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
import content from '../content/index';
import i18n from '../i18n';
2019-10-08 14:57:10 +00:00
const achievs = {};
const achievsContent = content.achievements;
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
let index = 0;
function contribText (contrib, backer, language) {
2019-10-09 14:51:17 +00:00
if (!contrib && !backer) return null;
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
if (backer && backer.npc) return backer.npc;
2019-10-09 14:51:17 +00:00
2019-10-08 14:57:10 +00:00
const lvl = contrib && contrib.level;
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
if (lvl && lvl > 0) {
let contribTitle = '';
if (lvl < 3) {
contribTitle = i18n.t('friend', language);
} else if (lvl < 5) {
contribTitle = i18n.t('elite', language);
} else if (lvl < 7) {
contribTitle = i18n.t('champion', language);
} else if (lvl < 8) {
contribTitle = i18n.t('legendary', language);
} else if (lvl < 9) {
contribTitle = i18n.t('guardian', language);
} else {
contribTitle = i18n.t('heroic', language);
}
return `${contribTitle} ${contrib.text}`;
}
2019-10-09 14:51:17 +00:00
return null;
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
}
function _add (result, data) {
result[data.key] = {
title: data.title,
text: data.text,
icon: data.icon,
earned: data.earned,
value: data.value,
2019-10-09 14:51:17 +00:00
index: index += 1,
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
optionalCount: data.optionalCount,
};
}
function _addSimpleWithCustomPath (result, user, data) {
2019-10-08 14:57:10 +00:00
const value = get(user, data.path);
const thisContent = achievsContent[data.key];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
_add(result, {
2019-10-08 14:57:10 +00:00
title: i18n.t(thisContent.titleKey, { key: value }, data.language),
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
text: i18n.t(thisContent.textKey, data.language),
icon: thisContent.icon,
key: data.key,
value,
earned: Boolean(value),
});
}
function _addQuest (result, user, data) {
data.key = `${data.path}Quest`;
data.path = `achievements.quests.${data.path}`;
_addSimpleWithCustomPath(result, user, data);
}
function _addSimple (result, user, data) {
2019-10-08 14:57:10 +00:00
const value = user.achievements[data.path];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
const key = data.key || data.path;
const thisContent = achievsContent[key];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
_add(result, {
title: i18n.t(thisContent.titleKey, data.language),
text: i18n.t(thisContent.textKey, data.language),
icon: thisContent.icon,
key,
value,
earned: Boolean(value),
});
}
function _addSimpleWithMasterCount (result, user, data) {
2019-10-08 14:57:10 +00:00
const { language } = data;
const value = user.achievements[`${data.path}Count`] || 0;
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
const thisContent = achievsContent[data.path];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
let text = i18n.t(thisContent.textKey, language);
if (value > 0) {
2019-10-08 14:57:10 +00:00
text += i18n.t(thisContent.text2Key, { count: value }, language);
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
}
_add(result, {
title: i18n.t(thisContent.titleKey, language),
text,
icon: thisContent.icon,
key: data.path,
value,
optionalCount: value,
earned: user.achievements[data.path] || false,
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
});
}
function _addSimpleWithCount (result, user, data) {
2019-10-08 14:57:10 +00:00
const value = user.achievements[data.path] || 0;
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
const key = data.key || data.path;
const thisContent = achievsContent[key];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
_add(result, {
title: i18n.t(thisContent.titleKey, data.language),
2019-10-08 14:57:10 +00:00
text: i18n.t(thisContent.textKey, { count: value }, data.language),
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
icon: thisContent.icon,
key,
value,
optionalCount: value,
earned: Boolean(value),
});
}
function _addPlural (result, user, data) {
2019-10-08 14:57:10 +00:00
const value = user.achievements[data.path] || 0;
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
const key = data.key || data.path;
const thisContent = achievsContent[key];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
let titleKey;
let textKey;
// If value === 1, use singular versions of strings.
// If value !== 1, use plural versions of strings.
if (value === 1) {
titleKey = thisContent.singularTitleKey;
textKey = thisContent.singularTextKey;
} else {
titleKey = thisContent.pluralTitleKey;
textKey = thisContent.pluralTextKey;
}
_add(result, {
2019-10-08 14:57:10 +00:00
title: i18n.t(titleKey, { count: value }, data.language),
text: i18n.t(textKey, { count: value }, data.language),
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
icon: thisContent.icon,
key,
value,
optionalCount: value,
earned: Boolean(value),
});
}
function _addUltimateGear (result, user, data) {
if (!data.altPath) {
data.altPath = data.path;
}
2019-10-08 14:57:10 +00:00
const value = user.achievements.ultimateGearSets[data.altPath];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
const key = `${data.path}UltimateGear`;
const thisContent = achievsContent[key];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
const localizedClass = i18n.t(data.path, data.language);
const title = i18n.t(thisContent.titleKey, { ultClass: localizedClass }, data.language);
const text = i18n.t(thisContent.textKey, { ultClass: localizedClass }, data.language);
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
_add(result, {
title,
text,
icon: thisContent.icon,
key,
value,
earned: Boolean(value),
});
}
function _getBasicAchievements (user, language) {
2019-10-08 14:57:10 +00:00
const result = {};
_addPlural(result, user, { path: 'streak', language });
_addPlural(result, user, { path: 'perfect', language });
_addSimple(result, user, { path: 'partyUp', language });
_addSimple(result, user, { path: 'partyOn', language });
_addSimple(result, user, { path: 'joinedGuild', language });
_addSimple(result, user, { path: 'royallyLoyal', language });
_addSimple(result, user, { path: 'joinedChallenge', language });
_addSimple(result, user, { path: 'invitedFriend', language });
_addSimple(result, user, { path: 'lostMasterclasser', language });
_addSimple(result, user, { path: 'mindOverMatter', language });
_addSimple(result, user, { path: 'justAddWater', language });
_addSimple(result, user, { path: 'backToBasics', language });
_addSimple(result, user, { path: 'allYourBase', language });
_addSimple(result, user, { path: 'dustDevil', language });
_addSimple(result, user, { path: 'aridAuthority', language });
_addSimple(result, user, { path: 'monsterMagus', language });
_addSimple(result, user, { path: 'undeadUndertaker', language });
2019-12-10 20:41:39 +00:00
_addSimple(result, user, { path: 'primedForPainting', language });
_addSimple(result, user, { path: 'pearlyPro', language });
_addSimple(result, user, { path: 'tickledPink', language });
_addSimple(result, user, { path: 'rosyOutlook', language });
2020-03-17 14:11:41 +00:00
_addSimple(result, user, { path: 'bugBonanza', language });
_addSimpleWithMasterCount(result, user, { path: 'beastMaster', language });
_addSimpleWithMasterCount(result, user, { path: 'mountMaster', language });
_addSimpleWithMasterCount(result, user, { path: 'triadBingo', language });
_addUltimateGear(result, user, { path: 'healer', language });
_addUltimateGear(result, user, { path: 'rogue', language });
_addUltimateGear(result, user, { path: 'warrior', language });
_addUltimateGear(result, user, { path: 'mage', altPath: 'wizard', language });
const cardAchievements = ['greeting', 'thankyou', 'birthday', 'congrats', 'getwell', 'goodluck'];
cardAchievements.forEach(path => {
2019-10-08 14:57:10 +00:00
_addSimpleWithCount(result, user, { path, key: `${path}Cards`, language });
});
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
let rebirthTitle;
let rebirthText;
if (user.achievements.rebirths > 1) {
2019-10-08 14:57:10 +00:00
rebirthTitle = i18n.t('rebirthText', { rebirths: user.achievements.rebirths }, language);
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
} else {
rebirthTitle = i18n.t('rebirthBegan', language);
}
if (!user.achievements.rebirthLevel) {
rebirthText = i18n.t('rebirthOrbNoLevel', language);
} else if (user.achievements.rebirthLevel < 100) {
2019-10-08 14:57:10 +00:00
rebirthText = i18n.t('rebirthOrb', { level: user.achievements.rebirthLevel }, language);
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
} else {
rebirthText = i18n.t('rebirthOrb100', language);
}
_add(result, {
key: 'rebirth',
title: rebirthTitle,
text: rebirthText,
icon: 'achievement-sun',
earned: Boolean(user.achievements.rebirths),
2016-12-15 17:49:15 +00:00
optionalCount: user.achievements.rebirths,
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
});
return result;
}
Onboarding guide and initial achievements refactoring (#11536) * add achievements to user * add placeholder strings * add to achievements to common script * add onboarding achievements category * add notifications * more notifications * award achievements * wip notification panel * add achievements icons and copy * do not count onboarding tasks for the created task achievement * add notes * sprites, fixes and completion status and reward * add onboarding panel * add toggle * fix toggle size * fix tests * fix typo * add notification * start adding modal * fix remove button positionin, timeout, progress bar * modal + fixes * disable broken social links from level up modal * change toggle icon color on hover * add border bottom to onboarding guide panel * add collapse animation * expanded onboarding on first open * onboarding: flip toggle colors * onboarding: show progress bar all the time * onboarding: fix panel closing on click * onboarding modal: add close icon and fix padding * wip: add migration for existing users * fix titles in guide * fix achievements copy * do not award completed task achievement when direction is down * start implementing new achievements * start migrating client * remove social links from achievements modals * prevent skipping tutorial + fix achievement notification * sync fixes * start redesign achievement modal * misc fixes to achievements, polish generic achievement modal and hatched pet modal * add special badge for onboarding * fix badge condition * modals fixes * hatched pet modal: add close icon * fix badge typo * fix justin button * new scrolling behavior for dropdowns * fix strings capitalization * add common tests * add api unit tests * add date check * achievements modal polishing * typos * add toggle for achievements categories * typo * fix test * fix edit avatar modal cannot be closed * finish migration and correct launch date * fix migration * migration fixes * fix tests
2019-12-16 16:20:47 +00:00
function _getOnboardingAchievements (user, language) {
const result = {};
_addSimple(result, user, { path: 'createdTask', language });
_addSimple(result, user, { path: 'completedTask', language });
_addSimple(result, user, { path: 'hatchedPet', language });
_addSimple(result, user, { path: 'fedPet', language });
_addSimple(result, user, { path: 'purchasedEquipment', language });
return result;
}
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
function _getSeasonalAchievements (user, language) {
2019-10-08 14:57:10 +00:00
const result = {};
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
_addPlural(result, user, { path: 'habiticaDays', language });
_addPlural(result, user, { path: 'habitBirthdays', language });
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
const spellAchievements = ['snowball', 'spookySparkles', 'shinySeed', 'seafoam'];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
spellAchievements.forEach(path => {
2019-10-08 14:57:10 +00:00
_addSimpleWithCount(result, user, { path, language });
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
});
2019-10-08 14:57:10 +00:00
const questAchievements = ['dilatory', 'stressbeast', 'burnout', 'bewilder', 'dysheartener'];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
questAchievements.forEach(path => {
if (user.achievements.quests[path]) {
2019-10-08 14:57:10 +00:00
_addQuest(result, user, { path, language });
}
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
});
2019-10-08 14:57:10 +00:00
_addPlural(result, user, { path: 'costumeContests', language });
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
const cardAchievements = ['nye', 'valentine'];
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
cardAchievements.forEach(path => {
2019-10-08 14:57:10 +00:00
_addSimpleWithCount(result, user, { path, key: `${path}Cards`, language });
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
});
return result;
}
function _getSpecialAchievements (user, language) {
2019-10-08 14:57:10 +00:00
const result = {};
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
_addPlural(result, user, { path: 'habitSurveys', language });
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
2019-10-08 14:57:10 +00:00
const contribKey = 'contributor';
const contribContent = achievsContent[contribKey];
const contributorAchiev = {
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
key: contribKey,
text: i18n.t(contribContent.textKey, language),
icon: contribContent.icon,
earned: Boolean(user.contributor && user.contributor.level),
};
if (user.contributor && user.contributor.level) {
contributorAchiev.value = user.contributor.level;
contributorAchiev.title = contribText(user.contributor, user.backer, language);
} else {
contributorAchiev.value = 0;
contributorAchiev.title = i18n.t(contribContent.titleKey, language);
}
_add(result, contributorAchiev);
if (user.backer && user.backer.npc) {
2019-10-08 14:57:10 +00:00
_addSimpleWithCustomPath(result, user, { key: 'npc', path: 'backer.npc', language });
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
}
if (user.backer && user.backer.tier) {
2019-10-08 14:57:10 +00:00
_addSimpleWithCustomPath(result, user, { key: 'kickstarter', path: 'backer.tier', language });
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
}
if (user.achievements.veteran) {
2019-10-08 14:57:10 +00:00
_addSimple(result, user, { path: 'veteran', language });
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
}
if (user.achievements.originalUser) {
2019-10-08 14:57:10 +00:00
_addSimple(result, user, { path: 'originalUser', language });
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
}
2019-09-27 16:45:24 +00:00
if (user.achievements.kickstarter2019) {
2019-10-08 14:57:10 +00:00
_addSimple(result, user, { path: 'kickstarter2019', language });
2019-09-27 16:45:24 +00:00
}
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
return result;
}
// Build and return the given user's achievement data.
achievs.getAchievementsForProfile = function getAchievementsForProfile (user, language) {
2019-10-08 14:57:10 +00:00
const result = {
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
basic: {
label: 'Basic',
achievements: _getBasicAchievements(user, language),
},
Onboarding guide and initial achievements refactoring (#11536) * add achievements to user * add placeholder strings * add to achievements to common script * add onboarding achievements category * add notifications * more notifications * award achievements * wip notification panel * add achievements icons and copy * do not count onboarding tasks for the created task achievement * add notes * sprites, fixes and completion status and reward * add onboarding panel * add toggle * fix toggle size * fix tests * fix typo * add notification * start adding modal * fix remove button positionin, timeout, progress bar * modal + fixes * disable broken social links from level up modal * change toggle icon color on hover * add border bottom to onboarding guide panel * add collapse animation * expanded onboarding on first open * onboarding: flip toggle colors * onboarding: show progress bar all the time * onboarding: fix panel closing on click * onboarding modal: add close icon and fix padding * wip: add migration for existing users * fix titles in guide * fix achievements copy * do not award completed task achievement when direction is down * start implementing new achievements * start migrating client * remove social links from achievements modals * prevent skipping tutorial + fix achievement notification * sync fixes * start redesign achievement modal * misc fixes to achievements, polish generic achievement modal and hatched pet modal * add special badge for onboarding * fix badge condition * modals fixes * hatched pet modal: add close icon * fix badge typo * fix justin button * new scrolling behavior for dropdowns * fix strings capitalization * add common tests * add api unit tests * add date check * achievements modal polishing * typos * add toggle for achievements categories * typo * fix test * fix edit avatar modal cannot be closed * finish migration and correct launch date * fix migration * migration fixes * fix tests
2019-12-16 16:20:47 +00:00
onboarding: {
label: 'Onboarding',
achievements: _getOnboardingAchievements(user, language),
},
Achievement list renovation & Achievements API (#7904) * pull apart achievements into different subcategories * achievs previously hidden to others if unachieved are now always shown * achievs previously always hidden if unachieved are now always shown * pull apart ultimate gear achievs * add achiev wrapper mixin * add achiev mixin for simple counts * add achiev mixin for singular/plural achievs * add simpleAchiev mixin and support attributes * always hide potentially unearnable achievs if unearned * contributor achiev now uses string interpolation for readMore link * transition to basic achiev grid layout * fix npc achievement img bug introduced in c90f7e2 * move surveys and contributor achievs into special section so it is never empty * double size of achievs in achievs grid * achievs in grid are muted if unachieved (includes recompiled sprites) * fix streak notification strings * add counts to achievement badges for applicable achieved achievs * list achievements by api * fix achievement strings in new api * unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges * fix & cleanup achievements api * extract generation of the achievements result to a class * clean up achievement counter css using existing classes * simplify exports of new achievementBuilder lib * remove class logic from achievementBuilder lib * move achievs to common, add rebirth achiev logic, misc fixes * replace achievs jade logic with results of api call * fix linting errors * achievs lib now returns achievs object subdivided by type (basic/seasonal/special * add tests for new achievs lib * fix linting errors * update controllers and views for updated achievs lib * add indices to achievements to preserve intended order * move achiev popovers to left * rename achievs lib to achievements * adjust positioning of achieve popovers now that stats and achievs pages are separate * fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs * revert compiled sprites so they don't bog down the PR * pull out achievs api integration tests * parameterize ultimate gear achievements' text string * break out static achievement data from user-specific data * reorg content.achievements to add achiev data in related chunks * cleanup, respond to feedback * improve api documentation * fix merge issues * Helped Habit Grow --> Helped Habitica Grow * achievement popovers are muted if the achiev is unearned * fix singular achievement labels / achievement popover on click * update apidoc for achievements (description, param-type, successExample, error-types) * fix whitespace issues in members.js * move html to a variable * updated json example * fix syntax after merge
2016-12-13 18:48:18 +00:00
seasonal: {
label: 'Seasonal',
achievements: _getSeasonalAchievements(user, language),
},
special: {
label: 'Special',
achievements: _getSpecialAchievements(user, language),
},
};
return result;
};
achievs.getContribText = contribText;
2019-10-01 15:53:48 +00:00
export default achievs;