@@ -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,12 @@ 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" ;
58
+
65
59
import { FreePlanUsage } from "../billing/FreePlanUsage" ;
66
- import { InlineCode } from "../code/InlineCode" ;
67
- import { useDevPresence } from "../DevPresence" ;
60
+ import { ConnectionIcon , DevConnection } from "../DevPresence" ;
68
61
import { ImpersonationBanner } from "../ImpersonationBanner" ;
69
62
import { Button , ButtonContent , LinkButton } from "../primitives/Buttons" ;
70
- import { Dialog , DialogContent , DialogHeader , DialogTrigger } from "../primitives/Dialog" ;
63
+ import { DialogTrigger } from "../primitives/Dialog" ;
71
64
import { Paragraph } from "../primitives/Paragraph" ;
72
65
import {
73
66
Popover ,
@@ -78,15 +71,12 @@ import {
78
71
} from "../primitives/Popover" ;
79
72
import { TextLink } from "../primitives/TextLink" ;
80
73
import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from "../primitives/Tooltip" ;
81
- import { PackageManagerProvider , TriggerDevStepV3 } from "../SetupCommands" ;
82
74
import { UserProfilePhoto } from "../UserProfilePhoto" ;
83
75
import { EnvironmentSelector } from "./EnvironmentSelector" ;
84
76
import { HelpAndFeedback } from "./HelpAndFeedbackPopover" ;
85
77
import { SideMenuHeader } from "./SideMenuHeader" ;
86
78
import { SideMenuItem } from "./SideMenuItem" ;
87
79
import { SideMenuSection } from "./SideMenuSection" ;
88
- import { WaitpointTokenIcon } from "~/assets/icons/WaitpointTokenIcon" ;
89
- import { Spinner } from "../primitives/Spinner" ;
90
80
91
81
type SideMenuUser = Pick < User , "email" | "admin" > & { isImpersonating : boolean } ;
92
82
export type SideMenuProject = Pick <
@@ -163,7 +153,34 @@ export function SideMenu({
163
153
project = { project }
164
154
environment = { environment }
165
155
/>
166
- { environment . type === "DEVELOPMENT" && < DevConnection /> }
156
+ { environment . type === "DEVELOPMENT" && (
157
+ < DevConnection >
158
+ { ( { isConnected } ) => (
159
+ < TooltipProvider disableHoverableContent = { true } >
160
+ < Tooltip >
161
+ < TooltipTrigger asChild >
162
+ < div className = "inline-flex" >
163
+ < DialogTrigger asChild >
164
+ < Button
165
+ variant = "minimal/small"
166
+ className = "aspect-square h-7 p-1"
167
+ LeadingIcon = { < ConnectionIcon isConnected = { isConnected } /> }
168
+ />
169
+ </ DialogTrigger >
170
+ </ div >
171
+ </ TooltipTrigger >
172
+ < TooltipContent side = "right" className = { "text-xs" } >
173
+ { isConnected === undefined
174
+ ? "Checking connection..."
175
+ : isConnected
176
+ ? "Your dev server is connected"
177
+ : "Your dev server is not connected" }
178
+ </ TooltipContent >
179
+ </ Tooltip >
180
+ </ TooltipProvider >
181
+ ) }
182
+ </ DevConnection >
183
+ ) }
167
184
</ div >
168
185
</ div >
169
186
@@ -522,81 +539,3 @@ function SelectorDivider() {
522
539
</ svg >
523
540
) ;
524
541
}
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