@@ -5,7 +5,7 @@ import { MarkdownSection } from "./splitMarkdown";
55import { ChatForm } from "./chatForm" ;
66import { Heading , StyledMarkdown } from "./markdown" ;
77import { useChatHistoryContext } from "./chatHistory" ;
8- import { useDynamicMdContext } from "./dynamicMdContext" ;
8+ import { useSidebarMdContext } from "./dynamicMdContext" ;
99import clsx from "clsx" ;
1010
1111// MarkdownSectionに追加で、ユーザーが今そのセクションを読んでいるかどうか、などの動的な情報を持たせる
@@ -20,10 +20,10 @@ interface PageContentProps {
2020 docs_id : string ;
2121}
2222export function PageContent ( props : PageContentProps ) {
23- const { setDynamicMdContent } = useDynamicMdContext ( ) ;
23+ const { setSidebarMdContent } = useSidebarMdContext ( ) ;
2424
2525 // SSR用のローカルstate
26- const [ localDynamicMdContent , setLocalDynamicMdContent ] = useState <
26+ const [ dynamicMdContent , setDynamicMdContent ] = useState <
2727 DynamicMarkdownSection [ ]
2828 > (
2929 props . splitMdContent . map ( ( section , i ) => ( {
@@ -40,14 +40,14 @@ export function PageContent(props: PageContentProps) {
4040 inView : false ,
4141 sectionId : `${ props . docs_id } -${ i } ` ,
4242 } ) ) ;
43- setLocalDynamicMdContent ( newContent ) ;
4443 setDynamicMdContent ( newContent ) ;
44+ setSidebarMdContent ( newContent ) ;
4545
4646 // クリーンアップ:コンポーネントがアンマウントされたらcontextをクリア
4747 return ( ) => {
48- setDynamicMdContent ( [ ] ) ;
48+ setSidebarMdContent ( [ ] ) ;
4949 } ;
50- } , [ props . splitMdContent , props . docs_id , setDynamicMdContent ] ) ;
50+ } , [ props . splitMdContent , props . docs_id , setSidebarMdContent ] ) ;
5151
5252 const sectionRefs = useRef < Array < HTMLDivElement | null > > ( [ ] ) ;
5353 // sectionRefsの長さをsplitMdContentに合わせる
@@ -70,15 +70,15 @@ export function PageContent(props: PageContentProps) {
7070 } ;
7171
7272 // ローカルstateとcontextの両方を更新
73- setLocalDynamicMdContent ( updateContent ) ;
7473 setDynamicMdContent ( updateContent ) ;
74+ setSidebarMdContent ( updateContent ) ;
7575 } ;
7676 window . addEventListener ( "scroll" , handleScroll ) ;
7777 handleScroll ( ) ;
7878 return ( ) => {
7979 window . removeEventListener ( "scroll" , handleScroll ) ;
8080 } ;
81- } , [ setDynamicMdContent ] ) ;
81+ } , [ setSidebarMdContent ] ) ;
8282
8383 const [ isFormVisible , setIsFormVisible ] = useState ( false ) ;
8484
@@ -91,7 +91,7 @@ export function PageContent(props: PageContentProps) {
9191 gridTemplateColumns : `1fr auto` ,
9292 } }
9393 >
94- { localDynamicMdContent . map ( ( section , index ) => (
94+ { dynamicMdContent . map ( ( section , index ) => (
9595 < >
9696 < div
9797 className = "max-w-200"
@@ -147,7 +147,7 @@ export function PageContent(props: PageContentProps) {
147147 < div className = "fixed bottom-4 right-4 left-4 lg:left-84 z-20" >
148148 < ChatForm
149149 documentContent = { props . documentContent }
150- sectionContent = { localDynamicMdContent }
150+ sectionContent = { dynamicMdContent }
151151 docs_id = { props . docs_id }
152152 close = { ( ) => setIsFormVisible ( false ) }
153153 />
0 commit comments