From 7393b82008b448db5953349acb49fb301d106ad1 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 12 Jun 2024 16:46:14 +0200 Subject: [PATCH] refactor: refs #6238 update getRate function and color logic --- src/pages/Travel/ExtraCommunity.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/pages/Travel/ExtraCommunity.vue b/src/pages/Travel/ExtraCommunity.vue index 37fe27717..d6669260f 100644 --- a/src/pages/Travel/ExtraCommunity.vue +++ b/src/pages/Travel/ExtraCommunity.vue @@ -432,9 +432,14 @@ const handleDragScroll = (event) => { } }; -const getKgPercentage = ({ kg, loadedKg, volumeKg }) => { +const getRate = ({ kg, loadedKg, volumeKg }) => { return Math.round((Math.max(loadedKg || 0, volumeKg || 0) / kg) * 100); }; + +const getColor = (percentage) => { + if (percentage >= 100) return 'red-10'; + else if (percentage >= 80 && percentage < 100) return 'deep-orange-10'; +}; +