storkit: merge 446_story_oauth_login_button_in_web_ui

This commit is contained in:
dave
2026-03-31 10:04:52 +00:00
parent 23562dfa61
commit 321c88e05e
7 changed files with 149 additions and 2 deletions
+28 -1
View File
@@ -1,4 +1,5 @@
import * as React from "react";
import type { OAuthStatus } from "./api/client";
import { api } from "./api/client";
import { Chat } from "./components/Chat";
import { SelectionScreen } from "./components/selection/SelectionScreen";
@@ -14,6 +15,27 @@ function App() {
const [isOpening, setIsOpening] = React.useState(false);
const [knownProjects, setKnownProjects] = React.useState<string[]>([]);
const [homeDir, setHomeDir] = React.useState<string | null>(null);
const [oauthStatus, setOauthStatus] = React.useState<OAuthStatus | null>(
null,
);
React.useEffect(() => {
let active = true;
function fetchOAuthStatus() {
api
.getOAuthStatus()
.then((s) => {
if (active) setOauthStatus(s);
})
.catch(() => {});
}
fetchOAuthStatus();
const intervalId = window.setInterval(fetchOAuthStatus, 5000);
return () => {
active = false;
window.clearInterval(intervalId);
};
}, []);
React.useEffect(() => {
api
@@ -182,10 +204,15 @@ function App() {
onCloseSuggestions={closeSuggestions}
completionError={completionError}
currentPartial={currentPartial}
oauthStatus={oauthStatus}
/>
) : (
<div className="workspace" style={{ height: "100%" }}>
<Chat projectPath={projectPath} onCloseProject={closeProject} />
<Chat
projectPath={projectPath}
onCloseProject={closeProject}
oauthStatus={oauthStatus}
/>
</div>
)}