Skip to content

Commit

Permalink
improve design
Browse files Browse the repository at this point in the history
  • Loading branch information
vincelwt committed Oct 4, 2024
1 parent ec6cf64 commit 87a75dc
Show file tree
Hide file tree
Showing 9 changed files with 487 additions and 478 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/jobs/resetUsage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';`;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/components/blocks/SocialProof.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export default function SocialProof() {
span
fw="bolder"
>
2500+
4500+
</Text>{" "}
AI devs build better apps
GenAI devs build better apps
</Text>
</Stack>
</Group>
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/components/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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) {
Expand Down
171 changes: 85 additions & 86 deletions packages/frontend/pages/login.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
Anchor,
Box,
Button,
Container,
Paper,
Expand Down Expand Up @@ -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 (
<Container pt="60" size="600">
<NextSeo title="Login" />
<Stack align="center" gap="50">
<Stack align="center">
<IconAnalyze color="#206dce" size="60" />
<Title order={2} fw="700" size="40" ta="center">
Welcome back
</Title>
</Stack>
<Paper radius="md" p="xl" withBorder miw="350">
<Text size="lg" mb="xl" fw="700">
Sign In
</Text>

{step !== "saml" && (
<form
onSubmit={
step === "email"
? (e) => {
determineAuthMethod(form.values.email);
e.preventDefault();
<Box style={{ backgroundColor: "var(--mantine-color-gray-0)" }} h="100vh">
<Container size="600" pt="60">
<NextSeo title="Login" />
<Stack align="center" gap="50">
<Stack align="center">
<IconAnalyze color="#4f87ff" size="60" />
</Stack>
<Paper radius="md" p="xl" miw="350" shadow="md">
<Text size="xl" mb="lg" fw="700" ta="center">
Welcome back!
</Text>

{step !== "saml" && (
<form
onSubmit={
step === "email"
? (e) => {
determineAuthMethod(form.values.email);
e.preventDefault();
}
: form.onSubmit(handleLoginWithPassword)
}
>
<Stack>
<TextInput
leftSection={<IconAt size="16" />}
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"
/>
<TextInput
type="password"
opacity={step === "email" ? 0 : 1}
h={step === "email" ? 0 : "auto"}
autoComplete="current-password"
label="Password"
value={form.values.password}
onChange={(event) =>
form.setFieldValue("password", event.currentTarget.value)
}
: form.onSubmit(handleLoginWithPassword)
}
>
<Stack>
<TextInput
leftSection={<IconAt size="16" />}
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"
/>
<TextInput
type="password"
opacity={step === "email" ? 0 : 1}
h={step === "email" ? 0 : "auto"}
autoComplete="current-password"
label="Password"
value={form.values.password}
onChange={(event) =>
form.setFieldValue("password", event.currentTarget.value)
}
error={form.errors.password}
placeholder="Your password"
/>
<Button
mt={step === "email" ? 0 : "md"}
type="submit"
fullWidth
loading={loading}
data-testid="continue-button"
>
{step === "email" ? "Continue" : "Login"}
</Button>
</Stack>
</form>
)}

{step === "saml" && (
<p>
Redirecting to your SSO login.
<br />
If you are not redirected in 5s,{" "}
<Anchor href={ssoURI || ""}>click here</Anchor>.
</p>
)}

<Text size="sm" mt="sm" style={{ textAlign: "center" }}>
{`Don't have an account? `}
<Anchor href="/signup">Sign Up</Anchor>
</Text>

{step === "password" && (
error={form.errors.password}
placeholder="Your password"
/>
<Button
mt={step === "email" ? 0 : "md"}
type="submit"
fullWidth
className="CtaBtn"
size="md"
loading={loading}
data-testid="continue-button"
>
{step === "email" ? "Continue" : "Login"}
</Button>
</Stack>
</form>
)}

{step === "saml" && (
<p>
Redirecting to your SSO login.
<br />
If you are not redirected in 5s,{" "}
<Anchor href={ssoURI || ""}>click here</Anchor>.
</p>
)}

<Text size="sm" mt="sm" style={{ textAlign: "center" }}>
<Anchor href="/request-password-reset">Forgot password?</Anchor>
{`Don't have an account? `}
<Anchor href="/signup">Sign Up</Anchor>
</Text>
)}
</Paper>
</Stack>
</Container>

{step === "password" && (
<Text size="sm" mt="sm" style={{ textAlign: "center" }}>
<Anchor href="/request-password-reset">Forgot password?</Anchor>
</Text>
)}
</Paper>
</Stack>
</Container>
</Box>
);
}
export default LoginPage;
80 changes: 45 additions & 35 deletions packages/frontend/pages/request-password-reset.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -53,42 +53,52 @@ export default function PasswordReset() {
}

return (
<Container py={100} size={600}>
<NextSeo title="Login" />
<Stack align="center" gap={50}>
<Stack align="center">
<IconAnalyze color={"#206dce"} size={60} />
<Title order={2} fw={700} size={40} ta="center">
Forgot password
</Title>
</Stack>
<Box style={{ backgroundColor: "var(--mantine-color-gray-0)" }} h="100vh">
<Container py={100} size={600}>
<NextSeo title="Login" />
<Stack align="center" gap={50}>
<Stack align="center">
<IconAnalyze color={"#4f87ff"} size={60} />
</Stack>

<Paper radius="md" p="xl" maw={400} miw={350} shadow="md">
<Text size="lg" mb="lg" fw={500} ta="center">
Password Recovery
</Text>

<Paper radius="md" p="xl" withBorder miw={350}>
<Text size="lg" mb="xl" fw={500}>
Request reset link
</Text>
<Text size="sm" mb="lg" c="gray.8">
Enter your email address and if it is registered, we will send you
a link to reset your password.
</Text>

<form onSubmit={form.onSubmit(handlePasswordReset)}>
<Stack>
<TextInput
leftSection={<IconAt size="16" />}
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"
/>
<form onSubmit={form.onSubmit(handlePasswordReset)}>
<Stack gap="lg">
<TextInput
leftSection={<IconAt size="16" />}
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"
/>

<Button mt="md" type="submit" fullWidth loading={loading}>
Submit
</Button>
</Stack>
</form>
</Paper>
</Stack>
</Container>
<Button
className="CtaBtn"
type="submit"
fullWidth
size="md"
loading={loading}
>
Request reset link
</Button>
</Stack>
</form>
</Paper>
</Stack>
</Container>
</Box>
);
}
Loading

0 comments on commit 87a75dc

Please sign in to comment.