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
Binary file not shown.
40 changes: 36 additions & 4 deletions apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
ThreadWorktreeIndicator,
} from "./ThreadStatusIndicators";
import { ProjectDefaultAgentField } from "./ProjectDefaultAgentField";
import { ProjectGitHubAccountField } from "./ProjectGitHubAccountField";
import { ProjectFavicon } from "./ProjectFavicon";
import { useAtomValue } from "@effect/atom-react";
import { autoAnimate } from "@formkit/auto-animate";
Expand All @@ -44,6 +45,7 @@ import { restrictToFirstScrollableAncestor, restrictToVerticalAxis } from "@dnd-
import { CSS } from "@dnd-kit/utilities";
import {
type ContextMenuItem,
type GitHubAccountRef,
type ModelSelection,
ProjectId,
type ScopedThreadRef,
Expand Down Expand Up @@ -1655,7 +1657,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec

const clicked = await api.contextMenu.show(
[
buildTargetedItem("rename", "Rename"),
buildTargetedItem("rename", "Project settings…"),
buildTargetedItem("grouping", "Group into..."),
buildTargetedItem("copy-path", "Copy Path"),
buildTargetedItem("delete", "Remove", {
Expand Down Expand Up @@ -2090,6 +2092,26 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
[updateProject],
);

const updateProjectGitHubAccount = useCallback(
async (member: SidebarProjectGroupMember, account: GitHubAccountRef | null) => {
const result = await updateProject({
environmentId: member.environmentId,
input: { projectId: member.id, gitHubAccount: account },
});
if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
const error = squashAtomCommandFailure(result);
toastManager.add(
stackedThreadToast({
type: "error",
title: "Failed to update project GitHub account",
description: error instanceof Error ? error.message : "An error occurred.",
}),
);
}
},
[updateProject],
);

const closeProjectGroupingDialog = useCallback(() => {
setProjectGroupingTarget(null);
setProjectGroupingSelection("inherit");
Expand Down Expand Up @@ -2389,11 +2411,11 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
>
<DialogPopup className="max-w-lg">
<DialogHeader>
<DialogTitle>Rename project</DialogTitle>
<DialogTitle>Project settings</DialogTitle>
<DialogDescription>
{projectRenameTarget
? `Update the title for ${projectRenameTarget.workspaceRoot}.`
: "Update the project title."}
? `Rename ${projectRenameTarget.workspaceRoot} and choose which account new threads use.`
: "Rename the project and choose which account new threads use."}
</DialogDescription>
</DialogHeader>
<DialogPanel className="space-y-4">
Expand Down Expand Up @@ -2426,6 +2448,16 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
}}
/>
) : null}
{projectRenameTarget ? (
<ProjectGitHubAccountField
idPrefix={`project-agent-${projectRenameTarget.physicalProjectKey}`}
environmentId={projectRenameTarget.environmentId}
projectId={projectRenameTarget.id}
onChange={(account) => {
void updateProjectGitHubAccount(projectRenameTarget, account);
}}
/>
) : null}
</DialogPanel>
<DialogFooter>
<Button variant="outline" onClick={closeProjectRenameDialog}>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/SidebarV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ function latestTurnDiff(
const GITHUB_DEFAULT_ACCOUNT_VALUE = "__default__";

function githubAccountValue(account: { readonly host: string; readonly login: string }): string {
return `${account.host}${account.login}`;
return `${account.host}\u0000${account.login}`;
}

// github.com is the overwhelmingly common host, so hide it to keep the label
Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/components/settings/SettingsPanels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1759,8 +1759,10 @@ function MultiAccountGuide() {
</li>
<li>
<span className="font-medium text-foreground">Attach an account to a project</span>: in
the sidebar, right-click a project → <span className="text-foreground">Project settings</span>{" "}
→ <span className="text-foreground">Default agent</span>. New threads in that project
the sidebar, right-click a project (or open its{" "}
<span className="text-foreground">⋯</span> menu) →{" "}
<span className="text-foreground">Project settings</span> →{" "}
<span className="text-foreground">Default agent</span>. New threads in that project
start on the account you pick (still overridable per thread).
</li>
</ol>
Expand Down