From 368b8dd5283dab8583f2c22e56afee65b3c338e5 Mon Sep 17 00:00:00 2001 From: rngsurrounded Date: Mon, 3 Mar 2025 23:44:43 +0900 Subject: [PATCH] fix markdown? --- .../components/TaskContent/index.tsx | 13 +++++++++++-- services/frontend/src/shared/stores/user.ts | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/services/frontend/src/pages/CompetitionSession/components/TaskContent/index.tsx b/services/frontend/src/pages/CompetitionSession/components/TaskContent/index.tsx index df6c72d..634a7a0 100644 --- a/services/frontend/src/pages/CompetitionSession/components/TaskContent/index.tsx +++ b/services/frontend/src/pages/CompetitionSession/components/TaskContent/index.tsx @@ -2,7 +2,7 @@ import React from 'react'; import ReactMarkdown from 'react-markdown'; import remarkMath from 'remark-math'; import rehypeKatex from 'rehype-katex'; -import remarkGfm from 'remark-gfm'; +import remarkGfm from 'remark-gfm'; import 'katex/dist/katex.min.css'; import { Task } from '@/shared/types/task'; import { useQuery } from '@tanstack/react-query'; @@ -25,6 +25,15 @@ const TaskContent: React.FC = ({ task }) => { const attachments = attachmentsQuery.data || []; + const convertToMarkdown = (text: string): string => { + if (!text) return ''; + + let markdown = text.replace(/\n/g, '\n\n'); + return markdown; + }; + + const markdownText = convertToMarkdown(task.description); + return (

@@ -36,7 +45,7 @@ const TaskContent: React.FC = ({ task }) => { remarkPlugins={[remarkMath, remarkGfm]} rehypePlugins={[rehypeKatex]} > - {task.description} + {markdownText}

diff --git a/services/frontend/src/shared/stores/user.ts b/services/frontend/src/shared/stores/user.ts index 08921c6..86bdc9b 100644 --- a/services/frontend/src/shared/stores/user.ts +++ b/services/frontend/src/shared/stores/user.ts @@ -1,6 +1,7 @@ import { create } from "zustand"; import { User } from "../types/user"; import { getCurrentUser } from "../api/user"; +import Cookies from "js-cookie"; interface UserState { user: User | null; @@ -22,6 +23,12 @@ const useUserStore = create((set) => ({ clearUser: () => { set({ user: null }); + + const cookies = Cookies.get(); + Object.keys(cookies).forEach(cookieName => { + Cookies.remove(cookieName, { path: '/' }); + Cookies.remove(cookieName); + }); }, }));