Skip to content

Commit f784f10

Browse files
committed
fix: railway connect form
1 parent dbc747f commit f784f10

File tree

5 files changed

+51
-43
lines changed

5 files changed

+51
-43
lines changed

frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"@tanstack/store": "^0.7.5",
8282
"@tanstack/zod-adapter": "^1.131.36",
8383
"@types/bcryptjs": "^2.4.6",
84+
"@types/canvas-confetti": "^1.9.0",
8485
"@types/escape-html": "^1.0.4",
8586
"@types/file-saver": "^2.0.7",
8687
"@types/lodash": "^4.17.20",
@@ -95,6 +96,7 @@
9596
"actor-core": "^0.6.3",
9697
"autoprefixer": "^10.4.21",
9798
"bcryptjs": "^2.4.3",
99+
"canvas-confetti": "^1.9.3",
98100
"class-variance-authority": "^0.7.1",
99101
"clsx": "^2.1.1",
100102
"cmdk": "^1.1.1",

frontend/src/app/dialogs/connect-railway-frame.tsx

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@ import {
1212
import { useEngineCompatDataProvider } from "@/components/actors";
1313
import { defineStepper } from "@/components/ui/stepper";
1414
import { cloudEnv, engineEnv } from "@/lib/env";
15+
import { NeedHelp } from "../forms/connect-vercel-form";
1516

1617
const { Stepper } = defineStepper(
1718
{
1819
id: "step-1",
1920
title: "Deploy to Railway",
2021
},
21-
{
22-
id: "step-2",
23-
title: "Set Environment Variables",
24-
},
2522
{
2623
id: "step-3",
2724
title: "Wait for a Runner to connect",
@@ -43,11 +40,6 @@ export default function ConnectRailwayFrameContent({
4340
<div>
4441
Add <Icon icon={faRailway} className="ml-0.5" /> Railway
4542
</div>
46-
<HelpDropdown>
47-
<Button variant="ghost" size="icon">
48-
<Icon icon={faQuestionCircle} />
49-
</Button>
50-
</HelpDropdown>
5143
</Frame.Title>
5244
</Frame.Header>
5345
<Frame.Content>
@@ -91,12 +83,8 @@ function FormStepper({ onClose }: { onClose?: () => void }) {
9183
</p>
9284
<a
9385
href={`https://railway.com/new/template/rivet-cloud-starter?referralCode=RC7bza&utm_medium=integration&utm_source=template&utm_campaign=generic&RIVET_TOKEN=${data}&RIVET_ENDPOINT=${
94-
__APP_TYPE__ ===
95-
"engine"
96-
? engineEnv()
97-
.VITE_APP_API_URL
98-
: cloudEnv()
99-
.VITE_APP_CLOUD_ENGINE_URL
86+
engineEnv()
87+
.VITE_APP_API_URL
10088
}&RIVET_NAMESPACE=${
10189
dataProvider.engineNamespace
10290
}`}
@@ -111,22 +99,18 @@ function FormStepper({ onClose }: { onClose?: () => void }) {
11199
/>
112100
</a>
113101

114-
<p>
115-
After deploying your app
116-
to Railway, return here
117-
to add the endpoint.
118-
</p>
102+
<EnvVariablesStep />
119103
</>
120104
)}
121-
{step.id === "step-2" && (
122-
<EnvVariablesStep />
123-
)}
124105
{step.id === "step-3" && (
125106
<div>
126107
<ConnectRailwayForm.ConnectionCheck />
127108
</div>
128109
)}
129110
<Stepper.Controls>
111+
{step.id === "step-3" ? (
112+
<NeedHelp />
113+
) : null}
130114
<Button
131115
type="button"
132116
variant="secondary"
@@ -173,12 +157,8 @@ function EnvVariablesStep() {
173157
settings.
174158
</p>
175159
<div className="gap-1 items-center grid grid-cols-2">
176-
{__APP_TYPE__ === "engine" ? (
177-
<>
178-
<DiscreteInput value="RIVET_ENDPOINT" show />
179-
<DiscreteInput value={engineEnv().VITE_APP_API_URL} />
180-
</>
181-
) : null}
160+
<DiscreteInput value="RIVET_ENDPOINT" show />
161+
<DiscreteInput value={engineEnv().VITE_APP_API_URL} />
182162
<DiscreteInput value="RIVET_TOKEN" show />
183163
{isLoading ? (
184164
<Skeleton className="w-56 h-10" />

frontend/src/app/forms/connect-railway-form.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { faCheck, faSpinnerThird, Icon } from "@rivet-gg/icons";
22
import { useInfiniteQuery } from "@tanstack/react-query";
3-
import { motion } from "framer-motion";
4-
import { useEffect, useRef } from "react";
3+
import { useEffect, useRef, useState } from "react";
54
import type { UseFormReturn } from "react-hook-form";
65
import z from "zod";
76
import { cn, createSchemaForm } from "@/components";
87
import { useEngineCompatDataProvider } from "@/components/actors";
9-
import { NeedHelp } from "./connect-vercel-form";
8+
import confetti from "canvas-confetti";
109

1110
export const formSchema = z.object({});
1211

@@ -37,15 +36,27 @@ export const ConnectionCheck = function ConnectionCheck() {
3736
const success =
3837
data !== undefined && data > 0 && data !== lastCount.current;
3938

39+
useEffect(() => {
40+
if(success){
41+
confetti({
42+
angle: 60,
43+
spread: 55,
44+
origin: { x: 0 },
45+
});
46+
confetti({
47+
angle: 120,
48+
spread: 55,
49+
origin: { x: 1 },
50+
});
51+
}
52+
}, [success])
53+
4054
return (
41-
<motion.div
42-
layoutId="msg"
55+
<div
4356
className={cn(
44-
"text-center text-muted-foreground text-sm overflow-hidden flex items-center justify-center",
57+
"text-center h-24 text-muted-foreground text-sm overflow-hidden flex items-center justify-center",
4558
success && "text-primary-foreground",
4659
)}
47-
initial={{ height: 0, opacity: 0.5 }}
48-
animate={{ height: "6rem", opacity: 1 }}
4960
>
5061
{success ? (
5162
<>
@@ -61,9 +72,8 @@ export const ConnectionCheck = function ConnectionCheck() {
6172
/>{" "}
6273
Waiting for Runner to connect...
6374
</div>
64-
<NeedHelp />
6575
</div>
6676
)}
67-
</motion.div>
77+
</div>
6878
);
6979
};

frontend/src/app/forms/connect-vercel-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export function NeedHelp() {
230230

231231
return (
232232
<HelpDropdown>
233-
<Button variant="outline">Need help?</Button>
233+
<Button variant="ghost">Need help?</Button>
234234
</HelpDropdown>
235235
);
236236
}

pnpm-lock.yaml

Lines changed: 19 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)