Skip to content

Commit 708e765

Browse files
committed
Update the Org creation route with new questions
1 parent 38a9ee3 commit 708e765

1 file changed

Lines changed: 40 additions & 64 deletions

File tree

  • apps/webapp/app/routes/_app.orgs.new

apps/webapp/app/routes/_app.orgs.new/route.tsx

Lines changed: 40 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { conform, useForm } from "@conform-to/react";
22
import { parse } from "@conform-to/zod";
33
import { BuildingOffice2Icon } from "@heroicons/react/20/solid";
44
import { RadioGroup } from "@radix-ui/react-radio-group";
5-
import type { ActionFunction, LoaderFunctionArgs } from "@remix-run/node";
6-
import { json, redirect } from "@remix-run/node";
5+
import { json, redirect, type ActionFunction, type LoaderFunctionArgs } from "@remix-run/node";
76
import { Form, useActionData, useNavigation } from "@remix-run/react";
87
import { typedjson, useTypedLoaderData } from "remix-typedjson";
98
import { z } from "zod";
@@ -19,18 +18,15 @@ import { Input } from "~/components/primitives/Input";
1918
import { InputGroup } from "~/components/primitives/InputGroup";
2019
import { Label } from "~/components/primitives/Label";
2120
import { RadioGroupItem } from "~/components/primitives/RadioButton";
22-
import { TextArea } from "~/components/primitives/TextArea";
2321
import { useFeatures } from "~/hooks/useFeatures";
2422
import { createOrganization } from "~/models/organization.server";
2523
import { NewOrganizationPresenter } from "~/presenters/NewOrganizationPresenter.server";
2624
import { requireUser, requireUserId } from "~/services/session.server";
27-
import { sendNewOrgMessage } from "~/services/slack.server";
2825
import { organizationPath, rootPath } from "~/utils/pathBuilder";
2926

3027
const schema = z.object({
3128
orgName: z.string().min(3).max(50),
3229
companySize: z.string().optional(),
33-
whyUseUs: z.string().optional(),
3430
});
3531

3632
export const loader = async ({ request }: LoaderFunctionArgs) => {
@@ -53,31 +49,21 @@ export const action: ActionFunction = async ({ request }) => {
5349
}
5450

5551
try {
52+
const companySize = submission.value.companySize ?? null;
53+
5654
const organization = await createOrganization({
5755
title: submission.value.orgName,
5856
userId: user.id,
59-
companySize: submission.value.companySize ?? null,
57+
companySize,
6058
});
6159

62-
const whyUseUs = formData.get("whyUseUs");
63-
64-
if (whyUseUs) {
65-
await sendNewOrgMessage({
66-
orgName: submission.value.orgName,
67-
whyUseUs: whyUseUs.toString(),
68-
userEmail: user.email,
69-
});
70-
}
71-
72-
// Preserve Vercel integration params if present
7360
const url = new URL(request.url);
7461
const code = url.searchParams.get("code");
7562
const configurationId = url.searchParams.get("configurationId");
7663
const integration = url.searchParams.get("integration");
7764
const next = url.searchParams.get("next");
7865

7966
if (code && configurationId && integration === "vercel") {
80-
// Redirect to projects/new with params preserved
8167
const params = new URLSearchParams({
8268
code,
8369
configurationId,
@@ -104,7 +90,6 @@ export default function NewOrganizationPage() {
10490

10591
const [form, { orgName }] = useForm({
10692
id: "create-organization",
107-
// TODO: type this
10893
lastSubmission: lastSubmission as any,
10994
onValidate({ formData }) {
11095
return parse(formData, { schema });
@@ -137,51 +122,42 @@ export default function NewOrganizationPage() {
137122
<FormError id={orgName.errorId}>{orgName.error}</FormError>
138123
</InputGroup>
139124
{isManagedCloud && (
140-
<>
141-
<InputGroup>
142-
<Label htmlFor={"companySize"}>Number of employees</Label>
143-
<RadioGroup
144-
name="companySize"
145-
className="flex items-center justify-between gap-2"
146-
>
147-
<RadioGroupItem
148-
id="employees-1-5"
149-
label="1-5"
150-
value={"1-5"}
151-
variant="button/small"
152-
className="grow"
153-
/>
154-
<RadioGroupItem
155-
id="employees-6-49"
156-
label="6-49"
157-
value={"6-49"}
158-
variant="button/small"
159-
className="grow"
160-
/>
161-
<RadioGroupItem
162-
id="employees-50-99"
163-
label="50-99"
164-
value={"50-99"}
165-
variant="button/small"
166-
className="grow"
167-
/>
168-
<RadioGroupItem
169-
id="employees-100+"
170-
label="100+"
171-
value={"100+"}
172-
variant="button/small"
173-
className="grow"
174-
/>
175-
</RadioGroup>
176-
</InputGroup>
177-
<InputGroup>
178-
<Label htmlFor={"whyUseUs"}>What problem are you trying to solve?</Label>
179-
<TextArea name="whyUseUs" rows={4} spellCheck={false} />
180-
<Hint>
181-
Your answer will help us understand your use case and provide better support.
182-
</Hint>
183-
</InputGroup>
184-
</>
125+
<InputGroup>
126+
<Label htmlFor={"companySize"}>Number of employees</Label>
127+
<RadioGroup
128+
name="companySize"
129+
className="flex items-center justify-between gap-2"
130+
>
131+
<RadioGroupItem
132+
id="employees-1-5"
133+
label="1-5"
134+
value={"1-5"}
135+
variant="button/small"
136+
className="grow"
137+
/>
138+
<RadioGroupItem
139+
id="employees-6-49"
140+
label="6-49"
141+
value={"6-49"}
142+
variant="button/small"
143+
className="grow"
144+
/>
145+
<RadioGroupItem
146+
id="employees-50-99"
147+
label="50-99"
148+
value={"50-99"}
149+
variant="button/small"
150+
className="grow"
151+
/>
152+
<RadioGroupItem
153+
id="employees-100+"
154+
label="100+"
155+
value={"100+"}
156+
variant="button/small"
157+
className="grow"
158+
/>
159+
</RadioGroup>
160+
</InputGroup>
185161
)}
186162

187163
<FormButtons

0 commit comments

Comments
 (0)