fix(web): keep a long path from running under the folder picker button (#4823)
Co-authored-by: Sy-D <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: codex <[email protected]>
This commit is contained in:
3 files changed
+51
-4
No files matched your search
@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from "vite-plus/test";
|
||||
import { EnvironmentId, ProjectId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
|
||||
import type { Thread } from "../types";
|
||||
import {
|
||||
browseInputEndPaddingClass,
|
||||
buildBrowseGroups,
|
||||
buildThreadActionItems,
|
||||
enumerateCommandPaletteItems,
|
||||
@@ -10,6 +11,35 @@ import {
|
||||
type CommandPaletteGroup,
|
||||
} from "./CommandPalette.logic";
|
||||
|
||||
describe("browseInputEndPaddingClass", () => {
|
||||
it("reserves the widest space for the create action", () => {
|
||||
expect(
|
||||
browseInputEndPaddingClass({
|
||||
willCreateProjectPath: true,
|
||||
hasHighlightedBrowseItem: false,
|
||||
}),
|
||||
).toContain("pe-38");
|
||||
});
|
||||
|
||||
it("reserves space for the wider highlighted-item shortcut", () => {
|
||||
expect(
|
||||
browseInputEndPaddingClass({
|
||||
willCreateProjectPath: false,
|
||||
hasHighlightedBrowseItem: true,
|
||||
}),
|
||||
).toContain("pe-30");
|
||||
});
|
||||
|
||||
it("keeps the compact reserve for the normal add action", () => {
|
||||
expect(
|
||||
browseInputEndPaddingClass({
|
||||
willCreateProjectPath: false,
|
||||
hasHighlightedBrowseItem: false,
|
||||
}),
|
||||
).toContain("pe-24");
|
||||
});
|
||||
});
|
||||
|
||||
describe("reduceCommandPaletteUiState", () => {
|
||||
const closedState = { open: false, mode: "command", openIntent: null } as const;
|
||||
|
||||
|
||||
@@ -15,6 +15,19 @@ export const RECENT_THREAD_LIMIT = 12;
|
||||
export const ITEM_ICON_CLASS = "size-4 text-icon-muted";
|
||||
export const ADDON_ICON_CLASS = "size-4";
|
||||
|
||||
export function browseInputEndPaddingClass(input: {
|
||||
readonly willCreateProjectPath: boolean;
|
||||
readonly hasHighlightedBrowseItem: boolean;
|
||||
}): string {
|
||||
if (input.willCreateProjectPath) {
|
||||
return "*:data-[slot=autocomplete-input]:pe-38!";
|
||||
}
|
||||
if (input.hasHighlightedBrowseItem) {
|
||||
return "*:data-[slot=autocomplete-input]:pe-30!";
|
||||
}
|
||||
return "*:data-[slot=autocomplete-input]:pe-24!";
|
||||
}
|
||||
|
||||
/**
|
||||
* The global search overlay hosts three mutually exclusive surfaces: the
|
||||
* command palette (⌘K), the project file picker (⌘P), and project content
|
||||
|
||||
@@ -98,6 +98,7 @@ import {
|
||||
} from "../wslPaths";
|
||||
import {
|
||||
ADDON_ICON_CLASS,
|
||||
browseInputEndPaddingClass,
|
||||
buildBrowseGroups,
|
||||
buildProjectActionItems,
|
||||
buildRootGroups,
|
||||
@@ -2345,13 +2346,16 @@ function OpenCommandPaletteDialog(props: {
|
||||
footerTrailing={footerTrailing}
|
||||
inputAccessory={inputAccessory}
|
||||
inputProps={{
|
||||
// The submit button is absolutely positioned over the field, so the
|
||||
// inner input must reserve enough room for the full action label.
|
||||
className:
|
||||
addProjectCloneFlow?.step === "repository"
|
||||
? "pe-32"
|
||||
? "*:data-[slot=autocomplete-input]:pe-32!"
|
||||
: isBrowsing
|
||||
? willCreateProjectPath
|
||||
? "pe-36"
|
||||
: "pe-16"
|
||||
? browseInputEndPaddingClass({
|
||||
willCreateProjectPath,
|
||||
hasHighlightedBrowseItem,
|
||||
})
|
||||
: undefined,
|
||||
placeholder: inputPlaceholder,
|
||||
wrapperClassName: isSubmenu
|
||||
|
||||
Reference in new issue
Block a user