feat(layout): add everything inside chat provider

This commit is contained in:
ItzCrazyKns
2025-10-24 22:57:56 +05:30
parent d0719429b4
commit 097a5c55c6
5 changed files with 24 additions and 25 deletions

View File

@@ -1,16 +1,11 @@
'use client';
import ChatWindow from '@/components/ChatWindow';
import { useParams } from 'next/navigation';
import React from 'react';
import { ChatProvider } from '@/lib/hooks/useChat';
const Page = () => {
const { chatId }: { chatId: string } = useParams();
return (
<ChatProvider id={chatId}>
<ChatWindow />
</ChatProvider>
<ChatWindow />
);
};

View File

@@ -9,6 +9,7 @@ import { Toaster } from 'sonner';
import ThemeProvider from '@/components/theme/Provider';
import configManager from '@/lib/config';
import SetupWizard from '@/components/Setup/SetupWizard';
import { ChatProvider } from '@/lib/hooks/useChat';
const montserrat = Montserrat({
weight: ['300', '400', '500', '700'],
@@ -36,7 +37,7 @@ export default function RootLayout({
<body className={cn('h-full', montserrat.className)}>
<ThemeProvider>
{setupComplete ? (
<>
<ChatProvider>
<Sidebar>{children}</Sidebar>
<Toaster
toastOptions={{
@@ -47,7 +48,7 @@ export default function RootLayout({
},
}}
/>
</>
</ChatProvider>
) : (
<SetupWizard configSections={configSections} />
)}

View File

@@ -1,7 +1,5 @@
import ChatWindow from '@/components/ChatWindow';
import { ChatProvider } from '@/lib/hooks/useChat';
import { Metadata } from 'next';
import { Suspense } from 'react';
export const metadata: Metadata = {
title: 'Chat - Perplexica',
@@ -10,13 +8,7 @@ export const metadata: Metadata = {
const Home = () => {
return (
<div>
<Suspense>
<ChatProvider>
<ChatWindow />
</ChatProvider>
</Suspense>
</div>
<ChatWindow />
);
};