Skip to content

Commit 606a325

Browse files
authored
Use the project context menu for renaming (#358)
- Remove project rename from double-click - Keep error notification dismiss handlers conditional
1 parent 5221e4a commit 606a325

3 files changed

Lines changed: 22 additions & 32 deletions

File tree

apps/web/src/components/Sidebar.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ describe("Sidebar file tree shortcut", () => {
1010
expect(src).toContain('useRightPanelStore.getState().open("workspace")');
1111
expect(src).not.toContain("<WorkspaceFileTree");
1212
});
13+
14+
it("uses the project context menu for renaming instead of double click", () => {
15+
const src = readFileSync(resolve(import.meta.dirname, "./Sidebar.tsx"), "utf8");
16+
17+
expect(src).toContain('{ id: "rename", label: "Rename project" }');
18+
expect(src).toContain("onContextMenu={(event) => {");
19+
expect(src).not.toContain("onDoubleClick={(e) => {");
20+
});
1321
});

apps/web/src/components/Sidebar.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,13 +1343,6 @@ export default function Sidebar() {
13431343
? { color: isDark ? pColor.textDark : pColor.text }
13441344
: undefined
13451345
}
1346-
onDoubleClick={(e) => {
1347-
e.stopPropagation();
1348-
startProjectEditing({
1349-
projectId: project.id,
1350-
title: project.name,
1351-
});
1352-
}}
13531346
>
13541347
{project.name}
13551348
</span>

apps/web/src/components/chat/ErrorNotificationBar.tsx

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const ErrorNotificationBar = memo(function ErrorNotificationBar({
118118
technicalDetails: presentation.technicalDetails,
119119
severity: "error",
120120
dismissible: !!onDismissThreadError,
121-
onDismiss: onDismissThreadError,
121+
...(onDismissThreadError ? { onDismiss: onDismissThreadError } : {}),
122122
});
123123
}
124124
}
@@ -167,15 +167,12 @@ export const ErrorNotificationBar = memo(function ErrorNotificationBar({
167167

168168
const visibleNotifications = notifications.filter((n) => !dismissedIds.has(n.id));
169169

170-
const handleDismiss = useCallback(
171-
(notif: NotificationItem) => {
172-
if (notif.onDismiss) {
173-
notif.onDismiss();
174-
}
175-
setDismissedIds((prev) => new Set(prev).add(notif.id));
176-
},
177-
[],
178-
);
170+
const handleDismiss = useCallback((notif: NotificationItem) => {
171+
if (notif.onDismiss) {
172+
notif.onDismiss();
173+
}
174+
setDismissedIds((prev) => new Set(prev).add(notif.id));
175+
}, []);
179176

180177
const handleDismissAll = useCallback(() => {
181178
for (const notif of visibleNotifications) {
@@ -207,14 +204,11 @@ export const ErrorNotificationBar = memo(function ErrorNotificationBar({
207204
} as const;
208205

209206
// Find the highest severity across all notifications
210-
const highestSeverity = visibleNotifications.reduce<"error" | "warning" | "info">(
211-
(acc, n) => {
212-
if (acc === "error" || n.severity === "error") return "error";
213-
if (acc === "warning" || n.severity === "warning") return "warning";
214-
return "info";
215-
},
216-
"info",
217-
);
207+
const highestSeverity = visibleNotifications.reduce<"error" | "warning" | "info">((acc, n) => {
208+
if (acc === "error" || n.severity === "error") return "error";
209+
if (acc === "warning" || n.severity === "warning") return "warning";
210+
return "info";
211+
}, "info");
218212

219213
return (
220214
<div className="mx-auto w-full max-w-7xl px-3 pt-2 sm:px-5">
@@ -290,13 +284,8 @@ export const ErrorNotificationBar = memo(function ErrorNotificationBar({
290284
{visibleNotifications.map((notif) => {
291285
const Icon = notif.icon;
292286
return (
293-
<div
294-
key={notif.id}
295-
className="flex items-start gap-2 py-1.5 text-xs"
296-
>
297-
<Icon
298-
className={cn("mt-0.5 size-3 shrink-0", severityColor[notif.severity])}
299-
/>
287+
<div key={notif.id} className="flex items-start gap-2 py-1.5 text-xs">
288+
<Icon className={cn("mt-0.5 size-3 shrink-0", severityColor[notif.severity])} />
300289
<div className="min-w-0 flex-1">
301290
<p className="font-medium text-foreground/90">{notif.title}</p>
302291
<p className="text-muted-foreground">{notif.description}</p>

0 commit comments

Comments
 (0)