Skip to content

Commit 83aad73

Browse files
author
Janith Rathnayaka
committed
dr fix indicator list hover
1 parent aff687b commit 83aad73

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ui/components/digital-right-indicator-list.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,23 +175,29 @@ const Indicator = ({
175175
if (!isNaN(number)) {
176176
return number;
177177
}
178-
if (indicator.raw_data_col.length > 3) {
178+
const cleanedData = indicator.raw_data_col.replace(/^["']+|["']+$/g, '').trim();
179+
180+
if (cleanedData.length > 9) {
181+
// Find the first word
182+
const firstWord = cleanedData.split(' ')[0];
183+
179184
return (
180185
<span
181186
onMouseEnter={() => setIsHovered(true)}
182187
onMouseLeave={() => setIsHovered(false)}
183188
>
184-
{indicator.raw_data_col.substring(0, 3)}...
189+
{firstWord}...
185190
</span>
186191
);
187192
} else {
188-
return indicator.raw_data_col;
193+
return cleanedData;
189194
}
190195
} else {
191196
return hasNoData ? "Data unavailable" : disp_val;
192197
}
193198
};
194199

200+
195201
const getWidthClass = () => {
196202
if (indicator.raw_data_col.length <= 7) {
197203
return "w-auto";
@@ -211,7 +217,7 @@ const Indicator = ({
211217
{isHovered && (
212218
<div className={`absolute right-0 text-center bottom-full mb-2 bg-white shadow-lg border border-gray-200 z-50
213219
${getWidthClass()} p-2`}>
214-
{indicator.raw_data_col}
220+
{indicator.raw_data_col.replace(/^["']+|["']+$/g, '').trim()}
215221
</div>
216222
)}
217223
</span>

0 commit comments

Comments
 (0)