From 87a75dc0570115c61a97ffa4ede974232bedc0c7 Mon Sep 17 00:00:00 2001 From: Vince Loewe Date: Fri, 4 Oct 2024 19:04:31 +0100 Subject: [PATCH 1/3] improve design --- packages/backend/src/jobs/resetUsage.ts | 2 +- .../components/blocks/SocialProof.tsx | 4 +- packages/frontend/components/layout/index.tsx | 4 +- packages/frontend/pages/login.tsx | 171 +++-- .../frontend/pages/request-password-reset.tsx | 80 +-- packages/frontend/pages/reset-password.tsx | 74 ++- packages/frontend/pages/signup.tsx | 584 ++++++++---------- packages/frontend/styles/globals.css | 41 ++ packages/frontend/utils/features.ts | 5 +- 9 files changed, 487 insertions(+), 478 deletions(-) diff --git a/packages/backend/src/jobs/resetUsage.ts b/packages/backend/src/jobs/resetUsage.ts index bd61b156..3333fecb 100644 --- a/packages/backend/src/jobs/resetUsage.ts +++ b/packages/backend/src/jobs/resetUsage.ts @@ -68,7 +68,7 @@ RETURNING *;`; // reset playground allowance async function resetPlaygroundAllowance() { - await sql`UPDATE "public"."org" o SET play_allowance = 3 WHERE o.plan = 'free';`; + await sql`UPDATE "public"."org" o SET play_allowance = 10 WHERE o.plan = 'free';`; await sql`UPDATE "public"."org" o SET play_allowance = 1000 WHERE o.plan = 'pro' OR o.plan = 'team';`; await sql`UPDATE "public"."org" o SET play_allowance = 1000 WHERE o.plan = 'unlimited' OR o.plan = 'custom';`; } diff --git a/packages/frontend/components/blocks/SocialProof.tsx b/packages/frontend/components/blocks/SocialProof.tsx index 23a2a8da..08c22834 100644 --- a/packages/frontend/components/blocks/SocialProof.tsx +++ b/packages/frontend/components/blocks/SocialProof.tsx @@ -22,9 +22,9 @@ export default function SocialProof() { span fw="bolder" > - 2500+ + 4500+ {" "} - AI devs build better apps + GenAI devs build better apps diff --git a/packages/frontend/components/layout/index.tsx b/packages/frontend/components/layout/index.tsx index 30cb3243..d16732c4 100644 --- a/packages/frontend/components/layout/index.tsx +++ b/packages/frontend/components/layout/index.tsx @@ -30,6 +30,8 @@ export default function Layout({ children }: { children: ReactNode }) { "/reset-password", ].find((path) => router.pathname.startsWith(path)); + const isSignupPage = router.pathname.startsWith("/signup"); + const isSignupLastStep = router.pathname === "/signup" && router.query.step === "3"; @@ -74,7 +76,7 @@ export default function Layout({ children }: { children: ReactNode }) { const isPromptPage = router.pathname.startsWith("/prompt"); const isTracePage = router.pathname.startsWith("/traces"); - const disablePagePadding = isPromptPage || isTracePage; + const disablePagePadding = isPromptPage || isTracePage || isAuthPage; useEffect(() => { if (user) { diff --git a/packages/frontend/pages/login.tsx b/packages/frontend/pages/login.tsx index 16ff8f79..5f9c1c22 100644 --- a/packages/frontend/pages/login.tsx +++ b/packages/frontend/pages/login.tsx @@ -1,5 +1,6 @@ import { Anchor, + Box, Button, Container, Paper, @@ -143,102 +144,100 @@ function LoginPage() { const email = router.query.email ? decodeURIComponent(router.query.email as string) : ""; - console.log(form.values.password); if (email && !form.values.email) { - console.log("here"); form.setFieldValue("email", email); determineAuthMethod(email); - console.log(step); } }, [router.query.email]); return ( - - - - - - - Welcome back - - - - - Sign In - - - {step !== "saml" && ( -
{ - determineAuthMethod(form.values.email); - e.preventDefault(); + + + + + + + + + + Welcome back! + + + {step !== "saml" && ( + { + determineAuthMethod(form.values.email); + e.preventDefault(); + } + : form.onSubmit(handleLoginWithPassword) + } + > + + } + label="Email" + type="email" + autoComplete="email" + value={form.values.email} + onChange={(event) => + form.setFieldValue("email", event.currentTarget.value) + } + error={form.errors.email} + placeholder="Your email" + /> + + form.setFieldValue("password", event.currentTarget.value) } - : form.onSubmit(handleLoginWithPassword) - } - > - - } - label="Email" - type="email" - autoComplete="email" - value={form.values.email} - onChange={(event) => - form.setFieldValue("email", event.currentTarget.value) - } - error={form.errors.email} - placeholder="Your email" - /> - - form.setFieldValue("password", event.currentTarget.value) - } - error={form.errors.password} - placeholder="Your password" - /> - - - - )} - - {step === "saml" && ( -

- Redirecting to your SSO login. -
- If you are not redirected in 5s,{" "} - click here. -

- )} - - - {`Don't have an account? `} - Sign Up - - - {step === "password" && ( + error={form.errors.password} + placeholder="Your password" + /> + +
+ + )} + + {step === "saml" && ( +

+ Redirecting to your SSO login. +
+ If you are not redirected in 5s,{" "} + click here. +

+ )} + - Forgot password? + {`Don't have an account? `} + Sign Up - )} -
-
-
+ + {step === "password" && ( + + Forgot password? + + )} +
+
+
+ ); } export default LoginPage; diff --git a/packages/frontend/pages/request-password-reset.tsx b/packages/frontend/pages/request-password-reset.tsx index 7361ddbb..e4f6dda5 100644 --- a/packages/frontend/pages/request-password-reset.tsx +++ b/packages/frontend/pages/request-password-reset.tsx @@ -1,11 +1,11 @@ import { + Box, Button, Container, Paper, Stack, Text, TextInput, - Title, } from "@mantine/core"; import { useForm } from "@mantine/form"; import { notifications } from "@mantine/notifications"; @@ -53,42 +53,52 @@ export default function PasswordReset() { } return ( - - - - - - - Forgot password - - + + + + + + + + + + + Password Recovery + - - - Request reset link - + + Enter your email address and if it is registered, we will send you + a link to reset your password. + -
- - } - label="Email" - type="email" - value={form.values.email} - onChange={(event) => - form.setFieldValue("email", event.currentTarget.value) - } - error={form.errors.email && "Invalid email"} - placeholder="Your email" - /> + + + } + label="Email" + type="email" + value={form.values.email} + onChange={(event) => + form.setFieldValue("email", event.currentTarget.value) + } + error={form.errors.email && "Invalid email"} + placeholder="Your email" + /> - - - -
-
-
+ +
+ + + +
+ ); } diff --git a/packages/frontend/pages/reset-password.tsx b/packages/frontend/pages/reset-password.tsx index 13b4f127..59e5a049 100644 --- a/packages/frontend/pages/reset-password.tsx +++ b/packages/frontend/pages/reset-password.tsx @@ -1,10 +1,11 @@ import { + Box, Button, Container, Paper, PasswordInput, Stack, - Title, + Text, } from "@mantine/core"; import { useForm } from "@mantine/form"; @@ -60,37 +61,46 @@ export default function UpdatePassword() { }; return ( - - - - - - - Reset password - - - -
- - - form.setFieldValue("password", event.currentTarget.value) - } - error={form.errors.password && "Invalid password"} - placeholder="Your new password" - /> + + + + + + + + + + Reset your password + + + + + form.setFieldValue("password", event.currentTarget.value) + } + error={form.errors.password && "Invalid password"} + placeholder="Your new password" + /> - - - - - - + +
+ +
+
+
+ ); } diff --git a/packages/frontend/pages/signup.tsx b/packages/frontend/pages/signup.tsx index 3900dd99..e86f4300 100644 --- a/packages/frontend/pages/signup.tsx +++ b/packages/frontend/pages/signup.tsx @@ -1,18 +1,18 @@ -import Router, { useRouter } from "next/router"; -import React, { useEffect, useMemo, useState } from "react"; +import { useRouter } from "next/router"; +import { useMemo, useState } from "react"; import { Alert, Anchor, Box, Button, + Center, Container, Grid, Group, List, Paper, PasswordInput, - Radio, Select, Stack, Text, @@ -44,7 +44,6 @@ import { fetcher } from "@/utils/fetcher"; import { NextSeo } from "next-seo"; import { useAuth } from "@/utils/auth"; import config from "@/utils/config"; -import Script from "next/script"; function getRandomizedChoices() { const choices = [ @@ -55,6 +54,8 @@ function getRandomizedChoices() { { label: "Hacker News", value: "hackernews" }, { label: "Friend", value: "friend" }, { label: "LangFlow", value: "langflow" }, + { label: "Flowise", value: "flowise" }, + { label: "GitHub", value: "github" }, { label: "Other", value: "other" }, ]; @@ -79,7 +80,7 @@ function SignupPage() { name: "", projectName: "Project #1", orgName: "", - employeeCount: "", + // employeeCount: "", whereFindUs: "", password: "", }, @@ -92,8 +93,8 @@ function SignupPage() { val.length <= 3 ? "Can you pick something longer?" : null, orgName: (val) => val.length <= 3 ? "Can you pick something longer?" : null, - employeeCount: (val) => - val.length <= 1 ? "Please select a value" : null, + // employeeCount: (val) => + // val.length <= 1 ? "Please select a value" : null, password: (val) => { if (val.length < 6) { return "Password must be at least 6 characters"; @@ -109,7 +110,7 @@ function SignupPage() { name, projectName, orgName, - employeeCount, + // employeeCount, whereFindUs, }: { email: string; @@ -117,7 +118,7 @@ function SignupPage() { name: string; projectName: string; orgName: string; - employeeCount: string; + // employeeCount: string; whereFindUs: string; }) { setLoading(true); @@ -136,7 +137,7 @@ function SignupPage() { name, projectName, orgName, - employeeCount, + // employeeCount, whereFindUs, signupMethod: "signup", }, @@ -154,7 +155,7 @@ function SignupPage() { projectName, orgName, whereFindUs, - employeeCount, + // employeeCount, }); if (!config.IS_SELF_HOSTED) { @@ -200,141 +201,114 @@ function SignupPage() { router.push(router); } - useEffect(() => { - if (step === 3) { - (async function () { - window.SavvyCal = - window.SavvyCal || - function () { - (SavvyCal.q = SavvyCal.q || []).push(arguments); - }; - SavvyCal("init"); - SavvyCal("inline", { - link: "vince/chat", - selector: "#booking-page", - email: form.values.email, - displayName: form.values.name, - hideAvatar: true, - hideBanner: true, - theme: "os", - }); - })(); - } - }, [step]); - const isBigCompany = form.values.employeeCount !== "1-5"; return ( - - - -