@@ -3,8 +3,6 @@ import { useShallow } from 'zustand/react/shallow'
33
44import { routeUserPrompt } from './commands/router'
55import { AgentModeToggle } from './components/agent-mode-toggle'
6- import { Button } from './components/button'
7- import { LoginModal } from './components/login-modal'
86import { MessageWithAgents } from './components/message-with-agents'
97import {
108 MultilineInput ,
@@ -15,7 +13,6 @@ import { StatusBar } from './components/status-bar'
1513import { SuggestionMenu } from './components/suggestion-menu'
1614import { SLASH_COMMANDS } from './data/slash-commands'
1715import { useAgentValidation } from './hooks/use-agent-validation'
18- import { useAuthState } from './hooks/use-auth-state'
1916import { useChatInput } from './hooks/use-chat-input'
2017import { useClipboard } from './hooks/use-clipboard'
2118import { useConnectionStatus } from './hooks/use-connection-status'
@@ -44,33 +41,39 @@ import { BORDER_CHARS } from './utils/ui-constants'
4441
4542import type { ContentBlock } from './types/chat'
4643import type { SendMessageFn } from './types/contracts/send-message'
44+ import type { User } from './utils/auth'
4745import type { FileTreeNode } from '@codebuff/common/util/file'
4846import type { ScrollBoxRenderable } from '@opentui/core'
47+ import type { UseMutationResult } from '@tanstack/react-query'
48+ import type { Dispatch , SetStateAction } from 'react'
4949
5050export const Chat = ( {
5151 headerContent,
5252 initialPrompt,
5353 agentId,
54- requireAuth,
55- hasInvalidCredentials,
5654 loadedAgentsData,
5755 validationErrors,
5856 fileTree,
57+ inputRef,
58+ setIsAuthenticated,
59+ setUser,
60+ logoutMutation,
5961} : {
6062 headerContent : React . ReactNode
6163 initialPrompt : string | null
6264 agentId ?: string
63- requireAuth : boolean | null
64- hasInvalidCredentials : boolean
6565 loadedAgentsData : {
6666 agents : Array < { id : string ; displayName : string } >
6767 agentsDir : string
6868 } | null
6969 validationErrors : Array < { id : string ; message : string } >
7070 fileTree : FileTreeNode [ ]
71+ inputRef : React . MutableRefObject < MultilineInputHandle | null >
72+ setIsAuthenticated : Dispatch < SetStateAction < boolean | null > >
73+ setUser : Dispatch < SetStateAction < User | null > >
74+ logoutMutation : UseMutationResult < boolean , Error , void , unknown >
7175} ) => {
7276 const scrollRef = useRef < ScrollBoxRenderable | null > ( null )
73- const inputRef = useRef < MultilineInputHandle | null > ( null )
7477
7578 const { separatorWidth, terminalWidth } = useTerminalDimensions ( )
7679
@@ -178,20 +181,6 @@ export const Chat = ({
178181 return ids
179182 } , [ messages ] )
180183
181- const {
182- isAuthenticated,
183- setIsAuthenticated,
184- setUser,
185- handleLoginSuccess,
186- logoutMutation,
187- } = useAuthState ( {
188- requireAuth,
189- hasInvalidCredentials,
190- inputRef,
191- setInputFocused,
192- resetChatStore,
193- } )
194-
195184 // Refs for tracking state across renders
196185 const activeAgentStreamsRef = useRef < number > ( 0 )
197186 const isChainInProgressRef = useRef < boolean > ( isChainInProgress )
@@ -800,15 +789,7 @@ export const Chat = ({
800789 </ box >
801790 </ box >
802791
803- { /* Login Modal Overlay - show when not authenticated and done checking */ }
804792 { validationBanner }
805-
806- { requireAuth !== null && isAuthenticated === false && (
807- < LoginModal
808- onLoginSuccess = { handleLoginSuccess }
809- hasInvalidCredentials = { hasInvalidCredentials }
810- />
811- ) }
812793 </ box >
813794 )
814795}
0 commit comments