chat client UI restructure + added all projects view and settings view(placeholder)
This commit is contained in:
@@ -1,15 +1,25 @@
|
||||
import React, { useState } from 'react';
|
||||
import SessionList from './components/SessionList';
|
||||
import ChatWindow from './components/ChatWindow';
|
||||
import InfoPanel from './components/InfoPanel';
|
||||
import Sidebar from './components/Sidebar';
|
||||
|
||||
/*** View Panels*** */
|
||||
import AllChatsView from './components/AllChatsView';
|
||||
import AllProjectsView from './components/AllProjectsView';
|
||||
import SettingsView from './components/SettingsView';
|
||||
|
||||
/**** useHooks **** */
|
||||
import { useSession } from './hooks/useSession';
|
||||
import { useChat } from './hooks/useChat';
|
||||
import { useModels } from './hooks/useModels';
|
||||
import { useProjects } from './hooks/useProjects';
|
||||
|
||||
export default function App() {
|
||||
const [leftOpen, setLeftOpen] = useState(true);
|
||||
const [rightOpen, setRightOpen] = useState(true);
|
||||
const [rightOpen, setRightOpen] = useState(false);
|
||||
const { models, selectedModel, setSelectedModel } = useModels();
|
||||
const [view, setView] = useState('chat')
|
||||
const {projects, refreshProjects} = useProjects();
|
||||
|
||||
const {
|
||||
sessions,
|
||||
@@ -48,24 +58,45 @@ export default function App() {
|
||||
height: '100vh',
|
||||
overflow: 'hidden',
|
||||
}}>
|
||||
<SessionList
|
||||
<Sidebar
|
||||
sessions={sessions}
|
||||
activeSession={activeSession}
|
||||
onSelectSession={selectSession}
|
||||
onNewChat={createSession}
|
||||
onNewProject={()=> setView('all-projects')}
|
||||
isOpen={leftOpen}
|
||||
onToggle={() => setLeftOpen(o => !o)}
|
||||
onSessionsChange={handleSessionsChange}
|
||||
onNavigate={setView}
|
||||
projects={projects}
|
||||
onProjectsChange={refreshProjects}
|
||||
/>
|
||||
|
||||
|
||||
{view === 'chat' && (
|
||||
<ChatWindow
|
||||
messages={messages}
|
||||
loadingHistory={loadingHistory}
|
||||
streaming={streaming}
|
||||
activeSession={activeSession}
|
||||
onSendMessage={handleSendMessage}
|
||||
onCancel={cancelStream}
|
||||
/>
|
||||
messages={messages}
|
||||
loadingHistory={loadingHistory}
|
||||
streaming={streaming}
|
||||
activeSession={activeSession}
|
||||
onSendMessage={handleSendMessage}
|
||||
onCancel={cancelStream}
|
||||
onTogglePanel={() => setRightOpen(o => !o)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{view === 'all-chats' && (
|
||||
<AllChatsView
|
||||
onSelectSession={session => {selectSession(session); setView('chat');}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{view === 'all-projects' && (
|
||||
<AllProjectsView onProjectsChange={refreshProjects}/>
|
||||
)}
|
||||
|
||||
{view === 'settings' && <SettingsView />}
|
||||
|
||||
|
||||
<InfoPanel
|
||||
isOpen={rightOpen}
|
||||
|
||||
Reference in New Issue
Block a user