Skip to content

Commit 50192f2

Browse files
committed
posthog migration: part 3
1 parent 5924b03 commit 50192f2

File tree

73 files changed

+233
-718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+233
-718
lines changed

apps/dashboard/src/@/components/blocks/Sidebar.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ export type SidebarBaseLink = {
99
label: React.ReactNode;
1010
exactMatch?: boolean;
1111
icon?: React.FC<{ className?: string }>;
12-
tracking?: {
13-
category: string;
14-
action: string;
15-
label: string;
16-
};
1712
};
1813

1914
export type SidebarLink =

apps/dashboard/src/@/components/blocks/SidebarLayout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ function RenderSidebarGroup(props: {
123123
className="flex items-center gap-2 text-muted-foreground text-sm hover:bg-accent"
124124
activeClassName="text-foreground bg-accent"
125125
exactMatch={link.exactMatch}
126-
tracking={link.tracking}
127126
onClick={() => {
128127
sidebar.setOpenMobile(false);
129128
}}

apps/dashboard/src/@/components/blocks/UpsellBannerCard.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"use client";
22

33
import { Button } from "@/components/ui/button";
4-
import { TrackedLinkTW } from "@/components/ui/tracked-link";
54
import { cn } from "@/lib/utils";
5+
import Link from "next/link";
66
import type React from "react";
77

88
const ACCENT = {
@@ -103,15 +103,10 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
103103
color.btn,
104104
)}
105105
>
106-
<TrackedLinkTW
107-
href={props.cta.link}
108-
category={props.trackingCategory}
109-
label={props.trackingLabel}
110-
target={props.cta.target}
111-
>
106+
<Link href={props.cta.link} target={props.cta.target}>
112107
{props.cta.text}
113108
{props.cta.icon && <span className="ml-2">{props.cta.icon}</span>}
114-
</TrackedLinkTW>
109+
</Link>
115110
</Button>
116111
</div>
117112
</div>

apps/dashboard/src/@/components/ui/NavLink.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { cn } from "@/lib/utils";
4-
import { useTrack } from "hooks/analytics/useTrack";
4+
55
import Link from "next/link";
66
import { usePathname } from "next/navigation";
77

@@ -10,16 +10,10 @@ export type NavButtonProps = {
1010
activeClassName?: string;
1111
href: string;
1212
exactMatch?: boolean;
13-
tracking?: {
14-
category: string;
15-
action: string;
16-
label: string;
17-
};
1813
onClick?: () => void;
1914
};
2015

2116
export function NavLink(props: React.PropsWithChildren<NavButtonProps>) {
22-
const track = useTrack();
2317
const pathname = usePathname();
2418
const isActive = pathname
2519
? props.exactMatch
@@ -32,17 +26,7 @@ export function NavLink(props: React.PropsWithChildren<NavButtonProps>) {
3226
className={cn(props.className, isActive && props.activeClassName)}
3327
target={props.href.startsWith("http") ? "_blank" : undefined}
3428
prefetch={false}
35-
onClick={() => {
36-
props.onClick?.();
37-
if (props.tracking) {
38-
track({
39-
category: props.tracking.category,
40-
action: props.tracking.action,
41-
label: props.tracking.label,
42-
url: props.href,
43-
});
44-
}
45-
}}
29+
onClick={props.onClick}
4630
>
4731
{props.children}
4832
</Link>

apps/dashboard/src/@/components/ui/tracked-link.tsx

Lines changed: 0 additions & 46 deletions
This file was deleted.

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/NFTCards.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SkeletonContainer } from "@/components/ui/skeleton";
2-
import { TrackedLinkTW } from "@/components/ui/tracked-link";
2+
import Link from "next/link";
33
import { useMemo } from "react";
44
import { type NFT, type ThirdwebClient, ZERO_ADDRESS } from "thirdweb";
55
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
@@ -28,7 +28,6 @@ const dummyMetadata: (idx: number) => NFTWithContract = (idx) => ({
2828

2929
interface NFTCardsProps {
3030
nfts: Array<NFTWithContract>;
31-
trackingCategory: string;
3231
isPending: boolean;
3332
allNfts?: boolean;
3433
projectMeta: ProjectMeta | undefined;
@@ -37,7 +36,6 @@ interface NFTCardsProps {
3736

3837
export const NFTCards: React.FC<NFTCardsProps> = ({
3938
nfts,
40-
trackingCategory,
4139
isPending,
4240
allNfts,
4341
projectMeta,
@@ -91,9 +89,7 @@ export const NFTCards: React.FC<NFTCardsProps> = ({
9189
render={(v) => {
9290
return (
9391
<h2 className="font-semibold tracking-tight">
94-
<TrackedLinkTW
95-
category={trackingCategory}
96-
label="view_nft"
92+
<Link
9793
href={buildContractPagePath({
9894
projectMeta,
9995
chainIdOrSlug: token.chainId.toString(),
@@ -103,7 +99,7 @@ export const NFTCards: React.FC<NFTCardsProps> = ({
10399
className="before:absolute before:inset-0"
104100
>
105101
{v.name}
106-
</TrackedLinkTW>
102+
</Link>
107103
</h2>
108104
);
109105
}}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account/components/nfts-owned.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export const NftsOwned: React.FC<NftsOwnedProps> = ({
4242
}))}
4343
allNfts
4444
isPending={isWalletNFTsLoading}
45-
trackingCategory="account_nfts_owned"
4645
/>
4746
) : isWalletNFTsLoading ? null : error ? (
4847
<p>Failed to fetch NFTs for this account: {error}</p>

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/AccountsPage.tsx

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

33
import { ButtonGroup, Flex } from "@chakra-ui/react";
44
import type { ThirdwebContract } from "thirdweb";
5-
import { Heading, TrackedLinkButton } from "tw-components";
5+
import { Heading, LinkButton } from "tw-components";
66
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
77
import { AccountsCount } from "./components/accounts-count";
88
import { AccountsTable } from "./components/accounts-table";
@@ -33,15 +33,13 @@ export const AccountsPage: React.FC<AccountsPageProps> = ({
3333
gap={2}
3434
w="inherit"
3535
>
36-
<TrackedLinkButton
37-
category="smart-wallet"
36+
<LinkButton
3837
variant="solid"
39-
label="docs-factory-page"
4038
href="https://portal.thirdweb.com/wallets/smart-wallet/get-started#3-connect-smart-wallets-in-your-application"
4139
isExternal
4240
>
4341
View Documentation
44-
</TrackedLinkButton>
42+
</LinkButton>
4543
<CreateAccountButton contract={contract} isLoggedIn={isLoggedIn} />
4644
</ButtonGroup>
4745
</Flex>

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/components/accounts-table.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { useMemo, useState } from "react";
1515
import type { ThirdwebContract } from "thirdweb";
1616
import { getAccounts, totalAccounts } from "thirdweb/extensions/erc4337";
1717
import { useReadContract } from "thirdweb/react";
18-
import { Text, TrackedCopyButton } from "tw-components";
18+
import { Legacy_CopyButton, Text } from "tw-components";
1919
import type { ProjectMeta } from "../../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
2020
import { buildContractPagePath } from "../../_utils/contract-page-path";
2121

@@ -27,9 +27,8 @@ const columns = [
2727
cell: (info) => (
2828
<Flex gap={2} align="center">
2929
<Text fontFamily="mono">{info.getValue()}</Text>
30-
<TrackedCopyButton
30+
<Legacy_CopyButton
3131
value={info.getValue()}
32-
category="accounts"
3332
aria-label="Copy account address"
3433
colorScheme="primary"
3534
/>

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/ContractOverviewPage.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ interface ContractOverviewPageProps {
2626
projectMeta: ProjectMeta | undefined;
2727
}
2828

29-
const TRACKING_CATEGORY = "contract_overview";
30-
3129
export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
3230
contract,
3331
isErc1155,
@@ -75,7 +73,6 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
7573
<ContractAnalyticsOverviewCard
7674
contractAddress={contract.address}
7775
chainId={contract.chain.id}
78-
trackingCategory={TRACKING_CATEGORY}
7976
chainSlug={chainSlug}
8077
projectMeta={projectMeta}
8178
/>
@@ -85,7 +82,6 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
8582
<MarketplaceDetails
8683
contract={contract}
8784
projectMeta={projectMeta}
88-
trackingCategory={TRACKING_CATEGORY}
8985
hasEnglishAuctions={hasEnglishAuctions}
9086
hasDirectListings={hasDirectListings}
9187
chainSlug={chainSlug}
@@ -95,7 +91,6 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
9591
{(isErc1155 || isErc721) && (
9692
<NFTDetails
9793
contract={contract}
98-
trackingCategory={TRACKING_CATEGORY}
9994
isErc721={isErc721}
10095
chainSlug={chainSlug}
10196
projectMeta={projectMeta}
@@ -106,22 +101,19 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
106101

107102
<LatestEvents
108103
contract={contract}
109-
trackingCategory={TRACKING_CATEGORY}
110104
chainSlug={chainSlug}
111105
projectMeta={projectMeta}
112106
/>
113107

114108
{isPermissionsEnumerable && (
115109
<PermissionsTable
116110
contract={contract}
117-
trackingCategory={TRACKING_CATEGORY}
118111
chainSlug={chainSlug}
119112
projectMeta={projectMeta}
120113
/>
121114
)}
122115

123116
<BuildYourApp
124-
trackingCategory={TRACKING_CATEGORY}
125117
chainSlug={chainSlug}
126118
contractAddress={contract.address}
127119
projectMeta={projectMeta}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ function getDateKey(date: Date, precision: "day" | "hour") {
2828
export function ContractAnalyticsOverviewCard(props: {
2929
contractAddress: string;
3030
chainId: number;
31-
trackingCategory: string;
3231
chainSlug: string;
3332
projectMeta: ProjectMeta | undefined;
3433
}) {
@@ -86,7 +85,7 @@ export function ContractAnalyticsOverviewCard(props: {
8685
variant="outline"
8786
onClick={() => {
8887
trackEvent({
89-
category: props.trackingCategory,
88+
category: "contract_overview",
9089
action: "click",
9190
label: "view_all_analytics",
9291
});

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/BuildYourApp.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { TrackedLinkTW } from "@/components/ui/tracked-link";
21
import { ReactIcon } from "components/icons/brand-icons/ReactIcon";
32
import { TypeScriptIcon } from "components/icons/brand-icons/TypeScriptIcon";
3+
import Link from "next/link";
44
import type { ProjectMeta } from "../../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
55
import { buildContractPagePath } from "../../_utils/contract-page-path";
66

77
export function BuildYourApp(props: {
8-
trackingCategory: string;
98
contractAddress: string;
109
chainSlug: string;
1110
projectMeta: ProjectMeta | undefined;
@@ -24,15 +23,13 @@ export function BuildYourApp(props: {
2423
<h2 className="mb-2 font-semibold text-xl leading-none tracking-tight">
2524
Build your app
2625
</h2>
27-
<TrackedLinkTW
28-
category={props.trackingCategory}
29-
label="build_your_app"
26+
<Link
3027
href={codePath}
3128
className="block text-balance text-muted-foreground text-sm before:absolute before:inset-0"
3229
>
3330
Learn more about how you can use thirdweb tools to build apps on top
3431
of this contract
35-
</TrackedLinkTW>{" "}
32+
</Link>{" "}
3633
</div>
3734

3835
{/* right */}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/LatestEvents.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const meta: Meta<typeof LatestEventsUI> = {
1515
allEvents: [],
1616
autoUpdate: false,
1717
eventsHref: "/ethereum/0x123456789/events",
18-
trackingCategory: "test-category",
1918
},
2019
};
2120

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/LatestEvents.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
TableHeader,
1414
TableRow,
1515
} from "@/components/ui/table";
16-
import { TrackedLinkTW } from "@/components/ui/tracked-link";
1716
import {
1817
type InternalTransaction,
1918
useActivity,
@@ -26,7 +25,6 @@ import type { ProjectMeta } from "../../../../../../team/[team_slug]/[project_sl
2625
import { buildContractPagePath } from "../../_utils/contract-page-path";
2726

2827
export function LatestEvents(props: {
29-
trackingCategory: string;
3028
contract: ThirdwebContract;
3129
chainSlug: string;
3230
projectMeta: ProjectMeta | undefined;
@@ -46,7 +44,6 @@ export function LatestEvents(props: {
4644
allEvents={allEvents}
4745
autoUpdate={autoUpdate}
4846
eventsHref={eventsHref}
49-
trackingCategory={props.trackingCategory}
5047
/>
5148
);
5249
}
@@ -55,7 +52,6 @@ export function LatestEventsUI(props: {
5552
allEvents: Pick<InternalTransaction, "transactionHash" | "events">[];
5653
autoUpdate: boolean;
5754
eventsHref: string;
58-
trackingCategory: string;
5955
}) {
6056
const { allEvents, autoUpdate, eventsHref } = props;
6157
return (
@@ -80,14 +76,12 @@ export function LatestEventsUI(props: {
8076
)}
8177
</div>
8278
<Button asChild variant="outline" size="sm" className="bg-background">
83-
<TrackedLinkTW
84-
category={props.trackingCategory}
85-
label="view_all_events"
79+
<Link
8680
href={eventsHref}
8781
className="flex items-center gap-2 text-muted-foreground text-sm"
8882
>
8983
View all <ArrowRightIcon className="size-4" />
90-
</TrackedLinkTW>
84+
</Link>
9185
</Button>
9286
</div>
9387

0 commit comments

Comments
 (0)