feat: Add red threshold for getStatusColor util (#9789)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
Miguel Solorio
2025-09-29 15:42:33 -07:00
committed by GitHub
parent d37fff7fd6
commit 6f6e004f82
2 changed files with 48 additions and 20 deletions
+4 -1
View File
@@ -19,7 +19,7 @@ export const CACHE_EFFICIENCY_MEDIUM = 15;
// --- Color Logic ---
export const getStatusColor = (
value: number,
thresholds: { green: number; yellow: number },
thresholds: { green: number; yellow: number; red?: number },
options: { defaultColor?: string } = {},
) => {
if (value >= thresholds.green) {
@@ -28,5 +28,8 @@ export const getStatusColor = (
if (value >= thresholds.yellow) {
return theme.status.warning;
}
if (thresholds.red != null && value >= thresholds.red) {
return theme.status.error;
}
return options.defaultColor ?? theme.status.error;
};