Skip to content

Commit 46f9c10

Browse files
authored
Merge pull request #3 from PriyanshuPz/evolution-added
Added Evaluation Jobs
2 parents 9683bb6 + 061190f commit 46f9c10

File tree

21 files changed

+873
-424
lines changed

21 files changed

+873
-424
lines changed

apps/platform/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"react-confetti": "^6.4.0",
4444
"react-dom": "^19.0.0",
4545
"react-hook-form": "^7.57.0",
46+
"react-icons": "^5.5.0",
4647
"react-markdown": "^10.1.0",
4748
"react-shiki": "^0.7.1",
4849
"react-swipeable": "^7.0.2",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { auth } from "@/lib/auth";
2+
import { prisma } from "@kbnet/db";
3+
import { headers } from "next/headers";
4+
import { NextRequest, NextResponse } from "next/server";
5+
6+
export async function GET(req: NextRequest) {
7+
try {
8+
const session = await auth.api.getSession({
9+
headers: await headers(),
10+
});
11+
12+
if (!session || !session.user) {
13+
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
14+
}
15+
16+
const evolutions = await prisma.evaluations.findMany({
17+
select: {},
18+
});
19+
20+
return NextResponse.json(
21+
{ message: "Map deleted successfully" },
22+
{ status: 200 }
23+
);
24+
} catch (error) {
25+
console.error("Error in fetching evolution:", error);
26+
return NextResponse.json(
27+
{ error: "Failed to fetch evolutions" },
28+
{ status: 500 }
29+
);
30+
}
31+
}

apps/platform/src/app/auth/page.tsx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import { ArrowLeft, GithubIcon, Loader2, UserIcon } from "lucide-react";
1515
import { authClient } from "@/lib/auth-client";
1616
import { useRouter } from "next/navigation";
1717
import { DISABLE_ANONYMOUS_AUTH } from "@/lib/utils";
18-
18+
import { FcGoogle } from "react-icons/fc";
19+
import { FaGithub } from "react-icons/fa";
1920
export default function AuthPage() {
2021
const [isLoading, setIsLoading] = useState(false);
2122

@@ -52,6 +53,20 @@ export default function AuthPage() {
5253
}
5354
};
5455

56+
async function handleGoogleSignIn() {
57+
setIsLoading(true);
58+
try {
59+
await authClient.signIn.social({
60+
provider: "google",
61+
callbackURL: "/pad",
62+
});
63+
} catch (error) {
64+
console.error("Google sign in error:", error);
65+
} finally {
66+
setIsLoading(false);
67+
}
68+
}
69+
5570
return (
5671
<div className="flex min-h-screen items-center justify-center bg-background p-6">
5772
<div className="absolute top-6 left-6">
@@ -83,10 +98,23 @@ export default function AuthPage() {
8398
{isLoading ? (
8499
<Loader2 className="h-5 w-5 animate-spin" />
85100
) : (
86-
<GithubIcon className="h-5 w-5" />
101+
<FaGithub className="h-5 w-5" />
87102
)}
88103
<span>Continue with GitHub</span>
89104
</Button>
105+
<Button
106+
variant="outline"
107+
className="w-full relative py-6 flex gap-3 paper-effect"
108+
onClick={handleGoogleSignIn}
109+
disabled={isLoading}
110+
>
111+
{isLoading ? (
112+
<Loader2 className="h-5 w-5 animate-spin" />
113+
) : (
114+
<FcGoogle className="h-5 w-5" />
115+
)}
116+
<span>Continue with Google</span>
117+
</Button>
90118

91119
{!DISABLE_ANONYMOUS_AUTH && (
92120
<Button

0 commit comments

Comments
 (0)