Skip to content

Commit 17fdf8b

Browse files
committed
fix: bolts, rivets and nits (#3197)
1 parent 711bebd commit 17fdf8b

38 files changed

+2444
-425
lines changed

frontend/src/app/actor-builds-list.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function ActorBuildsList() {
5050

5151
search: (old) => ({
5252
...old,
53+
actorId: undefined,
5354
n: [build.name],
5455
}),
5556
});
@@ -58,7 +59,11 @@ export function ActorBuildsList() {
5859
>
5960
<Link
6061
to="."
61-
search={(old) => ({ ...old, n: [build.name] })}
62+
search={(old) => ({
63+
...old,
64+
actorId: undefined,
65+
n: [build.name],
66+
})}
6267
>
6368
<span className="text-ellipsis overflow-hidden whitespace-nowrap">
6469
{build.name}

frontend/src/app/billing/plan-card.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,22 @@ function PlanCard({
5757
))}
5858
</ul>
5959
</div>
60-
{current ? (
61-
<Button
62-
variant="secondary"
63-
className="w-full mt-4"
64-
children="Current Plan"
65-
{...buttonProps}
66-
></Button>
67-
) : (
68-
<Button
69-
className="w-full mt-4"
70-
children={<>{custom ? "Contact Us" : "Upgrade"}</>}
71-
{...buttonProps}
72-
/>
73-
)}
60+
{!buttonProps?.hidden ? (
61+
current ? (
62+
<Button
63+
variant="secondary"
64+
className="w-full mt-4"
65+
children="Current Plan"
66+
{...buttonProps}
67+
></Button>
68+
) : (
69+
<Button
70+
className="w-full mt-4"
71+
children={<>{custom ? "Contact Us" : "Upgrade"}</>}
72+
{...buttonProps}
73+
/>
74+
)
75+
) : null}
7476
</div>
7577
);
7678
}

