@@ -20,13 +20,9 @@ import {
20
20
import { useNavigation } from "@remix-run/react" ;
21
21
import { useEffect , useRef , useState , type ReactNode } from "react" ;
22
22
import simplur from "simplur" ;
23
- import {
24
- CheckingConnectionIcon ,
25
- ConnectedIcon ,
26
- DisconnectedIcon ,
27
- } from "~/assets/icons/ConnectionIcons" ;
28
- import { RunsIconExtraSmall , RunsIconSmall } from "~/assets/icons/RunsIcon" ;
23
+ import { RunsIconExtraSmall } from "~/assets/icons/RunsIcon" ;
29
24
import { TaskIconSmall } from "~/assets/icons/TaskIcon" ;
25
+ import { WaitpointTokenIcon } from "~/assets/icons/WaitpointTokenIcon" ;
30
26
import { Avatar } from "~/components/primitives/Avatar" ;
31
27
import { type MatchedEnvironment } from "~/hooks/useEnvironment" ;
32
28
import { type MatchedOrganization } from "~/hooks/useOrganizations" ;
@@ -37,7 +33,6 @@ import { type FeedbackType } from "~/routes/resources.feedback";
37
33
import { cn } from "~/utils/cn" ;
38
34
import {
39
35
accountPath ,
40
- docsPath ,
41
36
logoutPath ,
42
37
newOrganizationPath ,
43
38
newProjectPath ,
@@ -60,14 +55,11 @@ import {
60
55
v3UsagePath ,
61
56
v3WaitpointTokensPath ,
62
57
} from "~/utils/pathBuilder" ;
63
- import connectedImage from "../../assets/images/cli-connected.png" ;
64
- import disconnectedImage from "../../assets/images/cli-disconnected.png" ;
65
58
import { FreePlanUsage } from "../billing/FreePlanUsage" ;
66
- import { InlineCode } from "../code/InlineCode" ;
67
- import { useDevPresence } from "../DevPresence" ;
59
+ import { ConnectionIcon , DevPresencePanel , useDevPresence } from "../DevPresence" ;
68
60
import { ImpersonationBanner } from "../ImpersonationBanner" ;
69
61
import { Button , ButtonContent , LinkButton } from "../primitives/Buttons" ;
70
- import { Dialog , DialogContent , DialogHeader , DialogTrigger } from "../primitives/Dialog" ;
62
+ import { Dialog , DialogTrigger } from "../primitives/Dialog" ;
71
63
import { Paragraph } from "../primitives/Paragraph" ;
72
64
import {
73
65
Popover ,
@@ -78,20 +70,17 @@ import {
78
70
} from "../primitives/Popover" ;
79
71
import { TextLink } from "../primitives/TextLink" ;
80
72
import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from "../primitives/Tooltip" ;
81
- import { PackageManagerProvider , TriggerDevStepV3 } from "../SetupCommands" ;
82
73
import { UserProfilePhoto } from "../UserProfilePhoto" ;
83
74
import { EnvironmentSelector } from "./EnvironmentSelector" ;
84
75
import { HelpAndFeedback } from "./HelpAndFeedbackPopover" ;
85
76
import { SideMenuHeader } from "./SideMenuHeader" ;
86
77
import { SideMenuItem } from "./SideMenuItem" ;
87
78
import { SideMenuSection } from "./SideMenuSection" ;
88
- import { WaitpointTokenIcon } from "~/assets/icons/WaitpointTokenIcon" ;
89
- import { Spinner } from "../primitives/Spinner" ;
90
79
91
80
type SideMenuUser = Pick < User , "email" | "admin" > & { isImpersonating : boolean } ;
92
81
export type SideMenuProject = Pick <
93
82
MatchedProject ,
94
- "id" | "name" | "slug" | "version" | "environments"
83
+ "id" | "name" | "slug" | "version" | "environments" | "engine"
95
84
> ;
96
85
export type SideMenuEnvironment = MatchedEnvironment ;
97
86
@@ -115,6 +104,7 @@ export function SideMenu({
115
104
const borderRef = useRef < HTMLDivElement > ( null ) ;
116
105
const [ showHeaderDivider , setShowHeaderDivider ] = useState ( false ) ;
117
106
const currentPlan = useCurrentPlan ( ) ;
107
+ const { isConnected } = useDevPresence ( ) ;
118
108
const isFreeUser = currentPlan ?. v3Subscription ?. isPaying === false ;
119
109
120
110
useEffect ( ( ) => {
@@ -163,7 +153,33 @@ export function SideMenu({
163
153
project = { project }
164
154
environment = { environment }
165
155
/>
166
- { environment . type === "DEVELOPMENT" && < DevConnection /> }
156
+ { environment . type === "DEVELOPMENT" && project . engine === "V2" && (
157
+ < Dialog >
158
+ < TooltipProvider disableHoverableContent = { true } >
159
+ < Tooltip >
160
+ < TooltipTrigger asChild >
161
+ < div className = "inline-flex" >
162
+ < DialogTrigger asChild >
163
+ < Button
164
+ variant = "minimal/small"
165
+ className = "aspect-square h-7 p-1"
166
+ LeadingIcon = { < ConnectionIcon isConnected = { isConnected } /> }
167
+ />
168
+ </ DialogTrigger >
169
+ </ div >
170
+ </ TooltipTrigger >
171
+ < TooltipContent side = "right" className = { "text-xs" } >
172
+ { isConnected === undefined
173
+ ? "Checking connection..."
174
+ : isConnected
175
+ ? "Your dev server is connected"
176
+ : "Your dev server is not connected" }
177
+ </ TooltipContent >
178
+ </ Tooltip >
179
+ </ TooltipProvider >
180
+ < DevPresencePanel isConnected = { isConnected } />
181
+ </ Dialog >
182
+ ) }
167
183
</ div >
168
184
</ div >
169
185
@@ -522,81 +538,3 @@ function SelectorDivider() {
522
538
</ svg >
523
539
) ;
524
540
}
525
-
526
- export function DevConnection ( ) {
527
- const { isConnected } = useDevPresence ( ) ;
528
-
529
- return (
530
- < Dialog >
531
- < TooltipProvider disableHoverableContent = { true } >
532
- < Tooltip >
533
- < TooltipTrigger asChild >
534
- < div className = "inline-flex" >
535
- < DialogTrigger asChild >
536
- < Button
537
- variant = "minimal/small"
538
- className = "aspect-square h-7 p-1"
539
- LeadingIcon = {
540
- isConnected === undefined ? (
541
- < CheckingConnectionIcon className = "size-5" />
542
- ) : isConnected ? (
543
- < ConnectedIcon className = "size-5" />
544
- ) : (
545
- < DisconnectedIcon className = "size-5" />
546
- )
547
- }
548
- />
549
- </ DialogTrigger >
550
- </ div >
551
- </ TooltipTrigger >
552
- < TooltipContent side = "right" className = { "text-xs" } >
553
- { isConnected === undefined
554
- ? "Checking connection..."
555
- : isConnected
556
- ? "Your dev server is connected"
557
- : "Your dev server is not connected" }
558
- </ TooltipContent >
559
- </ Tooltip >
560
- </ TooltipProvider >
561
- < DialogContent >
562
- < DialogHeader >
563
- { isConnected === undefined
564
- ? "Checking connection..."
565
- : isConnected
566
- ? "Your dev server is connected"
567
- : "Your dev server is not connected" }
568
- </ DialogHeader >
569
- < div className = "mt-2 flex flex-col gap-3 px-2" >
570
- < div className = "flex flex-col items-center justify-center gap-6 px-6 py-10" >
571
- < img
572
- src = { isConnected === true ? connectedImage : disconnectedImage }
573
- alt = { isConnected === true ? "Connected" : "Disconnected" }
574
- width = { 282 }
575
- height = { 45 }
576
- />
577
- < Paragraph variant = "small" className = { isConnected ? "text-success" : "text-error" } >
578
- { isConnected === undefined
579
- ? "Checking connection..."
580
- : isConnected
581
- ? "Your local dev server is connected to Trigger.dev"
582
- : "Your local dev server is not connected to Trigger.dev" }
583
- </ Paragraph >
584
- </ div >
585
- { isConnected ? null : (
586
- < div className = "space-y-3" >
587
- < PackageManagerProvider >
588
- < TriggerDevStepV3 title = "Run this command to connect" />
589
- </ PackageManagerProvider >
590
- < Paragraph variant = "small" >
591
- Run this CLI < InlineCode variant = "extra-small" > dev</ InlineCode > command to connect
592
- to the Trigger.dev servers to start developing locally. Keep it running while you
593
- develop to stay connected. Learn more in the{ " " }
594
- < TextLink to = { docsPath ( "cli-dev" ) } > CLI docs</ TextLink > .
595
- </ Paragraph >
596
- </ div >
597
- ) }
598
- </ div >
599
- </ DialogContent >
600
- </ Dialog >
601
- ) ;
602
- }
0 commit comments