Skip to content

Commit

Permalink
fix indicator list hover
Browse files Browse the repository at this point in the history
  • Loading branch information
Janith Rathnayaka committed May 16, 2024
1 parent afa82d5 commit aff687b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ui/components/indicator-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,22 @@ const Indicator = ({
if (!isNaN(number)) {
return number;
}
if (indicator.raw_data_col.length > 3) {
const cleanedData = indicator.raw_data_col.replace(/^["']+|["']+$/g, '').trim();

if (cleanedData.length > 9) {
// Find the first word
const firstWord = cleanedData.split(' ')[0];

return (
<span
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
{indicator.raw_data_col.substring(0, 3)}...
{firstWord}...
</span>
);
} else {
return indicator.raw_data_col;
return cleanedData;
}
} else {
return hasNoData ? "Data unavailable" : disp_val;
Expand Down Expand Up @@ -229,7 +234,7 @@ const Indicator = ({
className={`absolute right-0 text-center bottom-full mb-2 bg-white shadow-lg border border-gray-200 z-50
${getWidthClass()} p-2`}
>
{indicator.raw_data_col}
{indicator.raw_data_col.replace(/^["']+|["']+$/g, '').trim()}
</div>
)}
</span>
Expand Down

0 comments on commit aff687b

Please sign in to comment.