1
- "use client ";
2
-
1
+ import type { Team } from "@/api/team ";
2
+ import { UnderlineLink } from "@/components/ui/UnderlineLink" ;
3
3
import { Button } from "@/components/ui/button" ;
4
- import {
5
- ArrowRightIcon ,
6
- DownloadIcon ,
7
- ExternalLinkIcon ,
8
- PlusIcon ,
9
- } from "lucide-react" ;
4
+ import { Separator } from "@/components/ui/separator" ;
5
+ import { TrackedLinkTW } from "@/components/ui/tracked-link" ;
6
+ import { ArrowRightIcon , DownloadIcon , ExternalLinkIcon } from "lucide-react" ;
10
7
import Link from "next/link" ;
11
- import { useTrack } from "../../../../../../../hooks/analytics/useTrack" ;
12
-
13
- export function CreateEngineLink ( props : {
14
- label : string ;
15
- engineLinkPrefix : string ;
16
- } ) {
17
- const trackEvent = useTrack ( ) ;
18
-
19
- return (
20
- < Button
21
- asChild
22
- variant = "default"
23
- size = "sm"
24
- onClick = { ( ) => {
25
- trackEvent ( {
26
- category : "engine" ,
27
- action : "click" ,
28
- label : "add-engine-instance" ,
29
- } ) ;
30
- } }
31
- >
32
- < Link href = { `${ props . engineLinkPrefix } /create` } className = "gap-2" >
33
- < PlusIcon className = "size-3" />
34
- { props . label }
35
- </ Link >
36
- </ Button >
37
- ) ;
38
- }
8
+ import { PRO_CONTACT_US_URL } from "../../../../../../../constants/pro" ;
39
9
40
10
export function ImportEngineLink ( props : {
41
11
label : string ;
42
12
engineLinkPrefix : string ;
43
13
} ) {
44
- const trackEvent = useTrack ( ) ;
45
-
46
14
return (
47
- < Button
48
- asChild
49
- variant = "outline"
50
- size = "sm"
51
- className = "gap-2 bg-card"
52
- onClick = { ( ) => {
53
- trackEvent ( {
54
- category : "engine" ,
15
+ < Button asChild variant = "outline" size = "sm" className = "gap-2 bg-card" >
16
+ < TrackedLinkTW
17
+ href = { `${ props . engineLinkPrefix } /import` }
18
+ category = "engine"
19
+ trackingProps = { {
55
20
action : "import" ,
56
- } ) ;
57
- } }
58
- >
59
- < Link href = { `${ props . engineLinkPrefix } /import` } >
21
+ } }
22
+ >
60
23
< DownloadIcon className = "size-3" />
61
24
{ props . label }
62
- </ Link >
25
+ </ TrackedLinkTW >
63
26
</ Button >
64
27
) ;
65
28
}
66
29
67
- export function EngineInfoCard ( props : { team_slug : string } ) {
30
+ function EngineInfoSection ( props : { team_slug : string } ) {
68
31
const engineLinkPrefix = `/team/${ props . team_slug } /~/engine` ;
69
- const trackEvent = useTrack ( ) ;
70
32
71
33
return (
72
- < div className = " rounded-lg border border-border bg-card" >
73
- < div className = "p-6" >
74
- < h1 className = "font-semibold text-xl tracking-tight" >
75
- Your scalable web3 backend server
76
- </ h1 >
77
-
78
- < div className = "h-2" />
34
+ < div className = "" >
35
+ < h3 className = "mb-1 font-semibold text-lg tracking-tight" >
36
+ What is Engine?
37
+ </ h3 >
79
38
80
- < ul className = "list-disc space-y-2 pl-3 text-muted-foreground text-sm" >
81
- < li > Read, write, and deploy contracts at production scale</ li >
82
- < li >
83
- Reliably parallelize and retry transactions with gas & nonce
84
- management
85
- </ li >
86
- < li > Securely manage backend wallets</ li >
87
- < li > Built-in support for account abstraction, relayers, and more</ li >
88
- </ ul >
89
- </ div >
39
+ < ul className = "list-disc space-y-2 pl-3 text-muted-foreground text-sm" >
40
+ < li > Read, write, and deploy contracts at production scale</ li >
41
+ < li >
42
+ Reliably parallelize and retry transactions with gas & nonce
43
+ management
44
+ </ li >
45
+ < li > Securely manage backend wallets</ li >
46
+ < li > Built-in support for account abstraction, relayers, and more</ li >
47
+ </ ul >
90
48
91
- < div className = "flex justify-end gap-3 border-border border-t p-4 lg:px-6 " >
49
+ < div className = "mt-4 flex justify-start gap-3" >
92
50
< Button asChild variant = "outline" size = "sm" >
93
51
< Link
94
52
href = "https://portal.thirdweb.com/engine"
@@ -100,24 +58,110 @@ export function EngineInfoCard(props: { team_slug: string }) {
100
58
</ Link >
101
59
</ Button >
102
60
103
- < Button
104
- size = "sm"
105
- asChild
106
- onClick = { ( ) => {
107
- trackEvent ( {
108
- category : "engine" ,
61
+ < Button size = "sm" asChild variant = "outline" >
62
+ < TrackedLinkTW
63
+ href = { `${ engineLinkPrefix } /sandbox` }
64
+ className = "gap-2"
65
+ category = "engine"
66
+ label = "click-try-demo"
67
+ trackingProps = { {
109
68
action : "try-demo" ,
110
- label : "clicked-try-demo" ,
111
- } ) ;
112
- } }
113
- variant = "outline"
114
- >
115
- < Link href = { `${ engineLinkPrefix } /sandbox` } className = "gap-2" >
69
+ } }
70
+ >
116
71
Try Demo Engine
117
72
< ArrowRightIcon className = "size-3 text-muted-foreground" />
118
- </ Link >
73
+ </ TrackedLinkTW >
119
74
</ Button >
120
75
</ div >
121
76
</ div >
122
77
) ;
123
78
}
79
+
80
+ function CloudHostedEngineSection ( props : {
81
+ teamPlan : Exclude < Team [ "billingPlan" ] , "accelerate" | "scale" > ;
82
+ teamSlug : string ;
83
+ } ) {
84
+ return (
85
+ < div className = "flex flex-col" >
86
+ < h3 className = "mb-0.5 font-semibold text-lg tracking-tight" >
87
+ Get Cloud Hosted Engine
88
+ </ h3 >
89
+
90
+ { props . teamPlan !== "pro" ? (
91
+ < div >
92
+ < p className = "text-muted-foreground text-sm" >
93
+ Upgrade your plan to{ " " }
94
+ < UnderlineLink href = "/pricing" target = "_blank" >
95
+ Accelerate
96
+ </ UnderlineLink > { " " }
97
+ or{ " " }
98
+ < UnderlineLink href = "/pricing" target = "_blank" >
99
+ Scale
100
+ </ UnderlineLink > { " " }
101
+ to get a cloud hosted Engine
102
+ </ p >
103
+
104
+ < div className = "h-5" />
105
+ < div className = "flex justify-start gap-3" >
106
+ < Button
107
+ variant = "outline"
108
+ size = "sm"
109
+ asChild
110
+ className = "gap-2 bg-card"
111
+ >
112
+ < Link href = { `/team/${ props . teamSlug } /~/settings/billing` } >
113
+ Upgrade Plan
114
+ < ArrowRightIcon className = "size-3 text-muted-foreground" />
115
+ </ Link >
116
+ </ Button >
117
+
118
+ < Button
119
+ variant = "outline"
120
+ size = "sm"
121
+ asChild
122
+ className = "gap-2 bg-card"
123
+ >
124
+ < Link href = "/pricing" target = "_blank" >
125
+ View Pricing
126
+ < ExternalLinkIcon className = "size-3 text-muted-foreground" />
127
+ </ Link >
128
+ </ Button >
129
+ </ div >
130
+ </ div >
131
+ ) : (
132
+ < div >
133
+ < p className = "mb-4 text-muted-foreground text-sm" >
134
+ Contact us to get a cloud hosted engine for your team
135
+ </ p >
136
+ < Button variant = "outline" size = "sm" asChild className = "gap-2" >
137
+ < Link href = { PRO_CONTACT_US_URL } target = "_blank" >
138
+ Contact Us
139
+ < ExternalLinkIcon className = "size-3 text-muted-foreground" />
140
+ </ Link >
141
+ </ Button >
142
+ </ div >
143
+ ) }
144
+ </ div >
145
+ ) ;
146
+ }
147
+
148
+ export function EngineFooterCard ( props : {
149
+ teamPlan : Team [ "billingPlan" ] ;
150
+ team_slug : string ;
151
+ } ) {
152
+ return (
153
+ < div className = "relative rounded-lg border p-6" >
154
+ { props . teamPlan === "accelerate" || props . teamPlan === "scale" ? null : (
155
+ < >
156
+ < CloudHostedEngineSection
157
+ teamPlan = { props . teamPlan }
158
+ teamSlug = { props . team_slug }
159
+ />
160
+ < Separator className = "my-5" />
161
+ </ >
162
+ ) }
163
+
164
+ < EngineInfoSection team_slug = { props . team_slug } />
165
+ </ div >
166
+ ) ;
167
+ }
0 commit comments