submissions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { useState } from "react";
|
||||
import { cn } from "../../../lib/cn";
|
||||
import React from "react";
|
||||
// import { cn } from "../../../lib/cn";
|
||||
import LaTextContainer from "./LaTextContainer";
|
||||
// import FullLatexRenderer from "./FullLatexRenderer";
|
||||
|
||||
@@ -14,9 +14,16 @@ export interface StatementData {
|
||||
output?: string;
|
||||
sampleTests?: { input: string; output: string }[];
|
||||
notes?: string;
|
||||
html?: string;
|
||||
mediaFiles?: { id: number; fileName: string; mediaUrl: string }[];
|
||||
}
|
||||
|
||||
|
||||
function extractDivByClass(html: string, className: string): string {
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(html, "text/html");
|
||||
const div = doc.querySelector(`div.${className}`);
|
||||
return div ? div.outerHTML : "";
|
||||
}
|
||||
|
||||
const Statement: React.FC<StatementData> = ({
|
||||
id,
|
||||
@@ -29,11 +36,12 @@ const Statement: React.FC<StatementData> = ({
|
||||
output = "",
|
||||
sampleTests = [],
|
||||
notes = "",
|
||||
html = "",
|
||||
mediaFiles,
|
||||
}) => {
|
||||
|
||||
|
||||
return (
|
||||
<div className="flex flex-col w-full h-full bg-red-3001 overflow-y-scroll medium-scrollbar pl-[20px] pr-[12px] gap-[20px]">
|
||||
<div className="flex flex-col w-full h-full medium-scrollbar pl-[20px] pr-[12px] gap-[20px] text-liquid-white overflow-y-scroll thin-dark-scrollbar [scrollbar-gutter:stable]">
|
||||
<div>
|
||||
<p className="h-[50px] text-[40px] font-bold text-liquid-white">{name}</p>
|
||||
<p className="h-[23px] text-[18px] font-bold text-liquid-light">Задача #{id}</p>
|
||||
@@ -50,35 +58,31 @@ const Statement: React.FC<StatementData> = ({
|
||||
<p className="text-liquid-white h-[20px] text-[18px] font-bold"><span className="text-liquid-light">вывод:</span> стандартный вывод</p>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-[10px]">
|
||||
<LaTextContainer content={legend} />
|
||||
<div className="flex flex-col gap-[10px] mt-[20px]">
|
||||
<LaTextContainer html={extractDivByClass(html, "legend")} latex={legend} mediaFiles={mediaFiles}/>
|
||||
</div>
|
||||
<div className="flex flex-col gap-[10px]">
|
||||
<div>Входные данные</div>
|
||||
<LaTextContainer content={input} />
|
||||
<LaTextContainer html={extractDivByClass(html, "input-specification")} latex={input} mediaFiles={mediaFiles}/>
|
||||
</div>
|
||||
<div className="flex flex-col gap-[10px]">
|
||||
<div>Выходные данные</div>
|
||||
<LaTextContainer content={output} />
|
||||
<LaTextContainer html={extractDivByClass(html, "output-specification")} latex={output} mediaFiles={mediaFiles}/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>{sampleTests.length == 1 ? "Пример" : "Примеры"}</div>
|
||||
<div className="flex flex-col gap-[10px]">
|
||||
<div className="flex flex-col gap-[10px]">
|
||||
<div className="text-[18px] font-bold">{sampleTests.length == 1 ? "Пример" : "Примеры"}</div>
|
||||
|
||||
|
||||
{sampleTests.map((v, i) =>
|
||||
<div key={i} className="flex flex-col gap-[10px]">
|
||||
<div>Входные данные</div>
|
||||
<div>{v.input}</div>
|
||||
<div>Выходные данные</div>
|
||||
<div>{v.output}</div>
|
||||
<div className="text-[14px] font-bold">Входные данные</div>
|
||||
<div className="p-[10px] bg-liquid-lighter rounded-[10px] whitespace-pre-line">{v.input}</div>
|
||||
<div className="text-[14px] font-bold">Выходные данные</div>
|
||||
<div className="p-[10px] bg-liquid-lighter rounded-[10px] whitespace-pre-line">{v.output}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col gap-[10px]">
|
||||
<div>Примечание</div>
|
||||
<LaTextContainer content={notes} />
|
||||
<LaTextContainer html={extractDivByClass(html, "note")} latex={notes} mediaFiles={mediaFiles}/>
|
||||
<div>Автор: Jacks</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user