@@ -20,13 +20,9 @@ import {
2020import { useNavigation } from "@remix-run/react" ;
2121import { useEffect , useRef , useState , type ReactNode } from "react" ;
2222import 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" ;
2924import { TaskIconSmall } from "~/assets/icons/TaskIcon" ;
25+ import { WaitpointTokenIcon } from "~/assets/icons/WaitpointTokenIcon" ;
3026import { Avatar } from "~/components/primitives/Avatar" ;
3127import { type MatchedEnvironment } from "~/hooks/useEnvironment" ;
3228import { type MatchedOrganization } from "~/hooks/useOrganizations" ;
@@ -37,7 +33,6 @@ import { type FeedbackType } from "~/routes/resources.feedback";
3733import { cn } from "~/utils/cn" ;
3834import {
3935 accountPath ,
40- docsPath ,
4136 logoutPath ,
4237 newOrganizationPath ,
4338 newProjectPath ,
@@ -60,14 +55,11 @@ import {
6055 v3UsagePath ,
6156 v3WaitpointTokensPath ,
6257} from "~/utils/pathBuilder" ;
63- import connectedImage from "../../assets/images/cli-connected.png" ;
64- import disconnectedImage from "../../assets/images/cli-disconnected.png" ;
6558import { FreePlanUsage } from "../billing/FreePlanUsage" ;
66- import { InlineCode } from "../code/InlineCode" ;
67- import { useDevPresence } from "../DevPresence" ;
59+ import { ConnectionIcon , DevPresencePanel , useDevPresence } from "../DevPresence" ;
6860import { ImpersonationBanner } from "../ImpersonationBanner" ;
6961import { Button , ButtonContent , LinkButton } from "../primitives/Buttons" ;
70- import { Dialog , DialogContent , DialogHeader , DialogTrigger } from "../primitives/Dialog" ;
62+ import { Dialog , DialogTrigger } from "../primitives/Dialog" ;
7163import { Paragraph } from "../primitives/Paragraph" ;
7264import {
7365 Popover ,
@@ -78,20 +70,17 @@ import {
7870} from "../primitives/Popover" ;
7971import { TextLink } from "../primitives/TextLink" ;
8072import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from "../primitives/Tooltip" ;
81- import { PackageManagerProvider , TriggerDevStepV3 } from "../SetupCommands" ;
8273import { UserProfilePhoto } from "../UserProfilePhoto" ;
8374import { EnvironmentSelector } from "./EnvironmentSelector" ;
8475import { HelpAndFeedback } from "./HelpAndFeedbackPopover" ;
8576import { SideMenuHeader } from "./SideMenuHeader" ;
8677import { SideMenuItem } from "./SideMenuItem" ;
8778import { SideMenuSection } from "./SideMenuSection" ;
88- import { WaitpointTokenIcon } from "~/assets/icons/WaitpointTokenIcon" ;
89- import { Spinner } from "../primitives/Spinner" ;
9079
9180type SideMenuUser = Pick < User , "email" | "admin" > & { isImpersonating : boolean } ;
9281export type SideMenuProject = Pick <
9382 MatchedProject ,
94- "id" | "name" | "slug" | "version" | "environments"
83+ "id" | "name" | "slug" | "version" | "environments" | "engine"
9584> ;
9685export type SideMenuEnvironment = MatchedEnvironment ;
9786
@@ -115,6 +104,7 @@ export function SideMenu({
115104 const borderRef = useRef < HTMLDivElement > ( null ) ;
116105 const [ showHeaderDivider , setShowHeaderDivider ] = useState ( false ) ;
117106 const currentPlan = useCurrentPlan ( ) ;
107+ const { isConnected } = useDevPresence ( ) ;
118108 const isFreeUser = currentPlan ?. v3Subscription ?. isPaying === false ;
119109
120110 useEffect ( ( ) => {
@@ -163,7 +153,33 @@ export function SideMenu({
163153 project = { project }
164154 environment = { environment }
165155 />
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+ ) }
167183 </ div >
168184 </ div >
169185
@@ -522,81 +538,3 @@ function SelectorDivider() {
522538 </ svg >
523539 ) ;
524540}
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