mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
Refactor FAQ (#14372)
* refactor(faq): fetch from API on web Also make question list more maintainable, allowing different questions across platforms * fix(tests): don't return null when function is expected Also removes the unnecessary default to web in controller * fix(tests): add new fields to expectation, add placeholders * refactor(faq): allow reordering Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
@@ -1,6 +1,60 @@
|
||||
import t from './translation';
|
||||
|
||||
const NUMBER_OF_QUESTIONS = 12;
|
||||
const questionList = [
|
||||
{
|
||||
heading: 'overview',
|
||||
translationIndex: 0,
|
||||
},
|
||||
{
|
||||
heading: 'set-up-tasks',
|
||||
translationIndex: 1,
|
||||
},
|
||||
{
|
||||
heading: 'sample-tasks',
|
||||
translationIndex: 2,
|
||||
},
|
||||
{
|
||||
heading: 'task-color',
|
||||
translationIndex: 3,
|
||||
},
|
||||
{
|
||||
heading: 'health',
|
||||
translationIndex: 4,
|
||||
},
|
||||
{
|
||||
heading: 'party-with-friends',
|
||||
translationIndex: 5,
|
||||
},
|
||||
{
|
||||
heading: 'pets-mounts',
|
||||
translationIndex: 6,
|
||||
},
|
||||
{
|
||||
heading: 'character-classes',
|
||||
translationIndex: 7,
|
||||
},
|
||||
{
|
||||
heading: 'blue-mana-bar',
|
||||
translationIndex: 8,
|
||||
},
|
||||
{
|
||||
heading: 'monsters-quests',
|
||||
translationIndex: 9,
|
||||
},
|
||||
{
|
||||
heading: 'gems',
|
||||
translationIndex: 10,
|
||||
},
|
||||
{
|
||||
heading: 'bugs-features',
|
||||
translationIndex: 11,
|
||||
},
|
||||
{
|
||||
heading: 'group-plans',
|
||||
translationIndex: 13,
|
||||
excludedPlatforms: ['android', 'ios'],
|
||||
},
|
||||
];
|
||||
|
||||
const faq = {
|
||||
questions: [],
|
||||
@@ -10,12 +64,14 @@ const faq = {
|
||||
},
|
||||
};
|
||||
|
||||
for (let i = 0; i <= NUMBER_OF_QUESTIONS; i += 1) {
|
||||
questionList.forEach(listEntry => {
|
||||
const question = {
|
||||
question: t(`faqQuestion${i}`),
|
||||
ios: t(`iosFaqAnswer${i}`),
|
||||
android: t(`androidFaqAnswer${i}`),
|
||||
web: t(`webFaqAnswer${i}`, {
|
||||
exclusions: listEntry.excludedPlatforms || [],
|
||||
heading: listEntry.heading,
|
||||
question: t(`faqQuestion${listEntry.translationIndex}`),
|
||||
android: t(`androidFaqAnswer${listEntry.translationIndex}`),
|
||||
ios: t(`iosFaqAnswer${listEntry.translationIndex}`),
|
||||
web: t(`webFaqAnswer${listEntry.translationIndex}`, {
|
||||
// TODO: Need to pull these values from nconf
|
||||
techAssistanceEmail: 'admin@habitica.com',
|
||||
wikiTechAssistanceEmail: 'mailto:admin@habitica.com',
|
||||
@@ -23,6 +79,6 @@ for (let i = 0; i <= NUMBER_OF_QUESTIONS; i += 1) {
|
||||
};
|
||||
|
||||
faq.questions.push(question);
|
||||
}
|
||||
});
|
||||
|
||||
export default faq;
|
||||
|
||||
Reference in New Issue
Block a user