diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomChartTooltip.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomChartTooltip.tsx index f447bcd7c..2b57a7a6f 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomChartTooltip.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomChartTooltip.tsx @@ -13,9 +13,11 @@ interface Props { active: boolean; payload: PayloadItem[]; label: string; + activeKey?: string; } -function CustomTooltip({ active, payload, label }: Props) { +function CustomTooltip(props: Props) { + const { active, payload, label, activeKey } = props; if (!active || !payload?.length) return null; const shownPayloads: PayloadItem[] = payload.filter((p) => !p.hide); @@ -38,9 +40,13 @@ function CustomTooltip({ active, payload, label }: Props) { prevValue, }; }); + const isHigher = (item: { value: number; prevValue: number }) => { return item.prevValue !== null && item.prevValue < item.value; }; + const getPercentDelta = (val, prevVal) => { + return (((val - prevVal) / prevVal) * 100).toFixed(2); + }; return (
{label}, {formatTimeOrDate(p.payload.timestamp)}
-
+
{p.value}
- {p.prevValue !== null ? ( + {p.prevValue ? ( ) : null}
@@ -81,20 +88,23 @@ function CustomTooltip({ active, payload, label }: Props) { export function CompareTag({ isHigher, - prevValue, + absDelta, + delta, }: { isHigher: boolean; - prevValue: number | string; + absDelta?: number | string; + delta?: string; }) { return (
{!isHigher ? : } -
{prevValue}
+
{absDelta}
+
({delta}%)
); } diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricLineChart/CustomMetricLineChart.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricLineChart/CustomMetricLineChart.tsx index 618c6ed6b..15b30e9ff 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricLineChart/CustomMetricLineChart.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricLineChart/CustomMetricLineChart.tsx @@ -82,9 +82,7 @@ function CustomMetricLineChart(props: Props) { strokeOpacity={key === 'Total' ? 0 : 0.6} legendType={key === 'Total' ? 'none' : 'line'} dot={false} - activeDot={{ - fill: key === 'Total' ? 'transparent' : colors[index], - }} + activeDot={{ fill: colors[index]}} /> ) : null)} {compData?.namesMap.map((key, i) => data.namesMap[i] ? ( diff --git a/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx b/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx index f1a32c29a..2a3130f88 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx @@ -20,7 +20,7 @@ import Dashboard from 'App/mstore/types/dashboard'; import { dashboardSelected, withSiteId } from 'App/routes'; import CreateDashboardButton from 'Components/Dashboard/components/CreateDashboardButton'; import { Icon, confirm } from 'UI'; -import { EllipsisVertical } from "lucide-react"; +import { EllipsisVertical } from 'lucide-react'; import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG'; import DashboardEditModal from '../DashboardEditModal'; @@ -130,40 +130,38 @@ function DashboardList() { render: (id) => ( , key: 'rename', label: 'Rename', - onClick: () => onEdit(id, true), }, { icon: , key: 'access', label: 'Visibility & Access', - onClick: () => onEdit(id, false), }, { icon: , key: 'delete', label: 'Delete', - onClick: () => onDelete(id), }, ], - onClick: ({ key }) => { + onClick: async ({ key }) => { if (key === 'rename') { onEdit(id, true); } else if (key === 'access') { onEdit(id, false); } else if (key === 'delete') { - void onDelete(id); + await onDelete(id); } }, }} > -