From f7b1a7fe4221354ca9227f3f72c0c42c91743bf9 Mon Sep 17 00:00:00 2001 From: Nikita Date: Thu, 5 Sep 2024 19:15:16 +0300 Subject: [PATCH] fix(notebooks): add default project link and fix sidebar title render --- .../components/notebook_content_sections.tsx | 4 +- .../notebooks/components/notebook_editor.tsx | 64 ++++++++++++------- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/front_end/src/app/(main)/notebooks/components/notebook_content_sections.tsx b/front_end/src/app/(main)/notebooks/components/notebook_content_sections.tsx index a172ba49f3..fa7a2fd23d 100644 --- a/front_end/src/app/(main)/notebooks/components/notebook_content_sections.tsx +++ b/front_end/src/app/(main)/notebooks/components/notebook_content_sections.tsx @@ -47,11 +47,9 @@ const NotebookContentSections: FC = ({ }, [headings, headings.length]); useEffect(() => { - if (headings.length) { const notebookTitleElement = document.querySelector(`#${NOTEBOOK_TITLE}`); setNotebookTitle(notebookTitleElement?.textContent); - } - }, [headings.length]); + }, []); useEffect(() => { const handleOnScroll = () => { diff --git a/front_end/src/app/(main)/notebooks/components/notebook_editor.tsx b/front_end/src/app/(main)/notebooks/components/notebook_editor.tsx index 60d5a63281..6ca8f110cd 100644 --- a/front_end/src/app/(main)/notebooks/components/notebook_editor.tsx +++ b/front_end/src/app/(main)/notebooks/components/notebook_editor.tsx @@ -9,6 +9,8 @@ import { updateNotebook } from "@/app/(main)/questions/actions"; import MarkdownEditor from "@/components/markdown_editor"; import Button from "@/components/ui/button"; import { PostWithNotebook } from "@/types/post"; +import Link from "next/link"; +import { TournamentType } from "@/types/projects"; interface NotebookEditorProps { postData: PostWithNotebook; @@ -32,37 +34,53 @@ const NotebookEditor: React.FC = ({ setIsEditing((prev) => !prev); }; - + const defaultProject = postData.projects.default_project; return (
-
-
-
- - - setTitle(e.target.value)} - /> - + {isEditing && ( +
+ + + setTitle(e.target.value)} + /> + - -
+ +
+ )} -
- -
+ {!isEditing && ( +
+ +
+ )}
); };