From 46883c413cd12177a707d80fbfd0b63114bece45 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Sun, 22 Nov 2026 00:51:38 +0800 Subject: [PATCH] feat(welcome): show Remote Development as a header button (#5021) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remote Development was hidden in the welcome page's More Actions menu, with the same folder icon as Open; New File used the same plus as New Project. Remote Development is now a header button next to Clone Repository with a new server icon, and New File has a new page-with-plus icon (both icons apply wherever these actions appear). Header buttons no longer cap their width, which cut "Remote Development" to "Remote Develo…"; they collapse to icons below 740px. The Remote Development dialog's rows ended at different edges because Configure… is wider than Browse. The form is now a two-column grid: fields share the first column and side buttons the second, and its horizontal padding matches the dialog footer, so fields, side buttons and Cancel / Open line up. --- e2e/welcomeProjectsLayout.spec.ts | 6 +++-- src/features/app/windows.ts | 2 +- src/features/remote-dev/RemoteDev.module.css | 24 +++++++++++++------- src/features/remote-dev/index.ts | 2 +- src/features/welcome/ProjectPopup.tsx | 2 +- src/features/welcome/ProjectsPage.tsx | 9 ++++---- src/features/welcome/Welcome.module.css | 5 +--- src/ui/icons.tsx | 2 ++ src/ui/openidea/general/newFile.svg | 4 ++++ src/ui/openidea/general/newFile_dark.svg | 4 ++++ src/ui/openidea/general/remote.svg | 4 ++++ src/ui/openidea/general/remote_dark.svg | 4 ++++ 12 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 src/ui/openidea/general/newFile.svg create mode 100644 src/ui/openidea/general/newFile_dark.svg create mode 100644 src/ui/openidea/general/remote.svg create mode 100644 src/ui/openidea/general/remote_dark.svg diff --git a/e2e/welcomeProjectsLayout.spec.ts b/e2e/welcomeProjectsLayout.spec.ts index 786da3329..15b36b5d1 100644 --- a/e2e/welcomeProjectsLayout.spec.ts +++ b/e2e/welcomeProjectsLayout.spec.ts @@ -16,10 +16,12 @@ test("Welcome keeps project search and actions on one row at a narrow width", as await expect(list.getByRole("option")).toHaveCount(4); await expect(more).toBeVisible(); await expect(open).toHaveText("Open"); + await expect(projects.getByRole("button", { name: "Remote Development", exact: true })).toBeVisible(); await page.setViewportSize({ width: 440, height: 620 }); const boxes = await Promise.all([search.boundingBox(), open.boundingBox(), more.boundingBox()]); - expect(boxes[0]!.width).toBeGreaterThan(95); + // Four icon-only header actions plus More Actions leave the field room for its placeholder. + expect(boxes[0]!.width).toBeGreaterThan(64); for (const box of boxes.slice(1)) { expect(Math.abs(box!.y + box!.height / 2 - (boxes[0]!.y + boxes[0]!.height / 2))).toBeLessThan(2); expect(box!.x + box!.width).toBeLessThanOrEqual(440); @@ -32,7 +34,7 @@ test("Welcome keeps project search and actions on one row at a narrow width", as await expect(list.getByRole("option")).toContainText("tokio"); await more.press("Enter"); const menu = page.getByRole("menu", { name: "More Actions" }); - for (const label of ["New File", "Open File", "Remote Development"]) { + for (const label of ["New File", "Open File"]) { await expect(menu.getByRole("menuitem", { name: new RegExp(label) })).toBeVisible(); } await page.keyboard.press("Escape"); diff --git a/src/features/app/windows.ts b/src/features/app/windows.ts index b4b4857d1..31ef39412 100644 --- a/src/features/app/windows.ts +++ b/src/features/app/windows.ts @@ -544,7 +544,7 @@ export function windowActions(): Action[] { id: "file.newUntitled", title: t("app.action.newFile"), category: t("app.category.file"), - icon: "plus", + icon: "file-new", keywords: ["new", "create", "untitled", "file", "light edit"], run: async () => { if (desktopOnly()) return; diff --git a/src/features/remote-dev/RemoteDev.module.css b/src/features/remote-dev/RemoteDev.module.css index 623f4d498..d0ea9c546 100644 --- a/src/features/remote-dev/RemoteDev.module.css +++ b/src/features/remote-dev/RemoteDev.module.css @@ -1,8 +1,13 @@ +/* Fields fill the first column; their side buttons share the second, so both rows end at the same edge. */ .form { - display: flex; - flex-direction: column; - gap: var(--space-1-5); - padding: 14px; + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + gap: var(--space-1-5) var(--space-2); + align-items: center; + padding: 14px var(--space-4); +} +.form > * { + grid-column: 1 / -1; } .hint { margin: 0 0 6px; @@ -14,12 +19,15 @@ margin-top: 4px; } .row { - display: flex; - gap: var(--space-2); - align-items: center; + display: contents; +} +.row > * { + grid-column: auto; +} +.row > :only-child { + grid-column: 1 / -1; } .grow { - flex: 1; min-width: 0; } .folders { diff --git a/src/features/remote-dev/index.ts b/src/features/remote-dev/index.ts index c21f9e75f..8da2ee21d 100644 --- a/src/features/remote-dev/index.ts +++ b/src/features/remote-dev/index.ts @@ -71,7 +71,7 @@ export function activate(): () => void { title: "Remote Development…", description: "Opens a project folder on an SSH host; the IDE backend runs on that host.", category: "File", - icon: "folder", + icon: "remote", keywords: ["ssh", "remote", "server", "gateway", "connect", "host"], run: () => openConnectDialog(), }, diff --git a/src/features/welcome/ProjectPopup.tsx b/src/features/welcome/ProjectPopup.tsx index 3ca22dfdd..710b2a80f 100644 --- a/src/features/welcome/ProjectPopup.tsx +++ b/src/features/welcome/ProjectPopup.tsx @@ -18,7 +18,7 @@ const ACTIONS: { id: string; label: string; icon: IconName }[] = [ { id: "file.newProject", label: "New Project…", icon: "plus" }, { id: "file.openProject", label: "Open…", icon: "folder" }, { id: "vcs.clone", label: "Clone Repository…", icon: "branch" }, - { id: "remote.connect", label: "Remote Development…", icon: "terminal" }, + { id: "remote.connect", label: "Remote Development…", icon: "remote" }, ]; function useOpenProjects(): OpenProject[] { diff --git a/src/features/welcome/ProjectsPage.tsx b/src/features/welcome/ProjectsPage.tsx index 2cd209a08..3c9a0dcc0 100644 --- a/src/features/welcome/ProjectsPage.tsx +++ b/src/features/welcome/ProjectsPage.tsx @@ -1,4 +1,4 @@ -/** Welcome › Projects: search, New Project / Open / Clone Repository, and the recent projects list. */ +/** Welcome › Projects: search, New Project / Open / Clone Repository / Remote Development, and the recent projects list. */ import { useEffect, useId, useMemo, useRef, useState, type KeyboardEvent } from "react"; import clsx from "clsx"; import { executeAction, useActions } from "@/platform/actions"; @@ -29,6 +29,7 @@ import { tx } from "@/platform/i18n"; function HeaderButtons() { const canClone = useActions((s) => s.actions.has("vcs.clone")); + const canRemote = useActions((s) => s.actions.has("remote.connect")); const opening = useProject((s) => s.opening); const canCreate = useActions((s) => s.actions.has("file.newProject")); const openKey = shortcutLabel("file.openProject"); @@ -45,11 +46,11 @@ function HeaderButtons() { disabled: opening, }, { id: "vcs.clone", label: "Clone Repository", icon: "branch", available: canClone }, + { id: "remote.connect", label: "Remote Development", icon: "remote", available: canRemote, disabled: opening }, ]; const secondary: MenuItem[] = [ { kind: "action", action: "file.newUntitled", label: "New File", disabled: opening }, { kind: "action", action: "file.openFile", label: "Open File", disabled: opening }, - { kind: "action", action: "remote.connect", label: "Remote Development", disabled: opening }, ]; return (
@@ -114,7 +115,7 @@ function Landing() {
@@ -164,7 +165,7 @@ function Landing() { onClick={() => void executeAction("remote.connect")} > - + Remote Development diff --git a/src/features/welcome/Welcome.module.css b/src/features/welcome/Welcome.module.css index 1bce35a81..335b3a540 100644 --- a/src/features/welcome/Welcome.module.css +++ b/src/features/welcome/Welcome.module.css @@ -156,15 +156,12 @@ align-items: center; gap: var(--space-1); } -.headerAction { - max-width: 146px; -} .headerActionLabel { min-width: 0; overflow: hidden; text-overflow: ellipsis; } -@container welcome-projects (max-width: 600px) { +@container welcome-projects (max-width: 740px) { .headerAction { width: var(--h-control); padding: 0; diff --git a/src/ui/icons.tsx b/src/ui/icons.tsx index 23e17f143..6e28b8b4a 100644 --- a/src/ui/icons.tsx +++ b/src/ui/icons.tsx @@ -423,6 +423,8 @@ const ICONS = { export: "openidea/general/export", artifact: "openidea/general/artifact", web: "openidea/general/web", + remote: "openidea/general/remote", + "file-new": "openidea/general/newFile", "browser-chrome": "openidea/browsers/chrome", "browser-chromium": "openidea/browsers/chromium", "browser-firefox": "openidea/browsers/firefox", diff --git a/src/ui/openidea/general/newFile.svg b/src/ui/openidea/general/newFile.svg new file mode 100644 index 000000000..13b032c10 --- /dev/null +++ b/src/ui/openidea/general/newFile.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/openidea/general/newFile_dark.svg b/src/ui/openidea/general/newFile_dark.svg new file mode 100644 index 000000000..9107bc3e7 --- /dev/null +++ b/src/ui/openidea/general/newFile_dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/openidea/general/remote.svg b/src/ui/openidea/general/remote.svg new file mode 100644 index 000000000..f4fb620e3 --- /dev/null +++ b/src/ui/openidea/general/remote.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/openidea/general/remote_dark.svg b/src/ui/openidea/general/remote_dark.svg new file mode 100644 index 000000000..b61f9736e --- /dev/null +++ b/src/ui/openidea/general/remote_dark.svg @@ -0,0 +1,4 @@ + + + +