@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
40 lines • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FEAR_AND_GREED_COLORS = exports.FEAR_AND_GREED_TRANSLATION_KEYS = void 0;
exports.getFearAndGreedLevel = getFearAndGreedLevel;
exports.getFearAndGreedTranslationKey = getFearAndGreedTranslationKey;
exports.getFearAndGreedColorKey = getFearAndGreedColorKey;
exports.FEAR_AND_GREED_TRANSLATION_KEYS = {
fear: "fearAndGreed.levels.fear",
cautious: "fearAndGreed.levels.cautious",
neutral: "fearAndGreed.levels.neutral",
optimistic: "fearAndGreed.levels.optimistic",
greedy: "fearAndGreed.levels.greedy",
};
exports.FEAR_AND_GREED_COLORS = {
fear: "error",
cautious: "warning",
neutral: "muted",
optimistic: "success",
greedy: "success",
};
function getFearAndGreedLevel(value) {
if (value <= 20)
return "fear";
if (value <= 40)
return "cautious";
if (value <= 60)
return "neutral";
if (value <= 80)
return "optimistic";
return "greedy";
}
function getFearAndGreedTranslationKey(value) {
const level = getFearAndGreedLevel(value);
return exports.FEAR_AND_GREED_TRANSLATION_KEYS[level];
}
function getFearAndGreedColorKey(value) {
const level = getFearAndGreedLevel(value);
return exports.FEAR_AND_GREED_COLORS[level];
}
//# sourceMappingURL=fearAndGreed.js.map