clerk #1

Merged
afiqzudinhadi merged 7 commits from clerk into main 2025-07-08 21:45:30 +08:00
4 changed files with 65 additions and 31 deletions
Showing only changes of commit 14ef2719c7 - Show all commits

View file

@ -10,6 +10,7 @@
"lint": "eslint src/ --max-warnings 0"
},
"dependencies": {
"@clerk/clerk-react": "^5.32.0",
"@repo/ui": "*",
"react": "^18.3.1",
"react-dom": "^18.3.1"

View file

@ -10,33 +10,54 @@ import {
CardHeader,
CardTitle,
} from "@repo/ui/components/card";
import {
SignedIn,
SignedOut,
SignInButton,
UserButton,
} from "@clerk/clerk-react";
function App() {
return (
<div className="container">
<h1 className="title">
Admin <br />
<span>Kitchen Sink</span>
</h1>
<CounterButton />
<Card className="my-6">
<CardHeader>
<CardTitle>shadcn/ui Card Example</CardTitle>
</CardHeader>
<CardContent>
<Button>shadcn/ui Button</Button>
</CardContent>
</Card>
<p className="description">
Built With{" "}
<Link href="https://turborepo.com" newTab>
Turborepo
</Link>
{" & "}
<Link href="https://vitejs.dev/" newTab>
Vite
</Link>
</p>
<div>
<header className="flex items-center justify-end py-4 px-6 bg-white shadow-sm mb-6">
<div>
<SignedOut>
<SignInButton mode="modal">
<Button variant="outline">Sign In</Button>
</SignInButton>
</SignedOut>
<SignedIn>
<UserButton afterSignOutUrl="/" />
</SignedIn>
</div>
</header>
<div className="container">
<h1 className="title">
Admin <br />
<span>Kitchen Sink</span>
</h1>
<CounterButton />
<Card className="my-6">
<CardHeader>
<CardTitle>shadcn/ui Card Example</CardTitle>
</CardHeader>
<CardContent>
<Button>shadcn/ui Button</Button>
</CardContent>
</Card>
<p className="description">
Built With{" "}
<Link href="https://turborepo.com" newTab>
Turborepo
</Link>
{" & "}
<Link href="https://vitejs.dev/" newTab>
Vite
</Link>
</p>
</div>
</div>
);
}

View file

@ -2,15 +2,26 @@ import React from "react";
import { createRoot } from "react-dom/client";
import App from "./app";
import "./index.css";
import { ClerkProvider } from "@clerk/clerk-react";
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
if (!PUBLISHABLE_KEY) {
throw new Error(
"VITE_PUBLISHABLE_KEY is not defined. Please set it in your environment variables."
);
}
const el = document.getElementById("root");
if (el) {
const root = createRoot(el);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
const root = createRoot(el);
root.render(
<React.StrictMode>
<ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/">
<App />
</ClerkProvider>
</React.StrictMode>
);
} else {
throw new Error("Could not find root element");
throw new Error("Could not find root element");
}

1
package-lock.json generated
View file

@ -276,6 +276,7 @@
"apps/vite-template": {
"version": "0.0.0",
"dependencies": {
"@clerk/clerk-react": "^5.32.0",
"@repo/ui": "*",
"react": "^18.3.1",
"react-dom": "^18.3.1"