-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made root page static generated in nextjs to load faster
- Loading branch information
1 parent
d6719da
commit 61ebf26
Showing
7 changed files
with
90 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { AuthProvider } from "@/components/providers/authProvider"; | ||
|
||
type Props = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export default function Layout({ children }: Props) { | ||
return <>{children}</>; | ||
return <AuthProvider>{children}</AuthProvider>; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Button } from "@convoform/ui/components/ui/button"; | ||
|
||
import { LinkN } from "../common/linkN"; | ||
|
||
export function SignInButton() { | ||
return ( | ||
<LinkN href="/auth/sign-in" rel="noopener noreferrer nofollow"> | ||
<Button variant="secondary" className="rounded-full"> | ||
Sign In | ||
</Button> | ||
</LinkN> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"use client"; | ||
|
||
import { ClerkLoading, useAuth, UserButton } from "@clerk/nextjs"; | ||
import { Button } from "@convoform/ui/components/ui/button"; | ||
import { Skeleton } from "@convoform/ui/components/ui/skeleton"; | ||
import { LayoutDashboard } from "lucide-react"; | ||
|
||
import { LinkN } from "../common/linkN"; | ||
import { AuthProvider } from "../providers/authProvider"; | ||
import { SignInButton } from "./signInButton"; | ||
|
||
export default function UserSignInButton() { | ||
return ( | ||
<AuthProvider> | ||
<UserSignInButtonInner /> | ||
</AuthProvider> | ||
); | ||
} | ||
|
||
function UserSignInButtonInner() { | ||
const { isSignedIn } = useAuth(); | ||
|
||
if (isSignedIn) { | ||
return ( | ||
<> | ||
<LinkN href="/dashboard"> | ||
<Button variant="secondary"> | ||
<LayoutDashboard className="mr-2" size={20} /> Go to Dashboard | ||
</Button> | ||
</LinkN> | ||
<ClerkLoading> | ||
<Skeleton className="h-10 w-10 animate-pulse rounded-full" /> | ||
</ClerkLoading> | ||
<UserButton /> | ||
</> | ||
); | ||
} | ||
|
||
return <SignInButton />; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ClerkProvider } from "@clerk/nextjs"; | ||
|
||
import { SentryUserInit } from "../sentryUserInit"; | ||
|
||
export function AuthProvider({ | ||
children, | ||
}: Readonly<{ children: React.ReactNode }>) { | ||
return ( | ||
<ClerkProvider signInUrl="/auth/sign-in" signUpUrl="/auth/register"> | ||
<SentryUserInit /> | ||
{children} | ||
</ClerkProvider> | ||
); | ||
} |