mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Move background function to helpers
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import {each} from 'lodash';
|
import {each} from 'lodash';
|
||||||
import {
|
import {
|
||||||
translator as t,
|
translator as t,
|
||||||
formatForTranslator
|
generateBackgrounds
|
||||||
} from './helpers';
|
} from './helpers';
|
||||||
|
|
||||||
let sets = {
|
let sets = {
|
||||||
@@ -23,20 +23,6 @@ let sets = {
|
|||||||
'092015': ['market', 'stable', 'tavern'],
|
'092015': ['market', 'stable', 'tavern'],
|
||||||
};
|
};
|
||||||
|
|
||||||
let backgrounds = { };
|
let backgrounds = generateBackgrounds(sets);
|
||||||
|
|
||||||
each(sets, (names, set) => {
|
|
||||||
let setName = `backgrounds${set}`;
|
|
||||||
backgrounds[setName] = {};
|
|
||||||
|
|
||||||
each(names, (name) => {
|
|
||||||
let formattedName = formatForTranslator(name);
|
|
||||||
|
|
||||||
backgrounds[setName][name] = {
|
|
||||||
text: t(`background${formattedName}Text`),
|
|
||||||
notes: t(`background${formattedName}Notes`),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
export default backgrounds;
|
export default backgrounds;
|
||||||
|
|||||||
@@ -119,3 +119,27 @@ function _getGearAttributes(gear) {
|
|||||||
|
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------
|
||||||
|
// Background Helpers
|
||||||
|
//----------------------------------------
|
||||||
|
|
||||||
|
export function generateBackgrounds(sets) {
|
||||||
|
let backgrounds = {};
|
||||||
|
|
||||||
|
each(sets, (names, set) => {
|
||||||
|
let setName = `backgrounds${set}`;
|
||||||
|
backgrounds[setName] = {};
|
||||||
|
|
||||||
|
each(names, (name) => {
|
||||||
|
let formattedName = formatForTranslator(name);
|
||||||
|
|
||||||
|
backgrounds[setName][name] = {
|
||||||
|
text: translator(`background${formattedName}Text`),
|
||||||
|
notes: translator(`background${formattedName}Notes`),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return backgrounds;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user