The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 12:45 UTC
feat(web): open project settings from thread menus (#8925)
Dara Adedeji committed
Sep 1, 2026 at 16:43 UTC
cb007469161ff0db2bc2dc8123c4b30e186aae50
6 files changed
+105
-7
apps/web/src/components/LegacySidebar.tsx
+14
@@ -2165,11 +2165,21 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
2165
{ id: "mark-unread", label: "Mark unread" },
2166
{ id: "copy-path", label: "Copy Path" },
2167
{ id: "copy-thread-id", label: "Copy Thread ID" },
2168
+ { id: "project-settings", label: "Project settings" },
2169
{ id: "delete", label: "Delete", destructive: true, icon: "trash" },
2170
],
2171
position,
2172
);
2173
2174
+ if (clicked === "project-settings") {
2175
+ if (isMobile) setOpenMobile(false);
2176
+ void router.navigate({
2177
+ to: "/projects/$projectKey",
2178
+ params: { projectKey: project.projectKey },
2179
+ });
2180
+ return;
2181
+ }
2182
+
2183
if (clicked === "new-thread-on-branch") {
2184
// Explicit branch carry-over: reuse the thread's worktree when it
2185
// has one, otherwise its branch on the local checkout.
@@ -2252,9 +2262,13 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
2262
copyThreadIdToClipboard,
2263
deleteThread,
2264
handleNewThread,
2265
+ isMobile,
2266
markThreadUnread,
2267
memberProjectByScopedKey,
2268
+ project.projectKey,
2269
project.workspaceRoot,
2270
+ router,
2271
+ setOpenMobile,
2272
startThreadRename,
2273
],
2274
);
apps/web/src/components/Sidebar.tsx
+25
-5
@@ -1888,6 +1888,8 @@ export default function Sidebar() {
1888
() => sortLogicalProjectsForSidebar(unsortedProjectGroups, threads, sidebarProjectSortOrder),
1889
[sidebarProjectSortOrder, threads, unsortedProjectGroups],
1890
);
1891
+ const projectGroupsRef = useRef(projectGroups);
1892
+ projectGroupsRef.current = projectGroups;
1893
const serverConfigs = useAtomValue(environmentServerConfigsAtom);
1894
// Threads on non-primary environments (T3 Connect, hosted) resolve their
1895
// provider entry from their own environment's config: default instance ids
@@ -2043,11 +2045,8 @@ export default function Sidebar() {
2045
clearSelection();
2046
}, [clearSelection, projectScopeKey]);
2047
2046
- const handleProjectSettings = useCallback(
2047
- (event: ReactMouseEvent<HTMLButtonElement>, projectGroup: SidebarProjectSnapshot) => {
2048
- event.preventDefault();
2049
- event.stopPropagation();
2050
- dispatchProjectScopeMenu({ type: "project-settings-opened" });
2048
+ const openProjectSettings = useCallback(
2049
+ (projectGroup: SidebarProjectSnapshot) => {
2050
if (isMobile) {
2051
setOpenMobile(false);
2052
}
@@ -2058,6 +2057,15 @@ export default function Sidebar() {
2057
},
2058
[isMobile, router, setOpenMobile],
2059
);
2060
+ const handleProjectSettings = useCallback(
2061
+ (event: ReactMouseEvent<HTMLButtonElement>, projectGroup: SidebarProjectSnapshot) => {
2062
+ event.preventDefault();
2063
+ event.stopPropagation();
2064
+ dispatchProjectScopeMenu({ type: "project-settings-opened" });
2065
+ openProjectSettings(projectGroup);
2066
+ },
2067
+ [openProjectSettings],
2068
+ );
2069
2070
// Settled threads stay in the live shell stream (settled ≠ archived), so
2071
// the partition works directly off live shells: no archived-snapshot
@@ -3122,6 +3130,17 @@ export default function Sidebar() {
3130
return;
3131
}
3132
switch (clicked.value) {
3133
+ case "project-settings": {
3134
+ const projectGroup = projectGroupsRef.current.find((group) =>
3135
+ group.memberProjectRefs.some(
3136
+ (projectRef) =>
3137
+ projectRef.environmentId === thread.environmentId &&
3138
+ projectRef.projectId === thread.projectId,
3139
+ ),
3140
+ );
3141
+ if (projectGroup) openProjectSettings(projectGroup);
3142
+ return;
3143
+ }
3144
case "new-thread-on-branch": {
3145
// Explicit branch carry-over: reuse the thread's worktree when it
3146
// has one, otherwise its branch on the local checkout.
@@ -3281,6 +3300,7 @@ export default function Sidebar() {
3300
deleteThread,
3301
handleMultiSelectContextMenu,
3302
markThreadUnread,
3303
+ openProjectSettings,
3304
projectCwdByKey,
3305
serverConfigs,
3306
startThreadRename,
apps/web/src/components/threadActionMenu.logic.test.ts
+12
-1
@@ -33,7 +33,18 @@ describe("buildThreadActionMenuItems", () => {
33
...baseState,
34
supports: { settlement: false, snooze: false, pinning: false, titleRegeneration: false },
35
}),
36
- ).toEqual(["rename", "mark-unread", "copy", "archive", "delete"]);
36
+ ).toEqual(["rename", "mark-unread", "copy", "project-settings", "archive", "delete"]);
37
+ });
38
+
39
+ it("groups project settings with utility actions before archive", () => {
40
+ const items = buildThreadActionMenuItems(baseState);
41
+ const copyIndex = items.findIndex((item) => item.id === "copy");
42
+ expect(items[copyIndex + 1]).toMatchObject({
43
+ id: "project-settings",
44
+ label: "Project settings",
45
+ icon: "settings",
46
+ });
47
+ expect(items[copyIndex + 2]?.id).toBe("archive");
48
});
49
50
it("includes branch items only for threads with a branch", () => {
apps/web/src/components/threadActionMenu.logic.ts
+2
@@ -8,6 +8,7 @@ import type { SnoozePreset } from "@t3tools/client-runtime/state/thread-settled"
8
*/
9
export type ThreadActionMenuId =
10
| "new-thread-on-branch"
11
+ | "project-settings"
12
| "pin"
13
| "unpin"
14
| "settle"
@@ -119,6 +120,7 @@ export function buildThreadActionMenuItems(
120
{ id: "copy-thread-id", label: "Thread ID", icon: "hash" },
121
],
122
},
123
+ { id: "project-settings", label: "Project settings", icon: "settings" },
124
// Archive removes the thread from the sidebar while keeping its
125
// conversation under Settings > Archived threads — distinct from Settle
126
// (stays visible in the Settled shelf) and Delete (clears history for
apps/web/src/contextMenuFallback.ts
+9
@@ -96,6 +96,15 @@ const ICON_PATHS: Record<string, ReadonlyArray<{ tag: string; attrs: Record<stri
96
{ tag: "path", attrs: { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" } },
97
{ tag: "path", attrs: { d: "M8 16H3v5" } },
98
],
99
+ settings: [
100
+ {
101
+ tag: "path",
102
+ attrs: {
103
+ d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.51a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",
104
+ },
105
+ },
106
+ { tag: "circle", attrs: { cx: "12", cy: "12", r: "3" } },
107
+ ],
108
"folder-tree": [
109
{
110
tag: "path",
apps/web/src/hooks/useThreadActionMenu.ts
+43
-1
@@ -7,7 +7,8 @@ import {
7
} from "@t3tools/client-runtime/state/runtime";
8
import { canSnooze, effectiveSnoozed } from "@t3tools/client-runtime/state/thread-settled";
9
import type { ScopedThreadRef, ThreadId } from "@t3tools/contracts";
10
-import { useCallback } from "react";
10
+import { useRouter } from "@tanstack/react-router";
11
+import { useCallback, useMemo } from "react";
12
13
import { resolveSnoozePresets, snoozeWakeDescription } from "../components/Sidebar.snooze";
14
import {
@@ -23,8 +24,16 @@ import {
24
readEnvironmentSupportsSnooze,
25
readEnvironmentSupportsTitleRegeneration,
26
readThreadShell,
27
+ useProjects,
28
} from "../state/entities";
29
+import { usePrimaryEnvironmentId } from "../state/environments";
30
import { readLocalApi } from "../localApi";
31
+import {
32
+ deriveLogicalProjectKeyFromSettings,
33
+ derivePhysicalProjectKey,
34
+ selectProjectGroupingSettings,
35
+} from "../logicalProject";
36
+import { buildPhysicalToLogicalProjectKeyMap } from "../sidebarProjectGrouping";
37
import { useUiStateStore } from "../uiStateStore";
38
import { useCopyToClipboard } from "./useCopyToClipboard";
39
import { useNewThreadHandler } from "./useHandleNewThread";
@@ -58,6 +67,19 @@ export function useThreadActionMenu(input: {
67
readonly onStartRename: () => void;
68
}) {
69
const { threadRef, projectCwd, onStartRename } = input;
70
+ const router = useRouter();
71
+ const projects = useProjects();
72
+ const primaryEnvironmentId = usePrimaryEnvironmentId();
73
+ const projectGroupingSettings = useClientSettings(selectProjectGroupingSettings);
74
+ const logicalProjectKeyByPhysicalKey = useMemo(
75
+ () =>
76
+ buildPhysicalToLogicalProjectKeyMap({
77
+ projects,
78
+ settings: projectGroupingSettings,
79
+ primaryEnvironmentId,
80
+ }),
81
+ [primaryEnvironmentId, projectGroupingSettings, projects],
82
+ );
83
const {
84
settleThread,
85
unsettleThread,
@@ -168,6 +190,22 @@ export function useThreadActionMenu(input: {
190
}
191
};
192
switch (action) {
193
+ case "project-settings": {
194
+ const project = projects.find(
195
+ (candidate) =>
196
+ candidate.environmentId === thread.environmentId &&
197
+ candidate.id === thread.projectId,
198
+ );
199
+ if (!project) return;
200
+ const projectKey =
201
+ logicalProjectKeyByPhysicalKey.get(derivePhysicalProjectKey(project)) ??
202
+ deriveLogicalProjectKeyFromSettings(project, projectGroupingSettings);
203
+ void router.navigate({
204
+ to: "/projects/$projectKey",
205
+ params: { projectKey },
206
+ });
207
+ return;
208
+ }
209
case "new-thread-on-branch": {
210
// Explicit branch carry-over: reuse the thread's worktree when it
211
// has one, otherwise its branch on the local checkout.
@@ -300,10 +338,14 @@ export function useThreadActionMenu(input: {
338
copyThreadIdToClipboard,
339
deleteThread,
340
handleNewThread,
341
+ logicalProjectKeyByPhysicalKey,
342
markThreadUnread,
343
onStartRename,
344
pinThread,
345
projectCwd,
346
+ projectGroupingSettings,
347
+ projects,
348
+ router,
349
settleThread,
350
snoozeThread,
351
threadRef,