Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(mobile): compose task plays nice with virtual keyboard (#3803)

Peter Chinman255a82b382ce
diff --git a/js/app/packages/app/component/split-layout/components/PopoverSplitRenderer.tsx b/js/app/packages/app/component/split-layout/components/PopoverSplitRenderer.tsx
index dfbb17fc90..b88a3ec788 100644
--- a/js/app/packages/app/component/split-layout/components/PopoverSplitRenderer.tsx
+++ b/js/app/packages/app/component/split-layout/components/PopoverSplitRenderer.tsx
@@ -134,11 +134,7 @@ function PopoverSplitModal(props: {
bindHotKeyDom(r);
}}
>
- <Panel
- depth={2}
- active
- class="rounded-xl *:max-h-[75vh] bottom-(--virtual-keyboard-height,0)"
- >
+ <Panel depth={2} active class="rounded-xl *:max-h-[75vh]">
<SplitPanelContext.Provider value={stubPanelContext}>
<SoupContextProvider>
<Show when={props.popover.mount}>
diff --git a/js/app/packages/property/src/core/Root.tsx b/js/app/packages/property/src/core/Root.tsx
index 1afb09ffac..ef8a7ae9d6 100644
--- a/js/app/packages/property/src/core/Root.tsx
+++ b/js/app/packages/property/src/core/Root.tsx
@@ -1,3 +1,4 @@
+import { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';
import { cn, Dropdown } from '@ui';
import { createSignal, type JSX, onMount, splitProps } from 'solid-js';
import type { Property } from '../types';
@@ -100,7 +101,7 @@ export function Root(props: PropertyRootProps) {
open={editorOpen()}
onOpenChange={handleOpenChange}
getAnchorRect={() => editorAnchor()?.getBoundingClientRect()}
- placement="bottom-start"
+ placement={virtualKeyboardVisible() ? 'top-start' : 'bottom-start'}
>
<div
ref={rootEl}
diff --git a/js/app/packages/property/src/editors/selectors/PropertyOptionSelector.tsx b/js/app/packages/property/src/editors/selectors/PropertyOptionSelector.tsx
index 2c2d19fb4a..959225291a 100644
--- a/js/app/packages/property/src/editors/selectors/PropertyOptionSelector.tsx
+++ b/js/app/packages/property/src/editors/selectors/PropertyOptionSelector.tsx
@@ -1,3 +1,4 @@
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { useKeyPressed } from '@core/util/useKeyPressed';
import CircleDashedEmpty from '@phosphor/circle-dashed.svg';
import SearchIcon from '@phosphor/magnifying-glass.svg';
@@ -271,6 +272,9 @@ export const PropertyOptionSelector = (props: SelectOptionsProps) => {
const showClearItem = () =>
!!props.clearOption && !dropdown.searchQuery().trim();
+ // Hide search on touch device, makes using the menus awkward
+ const showSearchInput = () => !isTouchDevice();
+
// Get selectable items: optional clear + filtered options + optional add.
const selectableItems = createMemo(() => {
const items: SelectableItem[] = [];
@@ -343,17 +347,19 @@ export const PropertyOptionSelector = (props: SelectOptionsProps) => {
>
<Show when={!props.error}>
<div>
- <div class="relative">
- <DropdownSearchInput
- value={dropdown.searchQuery()}
- inputRef={(element) => {
- searchInputRef = element;
- }}
- inputType={props.config.inputType ?? 'text'}
- onInput={dropdown.setSearchQuery}
- placeholder={props.config.placeholder}
- />
- </div>
+ <Show when={showSearchInput()}>
+ <div class="relative">
+ <DropdownSearchInput
+ value={dropdown.searchQuery()}
+ inputRef={(element) => {
+ searchInputRef = element;
+ }}
+ inputType={props.config.inputType ?? 'text'}
+ onInput={dropdown.setSearchQuery}
+ placeholder={props.config.placeholder}
+ />
+ </div>
+ </Show>
<Show
when={props.options.length > 0}
diff --git a/js/app/packages/ui/components/Dialog.tsx b/js/app/packages/ui/components/Dialog.tsx
index 67fff7aeec..2614432392 100644
--- a/js/app/packages/ui/components/Dialog.tsx
+++ b/js/app/packages/ui/components/Dialog.tsx
@@ -21,7 +21,7 @@ export function Dialog(props: DialogProps) {
<KobalteDialog.Overlay class="fixed inset-0 z-modal bg-modal-overlay pattern-edge-muted pattern-diagonal-4" />
<div
class={cn(
- 'fixed inset-0 z-modal flex justify-center px-2',
+ 'fixed top-0 bottom-(--virtual-keyboard-height,0) inset-x-0 z-modal flex justify-center px-2',
props.position === 'center'
? 'items-center'
: 'items-start pt-[10vh]'
diff --git a/js/app/packages/ui/components/HoverCard.tsx b/js/app/packages/ui/components/HoverCard.tsx
index 1487da07f4..61f3c1afb2 100644
--- a/js/app/packages/ui/components/HoverCard.tsx
+++ b/js/app/packages/ui/components/HoverCard.tsx
@@ -1,6 +1,7 @@
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import type { Placement } from '@floating-ui/dom';
import { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip';
-import type { JSX, ParentProps } from 'solid-js';
+import { type JSX, type ParentProps, Show } from 'solid-js';
import { cn } from '../utils/classname';
import { Surface } from './Surface';
@@ -20,34 +21,36 @@ type HoverCardProps = ParentProps<{
*/
export function HoverCard(props: HoverCardProps) {
return (
- <KobalteTooltip
- placement={props.placement ?? 'bottom'}
- overflowPadding={16}
- fitViewport={true}
- closeDelay={250}
- openDelay={250}
- flip={true}
- gutter={4}
- >
- <KobalteTooltip.Trigger
- class={cn('inline-flex items-center', props.triggerClass)}
- as={props.as ?? 'div'}
+ <Show when={!isTouchDevice()} fallback={props.children}>
+ <KobalteTooltip
+ placement={props.placement ?? 'bottom'}
+ overflowPadding={16}
+ fitViewport={true}
+ closeDelay={250}
+ openDelay={250}
+ flip={true}
+ gutter={4}
>
- {props.children}
- </KobalteTooltip.Trigger>
- <KobalteTooltip.Portal>
- <KobalteTooltip.Content class="z-tool-tip max-w-[calc(100vw-32px)]">
- <Surface
- class={cn(
- 'flex items-center justify-center p-2 text-ink-muted text-xs wrap-break-word',
- props.contentClass
- )}
- depth={3}
- >
- {props.content}
- </Surface>
- </KobalteTooltip.Content>
- </KobalteTooltip.Portal>
- </KobalteTooltip>
+ <KobalteTooltip.Trigger
+ class={cn('inline-flex items-center', props.triggerClass)}
+ as={props.as ?? 'div'}
+ >
+ {props.children}
+ </KobalteTooltip.Trigger>
+ <KobalteTooltip.Portal>
+ <KobalteTooltip.Content class="z-tool-tip max-w-[calc(100vw-32px)]">
+ <Surface
+ class={cn(
+ 'flex items-center justify-center p-2 text-ink-muted text-xs wrap-break-word',
+ props.contentClass
+ )}
+ depth={3}
+ >
+ {props.content}
+ </Surface>
+ </KobalteTooltip.Content>
+ </KobalteTooltip.Portal>
+ </KobalteTooltip>
+ </Show>
);
}