|
5 | 5 |
|
6 | 6 | import api from './adapter.js'; |
7 | 7 |
|
| 8 | +const scoreTexts = { |
| 9 | + A: { |
| 10 | + label: "Your app is fully optimized, congratulations!", |
| 11 | + description: "Don't forget to check it again if you update your app.", |
| 12 | + tips: "100 % optimized, congrats!" |
| 13 | + }, |
| 14 | + B: { |
| 15 | + label: "Your app is nearly optimized.", |
| 16 | + description: "Well done! You can continue by fixing the recommended rule on the right side. This is the one that currently has the highest impact on your app.", |
| 17 | + tips: "You have between 1 and 9 minor severities." |
| 18 | + }, |
| 19 | + C: { |
| 20 | + label: "Your app is not fully optimized.", |
| 21 | + description: "Keep going! You can continue by fixing the recommended rule on the right side. This is the one that currently has the highest impact on your app.", |
| 22 | + tips: "You have between 10 and 19 minor severities or you have 1 or many major severity." |
| 23 | + }, |
| 24 | + D: { |
| 25 | + label: "Many elements of your application can be optimized.", |
| 26 | + description: "Don't worry! You can start by fixing the recommended rule on the right side. This is the one that currently has the highest impact on your app.", |
| 27 | + tips: "You have more than 20 minor severities or more than 10 major severities or 1 or many critical severities." |
| 28 | + }, |
| 29 | + E: { |
| 30 | + label: "Several elements of your application can be optimized.", |
| 31 | + description: "Don't worry! You can start by fixing the recommended rule on the right side. This is the one that currently has the highest impact on your app.", |
| 32 | + tips: "You have 1 or more than 1 blocker severities." |
| 33 | + } |
| 34 | +}; |
| 35 | + |
8 | 36 | /** |
9 | 37 | * Calculate an ABCDE score from the sustainability issues related to the project size. |
10 | 38 | * @param {Object} config |
@@ -35,3 +63,12 @@ export async function calculateProjectScore(config) { |
35 | 63 | } |
36 | 64 | return 'A'; |
37 | 65 | } |
| 66 | + |
| 67 | +/** |
| 68 | + * Returns the texts corresponding to the score. |
| 69 | + * @param {string} score the value of the project's score. |
| 70 | + * @returns {Object} texts corresponding to the project score. |
| 71 | + */ |
| 72 | +export function getScoreTexts(score) { |
| 73 | + return scoreTexts[score] |
| 74 | +} |
0 commit comments