mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Refactor showWelcome
This commit is contained in:
@@ -10,26 +10,14 @@ import { ExtensionStateContextProvider, useExtensionState } from "./context/Exte
|
||||
import { vscode } from "./utils/vscode"
|
||||
|
||||
const AppContent = () => {
|
||||
const { apiConfiguration, shouldShowAnnouncement } = useExtensionState()
|
||||
const { didHydrateState, showWelcome, apiConfiguration, shouldShowAnnouncement } = useExtensionState()
|
||||
const [showSettings, setShowSettings] = useState(false)
|
||||
const [showHistory, setShowHistory] = useState(false)
|
||||
const [showWelcome, setShowWelcome] = useState<boolean>(false)
|
||||
const [showAnnouncement, setShowAnnouncement] = useState(false)
|
||||
|
||||
const handleMessage = useCallback((e: MessageEvent) => {
|
||||
const message: ExtensionMessage = e.data
|
||||
switch (message.type) {
|
||||
case "state":
|
||||
let hasKey = false
|
||||
const config = message.state?.apiConfiguration
|
||||
if (config) {
|
||||
const { apiKey, openRouterApiKey, awsAccessKey, vertexProjectId } = config
|
||||
hasKey = [apiKey, openRouterApiKey, awsAccessKey, vertexProjectId].some((key) => key !== undefined)
|
||||
} else {
|
||||
hasKey = false
|
||||
}
|
||||
setShowWelcome(!hasKey)
|
||||
break
|
||||
case "action":
|
||||
switch (message.action!) {
|
||||
case "settingsButtonTapped":
|
||||
@@ -62,6 +50,10 @@ const AppContent = () => {
|
||||
}
|
||||
}, [shouldShowAnnouncement])
|
||||
|
||||
if (!didHydrateState) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{showWelcome ? (
|
||||
|
||||
Reference in New Issue
Block a user