Skip to content

Commit 22edd64

Browse files
authored
Merge pull request #5831 from bcgov/feat/5736
2 parents 815ec21 + 77f9ab5 commit 22edd64

18 files changed

+216
-164
lines changed

app/app/analytics/general/page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import { useQuery } from '@tanstack/react-query';
44
import { useSnapshot } from 'valtio';
5-
import CombinedAreaGraph from '@/components/analytics/CombinedAreaGraph';
5+
import LineChartCard from '@/components/analytics/LineChartCard';
6+
import { LineChartDataItem } from '@/components/generic/charts/LineChart';
67
import FormDateRangePicker from '@/components/generic/select/FormDateRangePicker';
78
import FormUserPicker from '@/components/generic/select/FormUserPicker';
89
import { GlobalPermissions } from '@/constants';
@@ -19,7 +20,7 @@ const analyticsDashboard = createClientPage({
1920
export default analyticsDashboard(() => {
2021
const snap = useSnapshot(pageState);
2122

22-
const { data, isLoading } = useQuery({
23+
const { data, isLoading } = useQuery<LineChartDataItem[]>({
2324
queryKey: ['logins', snap.dates, snap.userId],
2425
queryFn: () => getAnalyticsGeneralData({ dates: snap.dates, userId: snap.userId }),
2526
});
@@ -44,7 +45,7 @@ export default analyticsDashboard(() => {
4445
/>
4546
</div>
4647
<div className="flex flex-col gap-y-12 mt-14">
47-
<CombinedAreaGraph
48+
<LineChartCard
4849
index="date"
4950
isLoading={isLoading}
5051
title="Daily User Login Events"

app/app/analytics/private-cloud/ActiveProducts.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSnapshot } from 'valtio';
2-
import CombinedAreaGraph from '@/components/analytics/CombinedAreaGraph';
2+
import LineChartCard from '@/components/analytics/LineChartCard';
33
import { clusters } from '@/constants';
44
import { downloadPrivateCloudActiveProducts } from '@/services/backend/analytics/private-cloud';
55
import { ActiveProduct } from '@/types/analytics-private';
@@ -10,8 +10,9 @@ export default function ActiveProducts({ data }: { data: ActiveProduct[] }) {
1010
const pageSnapshot = useSnapshot(pageState);
1111
const startDate = pageSnapshot.dates?.[0] ?? data?.[0]?.date;
1212
const endDate = pageSnapshot.dates?.[1] ?? new Date();
13+
1314
return (
14-
<CombinedAreaGraph
15+
<LineChartCard
1516
index="date"
1617
title="Active Products"
1718
subtitle={`This chart displays the cumulative number of products created from ${formatDate(

app/app/analytics/private-cloud/AllRequests.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSnapshot } from 'valtio';
2-
import CombinedAreaGraph from '@/components/analytics/CombinedAreaGraph';
2+
import LineChartCard from '@/components/analytics/LineChartCard';
33
import { downloadPrivateCloudAllRequests } from '@/services/backend/analytics/private-cloud';
44
import type { AllRequests } from '@/types/analytics-private';
55
import { formatDate } from '@/utils/js/date';
@@ -10,7 +10,7 @@ export default function AllRequests({ data }: { data: AllRequests[] }) {
1010
const startDate = pageSnapshot.dates?.[0] ?? data?.[0]?.date;
1111
const endDate = pageSnapshot.dates?.[1] ?? new Date();
1212
return (
13-
<CombinedAreaGraph
13+
<LineChartCard
1414
index="date"
1515
title="Requests over time"
1616
subtitle={`This chart displays the number of requests created over time for each request type from ${formatDate(

app/app/analytics/private-cloud/ContactChangeRequests.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSnapshot } from 'valtio';
2-
import CombinedAreaGraph from '@/components/analytics/CombinedAreaGraph';
2+
import LineChartCard from '@/components/analytics/LineChartCard';
33
import { downloadPrivateCloudContactChangeRequests } from '@/services/backend/analytics/private-cloud';
44
import { ContactsChange } from '@/types/analytics-private';
55
import { formatDate } from '@/utils/js/date';
@@ -10,7 +10,7 @@ export default function ContactChangeRequests({ data }: { data: ContactsChange[]
1010
const startDate = pageSnapshot.dates?.[0] ?? data?.[0]?.date;
1111
const endDate = pageSnapshot.dates?.[1] ?? new Date();
1212
return (
13-
<CombinedAreaGraph
13+
<LineChartCard
1414
index="date"
1515
title="Contact change requests over time"
1616
subtitle={`This chart displays edit requests where contact changes were requested and the request decision from ${formatDate(

app/app/analytics/private-cloud/MinistryDistribution.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSnapshot } from 'valtio';
2-
import PieGraph from '@/components/analytics/PieGraph';
2+
import MultipleDoughnutChartCard from '@/components/analytics/MultipleDoughnutChartCard';
33
import { clusters } from '@/constants';
44
import { mapClusterData, transformMinistryData } from '@/helpers/ministry-data';
55
import { downloadPrivateCloudMinistryDistribution } from '@/services/backend/analytics/private-cloud';
@@ -21,7 +21,7 @@ export default function MinistryDistribution({ data }: { data: MinistryDistribut
2121
};
2222

2323
return (
24-
<PieGraph
24+
<MultipleDoughnutChartCard
2525
onExport={() => downloadPrivateCloudMinistryDistribution({ data: { ...pageSnapshot } })}
2626
title="Ministry per Cluster"
2727
subtitle={`This chart displays the cluster distributions by ministries for products created from ${formatDate(

app/app/analytics/private-cloud/QuotaRequests.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSnapshot } from 'valtio';
2-
import CombinedAreaGraph from '@/components/analytics/CombinedAreaGraph';
2+
import LineChartCard from '@/components/analytics/LineChartCard';
33
import { downloadPrivateCloudQuotaChangeRequests } from '@/services/backend/analytics/private-cloud';
44
import { QuotaChange } from '@/types/analytics-private';
55
import { formatDate } from '@/utils/js/date';
@@ -10,7 +10,7 @@ export default function QuotaRequests({ data }: { data: QuotaChange[] }) {
1010
const startDate = pageSnapshot.dates?.[0] ?? data?.[0]?.date;
1111
const endDate = pageSnapshot.dates?.[1] ?? new Date();
1212
return (
13-
<CombinedAreaGraph
13+
<LineChartCard
1414
index="date"
1515
title="Quota requests over time"
1616
subtitle={`This chart displays edit requests where a quota change was requested and the request decision from ${formatDate(

app/app/analytics/private-cloud/RequestsDecisionTime.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSnapshot } from 'valtio';
2-
import Histogram from '@/components/analytics/Histogram';
2+
import BarChartCard from '@/components/analytics/BarChartCard';
33
import { downloadPrivateCloudRequestsDecisionTime } from '@/services/backend/analytics/private-cloud';
44
import { RequestDecisionTime } from '@/types/analytics-private';
55
import { formatDate } from '@/utils/js/date';
@@ -10,15 +10,14 @@ export default function RequestsDecisionTime({ data }: { data: RequestDecisionTi
1010
const startDate = pageSnapshot.dates?.[0] ?? new Date('2023-04-01T00:00:00.000Z');
1111
const endDate = pageSnapshot.dates?.[1] ?? new Date();
1212
return (
13-
<Histogram
13+
<BarChartCard
1414
index="time"
1515
title="Request decision time frequency (%)"
1616
subtitle={`This chart displays the frequency of request decision times (%) for products created from ${formatDate(
1717
startDate,
1818
)} to ${formatDate(endDate)}.`}
1919
chartData={data}
2020
categories={['Percentage']}
21-
colors={['indigo']}
2221
onExport={() => downloadPrivateCloudRequestsDecisionTime({ data: { ...pageSnapshot } })}
2322
/>
2423
);

app/app/analytics/public-cloud/ActiveProducts.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSnapshot } from 'valtio';
2-
import CombinedAreaGraph from '@/components/analytics/CombinedAreaGraph';
2+
import LineChartCard from '@/components/analytics/LineChartCard';
33
import { providers } from '@/constants';
44
import { downloadPublicCloudActiveProducts } from '@/services/backend/analytics/public-cloud';
55
import { ActiveProduct } from '@/types/analytics-public';
@@ -11,7 +11,7 @@ export default function ActiveProducts({ data }: { data: ActiveProduct[] }) {
1111
const startDate = pageSnapshot.dates?.[0] ?? data?.[0]?.date;
1212
const endDate = pageSnapshot.dates?.[1] ?? new Date();
1313
return (
14-
<CombinedAreaGraph
14+
<LineChartCard
1515
index="date"
1616
title="Active Products"
1717
subtitle={`This chart displays the cumulative number of products created from ${formatDate(

app/app/analytics/public-cloud/AllRequests.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSnapshot } from 'valtio';
2-
import CombinedAreaGraph from '@/components/analytics/CombinedAreaGraph';
2+
import LineChartCard from '@/components/analytics/LineChartCard';
33
import { downloadPublicCloudAllRequests } from '@/services/backend/analytics/public-cloud';
44
import type { AllRequests } from '@/types/analytics-public';
55
import { formatDate } from '@/utils/js/date';
@@ -10,7 +10,7 @@ export default function AllRequests({ data }: { data: AllRequests[] }) {
1010
const startDate = pageSnapshot.dates?.[0] ?? data?.[0]?.date;
1111
const endDate = pageSnapshot.dates?.[1] ?? new Date();
1212
return (
13-
<CombinedAreaGraph
13+
<LineChartCard
1414
index="date"
1515
title="Requests over time"
1616
subtitle={`This chart displays the number of requests created over time for each request type from ${formatDate(

app/app/analytics/public-cloud/ContactChangeRequests.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSnapshot } from 'valtio';
2-
import CombinedAreaGraph from '@/components/analytics/CombinedAreaGraph';
2+
import LineChartCard from '@/components/analytics/LineChartCard';
33
import { downloadPublicCloudContactChangeRequests } from '@/services/backend/analytics/public-cloud';
44
import { ContactsChange } from '@/types/analytics-public';
55
import { formatDate } from '@/utils/js/date';
@@ -10,7 +10,7 @@ export default function ContactChangeRequests({ data }: { data: ContactsChange[]
1010
const startDate = pageSnapshot.dates?.[0] ?? data?.[0]?.date;
1111
const endDate = pageSnapshot.dates?.[1] ?? new Date();
1212
return (
13-
<CombinedAreaGraph
13+
<LineChartCard
1414
index="date"
1515
title="Contact change requests over time"
1616
subtitle={`This chart displays edit requests where contact changes were requested and the request decision from ${formatDate(

0 commit comments

Comments
 (0)