From 64701bf29f4e0b08e93ea48ad6d2b6a90be5ea5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Tue, 26 Mar 2024 22:14:18 +0100 Subject: [PATCH] dashboard: lazy load charts on overview --- .../overview-latest-events.tsx | 4 ++-- .../overview/overview-top-devices.tsx | 4 ++-- .../overview-top-events/overview-top-events.tsx | 3 ++- .../components/overview/overview-top-geo.tsx | 3 ++- .../components/overview/overview-top-pages.tsx | 4 ++-- .../overview/overview-top-sources.tsx | 4 ++-- .../src/components/report/chart/Chart.tsx | 17 +++++++++++------ 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/apps/dashboard/src/components/overview/overview-latest-events/overview-latest-events.tsx b/apps/dashboard/src/components/overview/overview-latest-events/overview-latest-events.tsx index 9e21200d..4594abed 100644 --- a/apps/dashboard/src/components/overview/overview-latest-events/overview-latest-events.tsx +++ b/apps/dashboard/src/components/overview/overview-latest-events/overview-latest-events.tsx @@ -1,6 +1,6 @@ 'use client'; -import { ChartSwitch } from '@/components/report/chart'; +import { LazyChart } from '@/components/report/chart/LazyChart'; import { useEventQueryFilters } from '@/hooks/useEventQueryFilters'; import { cn } from '@/utils/cn'; @@ -120,7 +120,7 @@ export default function OverviewLatestEvents({ - + diff --git a/apps/dashboard/src/components/overview/overview-top-devices.tsx b/apps/dashboard/src/components/overview/overview-top-devices.tsx index f89bc21f..4427f2ef 100644 --- a/apps/dashboard/src/components/overview/overview-top-devices.tsx +++ b/apps/dashboard/src/components/overview/overview-top-devices.tsx @@ -1,12 +1,12 @@ 'use client'; import { useState } from 'react'; -import { ChartSwitch } from '@/components/report/chart'; import { useEventQueryFilters } from '@/hooks/useEventQueryFilters'; import { cn } from '@/utils/cn'; import type { IChartType } from '@openpanel/validation'; +import { LazyChart } from '../report/chart/LazyChart'; import { Widget, WidgetBody } from '../widget'; import { OverviewChartToggle } from './overview-chart-toggle'; import { WidgetButtons, WidgetHead } from './overview-widget'; @@ -198,7 +198,7 @@ export default function OverviewTopDevices({ - - + diff --git a/apps/dashboard/src/components/overview/overview-top-geo.tsx b/apps/dashboard/src/components/overview/overview-top-geo.tsx index fe6cf34b..4c56646f 100644 --- a/apps/dashboard/src/components/overview/overview-top-geo.tsx +++ b/apps/dashboard/src/components/overview/overview-top-geo.tsx @@ -7,6 +7,7 @@ import { cn } from '@/utils/cn'; import type { IChartType } from '@openpanel/validation'; +import { LazyChart } from '../report/chart/LazyChart'; import { Widget, WidgetBody } from '../widget'; import { OverviewChartToggle } from './overview-chart-toggle'; import { WidgetButtons, WidgetHead } from './overview-widget'; @@ -136,7 +137,7 @@ export default function OverviewTopGeo({ projectId }: OverviewTopGeoProps) { - - -