mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
feat(welcome): show Remote Development as a header button (#5021)
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.
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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(),
|
||||
},
|
||||
|
||||
@@ -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[] {
|
||||
|
||||
@@ -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 (
|
||||
<div className={styles.headerButtons} role="group" aria-label={tx("Project actions")}>
|
||||
@@ -114,7 +115,7 @@ function Landing() {
|
||||
<div className={styles.landingActions}>
|
||||
<button type="button" className={styles.landingAction} onClick={() => void executeAction("file.newUntitled")}>
|
||||
<span className={styles.landingIcon}>
|
||||
<Icon name="plus" size={20} />
|
||||
<Icon name="file-new" size={20} />
|
||||
</span>
|
||||
<T>New File</T>
|
||||
</button>
|
||||
@@ -164,7 +165,7 @@ function Landing() {
|
||||
onClick={() => void executeAction("remote.connect")}
|
||||
>
|
||||
<span className={styles.landingIcon}>
|
||||
<Icon name="terminal" size={20} />
|
||||
<Icon name="remote" size={20} />
|
||||
</span>
|
||||
<T>Remote Development</T>
|
||||
</button>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<!-- OpenIDEA: new file (page with a plus) -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 13.5H4.5C3.94772 13.5 3.5 13.0523 3.5 12.5V3.5C3.5 2.94772 3.94772 2.5 4.5 2.5H9L12.5 6V8" stroke="#6C707E" stroke-linejoin="round"/><path d="M8.5 2.5V6.5H12.5" stroke="#6C707E" stroke-linejoin="round"/><path d="M12 10V15M9.5 12.5H14.5" stroke="#6C707E" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 441 B |
@@ -0,0 +1,4 @@
|
||||
<!-- OpenIDEA: new file (page with a plus) -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 13.5H4.5C3.94772 13.5 3.5 13.0523 3.5 12.5V3.5C3.5 2.94772 3.94772 2.5 4.5 2.5H9L12.5 6V8" stroke="#CED0D6" stroke-linejoin="round"/><path d="M8.5 2.5V6.5H12.5" stroke="#CED0D6" stroke-linejoin="round"/><path d="M12 10V15M9.5 12.5H14.5" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 441 B |
@@ -0,0 +1,4 @@
|
||||
<!-- OpenIDEA: remote host (server) -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2.5" y="2.5" width="11" height="4.5" rx="1" stroke="#6C707E"/><rect x="2.5" y="9" width="11" height="4.5" rx="1" stroke="#6C707E"/><circle cx="5" cy="4.75" r="0.75" fill="#6C707E"/><circle cx="5" cy="11.25" r="0.75" fill="#6C707E"/><path d="M8 4.75H11M8 11.25H11" stroke="#6C707E" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 458 B |
@@ -0,0 +1,4 @@
|
||||
<!-- OpenIDEA: remote host (server) -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2.5" y="2.5" width="11" height="4.5" rx="1" stroke="#CED0D6"/><rect x="2.5" y="9" width="11" height="4.5" rx="1" stroke="#CED0D6"/><circle cx="5" cy="4.75" r="0.75" fill="#CED0D6"/><circle cx="5" cy="11.25" r="0.75" fill="#CED0D6"/><path d="M8 4.75H11M8 11.25H11" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 458 B |
Reference in New Issue
Block a user