Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Fix tooltip trend color

Zach Gollwitzer743e291d56d1
diff --git a/app/javascript/controllers/time_series_chart_controller.js b/app/javascript/controllers/time_series_chart_controller.js
index 0a0c1bee..93f719fe 100644
--- a/app/javascript/controllers/time_series_chart_controller.js
+++ b/app/javascript/controllers/time_series_chart_controller.js
@@ -399,8 +399,14 @@ export default class extends Controller {
_tooltipTrendColor(datum) {
return {
- up: tailwindColors.success,
- down: tailwindColors.error,
+ up:
+ datum.trend.favorable_direction === "up"
+ ? tailwindColors.success
+ : tailwindColors.error,
+ down:
+ datum.trend.favorable_direction === "down"
+ ? tailwindColors.success
+ : tailwindColors.error,
flat: tailwindColors.gray[500],
}[datum.trend.direction];
}