chore: frontend fixes

Signed-off-by: Shivanshu Raj Shrivastava <shivanshu1333@gmail.com>
This commit is contained in:
Shivanshu Raj Shrivastava 2025-05-03 15:07:31 +05:30
parent 3587d7fea3
commit 1b20083f84
No known key found for this signature in database
GPG Key ID: D34D26C62AC3E9AE
3 changed files with 16 additions and 11 deletions

View File

@ -4,14 +4,19 @@ export const getYAxisFormattedValue = (
value: string,
format: string,
): string => {
let decimalPrecision: number | undefined;
const parsedValue = getValueFormat(format)(
parseFloat(value),
undefined,
undefined,
undefined,
);
try {
const parsedValue = getValueFormat(format)(
parseFloat(value),
undefined,
undefined,
undefined,
);
if (!parsedValue?.text) {
return `${parseFloat(value)}`;
}
let decimalPrecision: number | undefined;
const decimalSplitted = parsedValue.text.split('.');
if (decimalSplitted.length === 1) {
decimalPrecision = 0;
@ -41,9 +46,9 @@ export const getYAxisFormattedValue = (
),
);
} catch (error) {
console.error(error);
console.error('Error in getYAxisFormattedValue:', error);
return `${parseFloat(value)}`;
}
return `${parseFloat(value)}`;
};
export const getToolTipValue = (value: string, format?: string): string => {

View File

@ -14,7 +14,7 @@ function OverallMetrics(): JSX.Element {
title="Overall Funnel Metrics"
subtitle={{
label: 'Conversion rate',
value: `${conversionRate.toFixed(2)}%`,
value: `${(conversionRate || 0).toFixed(2)}%`,
}}
isLoading={isLoading}
isError={isError}

View File

@ -37,7 +37,7 @@ function StepsTransitionMetrics({
title={currentTransition.label}
subtitle={{
label: 'Conversion rate',
value: `${conversionRate.toFixed(2)}%`,
value: `${(conversionRate || 0).toFixed(2)}%`,
}}
isLoading={isLoading}
data={metricsData}