Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions apps/web/src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3072,6 +3072,10 @@ function OpenCommandPaletteDialog(props: {
? "Create & Add"
: "Add";
const addShortcutLabel = hasHighlightedBrowseItem ? `${submitModifierLabel} Enter` : "Enter";
const hasHighlightedNewProjectItem = newProjectFlow !== null && highlightedItemValue !== null;
const createShortcutLabel = hasHighlightedNewProjectItem
? `${submitModifierLabel} Enter`
: "Enter";
const remoteProjectButtonLabel = addProjectCloneFlow
? addProjectCloneFlow.source === "url"
? "Continue"
Expand Down Expand Up @@ -3165,15 +3169,17 @@ function OpenCommandPaletteDialog(props: {
}

// Enter creates the project unless an item below the name is
// highlighted, in which case it runs that item.
// highlighted, in which case it runs that item. Mod+Enter always creates.
if (
newProjectFlow !== null &&
event.key === "Enter" &&
highlightedItemValue === null &&
(!hasHighlightedNewProjectItem || isPrimaryModifierPressed(event)) &&
// Enter that confirms an IME composition is part of typing the name.
!event.nativeEvent.isComposing &&
event.keyCode !== 229
) {
// Base UI would otherwise also click the highlighted row.
(event as typeof event & { preventBaseUIHandler?: () => void }).preventBaseUIHandler?.();
event.preventDefault();
void submitNewProject();
return;
Expand Down Expand Up @@ -3383,7 +3389,7 @@ function OpenCommandPaletteDialog(props: {
size="xs"
tabIndex={-1}
className="absolute inset-e-2.5 top-1/2 -translate-y-1/2"
aria-label="Create (Enter)"
aria-label={`Create (${createShortcutLabel})`}
disabled={!canSubmitNewProject}
onMouseDown={(event) => {
event.preventDefault();
Expand All @@ -3396,10 +3402,10 @@ function OpenCommandPaletteDialog(props: {
>
<span>{isCreatingNewProject ? "Creating" : "Create"}</span>
<KbdGroup className="pointer-events-none -me-0.5">
<Kbd>Enter</Kbd>
<Kbd>{createShortcutLabel}</Kbd>
</KbdGroup>
</TooltipTrigger>
<TooltipPopup side="top">Create (Enter)</TooltipPopup>
<TooltipPopup side="top">{`Create (${createShortcutLabel})`}</TooltipPopup>
</Tooltip>
) : addProjectCloneFlow?.step === "repository" ? (
<Tooltip>
Expand Down Expand Up @@ -3512,8 +3518,9 @@ function OpenCommandPaletteDialog(props: {
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" || newProjectFlow !== null
className: hasHighlightedNewProjectItem
? "*:data-[slot=autocomplete-input]:pe-38!"
: addProjectCloneFlow?.step === "repository" || newProjectFlow !== null
? "*:data-[slot=autocomplete-input]:pe-32!"
: isBrowsing
? browseInputEndPaddingClass({
Expand Down
Loading