Skip to content

Commit 50e42c2

Browse files
TheodoreSpeaksTheodore Li
andauthored
fix(ui): Change modal field to be company size (#3801)
* Change modal field to be company size * Adjust dropdown options * Fix lint --------- Co-authored-by: Theodore Li <theo@sim.ai>
1 parent e70e1ec commit 50e42c2

File tree

3 files changed

+29
-27
lines changed

3 files changed

+29
-27
lines changed

apps/sim/app/(home)/components/demo-request/consts.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ export const DEMO_REQUEST_REGION_VALUES = [
1414
'other',
1515
] as const
1616

17-
export const DEMO_REQUEST_USER_COUNT_VALUES = [
17+
export const DEMO_REQUEST_COMPANY_SIZE_VALUES = [
1818
'1_10',
1919
'11_50',
2020
'51_200',
2121
'201_500',
2222
'501_1000',
23-
'1000_plus',
23+
'1001_10000',
24+
'10000_plus',
2425
] as const
2526

2627
export const DEMO_REQUEST_REGION_OPTIONS = [
@@ -32,13 +33,14 @@ export const DEMO_REQUEST_REGION_OPTIONS = [
3233
{ value: 'other', label: 'Other' },
3334
] as const
3435

35-
export const DEMO_REQUEST_USER_COUNT_OPTIONS = [
36-
{ value: '1_10', label: '1-10' },
37-
{ value: '11_50', label: '11-50' },
38-
{ value: '51_200', label: '51-200' },
39-
{ value: '201_500', label: '201-500' },
40-
{ value: '501_1000', label: '501-1,000' },
41-
{ value: '1000_plus', label: '1,000+' },
36+
export const DEMO_REQUEST_COMPANY_SIZE_OPTIONS = [
37+
{ value: '1_10', label: '1–10' },
38+
{ value: '11_50', label: '11–50' },
39+
{ value: '51_200', label: '51–200' },
40+
{ value: '201_500', label: '201–500' },
41+
{ value: '501_1000', label: '501–1,000' },
42+
{ value: '1001_10000', label: '1,001–10,000' },
43+
{ value: '10000_plus', label: '10,000+' },
4244
] as const
4345

4446
export const demoRequestSchema = z.object({
@@ -74,8 +76,8 @@ export const demoRequestSchema = z.object({
7476
region: z.enum(DEMO_REQUEST_REGION_VALUES, {
7577
errorMap: () => ({ message: 'Please select a region' }),
7678
}),
77-
userCount: z.enum(DEMO_REQUEST_USER_COUNT_VALUES, {
78-
errorMap: () => ({ message: 'Please select the number of users' }),
79+
companySize: z.enum(DEMO_REQUEST_COMPANY_SIZE_VALUES, {
80+
errorMap: () => ({ message: 'Please select company size' }),
7981
}),
8082
details: z.string().trim().min(1, 'Details are required').max(2000),
8183
})
@@ -86,6 +88,6 @@ export function getDemoRequestRegionLabel(value: DemoRequestPayload['region']):
8688
return DEMO_REQUEST_REGION_OPTIONS.find((option) => option.value === value)?.label ?? value
8789
}
8890

89-
export function getDemoRequestUserCountLabel(value: DemoRequestPayload['userCount']): string {
90-
return DEMO_REQUEST_USER_COUNT_OPTIONS.find((option) => option.value === value)?.label ?? value
91+
export function getDemoRequestCompanySizeLabel(value: DemoRequestPayload['companySize']): string {
92+
return DEMO_REQUEST_COMPANY_SIZE_OPTIONS.find((option) => option.value === value)?.label ?? value
9193
}

apps/sim/app/(home)/components/demo-request/demo-request-modal.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {
1616
} from '@/components/emcn'
1717
import { Check } from '@/components/emcn/icons'
1818
import {
19+
DEMO_REQUEST_COMPANY_SIZE_OPTIONS,
1920
DEMO_REQUEST_REGION_OPTIONS,
20-
DEMO_REQUEST_USER_COUNT_OPTIONS,
2121
type DemoRequestPayload,
2222
demoRequestSchema,
2323
} from '@/app/(home)/components/demo-request/consts'
@@ -36,21 +36,21 @@ interface DemoRequestFormState {
3636
companyEmail: string
3737
phoneNumber: string
3838
region: DemoRequestPayload['region'] | ''
39-
userCount: DemoRequestPayload['userCount'] | ''
39+
companySize: DemoRequestPayload['companySize'] | ''
4040
details: string
4141
}
4242

4343
const SUBMIT_SUCCESS_MESSAGE = "We'll be in touch soon!"
4444
const COMBOBOX_REGIONS = [...DEMO_REQUEST_REGION_OPTIONS]
45-
const COMBOBOX_USER_COUNTS = [...DEMO_REQUEST_USER_COUNT_OPTIONS]
45+
const COMBOBOX_COMPANY_SIZES = [...DEMO_REQUEST_COMPANY_SIZE_OPTIONS]
4646

4747
const INITIAL_FORM_STATE: DemoRequestFormState = {
4848
firstName: '',
4949
lastName: '',
5050
companyEmail: '',
5151
phoneNumber: '',
5252
region: '',
53-
userCount: '',
53+
companySize: '',
5454
details: '',
5555
}
5656

@@ -118,7 +118,7 @@ export function DemoRequestModal({ children, theme = 'dark' }: DemoRequestModalP
118118
companyEmail: fieldErrors.companyEmail?.[0],
119119
phoneNumber: fieldErrors.phoneNumber?.[0],
120120
region: fieldErrors.region?.[0],
121-
userCount: fieldErrors.userCount?.[0],
121+
companySize: fieldErrors.companySize?.[0],
122122
details: fieldErrors.details?.[0],
123123
})
124124
return
@@ -235,13 +235,13 @@ export function DemoRequestModal({ children, theme = 'dark' }: DemoRequestModalP
235235
filterOptions={false}
236236
/>
237237
</FormField>
238-
<FormField htmlFor='userCount' label='Number of users' error={errors.userCount}>
238+
<FormField htmlFor='companySize' label='Company size' error={errors.companySize}>
239239
<Combobox
240-
options={COMBOBOX_USER_COUNTS}
241-
value={form.userCount}
242-
selectedValue={form.userCount}
240+
options={COMBOBOX_COMPANY_SIZES}
241+
value={form.companySize}
242+
selectedValue={form.companySize}
243243
onChange={(value) =>
244-
updateField('userCount', value as DemoRequestPayload['userCount'])
244+
updateField('companySize', value as DemoRequestPayload['companySize'])
245245
}
246246
placeholder='Select'
247247
editable={false}

apps/sim/app/api/demo-requests/route.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { sendEmail } from '@/lib/messaging/email/mailer'
99
import { getFromEmailAddress } from '@/lib/messaging/email/utils'
1010
import {
1111
demoRequestSchema,
12+
getDemoRequestCompanySizeLabel,
1213
getDemoRequestRegionLabel,
13-
getDemoRequestUserCountLabel,
1414
} from '@/app/(home)/components/demo-request/consts'
1515

1616
const logger = createLogger('DemoRequestAPI')
@@ -58,13 +58,13 @@ export async function POST(req: NextRequest) {
5858
)
5959
}
6060

61-
const { firstName, lastName, companyEmail, phoneNumber, region, userCount, details } =
61+
const { firstName, lastName, companyEmail, phoneNumber, region, companySize, details } =
6262
validationResult.data
6363

6464
logger.info(`[${requestId}] Processing demo request`, {
6565
email: `${companyEmail.substring(0, 3)}***`,
6666
region,
67-
userCount,
67+
companySize,
6868
})
6969

7070
const emailText = `Demo request submitted
@@ -73,7 +73,7 @@ Name: ${firstName} ${lastName}
7373
Email: ${companyEmail}
7474
Phone: ${phoneNumber ?? 'Not provided'}
7575
Region: ${getDemoRequestRegionLabel(region)}
76-
Users: ${getDemoRequestUserCountLabel(userCount)}
76+
Company size: ${getDemoRequestCompanySizeLabel(companySize)}
7777
7878
Details:
7979
${details}

0 commit comments

Comments
 (0)