diff --git a/src/app/(app)/problems/[id]/@Submissions/page.tsx b/src/app/(app)/problems/[id]/@Submissions/page.tsx
index c949d4b..9028af6 100644
--- a/src/app/(app)/problems/[id]/@Submissions/page.tsx
+++ b/src/app/(app)/problems/[id]/@Submissions/page.tsx
@@ -1,8 +1,10 @@
import prisma from "@/lib/prisma";
+import { auth } from "@/lib/auth";
import { notFound } from "next/navigation";
import { getUserLocale } from "@/i18n/locale";
import SubmissionsTable from "@/components/submissions-table";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
+import SubmissionLoginButton from "@/components/submission-login-button";
interface SubmissionsPageProps {
params: Promise<{ id: string }>;
@@ -10,15 +12,26 @@ interface SubmissionsPageProps {
export default async function SubmissionsPage({ params }: SubmissionsPageProps) {
const { id } = await params;
+ const session = await auth();
if (!id) {
return notFound();
}
+ if (!session?.user?.id) {
+ return (
+
+ )
+ }
+
+
const problem = await prisma.problem.findUnique({
where: { id },
select: {
submissions: {
+ where: {
+ userId: session.user.id,
+ },
include: {
testcaseResults: {
include: {
diff --git a/src/components/features/playground/problem/description/footer.tsx b/src/components/features/playground/problem/description/footer.tsx
index dfcab32..0b8b6ca 100644
--- a/src/components/features/playground/problem/description/footer.tsx
+++ b/src/components/features/playground/problem/description/footer.tsx
@@ -16,7 +16,7 @@ export default function ProblemDescriptionFooter({
className={cn("h-9 flex flex-none items-center bg-muted px-3 py-2", className)}
>
- Description of {title}
+ {title}
);
diff --git a/src/components/features/playground/problem/solution/footer.tsx b/src/components/features/playground/problem/solution/footer.tsx
index 69a21d0..60e6832 100644
--- a/src/components/features/playground/problem/solution/footer.tsx
+++ b/src/components/features/playground/problem/solution/footer.tsx
@@ -16,7 +16,7 @@ export default function ProblemSolutionFooter({
className={cn("h-9 flex flex-none items-center bg-muted px-3 py-2", className)}
>
- Solution of {title}
+ {title}
);
diff --git a/src/components/submission-login-button.tsx b/src/components/submission-login-button.tsx
new file mode 100644
index 0000000..d504c7f
--- /dev/null
+++ b/src/components/submission-login-button.tsx
@@ -0,0 +1,36 @@
+"use client";
+
+import { CodeXmlIcon } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { usePathname, useRouter, useSearchParams } from "next/navigation";
+
+export default function SubmissionLoginButton() {
+ const router = useRouter();
+ const pathname = usePathname();
+ const searchParams = useSearchParams();
+
+ const handleLogIn = () => {
+ const params = new URLSearchParams(searchParams.toString());
+ params.set("redirectTo", pathname);
+ router.push(`/sign-in?${params.toString()}`);
+ };
+
+ return (
+
+
+
+
Join Judge4c to Code!
+
+
+ View your Submission records here
+
+
+
+ );
+}