From 7c2bed8641b11eab264fb592b02c671c3731d9a2 Mon Sep 17 00:00:00 2001 From: hanlinyu1030 Date: Tue, 4 Aug 2026 11:18:59 +0800 Subject: [PATCH 1/5] fix(new-project): open picker at displayed parent path and add hover tooltips for overflowing paths --- .../entry/src/main/ets/utils/CommonUtils.ets | 17 ++++++++++++- .../NewProjectDialog/NewProjectDialog.tsx | 25 ++++++++++++------- .../api/service-api/WorkspaceAPI.ts | 1 + 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/apps/ohos/entry/src/main/ets/utils/CommonUtils.ets b/src/apps/ohos/entry/src/main/ets/utils/CommonUtils.ets index 7041dd7a95..8ef39c4f93 100644 --- a/src/apps/ohos/entry/src/main/ets/utils/CommonUtils.ets +++ b/src/apps/ohos/entry/src/main/ets/utils/CommonUtils.ets @@ -43,7 +43,21 @@ export class CommonUtils { try { hilog.info(0x0000, 'vnext', `open_file_dialog: multiple=${multiple}, mode=${selectMode}`); const documentOptions = new filePicker.DocumentSelectOptions; - documentOptions.defaultFilePathUri = 'file://docs/storage/Users/currentUser'; + // Mirror reveal_in_explorer path→URI conversion so the picker opens at the + // caller-supplied path (e.g. the parent directory shown in NewProjectDialog) + // instead of the hardcoded default. Fallback keeps legacy behavior. + const defaultPathRaw: string = (opts.defaultPath ?? '').trim(); + let defaultUri: string = 'file://docs/storage/Users/currentUser'; + if (defaultPathRaw.length > 0) { + if (defaultPathRaw.startsWith('file://')) { + defaultUri = defaultPathRaw; + } else if (defaultPathRaw.startsWith('/data/storage/')) { + defaultUri = fileUri.getUriFromPath(defaultPathRaw); + } else { + defaultUri = 'file://docs' + defaultPathRaw; + } + } + documentOptions.defaultFilePathUri = defaultUri; documentOptions.selectMode = selectMode; documentOptions.maxSelectNumber = multiple ? 500 : 1; @@ -185,4 +199,5 @@ interface PickerOptions { multiple?: boolean; directory?: boolean; filters?: PickerFilter[]; + defaultPath?: string; } \ No newline at end of file diff --git a/src/web-ui/src/app/components/NewProjectDialog/NewProjectDialog.tsx b/src/web-ui/src/app/components/NewProjectDialog/NewProjectDialog.tsx index 6ffabab8aa..852eabb57d 100644 --- a/src/web-ui/src/app/components/NewProjectDialog/NewProjectDialog.tsx +++ b/src/web-ui/src/app/components/NewProjectDialog/NewProjectDialog.tsx @@ -14,7 +14,7 @@ import { } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { createLogger } from '@/shared/utils/logger'; -import { Modal, Button, Input } from '@/component-library'; +import { Modal, Button, Input, Tooltip } from '@/component-library'; import './NewProjectDialog.scss'; import {workspaceAPI} from "@/infrastructure"; import { notificationService } from '@/shared/notification-system'; @@ -52,7 +52,10 @@ export const NewProjectDialog: React.FC = ({ // Open directory picker dialog const handleSelectParentPath = useCallback(async () => { try { - const selected = await workspaceAPI.open_oh_file_dialog({ directory: true }); + const selected = await workspaceAPI.open_oh_file_dialog({ + directory: true, + defaultPath: parentPath || defaultParentPath, + }); if (selected && typeof selected === 'string') { setParentPath(selected); @@ -139,12 +142,14 @@ export const NewProjectDialog: React.FC = ({
- + + +
{t('newProject.fullPath')} - {fullPath} + + {fullPath} +
)} diff --git a/src/web-ui/src/infrastructure/api/service-api/WorkspaceAPI.ts b/src/web-ui/src/infrastructure/api/service-api/WorkspaceAPI.ts index 031538db74..60468e5d04 100644 --- a/src/web-ui/src/infrastructure/api/service-api/WorkspaceAPI.ts +++ b/src/web-ui/src/infrastructure/api/service-api/WorkspaceAPI.ts @@ -41,6 +41,7 @@ export interface OhOpenDialogOptions { multiple?: boolean; directory?: boolean; filters?: OhDialogFilter[]; + defaultPath?: string; } const FILE_SEARCH_PROGRESS_EVENT = 'file-search://progress'; From e2e41da05216261865fa24f36b1c795c96cf62c6 Mon Sep 17 00:00:00 2001 From: hanlinyu1030 Date: Tue, 4 Aug 2026 15:32:32 +0800 Subject: [PATCH 2/5] fix(new-project): submit on Enter from project name field --- .../app/components/NewProjectDialog/NewProjectDialog.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/web-ui/src/app/components/NewProjectDialog/NewProjectDialog.tsx b/src/web-ui/src/app/components/NewProjectDialog/NewProjectDialog.tsx index 852eabb57d..4ce9a43429 100644 --- a/src/web-ui/src/app/components/NewProjectDialog/NewProjectDialog.tsx +++ b/src/web-ui/src/app/components/NewProjectDialog/NewProjectDialog.tsx @@ -175,6 +175,12 @@ export const NewProjectDialog: React.FC = ({ type="text" value={projectName} onChange={handleProjectNameChange} + onKeyDown={(e) => { + if (e.key === 'Enter' && !isCreating) { + e.preventDefault(); + void handleConfirm(); + } + }} placeholder={t('newProject.projectNamePlaceholder')} disabled={isCreating} autoFocus From 858b45d799267eac2677fac7033b0a3f4e568ba8 Mon Sep 17 00:00:00 2001 From: hanlinyu1030 Date: Tue, 4 Aug 2026 15:54:46 +0800 Subject: [PATCH 3/5] fix(workspace): reposition menu popover on size change to avoid edge clipping --- .../sections/workspaces/WorkspaceItem.tsx | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/web-ui/src/app/components/NavPanel/sections/workspaces/WorkspaceItem.tsx b/src/web-ui/src/app/components/NavPanel/sections/workspaces/WorkspaceItem.tsx index 0b429d1cbf..4fd9068367 100644 --- a/src/web-ui/src/app/components/NavPanel/sections/workspaces/WorkspaceItem.tsx +++ b/src/web-ui/src/app/components/NavPanel/sections/workspaces/WorkspaceItem.tsx @@ -142,7 +142,8 @@ const WorkspaceItem: React.FC = ({ const [acpClientsLoading, setAcpClientsLoading] = useState(false); const menuRef = useRef(null); const menuAnchorRef = useRef(null); - const menuPopoverRef = useRef(null); + const menuPopoverRef = useRef(null); + const popoverResizeObserverRef = useRef(null); const cardRef = useRef(null); const [menuPosition, setMenuPosition] = useState<{ top: number; left: number } | null>(null); const isNamedAssistantWorkspace = @@ -384,6 +385,26 @@ const WorkspaceItem: React.FC = ({ requestAnimationFrame(apply); }, []); + // Callback ref for the menu popover. The popover only mounts once menuPosition + // is set (chicken-and-egg: menuPosition needs the popover's size), so a + // ResizeObserver created in the menuOpen effect would attach to a null ref. + // Attaching here ties the observer to the element's actual mount/unmount: + // on mount it fires once with the real size (fixing the stale initial height) + // and again whenever async content (ACP client rows, loading toggle, remote + // /git conditional rows, locale label width) changes the popover height. + const setMenuPopoverRef = useCallback((node: HTMLDivElement | null) => { + if (popoverResizeObserverRef.current) { + popoverResizeObserverRef.current.disconnect(); + popoverResizeObserverRef.current = null; + } + menuPopoverRef.current = node; + if (node && typeof ResizeObserver !== 'undefined') { + const ro = new ResizeObserver(() => updateMenuPosition()); + ro.observe(node); + popoverResizeObserverRef.current = ro; + } + }, [updateMenuPosition]); + const handleMenuTriggerClick = useCallback(() => { const nextOpen = !menuOpen; setMenuOpen(nextOpen); @@ -932,7 +953,7 @@ const WorkspaceItem: React.FC = ({ {menuOpen && menuPosition && createPortal(
= ({ {menuOpen && menuPosition && createPortal(
Date: Tue, 4 Aug 2026 17:15:18 +0800 Subject: [PATCH 4/5] fix(workspace): soften drag border, hide tooltip on drag, fill input background --- .../sections/workspaces/WorkspaceItem.tsx | 4 +- .../workspaces/WorkspaceListSection.scss | 17 +++++ .../NewProjectDialog/NewProjectDialog.scss | 66 ++++++++++++------- 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/src/web-ui/src/app/components/NavPanel/sections/workspaces/WorkspaceItem.tsx b/src/web-ui/src/app/components/NavPanel/sections/workspaces/WorkspaceItem.tsx index 4fd9068367..ec4cc69c1f 100644 --- a/src/web-ui/src/app/components/NavPanel/sections/workspaces/WorkspaceItem.tsx +++ b/src/web-ui/src/app/components/NavPanel/sections/workspaces/WorkspaceItem.tsx @@ -907,7 +907,7 @@ const WorkspaceItem: React.FC = ({ - +