11'use client'
22
3- import { useState , useRef , useEffect } from 'react'
3+ import { useState , useRef , useEffect , useCallback } from 'react'
44import { SetupPanel } from '@/components/setup-panel'
55import { ChatPanel } from '@/components/chat-panel'
66import { PreviewPanel } from '@/components/preview-panel'
@@ -21,24 +21,25 @@ export interface GeneratedData {
2121export default function Home ( ) {
2222 const [ config , setConfig ] = useState < AppConfig | null > ( null )
2323 const [ sessionData , setSessionData ] = useState < string > ( '' )
24- const [ generatedData , setGeneratedData ] = useState < GeneratedData | null > ( null )
24+ const [ generatedData , setGeneratedDataState ] = useState < GeneratedData | null > ( null )
2525 /** User explicitly confirms the preview before HackMD creation is allowed. */
2626 const [ previewConfirmed , setPreviewConfirmed ] = useState ( false )
2727 const [ showProgress , setShowProgress ] = useState ( false )
2828 const [ previewPage , setPreviewPage ] = useState < { title : string ; content : string } | null > ( null )
2929 const sessionDataRef = useRef ( sessionData )
3030 useEffect ( ( ) => { sessionDataRef . current = sessionData } , [ sessionData ] )
3131
32- useEffect ( ( ) => {
32+ const setGeneratedData = useCallback ( ( data : GeneratedData | null ) => {
33+ setGeneratedDataState ( data )
3334 setPreviewConfirmed ( false )
34- } , [ generatedData ] )
35+ } , [ ] )
3536
3637 if ( ! config ) {
3738 return < SetupPanel onConfigured = { setConfig } />
3839 }
3940
4041 return (
41- < div className = "flex flex-col lg:flex-row h-screen bg-gray -50 min-h-0 " >
42+ < div className = "flex flex-col lg:flex-row h-screen min-h-0 bg-zinc -50 dark:bg-zinc-950 " >
4243 { /* Chat */ }
4344 < div className = "flex-1 flex flex-col min-h-0 min-w-0 lg:max-w-[calc(100%-480px)]" >
4445 < ChatPanel
@@ -54,7 +55,7 @@ export default function Home() {
5455 </ div >
5556
5657 { /* Preview + confirm + create (always mounted so narrow screens can confirm before HackMD) */ }
57- < div className = "h-[min(42vh,420px)] lg:h-auto lg:w-[480px] border-t lg:border-t-0 lg: border-l border-gray -200 bg-white flex-shrink-0 flex flex-col min-h-0 " >
58+ < div className = "h-[min(42vh,420px)] lg:h-auto lg:w-[480px] flex-shrink-0 flex flex-col min-h-0 border-t border-zinc -200/80 bg-white shadow-[inset_0_1px_0_0_rgba(0,0,0,0.03)] dark:border-zinc-800 dark:bg-zinc-900 lg:border-t-0 lg:border-l " >
5859 < PreviewPanel
5960 generatedData = { generatedData }
6061 previewPage = { previewPage }
0 commit comments