Skip to content

Commit 255af74

Browse files
committed
Unlock free plan state
1 parent db7bf32 commit 255af74

File tree

1 file changed

+55
-3
lines changed

1 file changed

+55
-3
lines changed

apps/webapp/app/routes/resources.orgs.$organizationSlug.select-plan.tsx

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { ArrowDownCircleIcon } from "@heroicons/react/24/outline";
99
import { Form, useLocation, useNavigation } from "@remix-run/react";
1010
import { ActionFunctionArgs } from "@remix-run/server-runtime";
1111
import { PlainClient, uiComponent } from "@team-plain/typescript-sdk";
12+
import { GitHubLightIcon } from "@trigger.dev/companyicons";
1213
import {
1314
FreePlanDefinition,
1415
Limits,
@@ -373,7 +374,55 @@ export function TierFree({
373374
</div>
374375
) : (
375376
<>
376-
{subscription?.plan?.type !== "free" && subscription?.canceledAt === undefined ? (
377+
{status === "requires_connect" ? (
378+
<Dialog>
379+
<DialogTrigger asChild>
380+
<div className="my-6">
381+
<Button
382+
type="button"
383+
variant="tertiary/large"
384+
fullWidth
385+
className="text-md font-medium"
386+
disabled={isLoading}
387+
LeadingIcon={isLoading ? Spinner : undefined}
388+
>
389+
Unlock Free plan
390+
</Button>
391+
</div>
392+
</DialogTrigger>
393+
<DialogContent className="sm:max-w-md">
394+
<Form action={formAction} method="post" id="subscribe-free">
395+
<input type="hidden" name="type" value="free" />
396+
<input type="hidden" name="callerPath" value={location.pathname} />
397+
<DialogHeader>Unlock the Free plan</DialogHeader>
398+
<div className="mb-5 mt-7 flex flex-col items-center gap-4 px-6">
399+
<GitHubLightIcon className="size-16" />
400+
<Paragraph variant="base/bright" className="text-center">
401+
To unlock the Free plan, we need to verify that you have an active GitHub
402+
account.
403+
</Paragraph>
404+
<Paragraph className="text-center">
405+
We do this to prevent malicious use of our platform. We only ask for the
406+
minimum permissions to verify your account.
407+
</Paragraph>
408+
</div>
409+
<DialogFooter>
410+
<Button
411+
variant="primary/large"
412+
fullWidth
413+
disabled={isLoading}
414+
LeadingIcon={isLoading ? Spinner : undefined}
415+
form="subscribe-free"
416+
>
417+
Connect to GitHub
418+
</Button>
419+
</DialogFooter>
420+
</Form>
421+
</DialogContent>
422+
</Dialog>
423+
) : subscription?.plan !== undefined &&
424+
subscription.plan.type !== "free" &&
425+
subscription.canceledAt === undefined ? (
377426
<Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen} key="cancel">
378427
<DialogTrigger asChild>
379428
<Button variant="tertiary/large" fullWidth className="text-md my-6 font-medium">
@@ -467,8 +516,11 @@ export function TierFree({
467516
>
468517
{subscription?.plan === undefined
469518
? "Select plan"
470-
: subscription.plan.type === "free" ||
471-
(subscription.canceledAt !== undefined && "Current plan")}
519+
: subscription.plan.type === "free"
520+
? "Current plan"
521+
: subscription.canceledAt !== undefined
522+
? "Current plan"
523+
: "Select plan"}
472524
</Button>
473525
)}
474526
<ul className="flex flex-col gap-2.5">

0 commit comments

Comments
 (0)