Skip to content

Commit 8bd8ad1

Browse files
refactor(web): move project settings to contextual routes
- Replace the project settings listing with standalone contextual project pages - Add project renaming, checkout selection, and updated sidebar and command-palette navigation
1 parent 83d769f commit 8bd8ad1

10 files changed

Lines changed: 641 additions & 659 deletions

‎apps/web/src/components/CommandPalette.tsx‎

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,16 +1506,32 @@ function OpenCommandPaletteDialog(props: {
15061506
},
15071507
});
15081508

1509-
actionItems.push({
1510-
kind: "action",
1511-
value: "action:project-settings",
1512-
searchTerms: ["project", "settings", "scripts", "model", "grouping", "checkout"],
1513-
title: "Project settings",
1514-
icon: <FolderIcon className={ITEM_ICON_CLASS} />,
1515-
run: async () => {
1516-
await navigate({ to: "/settings/projects" });
1517-
},
1518-
});
1509+
// There is no projects listing page; the action targets the contextual
1510+
// project (active thread/draft, falling back to the first sidebar group).
1511+
const contextualProjectGroup =
1512+
(contextualProjectRef
1513+
? projectGroupByTargetKey.get(
1514+
`${contextualProjectRef.environmentId}:${contextualProjectRef.projectId}`,
1515+
)
1516+
: null) ??
1517+
projectGroups[0] ??
1518+
null;
1519+
if (contextualProjectGroup) {
1520+
actionItems.push({
1521+
kind: "action",
1522+
value: "action:project-settings",
1523+
searchTerms: ["project", "settings", "scripts", "model", "grouping", "checkout"],
1524+
title: "Project settings",
1525+
description: contextualProjectGroup.displayName,
1526+
icon: <FolderIcon className={ITEM_ICON_CLASS} />,
1527+
run: async () => {
1528+
await navigate({
1529+
to: "/projects/$projectKey",
1530+
params: { projectKey: contextualProjectGroup.projectKey },
1531+
});
1532+
},
1533+
});
1534+
}
15191535

15201536
const rootGroups = buildRootGroups({ actionItems, recentThreadItems });
15211537
const sourceSelectionViewValue =

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ import {
4242
FolderIcon,
4343
FolderPlusIcon,
4444
GitBranchIcon,
45-
EllipsisIcon,
4645
MessageSquareIcon,
4746
PinIcon,
4847
PlusIcon,
4948
SearchIcon,
5049
ServerIcon,
50+
SettingsIcon,
5151
SquarePenIcon,
5252
TerminalIcon,
5353
Undo2Icon,
@@ -1836,7 +1836,7 @@ export default function Sidebar() {
18361836
clearSelection();
18371837
}, [clearSelection, projectScopeKey]);
18381838

1839-
const handleProjectActions = useCallback(
1839+
const handleProjectSettings = useCallback(
18401840
(event: ReactMouseEvent<HTMLButtonElement>, projectGroup: SidebarProjectSnapshot) => {
18411841
event.preventDefault();
18421842
event.stopPropagation();
@@ -1845,7 +1845,7 @@ export default function Sidebar() {
18451845
setOpenMobile(false);
18461846
}
18471847
void router.navigate({
1848-
to: "/settings/projects/$projectKey",
1848+
to: "/projects/$projectKey",
18491849
params: { projectKey: projectGroup.projectKey },
18501850
});
18511851
},
@@ -3295,15 +3295,15 @@ export default function Sidebar() {
32953295
<span className="min-w-0 truncate text-sm">{project.displayName}</span>
32963296
<button
32973297
type="button"
3298-
aria-label={`Project actions for ${project.displayName}`}
3299-
title={`Project actions for ${project.displayName}`}
3298+
aria-label={`Project settings for ${project.displayName}`}
3299+
title={`Project settings for ${project.displayName}`}
33003300
className="ml-auto inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-icon-muted outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
33013301
onPointerDown={(event) => event.stopPropagation()}
33023302
onClick={(event) => {
3303-
void handleProjectActions(event, project);
3303+
void handleProjectSettings(event, project);
33043304
}}
33053305
>
3306-
<EllipsisIcon className="size-3.5" />
3306+
<SettingsIcon className="size-3.5" />
33073307
</button>
33083308
</MenuRadioItem>
33093309
);

0 commit comments

Comments
 (0)