@@ -14,6 +14,7 @@ import { SettingsSection } from "@/components/settings/SettingsSection";
1414import { extractTokenFromUri , getApiBaseUrlFromUri } from "@/lib/utils" ;
1515import { PDFAPIService } from "@/components/pdf/PDFAPIService" ;
1616import { MorphikSidebarRemote } from "@/components/sidebar-stateful" ;
17+ import { useChatContext } from "@/components/chat/chat-context" ;
1718import { DynamicSiteHeader } from "@/components/dynamic-site-header" ;
1819import { SidebarInset , SidebarProvider } from "@/components/ui/sidebar-components" ;
1920import { MorphikProvider } from "@/contexts/morphik-context" ;
@@ -203,6 +204,58 @@ const MorphikUI: React.FC<MorphikUIProps> = props => {
203204 }
204205 } ;
205206
207+ // Local wrapper to bridge ChatContext into the Sidebar props
208+ const SidebarWithChatContext : React . FC < {
209+ logoLight ?: string ;
210+ logoDark ?: string ;
211+ showChatView : boolean ;
212+ onChatViewChange : ( show : boolean ) => void ;
213+ showSettingsView : boolean ;
214+ onSettingsViewChange : ( show : boolean ) => void ;
215+ currentSection : string ;
216+ onSectionChange : ( section : string ) => void ;
217+ userProfile ?: typeof userProfile ;
218+ onLogout ?: typeof onLogout ;
219+ onProfileNavigate ?: typeof onProfileNavigate ;
220+ onUpgradeClick ?: typeof onUpgradeClick ;
221+ } > = ( {
222+ logoLight,
223+ logoDark,
224+ showChatView,
225+ onChatViewChange,
226+ showSettingsView,
227+ onSettingsViewChange,
228+ currentSection,
229+ onSectionChange,
230+ userProfile,
231+ onLogout,
232+ onProfileNavigate,
233+ onUpgradeClick,
234+ } ) => {
235+ const { activeChatId, setActiveChatId, activeSettingsTab, setActiveSettingsTab } = useChatContext ( ) ;
236+
237+ return (
238+ < MorphikSidebarRemote
239+ currentSection = { currentSection }
240+ onSectionChange = { onSectionChange }
241+ userProfile = { userProfile }
242+ onLogout = { onLogout }
243+ onProfileNavigate = { onProfileNavigate }
244+ onUpgradeClick = { onUpgradeClick }
245+ logoLight = { logoLight }
246+ logoDark = { logoDark }
247+ showChatView = { showChatView }
248+ onChatViewChange = { onChatViewChange }
249+ activeChatId = { activeChatId }
250+ onChatSelect = { setActiveChatId }
251+ showSettingsView = { showSettingsView }
252+ onSettingsViewChange = { onSettingsViewChange }
253+ activeSettingsTab = { activeSettingsTab }
254+ onSettingsTabChange = { setActiveSettingsTab }
255+ />
256+ ) ;
257+ } ;
258+
206259 const contentInner = (
207260 < PDFAPIService sessionId = { sessionId } userId = { userId } >
208261 < div className = "min-h-screen bg-sidebar" >
@@ -224,7 +277,7 @@ const MorphikUI: React.FC<MorphikUIProps> = props => {
224277 } as React . CSSProperties
225278 }
226279 >
227- < MorphikSidebarRemote
280+ < SidebarWithChatContext
228281 currentSection = { currentSection }
229282 onSectionChange = { handleSectionChange }
230283 userProfile = { userProfile }
0 commit comments