Skip to content

Commit

Permalink
working on dashboard page
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitmondal03 committed Dec 13, 2023
1 parent 77a4da1 commit 7798673
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 95 deletions.
58 changes: 58 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tooltip": "^1.0.7",
"@t3-oss/env-nextjs": "^0.7.1",
"class-variance-authority": "^0.7.0",
"classnames": "^2.3.2",
Expand Down
7 changes: 0 additions & 7 deletions src/app/(pages)/(landing-page)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";


const inter = Inter({
subsets: ["latin"],
variable: "--font-sans",
});


export const metadata: Metadata = {
Expand Down
10 changes: 8 additions & 2 deletions src/app/(pages)/(landing-page)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import HeadingText from "./_components/Heading";
import dynamic from "next/dynamic";
import { memo } from "react";

export default function HomePage() {
const HeadingText= dynamic(() => import("./_components/Heading"))


function HomePage() {
return(
<>
<HeadingText />
</>
)
}

export default memo(HomePage)
105 changes: 38 additions & 67 deletions src/app/(pages)/signin/_component/SignInPage.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
"use client"

import Image from "next/image";
import Link from "next/link";
import dynamic from "next/dynamic";
import { signIn } from "next-auth/react";
import classNames from "classnames";

import { montserrat } from "@/lib/fonts";
import { Button } from "@/components/ui/button";
import { useUser } from "@/hooks/useUser";
import { memo } from "react";


export default function SignInLandingComponent() {
const { authStatus, userDetails } = useUser();
const Button = dynamic(() => import("@/components/ui/button").then((mod) => mod.Button))


function SignInLandingComponent() {
return (
<section className={classNames(`${montserrat.className}`, {
"flex flex-row items-center justify-around": true,
Expand All @@ -22,7 +20,7 @@ export default function SignInLandingComponent() {
"space-y-16": true,
})}>
<h1 className={classNames({
"font-bold text-5xl": true,
"font-bold text-5xl text-orange-500 dark:text-amber-400": true,
})}
>
Welcome to BioSync
Expand All @@ -34,11 +32,37 @@ export default function SignInLandingComponent() {
Your one stop to share your bio with anyone, <br /> anytime and anywhere...
</p>

{authStatus === "unauthenticated"
? demo.unauthFooter
: demo.authFooter
}
</div >
<p className={classNames({
"text-4xl font-bold dark:text-violet-400": true,
})}>
Sign In to continue to BioSync
</p>

<div className={classNames({
"flex flex-row gap-x-3": true,
})}>
<Button
variant={"secondary"}
onClick={() => signIn("github", { callbackUrl: "/dashboard" })}
className={classNames({
"text-zinc-700 dark:text-white font-bold": true,
"outline outline-1 outline-zinc-100": true,
})}
>
Continue with GitHub
</Button>

<Button
variant={"secondary"}
onClick={() => signIn("discord", { callbackUrl: "/dashboard" })}
className={classNames({
"outline outline-1 outline-zinc-100 text-zinc-700 dark:text-white font-bold": true,
})}
>
Continue with Discord
</Button>
</div>
</div>

<div className={classNames({
})}>
Expand All @@ -51,62 +75,9 @@ export default function SignInLandingComponent() {
blurDataURL="/sign-in.svg"
/>
</div>
</section >
</section>
)
}



const demo = {
unauthFooter: (
<>
<p className={classNames({
"text-4xl font-bold text-orange-400": true,
})}>
Sign In to continue to BioSync
</p>

<div className={classNames({
"flex flex-row gap-x-3": true,
})}>
<Button
variant={"secondary"}
onClick={() => signIn("github", { callbackUrl: "/dashboard" })}
className={classNames({
"outline outline-1 outline-zinc-100 text-zinc-700 dark:text-white font-bold": true,
})}
>
Continue with GitHub
</Button>

<Button
variant={"secondary"}
onClick={() => signIn("discord", { callbackUrl: "/dashboard" })}
className={classNames({
"outline outline-1 outline-zinc-100 text-zinc-700 dark:text-white font-bold": true,
})}
>
Continue with Discord
</Button>
</div>
</>
),

authFooter: (
<div className={classNames({
"flex flex-col gap-y-5": true
})}>
<p className={classNames({
"": true,
})}>
Continue to your Dashboard
</p>

<Link href={"/dashboard"}>
<Button variant={"secondary"}>
Head to Dashboard
</Button>
</Link>
</div>
)
}
export default memo(SignInLandingComponent);
14 changes: 12 additions & 2 deletions src/app/(pages)/signin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import { redirect } from "next/navigation";
import { memo } from "react";
import classNames from "classnames";

import { getServerAuthSession } from "@/server/auth";
import SignInLandingComponent from "./_component/SignInPage";


export default function SignInPage() {
async function SignInPage() {
const sessionDetails = await getServerAuthSession();

// redirecting users if session present
sessionDetails ? redirect("/dashboard") : null;

return (
<section className={classNames({
"px-20 py-24": true,
})}>
<SignInLandingComponent />
</section>
)
}
}

export default memo(SignInPage);
5 changes: 5 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import { inter } from "@/lib/fonts";
import "@/styles/globals.css"


export const metadata: Metadata= {
title: "BioSync"
}


export default function RootLayout(
{ children }: ILayout
) {
Expand Down
Loading

0 comments on commit 7798673

Please sign in to comment.