frontend/src/app/connect.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { faNodeJs, faReact, Icon } from "@rivet-gg/icons";
1+
import { faNextjs, faNodeJs, faReact, Icon } from "@rivet-gg/icons";
22
import { useSearch } from "@tanstack/react-router";
33
import type { ComponentProps, Ref } from "react";
44
import {
@@ -54,6 +54,19 @@ export function Connect({
5454
React
5555
</Button>
5656
</DocsSheet>
57+
58+
<DocsSheet
59+
path={docsLinks.gettingStarted.nextjs}
60+
title="Next.js Quickstart"
61+
>
62+
<Button
63+
className="flex-1"
64+
variant="outline"
65+
startIcon={<Icon icon={faNextjs} />}
66+
>
67+
Next.js
68+
</Button>
69+
</DocsSheet>
5770
</div>
5871
</div>
5972
</CardContent>

frontend/src/app/data-providers/engine-data-provider.tsx

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { type Rivet, RivetClient } from "@rivetkit/engine-api-full";
22
import { type FetchFunction, fetcher } from "@rivetkit/engine-api-full/core";
3-
import { infiniteQueryOptions, queryOptions } from "@tanstack/react-query";
3+
import {
4+
infiniteQueryOptions,
5+
mutationOptions,
6+
queryOptions,
7+
} from "@tanstack/react-query";
48
import { getConfig, ls } from "@/components";
59
import {
610
type Actor,
@@ -10,6 +14,7 @@ import {
1014
} from "@/components/actors";
1115
import { engineEnv } from "@/lib/env";
1216
import { convertStringToId } from "@/lib/utils";
17+
import { queryClient } from "@/queries/global";
1318
import { noThrow, shouldRetryAllExpect403 } from "@/queries/utils";
1419
import {
1520
ActorQueryOptionsSchema,
@@ -505,7 +510,7 @@ export const createNamespaceContext = ({
505510
},
506511
});
507512
},
508-
runnerByNameQueryOptions(opts: { runnerName: string }) {
513+
runnerByNameQueryOptions(opts: { runnerName: string | undefined }) {
509514
return queryOptions({
510515
queryKey: [{ namespace }, "runner", opts.runnerName],
511516
enabled: !!opts.runnerName,
@@ -532,7 +537,7 @@ export const createNamespaceContext = ({
532537
onSuccess?: (data: Rivet.RunnerConfigsUpsertResponse) => void;
533538
} = {},
534539
) {
535-
return {
540+
return mutationOptions({
536541
...opts,
537542
mutationKey: ["runner-config"],
538543
mutationFn: async ({
@@ -552,7 +557,7 @@ export const createNamespaceContext = ({
552557
meta: {
553558
mightRequireAuth,
554559
},
555-
};
560+
});
556561
},
557562
deleteRunnerConfigMutationOptions(
558563
opts: { onSuccess?: (data: void) => void } = {},
@@ -569,16 +574,19 @@ export const createNamespaceContext = ({
569574
},
570575
};
571576
},
572-
runnerConfigsQueryOptions() {
577+
runnerConfigsQueryOptions(opts?: {
578+
variant?: Rivet.RunnerConfigVariant;
579+
}) {
573580
return infiniteQueryOptions({
574-
queryKey: [{ namespace }, "runners", "configs"],
581+
queryKey: [{ namespace }, "runners", "configs", opts],
575582
initialPageParam: undefined as string | undefined,
576583
queryFn: async ({ signal: abortSignal, pageParam }) => {
577584
const response = await client.runnerConfigs.list(
578585
{
579586
namespace,
580587
cursor: pageParam ?? undefined,
581588
limit: RECORDS_PER_PAGE,
589+
variant: opts?.variant,
582590
},
583591
{ abortSignal },
584592
);
@@ -608,20 +616,24 @@ export const createNamespaceContext = ({
608616
});
609617
},
610618

611-
runnerConfigQueryOptions(runnerName: string) {
619+
runnerConfigQueryOptions(opts: {
620+
name: string | undefined;
621+
variant?: Rivet.RunnerConfigVariant;
622+
}) {
612623
return queryOptions({
613-
queryKey: [{ namespace }, "runners", "config", runnerName],
614-
enabled: !!runnerName,
624+
queryKey: [{ namespace }, "runners", "config", opts],
625+
enabled: !!opts.name,
615626
queryFn: async ({ signal: abortSignal }) => {
616627
const response = await client.runnerConfigs.list(
617628
{
618629
namespace,
619-
runnerNames: runnerName,
630+
runnerNames: opts.name,
631+
variant: opts.variant,
620632
},
621633
{ abortSignal },
622634
);
623635

624-
const config = response.runnerConfigs[runnerName];
636+
const config = response.runnerConfigs[opts.name!];
625637

626638
if (!config) {
627639
throw new Error("Runner config not found");

frontend/src/app/dialogs/billing-frame.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,19 @@ export default function BillingFrameContent() {
8989
) : null}
9090
{!billing?.canChangePlan ? (
9191
// organization does not have a payment method, ask them to add one
92-
<span className="font-medium">
92+
<span className="font-bold text-destructive">
9393
You cannot change plans until you add a
9494
payment method to your organization.
9595
</span>
9696
) : null}
9797
</p>
9898
</div>
9999

100-
<BillingDetailsButton variant="secondary">
100+
<BillingDetailsButton
101+
variant={
102+
billing?.canChangePlan ? "secondary" : "default"
103+
}
104+
>
101105
Manage billing details
102106
</BillingDetailsButton>
103107
</div>
@@ -119,6 +123,7 @@ export default function BillingFrameContent() {
119123
isPending,
120124
isLoading:
121125
variables?.__from === plan && isPending,
126+
hidden: config.buttonProps.hidden,
122127
onClick: () => {
123128
if (billing.futurePlan === plan) {
124129
return mutate({
@@ -168,6 +173,7 @@ function getConfig(
168173
children: buttonText(plan, billing),
169174
variant: buttonVariant(plan, billing),
170175
disabled: !billing?.canChangePlan || buttonDisabled(plan, billing),
176+
hidden: buttonHidden(plan, billing),
171177
},
172178
};
173179
}
@@ -212,6 +218,13 @@ function buttonText(
212218
return comparePlans(plan, data.futurePlan) > 0 ? "Upgrade" : "Downgrade";
213219
}
214220

221+
function buttonHidden(
222+
plan: Rivet.BillingPlan,
223+
data: Rivet.BillingDetailsResponse.Billing,
224+
) {
225+
return plan === data.activePlan && plan === Rivet.BillingPlan.Free;
226+
}
227+
215228
export function comparePlans(
216229
a: Rivet.BillingPlan,
217230
b: Rivet.BillingPlan,

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { faHetzner, Icon } from "@rivet-gg/icons";
1+
import { faHetznerH, Icon } from "@rivet-gg/icons";
22
import { type DialogContentProps, Frame } from "@/components";
33
import ConnectManualServerlfullFrameContent from "./connect-manual-serverfull-frame";
44

@@ -12,7 +12,8 @@ export default function ConnectHetznerFrameContent({
1212
<Frame.Header>
1313
<Frame.Title className="gap-2 flex items-center">
1414
<div>
15-
Add <Icon icon={faHetzner} className="ml-0.5" /> Hetzner
15+
Add <Icon icon={faHetznerH} className="ml-0.5" />{" "}
16+
Hetzner
1617
</div>
1718
</Frame.Title>
1819
</Frame.Header>

frontend/src/app/dialogs/connect-manual-serverfull-frame.tsx

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from "@tanstack/react-query";
88
import confetti from "canvas-confetti";
99
import { useWatch } from "react-hook-form";
10+
import { match } from "ts-pattern";
1011
import z from "zod";
1112
import * as ConnectRailwayForm from "@/app/forms/connect-manual-serverfull-form";
1213
import {
@@ -129,9 +130,9 @@ function FormStepper({
129130
let existing: Record<string, Rivet.RunnerConfig> = {};
130131
try {
131132
const runnerConfig = await queryClient.fetchQuery(
132-
dataProvider.runnerConfigQueryOptions(
133-
values.runnerName,
134-
),
133+
dataProvider.runnerConfigQueryOptions({
134+
name: values.runnerName,
135+
}),
135136
);
136137
existing = runnerConfig?.datacenters || {};
137138
} catch {
@@ -156,7 +157,7 @@ function FormStepper({
156157
}}
157158
content={{
158159
"step-1": () => <Step1 />,
159-
"step-2": () => <Step2 />,
160+
"step-2": () => <Step2 provider={provider} />,
160161
"step-3": () => <Step3 />,
161162
}}
162163
/>
@@ -230,13 +231,56 @@ function Step1() {
230231
);
231232
}
232233

233-
function Step2() {
234+
function Step2({ provider }: { provider: string }) {
234235
return (
235236
<>
236-
<p>
237-
Set the following environment variables in your project
238-
settings.
239-
</p>
237+
{match(provider)
238+
.with("aws", () => (
239+
<p>
240+
<a
241+
href="https://www.rivet.dev/docs/deploy/aws-ecs/"
242+
className="underline"
243+
target="_blank"
244+
rel="noopener"
245+
>
246+
Follow the integration guide here
247+
</a>
248+
, and make sure to set the following environment
249+
variables:
250+
</p>
251+
))
252+
.with("hetzner", () => (
253+
<p>
254+
<a
255+
href="https://www.rivet.dev/docs/deploy/hetzner/"
256+
className="underline"
257+
target="_blank"
258+
rel="noopener"
259+
>
260+
Follow the integration guide here
261+
</a>
262+
, and make sure to set the following environment
263+
variables:
264+
</p>
265+
))
266+
.with("gcp", () => (
267+
<p>
268+
<a
269+
href="https://www.rivet.dev/docs/deploy/gcp-cloud-run/"
270+
className="underline"
271+
target="_blank"
272+
rel="noopener"
273+
>
274+
Follow the integration guide here
275+
</a>
276+
, and make sure to set the following environment
277+
variables:
278+
</p>
279+
))
280+
.otherwise(() => (
281+
<p>Set the following environment variables.</p>
282+
))}
283+
240284
<EnvVariablesStep />
241285
</>
242286
);

frontend/src/app/dialogs/connect-manual-serverless-frame.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function FormStepper({
117117
let existing: Record<string, Rivet.RunnerConfig> = {};
118118
try {
119119
const runnerConfig = await queryClient.fetchQuery(
120-
provider.runnerConfigQueryOptions(values.runnerName),
120+
provider.runnerConfigQueryOptions({name: values.runnerName}),
121121
);
122122
existing = runnerConfig?.datacenters || {};
123123
} catch {

0 commit comments

Comments
 (0)