generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b1e295
commit cbc2f9b
Showing
5 changed files
with
115 additions
and
37 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { auth } from "@clerk/nextjs/server"; | ||
import { redirect } from "next/navigation"; | ||
|
||
export default async function DashboardLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
const { userId } = await auth(); | ||
|
||
if (!userId) { | ||
redirect("/sign-in"); | ||
} | ||
|
||
return ( | ||
<div className="min-h-screen bg-background"> | ||
<div className="container mx-auto py-4"> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
} |
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,30 @@ | ||
import { SignIn } from "@clerk/nextjs"; | ||
|
||
export default function SignInPage() { | ||
return ( | ||
<div className="min-h-screen flex items-center justify-center bg-background"> | ||
<div className="w-full max-w-md p-8"> | ||
<div className="mb-8 text-center"> | ||
<h1 className="text-2xl font-bold text-[--text-normal]">Welcome Back</h1> | ||
<p className="text-[--text-muted] mt-2">Sign in to continue to your dashboard</p> | ||
</div> | ||
|
||
<SignIn | ||
appearance={{ | ||
elements: { | ||
formButtonPrimary: | ||
"bg-[--interactive-accent] hover:bg-[--interactive-accent-hover] text-[--text-on-accent]", | ||
card: "bg-[--background-primary] shadow-lg", | ||
headerTitle: "text-[--text-normal]", | ||
headerSubtitle: "text-[--text-muted]", | ||
socialButtonsBlockButton: "text-[--text-normal] border-[--background-modifier-border]", | ||
formFieldInput: "bg-[--background-primary-alt] border-[--background-modifier-border] text-[--text-normal]", | ||
footerActionLink: "text-[--text-accent] hover:text-[--text-accent-hover]", | ||
}, | ||
}} | ||
path="/sign-in" | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |
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,27 +1,29 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { UserButton } from "@clerk/nextjs"; | ||
import CheckoutButton from "@/components/ui/checkout-button"; | ||
import { auth } from "@clerk/nextjs/server"; | ||
import { isPaidUser } from "@/app/actions"; | ||
|
||
export default async function UserManagement() { | ||
export default async function ExtraUserSettings() { | ||
const { userId } = await auth(); | ||
const isPaid = await isPaidUser(userId); | ||
|
||
return ( | ||
<div className=" top-4 right-4 flex items-center gap-4 max-w-6xl mx-auto "> | ||
<div className="sm:block">{!isPaid && <CheckoutButton />}</div> | ||
<a className="hidden sm:block" href="https://discord.gg/udQnCRFyus" target="_blank"> | ||
<Button variant="outline" className="border whitespace-nowrap">Join our discord</Button> | ||
<a | ||
className="hidden sm:block" | ||
href="https://discord.gg/udQnCRFyus" | ||
target="_blank" | ||
> | ||
<Button variant="outline" className="border whitespace-nowrap"> | ||
Join our discord | ||
</Button> | ||
</a> | ||
{isPaid && ( | ||
<a href={process.env.NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_URL}> | ||
<Button variant="secondary">Subscription</Button> | ||
</a> | ||
)} | ||
<div className="flex items-center gap-2 w-full sm:w-auto flex-wrap justify-end"> | ||
<UserButton /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
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