Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/renderer/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMonaco } from "@monaco-editor/react";
import { useCallback, useEffect, useRef } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
import { createLogger } from "../shared/log/renderer";
import type { WorkspaceMeta } from "../shared/types/workspace";
import { bootstrapClaudeStatus, bootstrapWorkbench } from "./bootstrap";
Expand Down Expand Up @@ -62,6 +62,7 @@ export function App() {
// workspace's tabs below it, for each connection status and progress.
const workspaces = useWorkspacesStore((s) => s.workspaces);
const activeWorkspaceId = useActiveStore((s) => s.activeWorkspaceId);
const [restoringWorkbench, setRestoringWorkbench] = useState(true);
const settingsOpen = useSettingsUIStore((s) => s.settingsOpen);
const settingsInitialActiveId = useSettingsUIStore((s) => s.initialActiveId);
const closeSettings = useSettingsUIStore((s) => s.closeSettings);
Expand Down Expand Up @@ -91,9 +92,10 @@ export function App() {
initializeEditorServices(monaco);
}, [monaco]);

// Restore the tabs and workspace selection before opening the CLI gate.
// The workspace list arrives before the restored selection. Wait for both
// before showing a welcome screen.
useEffect(() => {
void bootstrapWorkbench();
void bootstrapWorkbench().finally(() => setRestoringWorkbench(false));
void bootstrapClaudeStatus();
}, []);

Expand Down Expand Up @@ -283,9 +285,11 @@ export function App() {
>
{/* In the one cell, as the panels are: the agent view, kept
mounted there, would push it into a row of its own below. */}
{workspaces.length === 0 && !agentView && (
{!restoringWorkbench && activeWorkspaceId === null && !agentView && (
<div className="col-start-1 row-start-1 flex flex-col island-surface rounded-(--radius-island) overflow-hidden">
<WelcomeScreen onAddWorkspace={handleAddWorkspace} />
<WelcomeScreen
onAddWorkspace={workspaces.length === 0 ? handleAddWorkspace : undefined}
/>
</div>
)}
{mountedWorkspaces.map((ws) => (
Expand Down
12 changes: 7 additions & 5 deletions src/renderer/components/workbench/welcome-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@ import { useTranslation } from "react-i18next";
import { Button } from "../ui/button";

interface WelcomeScreenProps {
readonly onAddWorkspace: () => void;
readonly onAddWorkspace?: () => void;
}

/** Renders the entrypoint for opening the Add-Workspace flow (local folder OR SSH). */
/** Prompts the user to add their first workspace or select an existing one. */
export function WelcomeScreen({ onAddWorkspace }: WelcomeScreenProps): React.JSX.Element {
const { t } = useTranslation();
return (
<div className="flex flex-1 items-center justify-center">
<div className="flex max-w-md flex-col items-center gap-4 text-center">
<div>
<h1 className="text-app-body-emphasis text-foreground">{t("welcome.no_workspace")}</h1>
<p className="mt-2 text-app-ui-sm text-muted-foreground">{t("welcome.add_to_start")}</p>
<p className="mt-2 text-app-ui-sm text-muted-foreground">
{onAddWorkspace ? t("welcome.add_to_start") : t("welcome.select_from_sidebar")}
</p>
</div>
<div className="flex flex-wrap justify-center gap-2">
{onAddWorkspace && (
<Button type="button" variant="outline" size="sm" onClick={onAddWorkspace}>
{t("welcome.add_workspace")}
</Button>
</div>
)}
</div>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/shared/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"welcome": {
"no_workspace": "No workspace selected",
"add_to_start": "Add a workspace to get started.",
"select_from_sidebar": "Choose a workspace from the sidebar.",
"add_workspace": "Add workspace"
},
"statusBar": {
Expand Down
1 change: 1 addition & 0 deletions src/shared/i18n/locales/ko/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"welcome": {
"no_workspace": "선택된 워크스페이스 없음",
"add_to_start": "워크스페이스를 추가하여 시작하세요.",
"select_from_sidebar": "사이드바에서 워크스페이스를 선택하세요.",
"add_workspace": "워크스페이스 추가"
},
"statusBar": {
Expand Down
Loading