mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 08:52:12 +00:00
fix(welcome): close the project switcher before the remove confirmation (#1884)
Removing a recent project from the title-bar project switcher opened the Remove confirmation under the still-open switcher popup, which covers the dialog (the popup layer sits above dialogs). askRemoveRecent and recentMenu now take a closer, and the switcher passes its own close so the confirmation lands on top (#1883).
This commit is contained in:
1 parent
8259a81335
commit
c4b9912036
2 files changed
+11
-6
No files matched your search
@@ -100,7 +100,7 @@ export function ProjectPopup({ anchor, onClose }: ProjectPopupProps) {
|
||||
const entry = entries[current];
|
||||
if (entry?.kind === "project" && !entry.open) {
|
||||
e.preventDefault();
|
||||
void askRemoveRecent(entry.m.project);
|
||||
void askRemoveRecent(entry.m.project, onClose);
|
||||
}
|
||||
} else if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && (query || e.key !== " ")) {
|
||||
e.preventDefault();
|
||||
@@ -153,7 +153,7 @@ export function ProjectPopup({ anchor, onClose }: ProjectPopupProps) {
|
||||
if (e.kind !== "project" || e.open) return;
|
||||
ev.preventDefault();
|
||||
setActive(i);
|
||||
showContextMenu(ev, recentMenu(e.m.project, onClose));
|
||||
showContextMenu(ev, recentMenu(e.m.project, onClose, onClose));
|
||||
}}
|
||||
>
|
||||
{e.kind === "action" ? (
|
||||
|
||||
@@ -32,8 +32,13 @@ import {
|
||||
import styles from "./Welcome.module.css";
|
||||
import { tx } from "@/platform/i18n";
|
||||
|
||||
/** IDEA's "Remove Recent Project" confirmation, then removes it from the list. */
|
||||
export async function askRemoveRecent(project: RecentProject) {
|
||||
/**
|
||||
* IDEA's "Remove Recent Project" confirmation, then removes it from the list.
|
||||
* `before` runs just before the confirmation opens: hosts above the dialog's
|
||||
* layer (a popup) pass their closer so the confirmation is not covered (#1883).
|
||||
*/
|
||||
export async function askRemoveRecent(project: RecentProject, before?: () => void) {
|
||||
before?.();
|
||||
const ok = await confirm({
|
||||
title: "Remove Recent Project",
|
||||
message: tx`Remove '${project.name}' from the list of recent projects?`,
|
||||
@@ -108,7 +113,7 @@ export function groupMenu(group: RecentProjectGroup): MenuItem[] {
|
||||
];
|
||||
}
|
||||
|
||||
export function recentMenu(project: RecentProject, onOpened?: () => void): MenuItem[] {
|
||||
export function recentMenu(project: RecentProject, onOpened?: () => void, onRemove?: () => void): MenuItem[] {
|
||||
// A remote project has no local folder.
|
||||
const remote = parseRemoteLocation(project.path);
|
||||
const items: MenuItem[] = [
|
||||
@@ -150,7 +155,7 @@ export function recentMenu(project: RecentProject, onOpened?: () => void): MenuI
|
||||
label: "Remove from Recent Projects…",
|
||||
icon: "close",
|
||||
danger: true,
|
||||
run: () => void askRemoveRecent(project),
|
||||
run: () => void askRemoveRecent(project, onRemove),
|
||||
},
|
||||
];
|
||||
return remote ? items.filter((i) => !("id" in i && i.id === "reveal")) : items;
|
||||
|
||||
Reference in new issue
Block a user