From 1b4737b668a0454a00211196151e8a7033abd1e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=92=D0=B8=D1=82=D0=B0=D0=BB=D0=B8=D0=B9=20=D0=9B=D0=B0?=
=?UTF-8?q?=D0=B2=D1=88=D0=BE=D0=BD=D0=BE=D0=BA?=
<114582703+valavshonok@users.noreply.github.com>
Date: Sun, 28 Dec 2025 21:32:54 +0300
Subject: [PATCH 1/2] fix tags
---
src/pages/Article.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pages/Article.tsx b/src/pages/Article.tsx
index 3282ab0..488dabd 100644
--- a/src/pages/Article.tsx
+++ b/src/pages/Article.tsx
@@ -50,7 +50,7 @@ const Article = () => {
#{article.id}
- {article.tags.length && (
+ {
{article.tags.map((v, i) => (
{
))}
- )}
+ }
Date: Mon, 29 Dec 2025 12:45:39 +0300
Subject: [PATCH 2/2] Save code to local storage
---
src/views/mission/codeeditor/CodeEditor.tsx | 28 ++++++++++++++++++---
src/views/mission/statement/Statement.tsx | 3 ++-
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/src/views/mission/codeeditor/CodeEditor.tsx b/src/views/mission/codeeditor/CodeEditor.tsx
index 0f501f4..1ee3f26 100644
--- a/src/views/mission/codeeditor/CodeEditor.tsx
+++ b/src/views/mission/codeeditor/CodeEditor.tsx
@@ -3,6 +3,7 @@ import Editor from '@monaco-editor/react';
import { upload } from '../../../assets/icons/input';
import { cn } from '../../../lib/cn';
import { DropDownList } from '../../../components/input/DropDownList';
+import { useParams } from 'react-router-dom';
const languageMap: Record = {
c: 'cpp',
@@ -23,19 +24,21 @@ const CodeEditor: React.FC = ({
onChange,
onChangeLanguage,
}) => {
- const [language, setLanguage] = useState('C++');
+ const { missionId } = useParams<{ missionId: string }>();
+
const [code, setCode] = useState('');
const [isDragging, setIsDragging] = useState(false);
const items = [
- { value: 'c', text: 'C' },
{ value: 'C++', text: 'C++' },
{ value: 'java', text: 'Java' },
{ value: 'python', text: 'Python' },
- { value: 'pascal', text: 'Pascal' },
{ value: 'kotlin', text: 'Kotlin' },
{ value: 'csharp', text: 'C#' },
];
+ const [language, setLanguage] = useState('C++');
+
+ const getCodeKey = (missionId?: string) => `mission_${missionId}_code`;
useEffect(() => {
onChange(code);
@@ -44,6 +47,24 @@ const CodeEditor: React.FC = ({
onChangeLanguage(language);
}, [language]);
+ useEffect(() => {
+ if (!missionId || !code) return;
+
+ localStorage.setItem(getCodeKey(missionId), code);
+ }, [code, missionId]);
+
+ useEffect(() => {
+ if (!missionId) return;
+
+ const savedCode = localStorage.getItem(getCodeKey(missionId));
+
+ if (savedCode !== null) {
+ setCode(savedCode);
+ } else {
+ setCode('');
+ }
+ }, [missionId]);
+
const handleFileUpload = (e: React.ChangeEvent) => {
const file = e.target.files?.[0];
if (!file) return;
@@ -95,7 +116,6 @@ const CodeEditor: React.FC = ({
onChange={(v) => {
setLanguage(v);
}}
- defaultState={{ value: 'C++', text: 'C++' }}
/>