Skip to content

Commit 087e87e

Browse files
Set instance url tracking on engine (#1866)
* Set instance url tracking on engine * Better like this * Also better * Track other engine connection states --------- Co-authored-by: Phillip Ho <[email protected]>
1 parent 8bb2943 commit 087e87e

File tree

5 files changed

+74
-13
lines changed

5 files changed

+74
-13
lines changed

components/engine/no-authorized-wallet.tsx

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
import { Flex } from "@chakra-ui/react";
2+
import { useTrack } from "hooks/analytics/useTrack";
3+
import { useEffect } from "react";
24
import { Card, Text } from "tw-components";
35

4-
export const NoAuthorizedWallet = () => {
6+
interface EngineNavigationProps {
7+
instance: string;
8+
}
9+
10+
export const NoAuthorizedWallet: React.FC<EngineNavigationProps> = ({
11+
instance,
12+
}) => {
13+
const trackEvent = useTrack();
14+
15+
useEffect(() => {
16+
if (instance) {
17+
trackEvent({
18+
category: "engine",
19+
action: "set-engine-instance",
20+
label: "no-authorized-wallet",
21+
url: instance,
22+
});
23+
}
24+
}, [instance, trackEvent]);
25+
526
return (
627
<Card py={8}>
728
<Flex flexDir="column" gap={4}>
829
<Text textAlign="center">
9-
You do not have permission to view this Engine instance. Please
10-
connect from a wallet with permission or ask the admin of the instance
11-
to grant you permission.
30+
You do not have permission to view this Engine instance. Please sign
31+
in with an admin wallet.
1232
</Text>
1333
</Flex>
1434
</Card>

components/engine/no-connected-wallet.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
import { CustomConnectWallet } from "@3rdweb-sdk/react/components/connect-wallet";
22
import { Flex } from "@chakra-ui/react";
3+
import { useTrack } from "hooks/analytics/useTrack";
4+
import { useEffect } from "react";
35
import { Card, Text } from "tw-components";
46

5-
export const NoConnectedWallet = () => {
7+
interface EngineNavigationProps {
8+
instance: string;
9+
}
10+
11+
export const NoConnectedWallet: React.FC<EngineNavigationProps> = ({
12+
instance,
13+
}) => {
14+
const trackEvent = useTrack();
15+
16+
useEffect(() => {
17+
if (instance) {
18+
trackEvent({
19+
category: "engine",
20+
action: "set-engine-instance",
21+
label: "no-connected-wallet",
22+
url: instance,
23+
});
24+
}
25+
}, [instance, trackEvent]);
26+
627
return (
728
<Card py={8}>
829
<Flex flexDir="column" gap={4}>

components/engine/no-server-connection.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
import { Flex } from "@chakra-ui/react";
2+
import { useTrack } from "hooks/analytics/useTrack";
3+
import { useEffect } from "react";
24
import { Card, Text } from "tw-components";
35

4-
export const NoServerConnection = () => {
6+
interface EngineNavigationProps {
7+
instance: string;
8+
}
9+
10+
export const NoServerConnection: React.FC<EngineNavigationProps> = ({
11+
instance,
12+
}) => {
13+
const trackEvent = useTrack();
14+
15+
useEffect(() => {
16+
if (instance) {
17+
trackEvent({
18+
category: "engine",
19+
action: "set-engine-instance",
20+
label: "no-server-connection",
21+
url: instance,
22+
});
23+
}
24+
}, [instance, trackEvent]);
25+
526
return (
627
<Card py={8}>
728
<Flex flexDir="column" gap={4}>
829
<Text textAlign="center">
9-
We weren&apos;t able to establish a connection with Engine. Please
10-
ensure the URL is correct, and the server is running.
30+
We weren&apos;t able to establish a connection with your Engine
31+
instance. Please confirm the URL is correct and the server is running.
1132
</Text>
1233
</Flex>
1334
</Card>

page-id.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ export enum PageId {
157157
// ---------------------------------------------------------------------------
158158
// engine pages
159159
// ---------------------------------------------------------------------------
160-
// thirdweb.com/dashboard/engine
161-
Engine = "engine",
162160

163161
// thirdweb.com/dashboard/engine
164162
EngineManage = "engine-manage",

pages/dashboard/engine/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const EngineManage: ThirdwebNextPage = () => {
4040
.
4141
</Text>
4242
</Flex>
43+
4344
{instanceUrl && (
4445
<Text>
4546
Engine URL: <em>{instanceUrl}</em>{" "}
@@ -61,7 +62,7 @@ const EngineManage: ThirdwebNextPage = () => {
6162
/>
6263

6364
{!address ? (
64-
<NoConnectedWallet />
65+
<NoConnectedWallet instance={instanceUrl} />
6566
) : instanceUrl ? (
6667
enginePermissions.isLoading ? (
6768
<Center>
@@ -73,11 +74,11 @@ const EngineManage: ThirdwebNextPage = () => {
7374
) : enginePermissions.isError &&
7475
(enginePermissions?.error as { message: string }).message ===
7576
"401" ? (
76-
<NoAuthorizedWallet />
77+
<NoAuthorizedWallet instance={instanceUrl} />
7778
) : enginePermissions.isError &&
7879
(enginePermissions?.error as { message: string }).message ===
7980
"Failed to fetch" ? (
80-
<NoServerConnection />
81+
<NoServerConnection instance={instanceUrl} />
8182
) : (
8283
<EngineNavigation instance={instanceUrl} />
8384
)

0 commit comments

Comments
 (0)