This commit is contained in:
rngsurrounded
2025-03-03 22:47:44 +09:00
parent a31e5b63d3
commit bc0c24fa5a
2 changed files with 18 additions and 14 deletions
@@ -80,20 +80,22 @@ const CompetitionHeader: React.FC<CompetitionHeaderProps> = ({
<header className="bg-white shadow-sm sticky top-0 z-30 w-full"> <header className="bg-white shadow-sm sticky top-0 z-30 w-full">
<div className="mx-auto max-w-6xl px-4"> <div className="mx-auto max-w-6xl px-4">
<div className="flex items-center justify-between py-4"> <div className="flex items-center justify-between py-4">
<Link <div>
to={`/competition/${competitionId}`} <Link
className="flex items-center text-gray-600 hover:text-gray-900 transition-colors font-hse-sans text-sm" to={`/competition/${competitionId}`}
> className="flex items-center text-gray-600 hover:text-gray-900 transition-colors font-hse-sans text-sm"
<ArrowLeft className="h-4 w-4 mr-1" /> >
</Link> <ArrowLeft className="h-4 w-4 mr-1" />
</Link>
<h1 className="font-hse-sans text-xl font-semibold text-center flex-1">
{title} <h1 className="font-hse-sans text-xl font-semibold text-center flex-1">
</h1> {title}
</h1>
</div>
{showTimeSection ? ( {showTimeSection ? (
<div className="flex items-center text-gray-600 font-hse-sans text-sm"> <div className="flex items-center text-gray-600 font-hse-sans text-sm">
<Clock className="h-4 w-4 mr-1" />
<div className="flex flex-col items-end"> <div className="flex flex-col items-end">
{startDate && ( {startDate && (
<span className="text-xs text-gray-500"> <span className="text-xs text-gray-500">
@@ -82,13 +82,14 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
useEffect(() => { useEffect(() => {
const loadSolutionContent = async () => { const loadSolutionContent = async () => {
if (!displayedSolution || !displayedSolution.content) return; if (!displayedSolution || !displayedSolution.content) return;
console.log(displayedSolution, solutionHistory, "CHECK")
try { try {
if (task.type === TaskType.FILE) { if (task.type === TaskType.FILE) {
setAnswer(""); setAnswer("");
setSelectedFile(null); setSelectedFile(null);
setSelectedSolutionUrl(displayedSolution.content); setSelectedSolutionUrl(displayedSolution.content);
} else { }
else {
setSelectedFile(null); setSelectedFile(null);
setSelectedSolutionUrl(null); setSelectedSolutionUrl(null);
const response = await fetch(displayedSolution.content); const response = await fetch(displayedSolution.content);
@@ -96,6 +97,7 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
throw new Error(`Failed to fetch solution content: ${response.status}`); throw new Error(`Failed to fetch solution content: ${response.status}`);
} }
const text = await response.text(); const text = await response.text();
setAnswer(text); setAnswer(text);
} }
} catch (error) { } catch (error) {
@@ -104,7 +106,7 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
}; };
loadSolutionContent(); loadSolutionContent();
}, [displayedSolution, task.type, setAnswer, setSelectedFile]); }, [displayedSolution, setAnswer, setSelectedFile]);
const handleOpenHistory = () => { const handleOpenHistory = () => {
setIsHistoryOpen(true); setIsHistoryOpen(true);