-
Notifications
You must be signed in to change notification settings - Fork 0
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
44c952a
commit 109d0bc
Showing
6 changed files
with
77 additions
and
63 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
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 was deleted.
Oops, something went wrong.
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 @@ | ||
"use client" | ||
import { useState } from "react"; | ||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs"; | ||
import { Submissions } from "./Submissions"; | ||
import { ProblemStatement } from "./ProblemStatement"; | ||
|
||
export function ProblemDetail({ problem }: { problem: any }) { | ||
const [activeTab, setActiveTab] = useState("description"); | ||
|
||
return ( | ||
<div className="bg-white dark:bg-gray-900 rounded-lg shadow-md p-4"> | ||
<div className="flex justify-between items-center mb-4"> | ||
<Tabs | ||
defaultValue="problem" | ||
className="rounded-md" | ||
value={activeTab} | ||
onValueChange={setActiveTab}> | ||
<TabsList className="grid grid-cols-2 w-48 gap-2"> | ||
<TabsTrigger value="description">Description</TabsTrigger> | ||
<TabsTrigger value="submissions">Submissions</TabsTrigger> | ||
</TabsList> | ||
</Tabs> | ||
</div> | ||
{activeTab === "submissions" && <Submissions problem={problem} />} | ||
{activeTab === "description" && ( | ||
<ProblemStatement description={problem.description} tags={problem.tags} title={problem.title} /> | ||
)} | ||
</div> | ||
) | ||
} |
File renamed without changes.
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,39 @@ | ||
"use client"; | ||
import { LANGUAGE_MAPPING } from "@repo/common/language"; | ||
import { useState } from "react"; | ||
import { LanguageSelector } from "./LanguageSelector"; | ||
import { SubmitProblem } from "./SubmitProblem"; | ||
|
||
export interface IProblem { | ||
id: string; | ||
title: string; | ||
description: string; | ||
slug: string; | ||
defaultCode: { | ||
languageId: number; | ||
code: string; | ||
}[]; | ||
}; | ||
|
||
|
||
export const ProblemSubmitBar = ({ | ||
problem, | ||
contestId, | ||
}: { | ||
problem: IProblem; | ||
contestId?: string; | ||
}) => { | ||
const [language, setLanguage] = useState( | ||
Object.keys(LANGUAGE_MAPPING)[0] as string | ||
); | ||
|
||
return ( | ||
<div className="bg-white dark:bg-gray-900 rounded-lg shadow-md "> | ||
<div className="flex justify-between items-center mb-4"> | ||
<LanguageSelector language={language} setLanguage={setLanguage} /> | ||
</div> | ||
<SubmitProblem problem={problem} contestId={contestId} language={language} /> | ||
</div> | ||
) | ||
}; | ||
|