Skip to content

Commit 2725f33

Browse files
[Dashboard] Fix active users aggregation in project highlights card (#8346)
1 parent 2c6ea3e commit 2725f33

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/overview/highlights-card.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type AggregatedMetrics = {
1414

1515
export function ProjectHighlightsCard(props: {
1616
selectedChart: string | undefined;
17+
aggregatedUserStats: InAppWalletStats[];
1718
userStats: InAppWalletStats[];
1819
volumeStats: UniversalBridgeStats[];
1920
teamSlug: string;
@@ -22,6 +23,7 @@ export function ProjectHighlightsCard(props: {
2223
}) {
2324
const {
2425
selectedChart,
26+
aggregatedUserStats,
2527
userStats,
2628
volumeStats,
2729
teamSlug,
@@ -70,6 +72,12 @@ export function ProjectHighlightsCard(props: {
7072
: "activeUsers"
7173
}
7274
aggregateFn={(_data, key) => {
75+
if (key === "activeUsers") {
76+
return aggregatedUserStats.reduce(
77+
(acc, curr) => acc + curr.uniqueWalletsConnected,
78+
0,
79+
);
80+
}
7381
return timeSeriesData.reduce((acc, curr) => acc + curr[key], 0);
7482
}}
7583
chartConfig={chartConfig}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/page.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,18 @@ async function AsyncAppHighlightsCard(props: {
378378
params: PageParams;
379379
authToken: string;
380380
}) {
381-
const [walletUserStatsTimeSeries, universalBridgeUsage] =
381+
const [aggregatedUserStats, walletUserStatsTimeSeries, universalBridgeUsage] =
382382
await Promise.allSettled([
383+
getInAppWalletUsage(
384+
{
385+
from: props.range.from,
386+
period: "all",
387+
projectId: props.project.id,
388+
teamId: props.project.teamId,
389+
to: props.range.to,
390+
},
391+
props.authToken,
392+
),
383393
getInAppWalletUsage(
384394
{
385395
from: props.range.from,
@@ -408,6 +418,11 @@ async function AsyncAppHighlightsCard(props: {
408418
) {
409419
return (
410420
<ProjectHighlightsCard
421+
aggregatedUserStats={
422+
aggregatedUserStats.status === "fulfilled"
423+
? aggregatedUserStats.value
424+
: []
425+
}
411426
selectedChart={props.selectedChart}
412427
selectedChartQueryParam={props.selectedChartQueryParam}
413428
teamSlug={props.params.team_slug}

0 commit comments

Comments
 (0)