-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: track step signup improve feedback align
- Loading branch information
Showing
4 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import Router, { useRouter } from "next/router" | ||
import { useEffect, useState } from "react" | ||
import React, { useEffect, useMemo, useState } from "react" | ||
|
||
import { | ||
Alert, | ||
|
@@ -13,6 +13,7 @@ import { | |
Paper, | ||
PasswordInput, | ||
Radio, | ||
Select, | ||
Stack, | ||
Text, | ||
TextInput, | ||
|
@@ -46,11 +47,29 @@ import { NextSeo } from "next-seo" | |
import { useAuth } from "@/utils/auth" | ||
import config from "@/utils/config" | ||
|
||
function getRandomizedChoices() { | ||
const choices = [ | ||
{ label: "Google", value: "seo" }, | ||
{ label: "X / Twitter", value: "s" }, | ||
{ label: "LangChain", value: "langchain" }, | ||
{ label: "LiteLLM", value: "litellm" }, | ||
{ label: "Hacker News", value: "hackernews" }, | ||
{ label: "Friend", value: "friend" }, | ||
{ label: "LangFlow", value: "langflow" }, | ||
{ label: "Other", value: "other" }, | ||
] | ||
|
||
return choices.sort(() => Math.random() - 0.5) | ||
} | ||
|
||
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)) | ||
|
||
function SignupPage() { | ||
const [loading, setLoading] = useState(false) | ||
const [step, setStep] = useState(1) | ||
|
||
const choices = useMemo(() => getRandomizedChoices(), []) | ||
|
||
const router = useRouter() | ||
|
||
const auth = useAuth() | ||
|
@@ -62,6 +81,7 @@ function SignupPage() { | |
projectName: "Project #1", | ||
orgName: "", | ||
employeeCount: "", | ||
whereFindUs: "", | ||
password: "", | ||
}, | ||
|
||
|
@@ -90,13 +110,15 @@ function SignupPage() { | |
projectName, | ||
orgName, | ||
employeeCount, | ||
whereFindUs, | ||
}: { | ||
email: string | ||
password: string | ||
name: string | ||
projectName: string | ||
orgName: string | ||
employeeCount: string | ||
whereFindUs: string | ||
}) { | ||
setLoading(true) | ||
|
||
|
@@ -115,6 +137,7 @@ function SignupPage() { | |
projectName, | ||
orgName, | ||
employeeCount, | ||
whereFindUs, | ||
signupMethod: "signup", | ||
}, | ||
}) | ||
|
@@ -125,24 +148,24 @@ function SignupPage() { | |
|
||
auth.setJwt(token) | ||
|
||
analytics.track("Signup", { | ||
email, | ||
name, | ||
projectName, | ||
orgName, | ||
whereFindUs, | ||
employeeCount, | ||
}) | ||
|
||
if (!config.IS_SELF_HOSTED) { | ||
notifications.show({ | ||
icon: <IconCheck size={18} />, | ||
color: "teal", | ||
title: "Email sent", | ||
message: "Check your emails for the confirmation link", | ||
}) | ||
} else { | ||
nextStep() | ||
} | ||
|
||
analytics.track("Signup", { | ||
email, | ||
name, | ||
projectName, | ||
orgName, | ||
employeeCount, | ||
}) | ||
nextStep() | ||
} catch (error) { | ||
console.error(error) | ||
|
@@ -166,7 +189,13 @@ function SignupPage() { | |
form.setFieldValue("orgName", form.values.name + "'s Org") | ||
} | ||
|
||
analytics.track("Signup Step " + (step + 1), { | ||
email: form.values.email, | ||
name: form.values.name, | ||
}) | ||
|
||
setStep(step + 1) | ||
|
||
router.query.step = String(step + 1) | ||
router.push(router) | ||
} | ||
|
@@ -296,7 +325,7 @@ function SignupPage() { | |
/> | ||
|
||
<Radio.Group | ||
label="Employee count" | ||
label="Company Size" | ||
error={ | ||
form.errors.employeeCount && | ||
"This field is required" | ||
|
@@ -311,6 +340,14 @@ function SignupPage() { | |
</Group> | ||
</Radio.Group> | ||
|
||
<Select | ||
label="Where did you find us?" | ||
description="This helps us focus our efforts." | ||
placeholder="Select an option" | ||
data={choices} | ||
{...form.getInputProps("whereFindUs")} | ||
/> | ||
|
||
<Stack gap="xs"> | ||
<Button | ||
size="md" | ||
|
@@ -420,8 +457,8 @@ function SignupPage() { | |
config={{ | ||
hideEventTypeDetails: "true", | ||
layout: "month_view", | ||
name: "vince loewe", //form.values.name, | ||
email: "[email protected]", //form.values.email, | ||
name: form.values.name, | ||
email: form.values.email, | ||
}} | ||
/> | ||
<Button | ||
|