Skip to content

Commit 20b68b4

Browse files
committed
feat(dashboard): uses isActive endpoint to get project activity
1 parent 3681b0c commit 20b68b4

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

apps/dashboard/src/@/api/analytics.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,21 @@ export async function getWalletUsers(
126126
const json = await res.json();
127127
return json.data as WalletUserStats[];
128128
}
129+
130+
export async function isProjectActive(
131+
params: AnalyticsQueryParams,
132+
): Promise<boolean> {
133+
const searchParams = buildSearchParams(params);
134+
const res = await fetchAnalytics(`v1/active?${searchParams.toString()}`, {
135+
method: "GET",
136+
headers: { "Content-Type": "application/json" },
137+
});
138+
139+
if (res?.status !== 200) {
140+
console.error("Failed to fetch project active status");
141+
return false;
142+
}
143+
144+
const json = await res.json();
145+
return json.data.isActive as boolean;
146+
}

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

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
getUserOpUsage,
2020
getWalletConnections,
2121
getWalletUsers,
22+
isProjectActive,
2223
} from "@/api/analytics";
2324
import { EmptyStateCard } from "app/team/components/Analytics/EmptyStateCard";
2425
import {
@@ -66,6 +67,8 @@ export default async function ProjectOverviewPage(props: PageProps) {
6667
notFound();
6768
}
6869

70+
const isActive = await isProjectActive({ clientId: project.publishableKey });
71+
6972
// Fetch all analytics data in parallel
7073
const [
7174
walletConnections,
@@ -110,12 +113,6 @@ export default async function ProjectOverviewPage(props: PageProps) {
110113
}),
111114
]);
112115

113-
const isEmpty =
114-
!walletUserStatsTimeSeries.some((w) => w.totalUsers !== 0) &&
115-
walletConnections.length === 0 &&
116-
inAppWalletUsage.length === 0 &&
117-
userOpUsage.length === 0;
118-
119116
return (
120117
<div className="md:pb-16">
121118
<div className="w-full border-border-800 border-b px-6 dark:bg-muted/50">
@@ -125,7 +122,7 @@ export default async function ProjectOverviewPage(props: PageProps) {
125122
range={range}
126123
/>
127124
</div>
128-
{isEmpty ? (
125+
{!isActive ? (
129126
<div className="container p-6">
130127
<EmptyState />
131128
</div>
@@ -151,14 +148,12 @@ export default async function ProjectOverviewPage(props: PageProps) {
151148
link="https://portal.thirdweb.com/connect/quickstart"
152149
/>
153150
)}
154-
<div>
155-
<RpcMethodBarChartCard
156-
from={range.from}
157-
to={range.to}
158-
period={interval}
159-
clientId={project.publishableKey}
160-
/>
161-
</div>
151+
<RpcMethodBarChartCard
152+
from={range.from}
153+
to={range.to}
154+
period={interval}
155+
clientId={project.publishableKey}
156+
/>
162157
<div className="grid gap-6 max-md:px-6 md:grid-cols-2">
163158
{walletConnections.length > 0 ? (
164159
<WalletDistributionCard data={walletConnections} />

0 commit comments

Comments
 (0)