* Enable biome rules: noUnusedVariables, noUnusedFunctionParameters, noUnusedImports * Apply new rules with format * remove unused currentReplaceContent * update nextTerminalId * fix all format issues * update biome config * add back applyContextOptimizations and killAllChromeBrowsers
93 lines
2.5 KiB
TypeScript
93 lines
2.5 KiB
TypeScript
import type { Boolean, EmptyRequest } from "@shared/proto/cline/common"
|
|
import { useEffect } from "react"
|
|
import AccountView from "./components/account/AccountView"
|
|
import ChatView from "./components/chat/ChatView"
|
|
import HistoryView from "./components/history/HistoryView"
|
|
import McpView from "./components/mcp/configuration/McpConfigurationView"
|
|
import SettingsView from "./components/settings/SettingsView"
|
|
import WelcomeView from "./components/welcome/WelcomeView"
|
|
import { useClineAuth } from "./context/ClineAuthContext"
|
|
import { useExtensionState } from "./context/ExtensionStateContext"
|
|
import { Providers } from "./Providers"
|
|
import { UiServiceClient } from "./services/grpc-client"
|
|
|
|
const AppContent = () => {
|
|
const {
|
|
didHydrateState,
|
|
showWelcome,
|
|
shouldShowAnnouncement,
|
|
showMcp,
|
|
mcpTab,
|
|
showSettings,
|
|
showHistory,
|
|
showAccount,
|
|
showAnnouncement,
|
|
setShowAnnouncement,
|
|
setShouldShowAnnouncement,
|
|
closeMcpView,
|
|
navigateToHistory,
|
|
hideSettings,
|
|
hideHistory,
|
|
hideAccount,
|
|
hideAnnouncement,
|
|
} = useExtensionState()
|
|
|
|
const { clineUser, organizations, activeOrganization } = useClineAuth()
|
|
|
|
useEffect(() => {
|
|
if (shouldShowAnnouncement) {
|
|
setShowAnnouncement(true)
|
|
|
|
// Use the gRPC client instead of direct WebviewMessage
|
|
UiServiceClient.onDidShowAnnouncement({} as EmptyRequest)
|
|
.then((response: Boolean) => {
|
|
setShouldShowAnnouncement(response.value)
|
|
})
|
|
.catch((error) => {
|
|
console.error("Failed to acknowledge announcement:", error)
|
|
})
|
|
}
|
|
}, [shouldShowAnnouncement, setShouldShowAnnouncement, setShowAnnouncement])
|
|
|
|
if (!didHydrateState) {
|
|
return null
|
|
}
|
|
|
|
if (showWelcome) {
|
|
return <WelcomeView />
|
|
}
|
|
|
|
return (
|
|
<div className="flex h-screen w-full flex-col">
|
|
{showSettings && <SettingsView onDone={hideSettings} />}
|
|
{showHistory && <HistoryView onDone={hideHistory} />}
|
|
{showMcp && <McpView initialTab={mcpTab} onDone={closeMcpView} />}
|
|
{showAccount && (
|
|
<AccountView
|
|
activeOrganization={activeOrganization}
|
|
clineUser={clineUser}
|
|
onDone={hideAccount}
|
|
organizations={organizations}
|
|
/>
|
|
)}
|
|
{/* Do not conditionally load ChatView, it's expensive and there's state we don't want to lose (user input, disableInput, askResponse promise, etc.) */}
|
|
<ChatView
|
|
hideAnnouncement={hideAnnouncement}
|
|
isHidden={showSettings || showHistory || showMcp || showAccount}
|
|
showAnnouncement={showAnnouncement}
|
|
showHistoryView={navigateToHistory}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const App = () => {
|
|
return (
|
|
<Providers>
|
|
<AppContent />
|
|
</Providers>
|
|
)
|
|
}
|
|
|
|
export default App
|