Files
habitica/website/common/script/content/achievements.js
Matteo Pagliazzi 8f5a0cfe79 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 17:20:47 +01:00

303 lines
8.0 KiB
JavaScript

import each from 'lodash/each';
const achievementsData = {};
const worldQuestAchievs = {
dilatoryQuest: {
icon: 'achievement-dilatory',
titleKey: 'achievementDilatory',
textKey: 'achievementDilatoryText',
},
stressbeastQuest: {
icon: 'achievement-stoikalm',
titleKey: 'achievementStressbeast',
textKey: 'achievementStressbeastText',
},
burnoutQuest: {
icon: 'achievement-burnout',
titleKey: 'achievementBurnout',
textKey: 'achievementBurnoutText',
},
bewilderQuest: {
icon: 'achievement-bewilder',
titleKey: 'achievementBewilder',
textKey: 'achievementBewilderText',
},
dysheartenerQuest: {
icon: 'achievement-dysheartener',
titleKey: 'achievementDysheartener',
textKey: 'achievementDysheartenerText',
},
};
Object.assign(achievementsData, worldQuestAchievs);
const seasonalSpellAchievs = {
snowball: {
icon: 'achievement-snowball',
titleKey: 'annoyingFriends',
textKey: 'annoyingFriendsText',
},
spookySparkles: {
icon: 'achievement-spookySparkles',
titleKey: 'alarmingFriends',
textKey: 'alarmingFriendsText',
},
shinySeed: {
icon: 'achievement-shinySeed',
titleKey: 'agriculturalFriends',
textKey: 'agriculturalFriendsText',
},
seafoam: {
icon: 'achievement-seafoam',
titleKey: 'aquaticFriends',
textKey: 'aquaticFriendsText',
},
};
Object.assign(achievementsData, seasonalSpellAchievs);
const masterAchievs = {
beastMaster: {
icon: 'achievement-rat',
titleKey: 'beastMasterName',
textKey: 'beastMasterText',
text2Key: 'beastMasterText2',
},
mountMaster: {
icon: 'achievement-wolf',
titleKey: 'mountMasterName',
textKey: 'mountMasterText',
text2Key: 'mountMasterText2',
},
triadBingo: {
icon: 'achievement-triadbingo',
titleKey: 'triadBingoName',
textKey: 'triadBingoText',
text2Key: 'triadBingoText2',
},
};
Object.assign(achievementsData, masterAchievs);
const basicAchievs = {
partyUp: {
icon: 'achievement-partyUp',
titleKey: 'partyUpName',
textKey: 'partyUpText',
},
partyOn: {
icon: 'achievement-partyOn',
titleKey: 'partyOnName',
textKey: 'partyOnText',
},
streak: {
icon: 'achievement-thermometer',
singularTitleKey: 'streakSingular',
singularTextKey: 'streakSingularText',
pluralTitleKey: 'streakName',
pluralTextKey: 'streakText',
},
perfect: {
icon: 'achievement-perfect',
singularTitleKey: 'perfectSingular',
singularTextKey: 'perfectSingularText',
pluralTitleKey: 'perfectName',
pluralTextKey: 'perfectText',
},
royallyLoyal: {
icon: 'achievement-royally-loyal',
titleKey: 'royallyLoyal',
textKey: 'royallyLoyalText',
},
joinedGuild: {
icon: 'achievement-guild',
titleKey: 'joinedGuild',
textKey: 'joinedGuildText',
},
joinedChallenge: {
icon: 'achievement-challenge',
titleKey: 'joinedChallenge',
textKey: 'joinedChallengeText',
},
invitedFriend: {
icon: 'achievement-friends',
titleKey: 'invitedFriend',
textKey: 'invitedFriendText',
},
lostMasterclasser: {
icon: 'achievement-lostMasterclasser',
titleKey: 'achievementLostMasterclasser',
textKey: 'achievementLostMasterclasserText',
},
mindOverMatter: {
icon: 'achievement-mindOverMatter',
titleKey: 'achievementMindOverMatter',
textKey: 'achievementMindOverMatterText',
},
justAddWater: {
icon: 'achievement-justAddWater',
titleKey: 'achievementJustAddWater',
textKey: 'achievementJustAddWaterText',
},
backToBasics: {
icon: 'achievement-backToBasics',
titleKey: 'achievementBackToBasics',
textKey: 'achievementBackToBasicsText',
},
allYourBase: {
icon: 'achievement-allYourBase',
titleKey: 'achievementAllYourBase',
textKey: 'achievementAllYourBaseText',
},
dustDevil: {
icon: 'achievement-dustDevil',
titleKey: 'achievementDustDevil',
textKey: 'achievementDustDevilText',
},
aridAuthority: {
icon: 'achievement-aridAuthority',
titleKey: 'achievementAridAuthority',
textKey: 'achievementAridAuthorityText',
},
monsterMagus: {
icon: 'achievement-monsterMagus',
titleKey: 'achievementMonsterMagus',
textKey: 'achievementMonsterMagusText',
},
undeadUndertaker: {
icon: 'achievement-undeadUndertaker',
titleKey: 'achievementUndeadUndertaker',
textKey: 'achievementUndeadUndertakerText',
},
primedForPainting: {
icon: 'achievement-primedForPainting',
titleKey: 'achievementPrimedForPainting',
textKey: 'achievementPrimedForPaintingText',
},
pearlyPro: {
icon: 'achievement-pearlyPro',
titleKey: 'achievementPearlyPro',
textKey: 'achievementPearlyProText',
},
};
Object.assign(achievementsData, basicAchievs);
const onboardingAchievs = {
createdTask: {
icon: 'achievement-createdTask',
titleKey: 'achievementCreatedTask',
textKey: 'achievementCreatedTaskText',
},
completedTask: {
icon: 'achievement-completedTask',
titleKey: 'achievementCompletedTask',
textKey: 'achievementCompletedTaskText',
},
hatchedPet: {
icon: 'achievement-hatchedPet',
titleKey: 'achievementHatchedPet',
textKey: 'achievementHatchedPetText',
},
fedPet: {
icon: 'achievement-fedPet',
titleKey: 'achievementFedPet',
textKey: 'achievementFedPetText',
},
purchasedEquipment: {
icon: 'achievement-purchasedEquipment',
titleKey: 'achievementPurchasedEquipment',
textKey: 'achievementPurchasedEquipmentText',
},
};
Object.assign(achievementsData, onboardingAchievs);
const specialAchievs = {
contributor: {
icon: 'achievement-boot',
titleKey: 'contribName',
textKey: 'contribText',
},
npc: {
icon: 'achievement-npc',
titleKey: 'npcAchievementName',
textKey: 'npcAchievementText',
},
kickstarter: {
icon: 'achievement-heart',
titleKey: 'kickstartName',
textKey: 'kickstartText',
},
veteran: {
icon: 'achievement-cake',
titleKey: 'veteran',
textKey: 'veteranText',
},
originalUser: {
icon: 'achievement-alpha',
titleKey: 'originalUser',
textKey: 'originalUserText',
},
habitSurveys: {
icon: 'achievement-tree',
singularTitleKey: 'helped',
singularTextKey: 'surveysSingle',
pluralTitleKey: 'helped',
pluralTextKey: 'surveysMultiple',
},
kickstarter2019: {
icon: 'achievement-kickstarter2019',
titleKey: 'achievementKickstarter2019',
textKey: 'achievementKickstarter2019Text',
},
};
Object.assign(achievementsData, specialAchievs);
const holidayAchievs = {
habiticaDays: {
icon: 'achievement-habiticaDay',
singularTitleKey: 'habiticaDay',
singularTextKey: 'habiticaDaySingularText',
pluralTitleKey: 'habiticaDay',
pluralTextKey: 'habiticaDayPluralText',
},
habitBirthdays: {
icon: 'achievement-habitBirthday',
singularTitleKey: 'habitBirthday',
singularTextKey: 'habitBirthdayText',
pluralTitleKey: 'habitBirthday',
pluralTextKey: 'habitBirthdayPluralText',
},
costumeContests: {
icon: 'achievement-costumeContest',
singularTitleKey: 'costumeContest',
singularTextKey: 'costumeContestText',
pluralTitleKey: 'costumeContest',
pluralTextKey: 'costumeContestTextPlural',
},
};
Object.assign(achievementsData, holidayAchievs);
const ultimateGearAchievs = ['healer', 'rogue', 'warrior', 'mage'].reduce((achievs, type) => {
achievs[`${type}UltimateGear`] = {
icon: `achievement-ultimate-${type}`,
titleKey: 'ultimGearName',
textKey: 'ultimGearText',
};
return achievs;
}, {});
Object.assign(achievementsData, ultimateGearAchievs);
const cardAchievs = ['greeting', 'thankyou', 'nye', 'valentine', 'birthday', 'congrats', 'getwell', 'goodluck'].reduce((achievs, type) => {
achievs[`${type}Cards`] = {
icon: `achievement-${type}`,
titleKey: `${type}CardAchievementTitle`,
textKey: `${type}CardAchievementText`,
};
return achievs;
}, {});
Object.assign(achievementsData, cardAchievs);
each(achievementsData, (value, key) => {
value.key = key;
});
export default achievementsData;