diff --git a/apps/webapp/app/components/SetupCommands.tsx b/apps/webapp/app/components/SetupCommands.tsx index 4071444ee3..dcfae4f88b 100644 --- a/apps/webapp/app/components/SetupCommands.tsx +++ b/apps/webapp/app/components/SetupCommands.tsx @@ -1,3 +1,5 @@ +import { createContext, useContext, useState } from "react"; +import { useAppOrigin } from "~/hooks/useAppOrigin"; import { useProject } from "~/hooks/useProject"; import { InlineCode } from "./code/InlineCode"; import { @@ -8,7 +10,31 @@ import { } from "./primitives/ClientTabs"; import { ClipboardField } from "./primitives/ClipboardField"; import { Paragraph } from "./primitives/Paragraph"; -import { useAppOrigin } from "~/hooks/useAppOrigin"; + +type PackageManagerContextType = { + activePackageManager: string; + setActivePackageManager: (value: string) => void; +}; + +const PackageManagerContext = createContext(undefined); + +export function PackageManagerProvider({ children }: { children: React.ReactNode }) { + const [activePackageManager, setActivePackageManager] = useState("npm"); + + return ( + + {children} + + ); +} + +function usePackageManager() { + const context = useContext(PackageManagerContext); + if (context === undefined) { + throw new Error("usePackageManager must be used within a PackageManagerProvider"); + } + return context; +} export function InitCommand({ appOrigin, apiKey }: { appOrigin: string; apiKey: string }) { return ( @@ -131,7 +157,6 @@ export function TriggerDevStep({ extra }: { extra?: string }) { ); } -// Trigger.dev version 3 setup commands const v3PackageTag = "latest"; function getApiUrlArg() { @@ -160,14 +185,19 @@ function getApiUrlArg() { export function InitCommandV3() { const project = useProject(); const projectRef = project.ref; - const apiUrlArg = getApiUrlArg(); const initCommandParts = [`trigger.dev@${v3PackageTag}`, "init", `-p ${projectRef}`, apiUrlArg]; const initCommand = initCommandParts.filter(Boolean).join(" "); + const { activePackageManager, setActivePackageManager } = usePackageManager(); + return ( - + npm pnpm @@ -202,8 +232,14 @@ export function InitCommandV3() { } export function TriggerDevStepV3() { + const { activePackageManager, setActivePackageManager } = usePackageManager(); + return ( - + npm pnpm @@ -238,8 +274,14 @@ export function TriggerDevStepV3() { } export function TriggerLoginStepV3() { + const { activePackageManager, setActivePackageManager } = usePackageManager(); + return ( - + npm pnpm diff --git a/apps/webapp/app/components/primitives/ClientTabs.tsx b/apps/webapp/app/components/primitives/ClientTabs.tsx index c8ac014dd3..52d10b8cfe 100644 --- a/apps/webapp/app/components/primitives/ClientTabs.tsx +++ b/apps/webapp/app/components/primitives/ClientTabs.tsx @@ -5,7 +5,11 @@ import * as TabsPrimitive from "@radix-ui/react-tabs"; import { cn } from "~/utils/cn"; import { motion } from "framer-motion"; -const ClientTabs = TabsPrimitive.Root; +const ClientTabs = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>((props, ref) => ); +ClientTabs.displayName = TabsPrimitive.Root.displayName; const ClientTabsList = React.forwardRef< React.ElementRef, diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam._index/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam._index/route.tsx index 74d5ca966c..69c63e5148 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam._index/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam._index/route.tsx @@ -20,7 +20,12 @@ import { TypedAwait, typeddefer, useTypedLoaderData } from "remix-typedjson"; import { ExitIcon } from "~/assets/icons/ExitIcon"; import { TaskIcon } from "~/assets/icons/TaskIcon"; import { Feedback } from "~/components/Feedback"; -import { InitCommandV3, TriggerDevStepV3, TriggerLoginStepV3 } from "~/components/SetupCommands"; +import { + InitCommandV3, + PackageManagerProvider, + TriggerDevStepV3, + TriggerLoginStepV3, +} from "~/components/SetupCommands"; import { StepContentContainer } from "~/components/StepContentContainer"; import { AdminDebugTooltip } from "~/components/admin/debugTooltip"; import { InlineCode } from "~/components/code/InlineCode"; @@ -431,38 +436,40 @@ export default function Page() { function CreateTaskInstructions() { return ( -
-
- Get setup in 3 minutes -
- - I'm stuck! - - } - defaultValue="help" - /> + +
+
+ Get setup in 3 minutes +
+ + I'm stuck! + + } + defaultValue="help" + /> +
+ + + + + You'll notice a new folder in your project called{" "} + trigger. We've added a very simple example task + in here to help you get started. + + + + + + + + + This page will automatically refresh. +
- - - - - You’ll notice a new folder in your project called{" "} - trigger. We’ve added a very simple example task - in here to help you get started. - - - - - - - - - This page will automatically refresh. - -
+ ); } @@ -484,26 +491,28 @@ function UserHasNoTasks() { } > {open ? ( -
- Get setup in 3 minutes - - - - You'll need to open a terminal at the root of your project. - - - - - - - - - - - - This page will automatically refresh. - -
+ +
+ Get setup in 3 minutes + + + + You'll need to open a terminal at the root of your project. + + + + + + + + + + + + This page will automatically refresh. + +
+
) : ( "Your DEV environment isn't setup yet." )}