Skip to content

Commit d315d06

Browse files
[Website] Point contact CTAs to contact page with subject pre-select (#10005)
1 parent 47ddbe0 commit d315d06

10 files changed

Lines changed: 44 additions & 21 deletions

File tree

website-next/app/(content)/pricing/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Hero() {
5959
<SolidButton href="https://nitro.chillicream.com">
6060
Start for Free
6161
</SolidButton>
62-
<OutlineButton href="/services/support/contact">
62+
<OutlineButton href="/services/support/contact?subject=Sales">
6363
Talk to Sales
6464
</OutlineButton>
6565
</div>

website-next/app/(content)/resources/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const metadata = {
1010

1111
const COMPANY_LINKS = [
1212
{
13-
href: "mailto:contact@chillicream.com",
13+
href: "/services/support/contact",
1414
title: "Contact",
1515
description: "Get in touch with the team.",
1616
},

website-next/app/(content)/services/advisory/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ const PLANS: InquiryPlan[] = [
3131
"Best practices education",
3232
],
3333
ctaText: "Talk to an Expert",
34-
ctaLink: "mailto:contact@chillicream.com?subject=Consulting",
34+
ctaLink: "/services/support/contact?subject=Technical+Support",
3535
},
3636
{
3737
title: "Contracting",
3838
description:
3939
"Options for teams who don't have the time, bandwidth, and/or expertise to implement their own GraphQL solutions.",
4040
features: ["Proof of concept", "Implementation"],
4141
ctaText: "Talk to an Expert",
42-
ctaLink: "mailto:contact@chillicream.com?subject=Contracting",
42+
ctaLink: "/services/support/contact?subject=Technical+Support",
4343
},
4444
];
4545

website-next/app/(content)/services/support/contact/ContactForm.tsx

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useState, type FormEvent } from "react";
3+
import { useState, useSyncExternalStore, type FormEvent } from "react";
44
import { SolidButton } from "@/src/design-system/Button";
55
import { Dropdown, DropdownItem } from "@/src/design-system/Dropdown";
66
import { Input } from "@/src/design-system/Input";
@@ -23,7 +23,6 @@ interface FormData {
2323
name: string;
2424
email: string;
2525
company: string;
26-
subject: string;
2726
message: string;
2827
}
2928

@@ -33,15 +32,37 @@ const INITIAL: FormData = {
3332
name: "",
3433
email: "",
3534
company: "",
36-
subject: SUBJECTS[0],
3735
message: "",
3836
};
3937

38+
function resolveSubject(subject: string | null): string {
39+
if (!subject) {
40+
return SUBJECTS[0];
41+
}
42+
43+
const match = SUBJECTS.find((s) => s.toLowerCase() === subject.toLowerCase());
44+
45+
return match ?? SUBJECTS[0];
46+
}
47+
48+
const subscribe = () => () => {};
49+
const getSubjectFromUrl = () =>
50+
resolveSubject(new URLSearchParams(window.location.search).get("subject"));
51+
const getServerSubject = () => "";
52+
4053
export function ContactForm() {
4154
const [data, setData] = useState<FormData>(INITIAL);
4255
const [errors, setErrors] = useState<FormErrors>({});
4356
const [isSubmitting, setIsSubmitting] = useState(false);
4457

58+
const urlSubject = useSyncExternalStore(
59+
subscribe,
60+
getSubjectFromUrl,
61+
getServerSubject,
62+
);
63+
const [selectedSubject, setSelectedSubject] = useState<string | null>(null);
64+
const subject = selectedSubject ?? urlSubject;
65+
4566
function update<K extends keyof FormData>(field: K, value: FormData[K]) {
4667
setData((prev) => ({ ...prev, [field]: value }));
4768
if (field in errors) {
@@ -85,7 +106,7 @@ export function ContactForm() {
85106
Name: data.name,
86107
Email: data.email,
87108
Company: data.company,
88-
SupportPlan: data.subject,
109+
SupportPlan: subject,
89110
Message: data.message,
90111
}),
91112
});
@@ -95,7 +116,7 @@ export function ContactForm() {
95116
}
96117

97118
window.gtag?.("event", "contact_form_submit", {
98-
event_label: data.subject,
119+
event_label: subject,
99120
page_path: window.location.pathname,
100121
});
101122

@@ -147,14 +168,16 @@ export function ContactForm() {
147168
label="Subject"
148169
className={isSubmitting ? "pointer-events-none opacity-60" : undefined}
149170
panelClassName="p-1"
150-
trigger={<span className="text-cc-ink text-sm">{data.subject}</span>}
171+
trigger={
172+
<span className="text-cc-ink text-sm">{subject || "\u00A0"}</span>
173+
}
151174
>
152175
<ul className="m-0 flex list-none flex-col p-0">
153176
{SUBJECTS.map((s) => (
154177
<DropdownItem
155178
key={s}
156-
active={s === data.subject}
157-
onClick={() => update("subject", s)}
179+
active={s === subject}
180+
onClick={() => setSelectedSubject(s)}
158181
>
159182
{s}
160183
</DropdownItem>

website-next/app/(content)/services/support/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const SUPPORT_PLANS = [
4040
perks: ["Private Slack Channel", "2 critical incidents"],
4141
callToAction: {
4242
title: "Contact Us",
43-
link: "/services/support/contact?plan=Startup",
43+
link: "/services/support/contact?subject=Pricing+%26+Plans",
4444
},
4545
},
4646
{
@@ -56,7 +56,7 @@ const SUPPORT_PLANS = [
5656
],
5757
callToAction: {
5858
title: "Contact Us",
59-
link: "/services/support/contact?plan=Business",
59+
link: "/services/support/contact?subject=Pricing+%26+Plans",
6060
},
6161
},
6262
{
@@ -74,7 +74,7 @@ const SUPPORT_PLANS = [
7474
],
7575
callToAction: {
7676
title: "Contact Us",
77-
link: "/services/support/contact?plan=Enterprise",
77+
link: "/services/support/contact?subject=Pricing+%26+Plans",
7878
},
7979
},
8080
];

website-next/app/(content)/services/training/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default function TrainingPage() {
6161
perks={service.perks}
6262
callToAction={{
6363
title: "Talk to us",
64-
link: `mailto:contact@chillicream.com?subject=${service.kind}`,
64+
link: "/services/support/contact?subject=Sales",
6565
}}
6666
/>
6767
))}

website-next/src/components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default function Footer() {
7474
))}
7575
</LinkColumn>
7676
<LinkColumn title="Company">
77-
<NavLink href="mailto:contact@chillicream.com">Contact</NavLink>
77+
<NavLink href="/services/support/contact">Contact</NavLink>
7878
<NavLink href={tools.shop}>Shop</NavLink>
7979
{basicPages.map((page) => (
8080
<NavLink key={page.path} href={`/${page.path}`}>

website-next/src/components/header/navData.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export const NAV_ITEMS: NavItem[] = [
176176
title: "Company",
177177
links: [
178178
{
179-
href: "mailto:contact@chillicream.com",
179+
href: "/services/support/contact",
180180
label: "Contact",
181181
icon: NewspaperIcon,
182182
},

website-next/src/components/pricing/RegulatedBand.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function RegulatedBand() {
3434
come back with an architecture.
3535
</p>
3636
<div className="mt-6 flex flex-wrap gap-3">
37-
<SolidButton href="/services/support/contact">
37+
<SolidButton href="/services/support/contact?subject=Sales">
3838
Talk to Sales
3939
</SolidButton>
4040
<OutlineButton href="/platform">See the platform</OutlineButton>

website-next/src/components/pricing/pricingData.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const TIERS: readonly Tier[] = [
7474
"SSO, audit log, role-based access",
7575
],
7676
cta: "Talk to Us",
77-
ctaHref: "/services/support/contact",
77+
ctaHref: "/services/support/contact?subject=Sales",
7878
popular: true,
7979
},
8080
{
@@ -91,7 +91,7 @@ export const TIERS: readonly Tier[] = [
9191
"Long-term release channel",
9292
],
9393
cta: "Talk to Us",
94-
ctaHref: "/services/support/contact",
94+
ctaHref: "/services/support/contact?subject=Sales",
9595
},
9696
];
9797

0 commit comments

Comments
 (0)