Skip to content

Commit

Permalink
dr 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 aff687b commit 83aad73
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ui/components/digital-right-indicator-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,23 +175,29 @@ 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;
}
};


const getWidthClass = () => {
if (indicator.raw_data_col.length <= 7) {
return "w-auto";
Expand All @@ -211,7 +217,7 @@ const Indicator = ({
{isHovered && (
<div 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 83aad73

Please sign in to comment.