[go: nahoru, domu]

Skip to content

Commit

Permalink
make ux a little bit better on initial signup
Browse files Browse the repository at this point in the history
  • Loading branch information
realjoshuau committed Feb 29, 2024
1 parent 2081669 commit 3b263ac
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
20 changes: 16 additions & 4 deletions apps/nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
"use client";

import { Metadata } from "next";
import Image from "next/image";
import Link from "next/link";
import { redirect, useSearchParams } from "next/navigation";
import { buttonVariants } from "@/components/ui/button";
import { SignUp } from "@/components/user-auth-form";
import { cn } from "@/lib/utils";

import { signup } from "./actions";

export const metadata: Metadata = {
title: "Authentication",
description: "Authentication forms built using the components.",
};
// export const metadata: Metadata = {
// title: "Authentication",
// description: "Authentication forms built using the components.",
// };

export default function AuthenticationPage() {
const searchParams = useSearchParams();
const noredir = searchParams.get("noredir");
const code = searchParams.get("code");
if (code) {
redirect("/signin?signup=true&code=" + code);
}
// if (!noredir) {
// redirect("/signin");
// }
return (
<>
<div className="md:hidden">
Expand Down
18 changes: 18 additions & 0 deletions apps/nextjs/src/app/registered/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";

import { Alert, AlertDescription, AlertTitle } from "../../components/ui/alert";

const SuccessPage: React.FC = () => {
return (
<div>
<Alert>
<AlertTitle>Success!</AlertTitle>
<AlertDescription>
Your account on "scouting-app" has been created successfully.
</AlertDescription>
</Alert>
</div>
);
};

export default SuccessPage;
10 changes: 9 additions & 1 deletion apps/nextjs/src/app/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
import { Metadata } from "next";
import Image from "next/image";
import Link from "next/link";
import { redirect, useSearchParams } from "next/navigation";
import { buttonVariants } from "@/components/ui/button";
import { SignIn } from "@/components/user-auth-form";
import { cn } from "@/lib/utils";

import { signin } from "./actions";

export default function LoginPage() {
const searchParams = useSearchParams();
const noredir = searchParams.get("noredir");
const code = searchParams.get("code");
const isSignup = searchParams.get("signup");
if (code && isSignup) {
redirect("/registered?action=show_coming_soon&code=" + code);
}
return (
<>
<div className="md:hidden">
Expand All @@ -30,7 +38,7 @@ export default function LoginPage() {
</div>
<div className="container relative hidden h-screen flex-col items-center justify-center md:grid lg:max-w-none lg:grid-cols-2 lg:px-0">
<Link
href="/signup"
href="/?noredir=true"
className={cn(
buttonVariants({ variant: "ghost" }),
"absolute right-4 top-4 md:right-8 md:top-8",
Expand Down

2 comments on commit 3b263ac

@ThatXliner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone in the near future should revert this commit

@ThatXliner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now, it improves the UX

Please sign in to comment.