Skip to content

Commit 9910a02

Browse files
committed
[Dashboard] Feature: Team Analytics Page (#5353)
CNCT-2291 https://github.com/user-attachments/assets/163c5eb5-c4dc-4d0f-a6aa-099a321148e8 <!-- start pr-codex --> --- ## PR-Codex overview This PR primarily focuses on refactoring components related to analytics in the dashboard. It replaces the `ProjectOverviewHeader` with an `AnalyticsHeader`, updates various components to enhance functionality, and introduces new analytics-related features. ### Detailed summary - Deleted `Steps.tsx` and `HomeProductCard.tsx`. - Replaced `ProjectOverviewHeader` with `AnalyticsHeader` in various files. - Updated `projectStub` function to remove the export. - Introduced new components for analytics: `UsersChartCard`, `WalletDistributionCard`, `AuthMethodDistributionCard`, `TotalSponsoredCard`, and `UserOpUsageCard`. - Enhanced `EmptyState` component styling and functionality. - Adjusted imports to reflect new component paths. - Added new fetching functions for analytics data: `getWalletConnections`, `getInAppWalletUsage`, `getUserOpUsage`, and `getWalletUsers`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 9572db0 commit 9910a02

21 files changed

+533
-454
lines changed

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

Lines changed: 507 additions & 45 deletions
Large diffs are not rendered by default.

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ import {
2424
import { type WalletId, getWalletInfo } from "thirdweb/wallets";
2525

2626
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
27-
import { CombinedBarChartCard } from "./components/CombinedBarChartCard";
28-
import { EmptyState } from "./components/EmptyState";
29-
import { PieChartCard } from "./components/PieChartCard";
30-
import { ProjectOverviewHeader } from "./components/ProjectOverviewHeader";
31-
import { StatBreakdownCard } from "./components/StatBreakdownCard";
27+
import { AnalyticsHeader } from "../../components/Analytics/AnalyticsHeader";
28+
import { CombinedBarChartCard } from "../../components/Analytics/CombinedBarChartCard";
29+
import { EmptyState } from "../../components/Analytics/EmptyState";
30+
import { PieChartCard } from "../../components/Analytics/PieChartCard";
31+
import { StatBreakdownCard } from "../../components/Analytics/StatBreakdownCard";
3232

3333
type PageParams = {
3434
team_slug: string;
@@ -111,10 +111,10 @@ export default async function ProjectOverviewPage(props: PageProps) {
111111
userOpUsage.length === 0;
112112

113113
return (
114-
<div className="">
114+
<div className="pb-16">
115115
<div className="w-full border-border-800 border-b px-6 dark:bg-muted/50">
116-
<ProjectOverviewHeader
117-
project={project}
116+
<AnalyticsHeader
117+
title={project.name}
118118
interval={interval}
119119
range={range}
120120
/>
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22
import { getLastNDaysRange } from "components/analytics/date-range-selector";
3-
import { projectStub } from "stories/stubs";
43
import { BadgeContainer, mobileViewport } from "stories/utils";
5-
import { ProjectOverviewHeader } from "./ProjectOverviewHeader";
4+
import { AnalyticsHeader } from "./AnalyticsHeader";
65

76
const meta = {
8-
title: "project/Overview/Header",
7+
title: "Analytics/AnalyticsHeader",
98
component: Component,
109
parameters: {
1110
layout: "centered",
@@ -36,8 +35,8 @@ function Component() {
3635
return (
3736
<div className="container py-8">
3837
<BadgeContainer label="Base">
39-
<ProjectOverviewHeader
40-
project={projectStub("123", "456")}
38+
<AnalyticsHeader
39+
title="Project Overview"
4140
interval="day"
4241
range={getLastNDaysRange("last-120")}
4342
/>
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
import type { Project } from "@/api/projects";
21
import type { Range } from "components/analytics/date-range-selector";
32
import { RangeSelector } from "components/analytics/range-selector";
43

5-
export function ProjectOverviewHeader(props: {
6-
project: Project;
4+
export function AnalyticsHeader(props: {
5+
title: string;
76
interval: "day" | "week";
87
range: Range;
98
}) {
10-
const { project, interval, range } = props;
9+
const { title, interval, range } = props;
1110

1211
return (
1312
<div className="container flex flex-col items-start gap-6 px-2 py-6 md:h-[120px] md:flex-row md:items-center md:p-6 md:py-0">
1413
<div className="flex-1">
15-
<h1 className="font-semibold text-3xl text-foreground">
16-
{project.name}
17-
</h1>
14+
<h1 className="font-semibold text-3xl text-foreground">{title}</h1>
1815
</div>
1916
<RangeSelector interval={interval} range={range} />
2017
</div>
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ import { TypeScriptIcon } from "components/icons/brand-icons/TypeScriptIcon";
66
import { UnityIcon } from "components/icons/brand-icons/UnityIcon";
77
import { UnrealIcon } from "components/icons/brand-icons/UnrealIcon";
88
import { DocLink } from "components/shared/DocLink";
9+
import { ArrowRightIcon } from "lucide-react";
910
import Image, { type StaticImageData } from "next/image";
1011
import Link from "next/link";
11-
import accountAbstractionIcon from "../../../../../../public/assets/tw-icons/account-abstraction.svg";
12-
import authIcon from "../../../../../../public/assets/tw-icons/auth.svg";
13-
import payIcon from "../../../../../../public/assets/tw-icons/pay.svg";
14-
import socialAuthIcon from "../../../../../../public/assets/tw-icons/social-auth.svg";
15-
import walletsIcon from "../../../../../../public/assets/tw-icons/wallets.svg";
12+
import accountAbstractionIcon from "../../../../../public/assets/tw-icons/account-abstraction.svg";
13+
import authIcon from "../../../../../public/assets/tw-icons/auth.svg";
14+
import payIcon from "../../../../../public/assets/tw-icons/pay.svg";
15+
import socialAuthIcon from "../../../../../public/assets/tw-icons/social-auth.svg";
16+
import walletsIcon from "../../../../../public/assets/tw-icons/wallets.svg";
1617

1718
export function EmptyState() {
1819
return (
19-
<div className="flex items-center justify-center md:min-h-[500px]">
20+
<div className="flex items-start justify-center md:min-h-[500px]">
2021
<div className="group container flex flex-col items-center justify-center gap-8 rounded-lg border bg-card p-6 py-24">
2122
<div className="flex max-w-[500px] flex-col items-center justify-center gap-6">
2223
<AnimatedIcons />
@@ -62,9 +63,9 @@ export function EmptyState() {
6263
</div>
6364
</div>
6465
<div className="flex gap-2">
65-
<Button variant="outline" asChild className="min-w-36">
66+
<Button variant="primary" asChild className="min-w-36">
6667
<Link href="https://portal.thirdweb.com/connect" target="_blank">
67-
View Docs
68+
View Docs <ArrowRightIcon className="ml-2 h-4 w-auto" />
6869
</Link>
6970
</Button>
7071
</div>

0 commit comments

Comments
 (0)