Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat[new-channels]: mobile action drawers and other mobile improvements (#2337)
Peter Chinman6c24c93b714a
diff --git a/js/app/packages/app/component/mobile/MobileDock.tsx b/js/app/packages/app/component/mobile/MobileDock.tsxindex f69fd5c64a..66b5de4012 100644--- a/js/app/packages/app/component/mobile/MobileDock.tsx+++ b/js/app/packages/app/component/mobile/MobileDock.tsx@@ -55,7 +55,7 @@ function MobileDockButton(props: MobileDockButtonProps) {onTouchMove={props.onTouchMove}onTouchEnd={props.onTouchEnd}class={cn(- 'flex flex-col items-center justify-center flex-1 pt-3 pb-2 bg-page border-t border-edge-muted',+ 'flex flex-col items-center justify-center flex-1 pt-3 pb-2 bg-panel border-t border-edge-muted',props.active && 'text-accent')}>@@ -142,7 +142,7 @@ function FloatingCreateButton(props: {<Show when={createAction()}><buttontype="button"- class="absolute bottom-full right-4 mb-14 w-11 h-11 rounded-full bg-page text-accent flex items-center justify-center shadow-lg"+ class="absolute bottom-full right-4 mb-14 w-11 h-11 rounded-full bg-panel text-accent flex items-center justify-center shadow-lg"onPointerDown={() => {impactFeedback('light');setAnimating(true);@@ -187,7 +187,7 @@ export function MobileDock() {return (<div class="relative z-mobile-nav-bar flex flex-row justify-between">- <div class="-z-1 absolute left-0 top-0 right-0 w-screen h-40 bg-page" />+ <div class="-z-1 absolute left-0 top-0 right-0 w-screen h-40 bg-panel" /><FloatingCreateButton activeView={activeView} /><MobileDockButtonicon={AnimatedInboxIcon}diff --git a/js/app/packages/app/component/mobile/MobileDrawer.tsx b/js/app/packages/app/component/mobile/MobileDrawer.tsxnew file mode 100644index 0000000000..24ff35c759--- /dev/null+++ b/js/app/packages/app/component/mobile/MobileDrawer.tsx@@ -0,0 +1,118 @@+import Drawer from '@corvu/drawer';+import { cn } from '@ui/utils/classname';+import {+ createSignal,+ splitProps,+ type ComponentProps,+ type ValidComponent,+} from 'solid-js';+import { Dynamic } from 'solid-js/web';++/**+ * Call this from a scroll container's `onFocusIn` to smoothly scroll a+ * focused input/textarea to `offset` px from the container's top edge.+ *+ * Usage:+ * <div onFocusIn={(e) => scrollToFocusedInput(e, e.currentTarget)}>+ */+export function scrollToFocusedInput(+ e: FocusEvent & { currentTarget: HTMLElement },+ offset = 40+) {+ if (+ !(e.target instanceof HTMLInputElement) &&+ !(e.target instanceof HTMLTextAreaElement)+ )+ return;+ const input = e.target as HTMLElement;+ const container = e.currentTarget;+ // Has to be delayed until after browser's native keyboard-show scroll completes+ setTimeout(() => {+ const inputRect = input.getBoundingClientRect();+ const containerRect = container.getBoundingClientRect();+ container.scrollTo({+ top: container.scrollTop + (inputRect.top - containerRect.top) - offset,+ behavior: 'smooth',+ });+ }, 300);+}++/**+ * Drop-in replacement for `Drawer.Content` that handles mobile keyboard+ * behaviour automatically:+ *+ * - Positions itself above the virtual keyboard via `bottom-(--virtual-keyboard-height)`+ * - Switches between `pb-(--safe-bottom)` and `pb-0` based on whether any+ * input/textarea inside the drawer currently has focus (detected via+ * bubbling focusin/focusout — no per-input wiring needed)+ *+ * Also handles default styling, which can be overridden via the `class` prop.+ */+function MobileDrawerContent(props: ComponentProps<typeof Drawer.Content>) {+ const [local, rest] = splitProps(props, ['class']);+ const [inputFocused, setInputFocused] = createSignal(false);++ const isInputEl = (target: EventTarget | null) =>+ target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement;++ return (+ <Drawer.Content+ onFocusIn={(e: FocusEvent) => {+ if (isInputEl(e.target)) setInputFocused(true);+ }}+ onFocusOut={(e: FocusEvent) => {+ if (isInputEl(e.target)) setInputFocused(false);+ }}+ class={cn(+ 'bottom-(--virtual-keyboard-height) fixed left-0 right-0 z-modal bg-page rounded-t-2xl flex flex-col h-[80vh] data-transitioning:transition-transform data-transitioning:duration-200 ease-out',+ inputFocused()+ ? 'pb-0 h-[calc(80vh-var(--virtual-keyboard-height))]'+ : 'pb-(--safe-bottom)',+ local.class+ )}+ {...rest}+ />+ );+}++type MobileDrawerSectionProps<T extends ValidComponent = 'div'> =+ ComponentProps<T> & {+ as?: T;+ };++/**+ * Component for rendering styled Drawer sections.+ */+function MobileDrawerSection<T extends ValidComponent = 'div'>(+ props: MobileDrawerSectionProps<T>+) {+ const [local, rest] = splitProps(props as MobileDrawerSectionProps, [+ 'as',+ 'class',+ 'children',+ ]);+ return (+ <Dynamic+ component={(local.as ?? 'div') as ValidComponent}+ class={cn('bg-menu rounded-2xl mx-3', local.class as string)}+ {...rest}+ >+ {local.children}+ </Dynamic>+ );+}++/**+ * Wrapper around Corvu's Drawer for mobile. Handles styling and input/virtual keyboard behaviour.+ */+export const MobileDrawer = Object.assign(+ (props: ComponentProps<typeof Drawer>) => <Drawer {...props} />,+ {+ Trigger: Drawer.Trigger,+ Portal: Drawer.Portal,+ Overlay: Drawer.Overlay,+ Content: MobileDrawerContent,+ Close: Drawer.Close,+ Section: MobileDrawerSection,+ }+);diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsxindex ef2a9da606..058a11a5ee 100644--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx@@ -1,4 +1,7 @@-import Drawer from '@corvu/drawer';+import {+ MobileDrawer,+ scrollToFocusedInput,+} from '@app/component/mobile/MobileDrawer';import { Accordion } from '@kobalte/core/accordion';import { cn } from '@ui/utils/classname';import { createMemo, createSignal, For, Show } from 'solid-js';@@ -34,6 +37,26 @@ import {type SortOption,} from '@app/component/next-soup/soup-view/sort-options';+function scrollAccordionItemToTop(+ e: MouseEvent,+ scrollEl: HTMLElement | undefined+) {+ if (!scrollEl) return;+ const item = (e.currentTarget as HTMLElement).closest(+ '[data-closed],[data-expanded]'+ ) as HTMLElement | null;+ if (!item) return;+ requestAnimationFrame(() => {+ if (!item.hasAttribute('data-expanded')) return;+ const containerRect = scrollEl.getBoundingClientRect();+ const itemRect = item.getBoundingClientRect();+ scrollEl.scrollTo({+ top: scrollEl.scrollTop + (itemRect.top - containerRect.top),+ behavior: 'smooth',+ });+ });+}+export const MobileFilterDrawer = () => {const {activeFiltersList,@@ -133,13 +156,13 @@ export const MobileFilterDrawer = () => {return (<Show when={hasFiltersOrCategories()}>- <Drawer+ <MobileDrawerside="bottom"preventScroll={false}preventScrollbarShift={false}breakPoints={[0.85]}>- <Drawer.Trigger+ <MobileDrawer.Triggeras={Button}aria-label="Open filters"variant="ghost"@@ -152,35 +175,16 @@ export const MobileFilterDrawer = () => {{activeCount()}</span></Show>- </Drawer.Trigger>+ </MobileDrawer.Trigger>- <Drawer.Portal>- <Drawer.Overlay class="fixed inset-0 z-modal-overlay bg-modal-overlay" />- <Drawer.Content- aria-label="Filters"- class="fixed bottom-0 left-0 right-0 z-modal bg-menu rounded-t-lg shadow-lg flex flex-col h-[80dvh] border-l border-r border-t border-edge transition-transform duration-100 ease-out data-[closing]:ease-in pb-(--safe-bottom)"- >+ <MobileDrawer.Portal>+ <MobileDrawer.Overlay class="fixed inset-0 z-modal-overlay bg-modal-overlay pattern-diagonal-4 pattern-edge-muted" />+ <MobileDrawer.Content aria-label="Filters">{/* Drag handle */}<div class="flex justify-center pt-3 pb-1 shrink-0"><div class="w-10 h-1 rounded-full bg-edge-muted" /></div>- {/* Header */}- {/*- <div class="flex items-center justify-between px-4 pb-2 shrink-0 border-b border-edge-muted/50">- <span class="text-md font-md text-ink-muted">Filters</span>- <div class="flex items-center gap-2">- <Drawer.Close- as={Button}- variant="ghost"- class="rounded-xs size-11 [&_svg]:size-6 px-1"- >- <XIcon />- </Drawer.Close>- </div>- </div>- */}-{/* Scrollable filter list */}<div class="relative flex-1 min-h-0"><ScrollIndicators@@ -190,11 +194,12 @@ export const MobileFilterDrawer = () => {/><divref={setScrollRef}+ onFocusIn={(e) => scrollToFocusedInput(e)}class="overflow-y-auto scrollbar-hidden h-full pb-1">{/* Sort section */}<Show when={sortOptions().length > 0}>- <div class="px-4 pb-2 border-b border-edge-muted/30">+ <div class="px-4 pb-2"><spanid="sort-section-label"class="text-xs font-medium text-ink-muted uppercase tracking-wide"@@ -202,7 +207,10 @@ export const MobileFilterDrawer = () => {Sort</span></div>- <div role="radiogroup" aria-labelledby="sort-section-label">+ <MobileDrawer.Section+ role="radiogroup"+ aria-labelledby="sort-section-label"+ ><For each={sortOptions()}>{(option) => {const active = () => activeSort() === option.value;@@ -211,7 +219,7 @@ export const MobileFilterDrawer = () => {type="button"role="radio"aria-checked={active()}- class="w-full flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-hover transition-colors text-left"+ class="w-full flex items-center gap-3 px-3 py-2.5 text-sm hover:bg-hover transition-colors text-left"onClick={() => setSort(option.value)}><Show when={option.icon}>@@ -238,7 +246,7 @@ export const MobileFilterDrawer = () => {);}}</For>- </div>+ </MobileDrawer.Section></Show><Accordion@@ -248,92 +256,108 @@ export const MobileFilterDrawer = () => {>{/* Filter section */}<Show when={categories().length > 0 || isTasksView()}>- <div class="px-4 pt-4 pb-2 border-b border-edge-muted/30">+ <div class="px-4 pt-4 pb-2"><span class="text-xs font-medium text-ink-muted uppercase tracking-wide">Filters</span></div></Show>- <For each={categories()}>- {(category) => {- const activeCount = createMemo(- () =>- category.options.filter((o) =>- soup.filters.isActive(o.id)- ).length- );- return (- <Accordion.Item- value={category.id}- class="border-b border-edge-muted/30 last:border-b-0"- >- <Accordion.Header>- <Accordion.Trigger class="w-full flex items-center justify-between px-4 py-3 text-sm text-ink hover:bg-hover transition-colors outline-none group">- <span class="font-medium">{category.label}</span>- <div class="flex items-center gap-2">- <Show when={activeCount() > 0}>- <span class="group-data-[expanded]:hidden size-4 flex items-center justify-center rounded-full bg-accent text-page text-[10px] font-medium leading-none">- {activeCount()}- </span>- </Show>- <ChevronDownIcon class="size-3.5 text-ink-muted transition-transform duration-200 group-data-[expanded]:rotate-180" />- </div>- </Accordion.Trigger>- </Accordion.Header>- <Accordion.Content class="pb-1">- <For each={category.options}>- {(option) => {- const active = () =>- soup.filters.isActive(option.id);- return (- <button- type="button"- role="checkbox"- aria-checked={active()}- class="w-full flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-hover transition-colors text-left"- onClick={() => toggleFilter(option.id)}- >- <span- class={cn(- 'size-4 flex items-center justify-center shrink-0 rounded border transition-colors',- active()- ? 'bg-accent border-accent'- : 'border-edge'- )}+ <div>+ <For each={categories()}>+ {(category) => {+ const activeCount = createMemo(+ () =>+ category.options.filter((o) =>+ soup.filters.isActive(o.id)+ ).length+ );+ return (+ <MobileDrawer.Section+ as={Accordion.Item}+ value={category.id}+ class="not-first:mt-3"+ >+ <Accordion.Header>+ <Accordion.Trigger+ class="w-full flex items-center justify-between px-3 py-3 text-sm text-ink hover:bg-hover transition-colors outline-none group"+ onClick={(e) =>+ scrollAccordionItemToTop(e, scrollRef())+ }+ >+ <span class="font-medium">+ {category.label}+ </span>+ <div class="flex items-center gap-2">+ <Show when={activeCount() > 0}>+ <span class="group-data-[expanded]:hidden size-4 flex items-center justify-center rounded-full bg-accent text-page text-[10px] font-medium leading-none">+ {activeCount()}+ </span>+ </Show>+ <ChevronDownIcon class="size-3.5 text-ink-muted transition-transform duration-200 group-data-[expanded]:rotate-180" />+ </div>+ </Accordion.Trigger>+ </Accordion.Header>+ <Accordion.Content class="pb-1">+ <For each={category.options}>+ {(option) => {+ const active = () =>+ soup.filters.isActive(option.id);+ return (+ <button+ type="button"+ role="checkbox"+ aria-checked={active()}+ class="w-full flex items-center gap-3 px-3 py-2.5 text-sm hover:bg-hover transition-colors text-left"+ onClick={() => toggleFilter(option.id)}>- <Show when={active()}>- <CheckIcon class="size-2.5 text-page" />+ <span+ class={cn(+ 'size-4 flex items-center justify-center shrink-0 rounded border transition-colors',+ active()+ ? 'bg-accent border-accent'+ : 'border-edge'+ )}+ >+ <Show when={active()}>+ <CheckIcon class="size-2.5 text-page" />+ </Show>+ </span>+ <Show when={option.icon}>+ {(icon) => (+ <span class="size-4 flex items-center justify-center shrink-0">+ {icon()()}+ </span>+ )}</Show>- </span>- <Show when={option.icon}>- {(icon) => (- <span class="size-4 flex items-center justify-center shrink-0">- {icon()()}- </span>- )}- </Show>- <span class={cn('flex-1 truncate')}>- {option.label}- </span>- </button>- );- }}- </For>- </Accordion.Content>- </Accordion.Item>- );- }}- </For>+ <span class={cn('flex-1 truncate')}>+ {option.label}+ </span>+ </button>+ );+ }}+ </For>+ </Accordion.Content>+ </MobileDrawer.Section>+ );+ }}+ </For>+ </div>{/* Assignee section for tasks view */}<Show when={isTasksView()}>- <Accordion.Item+ <MobileDrawer.Section+ as={Accordion.Item}value="assignee"- class="border-b border-edge-muted/30 last:border-b-0"+ class="mt-3"><Accordion.Header>- <Accordion.Trigger class="w-full flex items-center justify-between px-4 py-3 text-sm text-ink hover:bg-hover transition-colors outline-none group">+ <Accordion.Trigger+ class="w-full flex items-center justify-between px-3 py-3 text-sm text-ink hover:bg-hover transition-colors outline-none group"+ onClick={(e) =>+ scrollAccordionItemToTop(e, scrollRef())+ }+ ><span class="font-medium">Assignee</span><div class="flex items-center gap-2"><Show when={assigneeFilter().length > 0}>@@ -347,7 +371,7 @@ export const MobileFilterDrawer = () => {</Accordion.Header><Accordion.Content class="pb-1">{/* Search */}- <div class="flex items-center gap-2 px-4 py-2 border-b border-edge-muted/50 mb-1">+ <div class="flex items-center gap-2 px-3 py-2 border-b border-edge-muted/50 mb-1"><SearchIcon class="size-3.5 text-ink-muted shrink-0" /><inputtype="text"@@ -360,52 +384,55 @@ export const MobileFilterDrawer = () => {class="flex-1 bg-transparent text-sm outline-none placeholder:text-ink-muted"/></div>- <For each={filteredAssigneeOptions()}>- {(option) => {- const active = () =>- assigneeFilter().includes(option.id);- return (- <button- type="button"- role="checkbox"- aria-checked={active()}- class="w-full flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-hover transition-colors text-left"- onClick={() => toggleAssignee(option.id)}- >- <span- class={cn(- 'size-4 flex items-center justify-center shrink-0 rounded border transition-colors',- active()- ? 'bg-accent border-accent'- : 'border-edge'- )}- >- <Show when={active()}>- <CheckIcon class="size-2.5 text-page" />- </Show>- </span>- <span class="size-4 flex items-center justify-center shrink-0">- {option.icon()}- </span>- <span- class={cn(- 'flex-1 truncate',- active() ? 'text-ink' : 'text-ink-muted'- )}+ <div class="max-h-[calc(50*var(--dvh))] overflow-y-auto">+ <For each={filteredAssigneeOptions()}>+ {(option) => {+ const active = () =>+ assigneeFilter().includes(option.id);+ return (+ <button+ type="button"+ role="checkbox"+ aria-checked={active()}+ class="w-full flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-hover transition-colors text-left"+ onClick={() => toggleAssignee(option.id)}>- {option.label}- </span>- </button>- );- }}- </For>+ <span+ class={cn(+ 'size-4 flex items-center justify-center shrink-0 rounded border transition-colors',+ active()+ ? 'bg-accent border-accent'+ : 'border-edge'+ )}+ >+ <Show when={active()}>+ <CheckIcon class="size-2.5 text-page" />+ </Show>+ </span>+ <span class="size-4 flex items-center justify-center shrink-0">+ {option.icon()}+ </span>+ <span+ class={cn(+ 'flex-1 truncate',+ active() ? 'text-ink' : 'text-ink-muted'+ )}+ >+ {option.label}+ </span>+ </button>+ );+ }}+ </For>+ </div>+<Show when={filteredAssigneeOptions().length === 0}><div class="px-4 py-2 text-sm text-ink-muted">No results</div></Show></Accordion.Content>- </Accordion.Item>+ </MobileDrawer.Section></Show></Accordion></div>@@ -420,14 +447,14 @@ export const MobileFilterDrawer = () => {onReplace={replaceFilter}onClearAll={resetToTabDefaults}isOptionActive={isOptionActive}- chipClass="min-h-11"+ chipClass="min-h-11 bg-menu border-none rounded-lg"hideCategoryLabel/></div></Show>- </Drawer.Content>- </Drawer.Portal>- </Drawer>+ </MobileDrawer.Content>+ </MobileDrawer.Portal>+ </MobileDrawer></Show>);};diff --git a/js/app/packages/app/component/useAppSquishHandlers.ts b/js/app/packages/app/component/useAppSquishHandlers.tsindex 44ceaf4daa..7b86aa5fe3 100644--- a/js/app/packages/app/component/useAppSquishHandlers.ts+++ b/js/app/packages/app/component/useAppSquishHandlers.ts@@ -22,17 +22,30 @@ export function useAppSquishHandlers() {setVirtualKeyboardHeight(event.detail?.height ?? 0);const newViewportHeight =(window.visualViewport?.height ?? 0) - (event.detail?.height ?? 0);- const vh = newViewportHeight * 0.01;- document.documentElement.style.setProperty('--dvh', `${vh}px`);+ const dvh = newViewportHeight * 0.01;+ document.documentElement.style.setProperty('--dvh', `${dvh}px`);+ document.documentElement.style.setProperty(+ '--virtual-keyboard-height',+ `${event.detail?.height ?? 0}px`+ );};const handleKeyboardWillHide = () => {setVirtualKeyboardVisible(false);setVirtualKeyboardHeight(0);document.documentElement.style.setProperty('--dvh', '1dvh');+ document.documentElement.style.setProperty(+ '--virtual-keyboard-height',+ '0px'+ );};onMount(() => {+ document.documentElement.style.setProperty(+ '--virtual-keyboard-height',+ '0px'+ );+ document.documentElement.style.setProperty('--dvh', '1dvh');window.addEventListener('keyboardWillShow', handleKeyboardWillShow);window.addEventListener('keyboardWillHide', handleKeyboardWillHide);diff --git a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsxindex d2a3a0292f..0fd4b65de2 100644--- a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx+++ b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx@@ -39,18 +39,16 @@ function NewTop(props: {return (<Suspense>- <>- <ChannelTopLeft- channelId={props.channelId}- channelType={channelType()!}- participants={participants() ?? []}- channelName={channelName() ?? 'New Channel'}- tabs={tabs()}- activeTab={props.activeTab}- onTabChange={props.onTabChange}- />- <ChannelTopBarLiveIndicators />- </>+ <ChannelTopLeft+ channelId={props.channelId}+ channelType={channelType()!}+ participants={participants() ?? []}+ channelName={channelName() ?? 'New Channel'}+ tabs={tabs()}+ activeTab={props.activeTab}+ onTabChange={props.onTabChange}+ />+ <ChannelTopBarLiveIndicators /></Suspense>);}diff --git a/js/app/packages/channel/Channel/Channel.tsx b/js/app/packages/channel/Channel/Channel.tsxindex 3aa75f2d51..344b2c54e8 100644--- a/js/app/packages/channel/Channel/Channel.tsx+++ b/js/app/packages/channel/Channel/Channel.tsx@@ -8,6 +8,7 @@ import {createMemo,createSignal,on,+ onCleanup,onMount,Show,type Accessor,@@ -38,6 +39,7 @@ import {createInputAttachmentTracker,type InputSnapshot,} from '../Input';+import { ChannelInputContainer } from '../Input/ChannelInputContainer';import { createChannelMessageActions } from './create-channel-message-actions';import { createActivityTracker } from '@channel/activity-tracker';import { useChannelActivity } from '@core/context/channels';@@ -66,10 +68,16 @@ import {useRemoveReactionMutation,} from '@queries/channel/reaction';import { resetKeyboardModality } from './util';+import { focusAndOpenKeyboard } from '@core/mobile/focus-and-open-keyboard';+import { isMobile } from '@core/mobile/isMobile';import { DebugSuspense } from '@channel/DebugSuspense';+import { MaybeMessageActionDrawerManager } from '@channel/Mobile/MessageActionDrawerManager';import { useChannelParticipants } from '@channel/use-channel-participants';import { usePostTypingUpdateMutation } from '@queries/channel/typing';-import { scrollReplyInputIntoView } from '../scroll-utils';+import {+ scrollReplyInputAboveKeyboard,+ scrollReplyInputIntoView,+} from '../scroll-utils';type ChannelProps = {channelId: string;@@ -143,6 +151,7 @@ export function Channel(props: ChannelProps) {});const threadManager = createThreadManager();+ const [isChannelInputHidden, setIsChannelInputHidden] = createSignal(false);const threadPaginator = createThreadPaginator(messagesQuery);const messageEditor = createMessageEditor({channelId: () => props.channelId,@@ -184,6 +193,13 @@ export function Channel(props: ChannelProps) {removeReaction: removeReactionMutation.mutate,onReply: (ctx) => {const state = threadManager.getOrCreateThreadState(ctx.message.id);+ focusAndOpenKeyboard(+ () =>+ document.querySelector(+ `[data-input-id="thread-reply-input-${ctx.message.id}"] [contenteditable]`+ ) as HTMLElement | null,+ ctx.event?.target as HTMLElement | undefined+ );state.setIsReplying(true);requestAnimationFrame(() => scrollReplyInputIntoView(ctx.message.id));},@@ -257,122 +273,201 @@ export function Channel(props: ChannelProps) {return (<DebugSuspense name="Channel.root"><StaticMarkdownContext>- <ChannelDropZone dragState={dragState}>- <Show when={messages().length > 0}>- <div- class="ph-no-capture relative flex-1 min-h-0 suppress-css-brackets suppress-css-bracket outline-none"- ref={(element) => {- messageListElement = element;- attachMessageListRef(element);- }}- tabIndex={-1}- data-channel-message-list- data-channel-nav="keyboard"- onMouseMove={(e) => {- const el = e.currentTarget;- if (el.dataset.channelNav !== 'mouse') {- el.dataset.channelNav = 'mouse';- }- }}- >- <ThreadList- keys={() => messageIndex().keys}- initialScrollTarget={threadListInitialScrollTarget()}- shift={shift}- prepend={threadPaginator.isPrepending}- onScrollNearTop={threadPaginator.shiftPaginate}- onScrollNearBottom={threadPaginator.prependPaginate}- onNavigationReady={setThreadListNavigation}- onScrollStateChange={setThreadListScrollState}+ <MaybeMessageActionDrawerManager>+ <ChannelDropZone dragState={dragState}>+ <Show when={messages().length > 0}>+ <div+ class="ph-no-capture relative flex-1 min-h-0 suppress-css-brackets suppress-css-bracket outline-none"+ ref={(element) => {+ messageListElement = element;+ attachMessageListRef(element);+ }}+ tabIndex={-1}+ data-channel-message-list+ data-channel-nav="keyboard"+ onMouseMove={(e) => {+ const el = e.currentTarget;+ if (el.dataset.channelNav !== 'mouse') {+ el.dataset.channelNav = 'mouse';+ }+ }}>- {(item) => {- const message = () => messageById().get(item.id);- const state = threadManager.getOrCreateThreadState(item.id);- const isNewestThread = () =>- item.id === messageIndex().keys.at(-1);- return (- <Show when={message()}>- {(m) => (- <ChannelThread- data={m}- channelId={() => props.channelId}- isNewestThread={isNewestThread()}- getMessageActions={getMessageActions}- targetReplyId={targetMessageController.pendingTargetReplyId()}- highlightedReplyId={targetMessageController.activeTargetMessageReplyId()}- onTargetReplyScrolled={(replyId) => {- targetMessageController.completePendingReplyScroll(- m().id,- replyId+ <ThreadList+ keys={() => messageIndex().keys}+ initialScrollTarget={threadListInitialScrollTarget()}+ shift={shift}+ prepend={threadPaginator.isPrepending}+ onScrollNearTop={threadPaginator.shiftPaginate}+ onScrollNearBottom={threadPaginator.prependPaginate}+ onNavigationReady={setThreadListNavigation}+ onScrollStateChange={setThreadListScrollState}+ >+ {(item) => {+ const message = () => messageById().get(item.id);+ const state = threadManager.getOrCreateThreadState(item.id);+ const isNewestThread = () =>+ item.id === messageIndex().keys.at(-1);++ if (isMobile()) {+ createEffect(() => {+ const el = state.replyInputEl?.();+ if (!el) return;++ let keyboardWillShowHandler:+ | ((e: Event) => void)+ | undefined;++ const handleFocusIn = () => {+ setIsChannelInputHidden(true);+ const currentKeyboardHeight = parseFloat(+ getComputedStyle(+ document.documentElement+ ).getPropertyValue('--virtual-keyboard-height')+ );+ if (currentKeyboardHeight > 0) {+ scrollReplyInputAboveKeyboard(+ item.id,+ currentKeyboardHeight+ );+ } else {+ keyboardWillShowHandler = (event: Event) => {+ const height =+ (event as CustomEvent<{ height: number }>)+ .detail?.height ?? 0;+ scrollReplyInputAboveKeyboard(item.id, height);+ keyboardWillShowHandler = undefined;+ };+ window.addEventListener(+ 'keyboardWillShow',+ keyboardWillShowHandler,+ { once: true });- }}- highlighted={- m().id ===- targetMessageController.highlightedMessageId()}- isExpanded={state.isExpanded}- setIsExpanded={state.setIsExpanded}- isReplying={state.isReplying}- setIsReplying={state.setIsReplying}- replyInputState={state.replyInputState}- setReplyInputState={state.setReplyInputState}- listMeta={listMetaByMessageId()[item.id]}- messageEditor={messageEditor}- threadActions={{- onDismissNewMessages:- activityTracker.dismissNewMessages,- }}- isNewMessage={activityTracker.isNewMessage}- selectedMessageId={selection.selectedId}- messageListScopeId={messageListScopeId}- />- )}- </Show>- );- }}- </ThreadList>- <ScrollToBottomOverlay- navigation={threadListNavigation}- scrollState={threadListScrollState}- />- </div>- </Show>- <DebugSuspense name="Channel.input">- <div class="pb-2 w-full flex justify-center" ref={attachInputRef}>- <ChannelInput- input={{- mode: 'channel',- id: `channel-input-${props.channelId}`,- placeholder: 'Message channel',- isDraggingOverChannel: dragState.isDraggingOverChannel(),- isValidChannelDrag: dragState.isValidChannelDrag(),- }}- participants={participants.users}- attachmentTracker={attachmentTracker}- persistenceKey={makeInputValuePersistenceKey({- channelId: props.channelId,- })}- onReady={(handle) => {- dragState.setAttachFilesToChannel(handle.attachFiles);- }}- onChange={(snapshot) => void setChannelInputSnapshot(snapshot)}- onSend={onSend}- onStartTyping={() =>- typingMutation.mutate({- channelId: props.channelId,- action: 'start',- })- }- onStopTyping={() =>- typingMutation.mutate({+ };++ const handleFocusOut = (e: FocusEvent) => {+ if (!el.contains(e.relatedTarget as Node)) {+ setIsChannelInputHidden(false);+ if (keyboardWillShowHandler) {+ window.removeEventListener(+ 'keyboardWillShow',+ keyboardWillShowHandler+ );+ keyboardWillShowHandler = undefined;+ }+ }+ };++ el.addEventListener('focusin', handleFocusIn);+ el.addEventListener(+ 'focusout',+ handleFocusOut as EventListener+ );+ onCleanup(() => {+ el.removeEventListener('focusin', handleFocusIn);+ el.removeEventListener(+ 'focusout',+ handleFocusOut as EventListener+ );+ if (keyboardWillShowHandler) {+ window.removeEventListener(+ 'keyboardWillShow',+ keyboardWillShowHandler+ );+ }+ });+ });+ }+ return (+ <Show when={message()}>+ {(m) => (+ <ChannelThread+ data={m}+ channelId={() => props.channelId}+ isNewestThread={isNewestThread()}+ getMessageActions={getMessageActions}+ targetReplyId={targetMessageController.pendingTargetReplyId()}+ highlightedReplyId={targetMessageController.activeTargetMessageReplyId()}+ onTargetReplyScrolled={(replyId) => {+ targetMessageController.completePendingReplyScroll(+ m().id,+ replyId+ );+ }}+ highlighted={+ m().id ===+ targetMessageController.highlightedMessageId()+ }+ isExpanded={state.isExpanded}+ setIsExpanded={state.setIsExpanded}+ isReplying={state.isReplying}+ setIsReplying={state.setIsReplying}+ replyInputState={state.replyInputState}+ setReplyInputState={state.setReplyInputState}+ setReplyInputEl={state.setReplyInputEl}+ listMeta={listMetaByMessageId()[item.id]}+ messageEditor={messageEditor}+ threadActions={{+ onDismissNewMessages:+ activityTracker.dismissNewMessages,+ }}+ isNewMessage={activityTracker.isNewMessage}+ selectedMessageId={selection.selectedId}+ messageListScopeId={messageListScopeId}+ />+ )}+ </Show>+ );+ }}+ </ThreadList>+ <ScrollToBottomOverlay+ navigation={threadListNavigation}+ scrollState={threadListScrollState}+ />+ </div>+ </Show>+ <DebugSuspense name="Channel.input">+ <ChannelInputContainer+ ref={attachInputRef}+ isHidden={isChannelInputHidden()}+ >+ <ChannelInput+ input={{+ mode: 'channel',+ id: `channel-input-${props.channelId}`,+ placeholder: 'Message channel',+ isDraggingOverChannel: dragState.isDraggingOverChannel(),+ isValidChannelDrag: dragState.isValidChannelDrag(),+ }}+ participants={participants.users}+ attachmentTracker={attachmentTracker}+ persistenceKey={makeInputValuePersistenceKey({channelId: props.channelId,- action: 'stop',- })- }- />- </div>- </DebugSuspense>- </ChannelDropZone>+ })}+ onReady={(handle) => {+ dragState.setAttachFilesToChannel(handle.attachFiles);+ }}+ onChange={(snapshot) =>+ void setChannelInputSnapshot(snapshot)+ }+ onSend={onSend}+ onStartTyping={() =>+ typingMutation.mutate({+ channelId: props.channelId,+ action: 'start',+ })+ }+ onStopTyping={() =>+ typingMutation.mutate({+ channelId: props.channelId,+ action: 'stop',+ })+ }+ />+ </ChannelInputContainer>+ </DebugSuspense>+ </ChannelDropZone>+ </MaybeMessageActionDrawerManager></StaticMarkdownContext></DebugSuspense>);diff --git a/js/app/packages/channel/Channel/ThreadList.tsx b/js/app/packages/channel/Channel/ThreadList.tsxindex e41a94955a..58ba443d48 100644--- a/js/app/packages/channel/Channel/ThreadList.tsx+++ b/js/app/packages/channel/Channel/ThreadList.tsx@@ -277,6 +277,7 @@ export function ThreadList(props: ThreadListProps) {return (<divref={scrollRef}+ data-channel-scroll{...scrollIntent.handlers}style={{width: '100%',diff --git a/js/app/packages/channel/Channel/thread-manager.ts b/js/app/packages/channel/Channel/thread-manager.tsindex 470f47fa75..f1568d05d9 100644--- a/js/app/packages/channel/Channel/thread-manager.ts+++ b/js/app/packages/channel/Channel/thread-manager.ts@@ -13,6 +13,9 @@ export function createThreadManager() {const [replyInputState, setReplyInputState] = createSignal<InputSnapshot | undefined>();+ const [replyInputEl, setReplyInputEl] = createSignal<+ HTMLElement | undefined+ >();/** If you set replying from false -> true this means it must be expanded **/const setIsReplying: Setter<boolean> = (val) => {@@ -31,6 +34,8 @@ export function createThreadManager() {setIsReplying,replyInputState,setReplyInputState,+ replyInputEl,+ setReplyInputEl,};setThreadStore(threadId, state);diff --git a/js/app/packages/channel/Input/ChannelInputContainer.tsx b/js/app/packages/channel/Input/ChannelInputContainer.tsxnew file mode 100644index 0000000000..34ec07c6fc--- /dev/null+++ b/js/app/packages/channel/Input/ChannelInputContainer.tsx@@ -0,0 +1,17 @@+import type { JSX } from 'solid-js';+import { cn } from '@ui/utils/classname';++export function ChannelInputContainer(props: {+ ref: (el: HTMLDivElement) => void;+ children: JSX.Element;+ isHidden?: boolean;+}) {+ return (+ <div+ class={cn('pb-2 w-full flex justify-center', props.isHidden && 'hidden')}+ ref={props.ref}+ >+ {props.children}+ </div>+ );+}diff --git a/js/app/packages/channel/Message/ChannelMessage.tsx b/js/app/packages/channel/Message/ChannelMessage.tsxindex e09bf27e10..5f498d43e4 100644--- a/js/app/packages/channel/Message/ChannelMessage.tsx+++ b/js/app/packages/channel/Message/ChannelMessage.tsx@@ -1,11 +1,14 @@import { Match, Show, Switch } from 'solid-js';+import { cn } from '@ui/utils/classname';import type { MessageActions, MessageData } from './types';import { Message } from './Message';import type { ChannelMessageListMeta } from './list-meta';import { useMessage, MessageSelectionProvider } from './context';import type { MessageSelectionState } from './context';+import { useMessageActionDrawer } from '@channel/Mobile/message-action-drawer-context';import type { MessageEditor } from '../Channel/create-message-editor';import { MessageEditorContent } from '../Channel/InlineMessageEditor';+import { touchHandler } from '@core/directive/touchHandler';type ChannelMessageProps = {channelId: string;@@ -131,11 +134,10 @@ function GroupedMessageLayout(props: {</Message.Slot><Message.Slot placement="content"><div- class="ph-no-capture flex gap-3 min-w-0"- classList={{- 'items-center': !isEditing(),- 'items-start': isEditing(),- }}+ class={cn(+ 'ph-no-capture flex gap-3 min-w-0',+ isEditing() ? 'items-start' : 'items-center'+ )}><MessageContentSlotchannelId={props.channelId}@@ -159,6 +161,7 @@ function GroupedMessageLayout(props: {}export function ChannelMessage(props: ChannelMessageProps) {+ const drawerManager = useMessageActionDrawer();const isGrouped = () => props.listMeta?.isGroupedWithPrevious === true;return (@@ -166,6 +169,11 @@ export function ChannelMessage(props: ChannelMessageProps) {message={props.message}actions={props.actions}highlighted={props.highlighted}+ ref={(el) =>+ touchHandler(el, () => ({+ onLongPress: () => drawerManager?.open(props.message, props.actions),+ }))+ }><MessageSelectionProvider value={props.selectionState}><Switch>diff --git a/js/app/packages/channel/Message/HoverActions.tsx b/js/app/packages/channel/Message/HoverActions.tsxindex 9f4a82c4d5..3a12b29386 100644--- a/js/app/packages/channel/Message/HoverActions.tsx+++ b/js/app/packages/channel/Message/HoverActions.tsx@@ -1,5 +1,6 @@import type { JSX } from 'solid-js';import { cn } from '@ui/utils/classname';+import { isTouchDevice } from '@core/mobile/isTouchDevice';type HoverActionsProps = {class?: string;@@ -12,9 +13,8 @@ export function HoverActions(props: HoverActionsProps) {<divclass={cn('absolute right-2 top-0 -translate-y-1/2 z-10',- props.persistentVisible- ? 'opacity-100'- : 'opacity-0 group-hover/message:opacity-100',+ props.persistentVisible ? '' : 'hidden group-hover/message:block',+ isTouchDevice() && 'hidden',props.class)}data-message-hover-actionsdiff --git a/js/app/packages/channel/Message/Root.tsx b/js/app/packages/channel/Message/Root.tsxindex af6fb98a32..ee81919892 100644--- a/js/app/packages/channel/Message/Root.tsx+++ b/js/app/packages/channel/Message/Root.tsx@@ -20,7 +20,7 @@ export function Root(props: RootProps) {return (<div- class={cn('group/message relative', local.class)}+ class={cn('group/message relative touch:no-select-children', local.class)}data-messagedata-message-id={local.message.id}data-highlighted={local.highlighted ? '' : undefined}diff --git a/js/app/packages/channel/Message/render-icon.tsx b/js/app/packages/channel/Message/render-icon.tsxindex 00b604867c..6bacd9a749 100644--- a/js/app/packages/channel/Message/render-icon.tsx+++ b/js/app/packages/channel/Message/render-icon.tsx@@ -1,12 +1,14 @@import type { Component, JSX } from 'solid-js';+import { cn } from '@ui/utils/classname';export function renderIcon(- icon: Component<JSX.SvgSVGAttributes<SVGSVGElement>> | string+ icon: Component<JSX.SvgSVGAttributes<SVGSVGElement>> | string,+ className?: string): JSX.Element {if (typeof icon === 'string') {- return <img src={icon} alt="" class="size-4" />;+ return <img src={icon} alt="" class={cn('size-4', className)} />;}const Icon = icon;- return <Icon class="size-4" />;+ return <Icon class={cn('size-4', className)} />;}diff --git a/js/app/packages/channel/Mobile/ActionDrawer.tsx b/js/app/packages/channel/Mobile/ActionDrawer.tsxnew file mode 100644index 0000000000..144c4baf83--- /dev/null+++ b/js/app/packages/channel/Mobile/ActionDrawer.tsx@@ -0,0 +1,244 @@+import { MobileDrawer } from '@app/component/mobile/MobileDrawer';+import { EmojiSelector } from '@core/component/Emoji/EmojiSelector';+import ReplyIcon from '@icon/regular/arrow-bend-up-left.svg';+import LinkIcon from '@icon/regular/link.svg';+import PencilIcon from '@icon/regular/pencil.svg';+import PlusIcon from '@icon/regular/plus.svg';+import TrashIcon from '@icon/regular/trash.svg';+import {+ createSignal,+ For,+ onMount,+ Show,+ type Component,+ type JSX,+} from 'solid-js';+import { useMessageActionDrawer } from './message-action-drawer-context';+import { renderIcon } from '../Message/render-icon';+import type {+ MessageActionEvent,+ MessageActionHandler,+ MessageActions,+} from '../Message/types';++const QUICK_REACTION_EMOJIS = ['❤️', '👍', '👎', '😂', '😡'] as const;++type ActionId = 'reply' | 'copy-link' | 'edit' | 'delete';++type ActionItem = {+ id: ActionId;+ label: string;+ icon: Component<JSX.SvgSVGAttributes<SVGSVGElement>> | string;+ onClick?: MessageActionHandler;+ destructive?: boolean;+};++function buildActionItems(actions: MessageActions | undefined): ActionItem[] {+ return [+ { id: 'reply', label: 'Reply', icon: ReplyIcon, onClick: actions?.onReply },+ {+ id: 'copy-link',+ label: 'Copy Link',+ icon: LinkIcon,+ onClick: actions?.onCopyLink,+ },+ { id: 'edit', label: 'Edit', icon: PencilIcon, onClick: actions?.onEdit },+ {+ id: 'delete',+ label: 'Delete',+ icon: TrashIcon,+ onClick: actions?.onDelete,+ destructive: true,+ },+ ];+}++function EmojiSearchView(props: {+ onSelect: (emoji: string) => void;+ onBack: () => void;+}) {+ let inputRef: HTMLInputElement | undefined;+ const [query, setQuery] = createSignal('');++ onMount(() => {+ setTimeout(() => {+ inputRef?.focus();+ }, 0);+ });++ return (+ <div class="flex flex-col flex-1 min-h-0 pb-2">+ {/* Search input */}+ <div class="flex items-center gap-2 px-3 pb-2 shrink-0">+ <div class="flex flex-1 items-center bg-input border border-edge-muted rounded-sm px-2 py-1.5 text-sm gap-1">+ <input+ ref={inputRef}+ value={query()}+ onInput={(e) => setQuery(e.currentTarget.value)}+ placeholder="Search emojis"+ aria-label="Search emojis"+ class="flex-1 bg-transparent outline-none placeholder:text-ink-placeholder"+ />+ </div>+ </div>++ {/* Emoji grid — onPointerDown preventDefault prevents the input from+ blurring before the click fires on an emoji button */}+ <div+ class="overflow-y-auto flex-1 px-1"+ onPointerDown={(e) => e.preventDefault()}+ >+ <EmojiSelector+ nameFilter={query()}+ onEmojiClick={(emoji) => props.onSelect(emoji.emoji)}+ columns={7}+ />+ </div>+ </div>+ );+}++export function ActionDrawer() {+ const drawerState = useMessageActionDrawer();+ const [showEmojiSearch, setShowEmojiSearch] = createSignal(false);++ if (!drawerState) {+ console.warn('No drawer state.');+ return null;+ }++ const message = () => drawerState.message();+ const actions = () => drawerState.actions();++ const handleReaction = (emoji: string, event?: MessageActionEvent) => {+ const msg = message();+ if (!msg) return;+ void actions()?.onReact?.({ message: msg, event, emoji });+ drawerState.close();+ setShowEmojiSearch(false);+ };++ const handleAction = (+ handler: MessageActionHandler | undefined,+ event: MouseEvent+ ) => {+ const msg = message();+ if (!msg) return;+ void handler?.({ message: msg, event });+ drawerState.close();+ };++ const actionItems = () => buildActionItems(actions());+ const nonDestructiveActions = () =>+ actionItems().filter((item) => item.onClick && !item.destructive);+ const destructiveActions = () =>+ actionItems().filter((item) => item.onClick && item.destructive);+ const hasReactAction = () => actions()?.onReact !== undefined;++ return (+ <MobileDrawer+ side="bottom"+ open={drawerState.isOpen()}+ closeOnOutsidePointerStrategy="pointerdown"+ onOpenChange={(v) => {+ if (!v) {+ drawerState.close();+ setShowEmojiSearch(false);+ }+ }}+ preventScroll={false}+ preventScrollbarShift={false}+ restoreFocus={false}+ >+ <MobileDrawer.Portal>+ <MobileDrawer.Overlay class="fixed inset-0 z-modal-overlay bg-modal-overlay pattern-diagonal-4 pattern-edge-muted" />+ <MobileDrawer.Content aria-label="Message actions">+ {/* Drag handle */}+ <div class="flex justify-center pt-3 pb-2 shrink-0">+ <div class="w-10 h-1 rounded-full bg-edge-muted" />+ </div>++ <Show+ when={!showEmojiSearch()}+ fallback={+ <EmojiSearchView+ onSelect={(emoji) => handleReaction(emoji)}+ onBack={() => setShowEmojiSearch(false)}+ />+ }+ >+ {/* Emoji reaction row */}+ <Show when={hasReactAction()}>+ <div class="flex flex-row items-center justify-between px-3 pb-4 gap-1 shrink-0">+ <For each={QUICK_REACTION_EMOJIS}>+ {(emoji) => (+ <button+ type="button"+ title={`React ${emoji}`}+ aria-label={`React ${emoji}`}+ class="size-12 flex items-center justify-center bg-edge/30 rounded-full text-[28px]"+ onClick={(event) => handleReaction(emoji, event)}+ >+ {emoji}+ </button>+ )}+ </For>+ <button+ type="button"+ title="More reactions"+ aria-label="More reactions"+ class="size-12 bg-edge/30 rounded-full flex items-center justify-center text-ink-muted"+ onClick={() => setShowEmojiSearch(true)}+ >+ {renderIcon(PlusIcon, 'size-[28px]')}+ </button>+ </div>+ </Show>++ {/* Non-destructive actions */}+ <Show when={nonDestructiveActions().length > 0}>+ <MobileDrawer.Section class="flex flex-col shrink-0">+ <For each={nonDestructiveActions()}>+ {(action) => (+ <button+ type="button"+ data-message-action={action.id}+ class="flex items-center gap-3 px-4 py-3 text-sm text-ink hover:bg-hover hover-transition-bg text-left not-last:border-b border-page"+ onClick={(event) => handleAction(action.onClick, event)}+ >+ <span class="size-5 flex items-center justify-center shrink-0">+ {renderIcon(action.icon)}+ </span>+ {action.label}+ </button>+ )}+ </For>+ </MobileDrawer.Section>+ </Show>++ {/* Destructive actions */}+ <Show when={destructiveActions().length > 0}>+ <MobileDrawer.Section class="flex flex-col shrink-0 mt-3">+ <For each={destructiveActions()}>+ {(action) => (+ <button+ type="button"+ data-message-action={action.id}+ class="flex items-center gap-3 px-4 py-3 text-sm text-failure-ink hover:bg-hover hover-transition-bg text-left not-last:border-b border-panel"+ onClick={(event) => handleAction(action.onClick, event)}+ >+ <span class="size-5 flex items-center justify-center shrink-0">+ {renderIcon(action.icon)}+ </span>+ {action.label}+ </button>+ )}+ </For>+ </MobileDrawer.Section>+ </Show>+ </Show>+ </MobileDrawer.Content>+ </MobileDrawer.Portal>+ </MobileDrawer>+ );+}diff --git a/js/app/packages/channel/Mobile/MessageActionDrawerManager.tsx b/js/app/packages/channel/Mobile/MessageActionDrawerManager.tsxnew file mode 100644index 0000000000..76cd3b5c5c--- /dev/null+++ b/js/app/packages/channel/Mobile/MessageActionDrawerManager.tsx@@ -0,0 +1,42 @@+import { createSignal, type JSX } from 'solid-js';+import { isMobile } from '@core/mobile/isMobile';+import {+ MessageActionDrawerContextProvider,+ type MessageActionDrawerState,+} from './message-action-drawer-context';+import { ActionDrawer } from './ActionDrawer';+import type { MessageActions, MessageData } from '../Message/types';++/**+ * On mobile: provides drawer context and renders the ActionDrawer (opened via+ * long-press on Message.Root).+ * On desktop: renders children as-is with no context, signals, or drawer.+ */+export function MaybeMessageActionDrawerManager(props: {+ children: JSX.Element;+}) {+ if (!isMobile()) return props.children;++ const [isOpen, setIsOpen] = createSignal(false);+ const [message, setMessage] = createSignal<MessageData | undefined>();+ const [actions, setActions] = createSignal<MessageActions | undefined>();++ const ctx: MessageActionDrawerState = {+ isOpen,+ message,+ actions,+ open: (msg: MessageData, acts: MessageActions | undefined) => {+ setMessage(() => msg);+ setActions(() => acts);+ setIsOpen(true);+ },+ close: () => setIsOpen(false),+ };++ return (+ <MessageActionDrawerContextProvider value={ctx}>+ {props.children}+ <ActionDrawer />+ </MessageActionDrawerContextProvider>+ );+}diff --git a/js/app/packages/channel/Mobile/message-action-drawer-context.ts b/js/app/packages/channel/Mobile/message-action-drawer-context.tsnew file mode 100644index 0000000000..181f80fbcf--- /dev/null+++ b/js/app/packages/channel/Mobile/message-action-drawer-context.ts@@ -0,0 +1,18 @@+import { createContext, useContext, type Accessor } from 'solid-js';+import type { MessageActions, MessageData } from '../Message/types';++export type MessageActionDrawerState = {+ isOpen: Accessor<boolean>;+ message: Accessor<MessageData | undefined>;+ actions: Accessor<MessageActions | undefined>;+ open: (message: MessageData, actions: MessageActions | undefined) => void;+ close: () => void;+};++const MessageActionDrawerContext = createContext<MessageActionDrawerState>();+export const MessageActionDrawerContextProvider =+ MessageActionDrawerContext.Provider;++export function useMessageActionDrawer(): MessageActionDrawerState | undefined {+ return useContext(MessageActionDrawerContext);+}diff --git a/js/app/packages/channel/Thread/ChannelThread.tsx b/js/app/packages/channel/Thread/ChannelThread.tsxindex 29dc261361..a7a5c64794 100644--- a/js/app/packages/channel/Thread/ChannelThread.tsx+++ b/js/app/packages/channel/Thread/ChannelThread.tsx@@ -5,6 +5,7 @@ import { MarkMessaageNotifications } from '@notifications/components/MarkMessageimport { useUserId } from '@core/context/user';import { deferredGate } from '@core/util/debounce';import { tryMacroId, useDisplayName } from '@core/user';+import { focusAndOpenKeyboard } from '@core/mobile/focus-and-open-keyboard';import { Thread } from './Thread';import type { ThreadProps } from './types';import type { ApiThreadReply } from '@service-comms/client';@@ -75,6 +76,8 @@ export function ChannelThread(props: ThreadProps) {const isThreadFocused = () => isSelected() && !!replySelection.selectedId();+ let replyInputContainerRef: HTMLDivElement | undefined;+const { attachReplyInputRef } = createThreadHotkeys({messageListScopeId: props.messageListScopeId!,replySelection,@@ -219,7 +222,13 @@ export function ChannelThread(props: ThreadProps) {/><Show when={props.isReplying()}>- <div ref={attachReplyInputRef} class="ph-no-capture">+ <div+ ref={(el) => {+ attachReplyInputRef(el);+ replyInputContainerRef = el;+ }}+ class="ph-no-capture"+ ><Show when={!hasReplies()}><Thread.ReplyAuthoruserId={replyUserId()}@@ -232,6 +241,7 @@ export function ChannelThread(props: ThreadProps) {replyInputState={props.replyInputState}setReplyInputState={props.setReplyInputState}setIsReplying={props.setIsReplying}+ setReplyInputEl={props.setReplyInputEl}/></div></Show>@@ -253,7 +263,16 @@ export function ChannelThread(props: ThreadProps) {</Show><Show when={shouldShowReplyButton()}><Thread.ReplyButton- onClick={() => props.setIsReplying(true)}+ onClick={(e) => {+ focusAndOpenKeyboard(+ () =>+ (replyInputContainerRef?.querySelector(+ '[contenteditable]'+ ) as HTMLElement | null) ?? null,+ e.currentTarget as HTMLElement+ );+ props.setIsReplying(true);+ }}aria-label="Reply"/></Show>diff --git a/js/app/packages/channel/Thread/ThreadReplyInput.tsx b/js/app/packages/channel/Thread/ThreadReplyInput.tsxindex 195ede06ea..b686fb0026 100644--- a/js/app/packages/channel/Thread/ThreadReplyInput.tsx+++ b/js/app/packages/channel/Thread/ThreadReplyInput.tsx@@ -1,7 +1,7 @@import { useUserId } from '@core/context/user';import { useSendMessageMutation } from '@queries/channel/message';import { usePostTypingUpdateMutation } from '@queries/channel/typing';-import type { Accessor, Setter } from 'solid-js';+import { onCleanup, type Accessor, type Setter } from 'solid-js';import { ChannelInput, createInputAttachmentTracker } from '../Input';import type { InputSnapshot } from '../Input';import { buildPostMessageRequest } from '../Input/message-payload';@@ -20,9 +20,12 @@ type ThreadReplyInputProps = {replyInputState: Accessor<InputSnapshot | undefined>;setReplyInputState: Setter<InputSnapshot | undefined>;setIsReplying: Setter<boolean>;+ setReplyInputEl?: Setter<HTMLElement | undefined>;};export function ThreadReplyInput(props: ThreadReplyInputProps) {+ onCleanup(() => props.setReplyInputEl?.(undefined));+const userId = useUserId();const sendMessageMutation = useSendMessageMutation();const typingMutation = usePostTypingUpdateMutation();@@ -46,6 +49,7 @@ export function ThreadReplyInput(props: ThreadReplyInputProps) {<divclass="relative pt-2"style={{ 'margin-left': replyInputOffsetX }}+ ref={(el) => props.setReplyInputEl?.(el)}data-reply-inputdata-reply-input-id={props.messageId}>diff --git a/js/app/packages/channel/Thread/types.ts b/js/app/packages/channel/Thread/types.tsindex a80bcc4b20..7aff929fdb 100644--- a/js/app/packages/channel/Thread/types.ts+++ b/js/app/packages/channel/Thread/types.ts@@ -20,6 +20,8 @@ export type ThreadState = {setIsReplying: Setter<boolean>;replyInputState: Accessor<InputSnapshot | undefined>;setReplyInputState: Setter<InputSnapshot | undefined>;+ replyInputEl?: Accessor<HTMLElement | undefined>;+ setReplyInputEl?: Setter<HTMLElement | undefined>;};export type MessageEditState = {diff --git a/js/app/packages/channel/scroll-utils.ts b/js/app/packages/channel/scroll-utils.tsindex bcee1fd227..035e4dcd1a 100644--- a/js/app/packages/channel/scroll-utils.ts+++ b/js/app/packages/channel/scroll-utils.ts@@ -10,6 +10,10 @@ function getReplyInputElement(messageId: string) {);}+function getChannelScrollElement(element: HTMLElement) {+ return element.closest('[data-channel-scroll]');+}+function isElementInView(element: HTMLElement) {const rect = element.getBoundingClientRect();return rect.top >= 0 && rect.bottom <= window.innerHeight;@@ -42,3 +46,41 @@ export function scrollReplyInputIntoView(messageId: string) {if (!element) return false;return scrollIntoViewIfNeeded(element);}++/**+ * Scrolls the channel's scroll container so the reply input is not hidden+ * behind the virtual keyboard. Call this after the keyboard has appeared and+ * its height is known. If the input's bottom edge falls within `keyboardHeight`+ * pixels of the windows bottom edge, the container is scrolled up+ * by the overlap.+ */+export function scrollReplyInputAboveKeyboard(+ messageId: string,+ keyboardHeight: number+): boolean {+ if (keyboardHeight <= 0) return false;++ const inputEl = getReplyInputElement(messageId);+ if (!inputEl) return false;++ const scrollContainer = getChannelScrollElement(inputEl);+ if (!scrollContainer) return false;++ const inputRect = inputEl.getBoundingClientRect();+ const containerRect = scrollContainer.getBoundingClientRect();+ // The keyboard rises from the bottom of the screen, so the visible bottom of+ // the scroll container is capped at (screen bottom - keyboard height).+ const visibleBottom = Math.min(+ containerRect.bottom,+ window.innerHeight - keyboardHeight+ );++ const SCROLL_OFFSET = 8;++ if (inputRect.bottom > visibleBottom - SCROLL_OFFSET) {+ scrollContainer.scrollTop +=+ inputRect.bottom - visibleBottom + SCROLL_OFFSET;+ return true;+ }+ return false;+}diff --git a/js/app/packages/core/component/Emoji/EmojiSelector.tsx b/js/app/packages/core/component/Emoji/EmojiSelector.tsxindex ee95db4fa2..d74930f14f 100644--- a/js/app/packages/core/component/Emoji/EmojiSelector.tsx+++ b/js/app/packages/core/component/Emoji/EmojiSelector.tsx@@ -1,7 +1,6 @@import type { JSX } from 'solid-js';import {createEffect,- createMemo,createSignal,For,Match,@@ -38,6 +37,7 @@ export type EmojiEventHandler<T extends Event> = (export interface EmojiPickerProps {nameFilter?: string;onEmojiClick: (emoji: SimpleEmoji) => void;+ columns?: number;}export interface EmojiOptionProps {@@ -50,17 +50,20 @@ export function EmojiSelector(props: EmojiPickerProps): JSX.Element {const { groups, emojis: filteredEmojis, filter } = useEmojiData();let scrollEl!: HTMLDivElement;+ const columns = () => props.columns ?? 6;+function EmojiOption(props: EmojiOptionProps): JSX.Element {return (<buttontype="button"- class={`hover:bg-hover hover-transition-bg rounded-md p-1 ${props.isSelected ? 'bg-hover' : ''}`}+ class={`hover:bg-hover hover-transition-bg rounded-md p-1 aspect-square w-full flex items-center justify-center ${props.isSelected ? 'bg-hover' : ''}`}+ style={{ 'container-type': 'inline-size' }}onClick={() => props.onEmojiClick(props.emoji)}title={props.emoji.slug}role="option"aria-selected={props.isSelected}>- {renderEmoji(props.emoji.emoji, '32px')}+ {renderEmoji(props.emoji.emoji, '90cqi')}</button>);}@@ -83,7 +86,6 @@ export function EmojiSelector(props: EmojiPickerProps): JSX.Element {: groups.flatMap((g) => g.emojis);if (!emojisToUse || emojisToUse.length === 0) return;- const EMOJIS_PER_ROW = 6;const totalEmojis = emojisToUse.length;if (e.key === 'ArrowRight') {@@ -105,7 +107,7 @@ export function EmojiSelector(props: EmojiPickerProps): JSX.Element {e.stopPropagation();setSelectedIndex((prev) => {if (prev === -1) return 0;- const nextIndex = prev + EMOJIS_PER_ROW;+ const nextIndex = prev + columns();return nextIndex >= totalEmojis ? prev : nextIndex;});} else if (e.key === 'ArrowUp') {@@ -113,7 +115,7 @@ export function EmojiSelector(props: EmojiPickerProps): JSX.Element {e.stopPropagation();setSelectedIndex((prev) => {if (prev === -1) return totalEmojis - 1;- const nextIndex = prev - EMOJIS_PER_ROW;+ const nextIndex = prev - columns();return nextIndex < 0 ? prev : nextIndex;});} else if (e.key === 'Enter') {@@ -132,6 +134,11 @@ export function EmojiSelector(props: EmojiPickerProps): JSX.Element {});});+ const gridStyle = () => ({+ display: 'grid',+ 'grid-template-columns': `repeat(${columns()}, 1fr)`,+ });+return (<divref={scrollEl}@@ -139,57 +146,53 @@ export function EmojiSelector(props: EmojiPickerProps): JSX.Element {role="listbox"aria-label="Emoji Selector">- {createMemo(() => {- return (- <Switch>- <Match- when={- !validFilter(props.nameFilter) || filteredEmojis() === undefined- }- >- <For each={groups}>- {(group): JSX.Element => (- <Show when={group.emojis.length > 0}>- <div class="mt-2 w-full">- <p class="text-ink-extra-muted text-xs w-full flex items-center justify-start">- {group.name}- </p>- <div class="flex flex-row flex-wrap">- <For each={group.emojis}>- {(emojiItem, index): JSX.Element => (- <EmojiOption- emoji={emojiItem}- onEmojiClick={props.onEmojiClick}- isSelected={selectedIndex() === index()}- />- )}- </For>- </div>- </div>- </Show>- )}- </For>- </Match>- <Match when={filteredEmojis() !== undefined}>- <div class="mt-2">- <span class="text-ink-extra-muted text-xs">Search Results</span>- </div>-- <div class="flex flex-row flex-wrap">- <For each={filteredEmojis()}>- {(emojiItem, index): JSX.Element => (- <EmojiOption- emoji={emojiItem}- onEmojiClick={props.onEmojiClick}- isSelected={selectedIndex() === index()}- />- )}- </For>- </div>- </Match>- </Switch>- );- })()}+ <Switch>+ <Match+ when={+ !validFilter(props.nameFilter) || filteredEmojis() === undefined+ }+ >+ <For each={groups}>+ {(group): JSX.Element => (+ <Show when={group.emojis.length > 0}>+ <div class="mt-2 w-full">+ <p class="pl-1 text-ink-extra-muted text-xs">{group.name}</p>+ <div style={gridStyle()}>+ <For each={group.emojis}>+ {(emojiItem, index): JSX.Element => (+ <EmojiOption+ emoji={emojiItem}+ onEmojiClick={props.onEmojiClick}+ isSelected={selectedIndex() === index()}+ />+ )}+ </For>+ </div>+ </div>+ </Show>+ )}+ </For>+ </Match>+ <Match when={filteredEmojis() !== undefined}>+ <div class="mt-2">+ <span class="pl-1 text-ink-extra-muted text-xs">+ Search Results+ </span>+ </div>++ <div style={gridStyle()}>+ <For each={filteredEmojis()}>+ {(emojiItem, index): JSX.Element => (+ <EmojiOption+ emoji={emojiItem}+ onEmojiClick={props.onEmojiClick}+ isSelected={selectedIndex() === index()}+ />+ )}+ </For>+ </div>+ </Match>+ </Switch></div>);}diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.tsindex 73548a7f83..b2152d00de 100644--- a/js/app/packages/core/constant/featureFlags.ts+++ b/js/app/packages/core/constant/featureFlags.ts@@ -280,9 +280,7 @@ export const ENABLE_FEATURED_SEARCH_RESULTS = resolveFeatureFlag(true);-const ENABLE_NEW_CHANNELS_OVERRIDE = getFeatureFlagOverride(- 'ENABLE_NEW_CHANNELS'-);+const ENABLE_NEW_CHANNELS_OVERRIDE = true;export function ENABLE_NEW_CHANNELS(): boolean {if (ENABLE_NEW_CHANNELS_OVERRIDE !== undefined) {diff --git a/js/app/packages/core/directive/touchHandler.ts b/js/app/packages/core/directive/touchHandler.tsindex 3e7a668589..b87a1bef31 100644--- a/js/app/packages/core/directive/touchHandler.ts+++ b/js/app/packages/core/directive/touchHandler.ts@@ -1,3 +1,4 @@+import { impactFeedback } from '@tauri-apps/plugin-haptics';import { type Accessor, createSignal, type JSX, onCleanup } from 'solid-js';export const hasHaptics = false;@@ -69,6 +70,7 @@ export function touchHandler(timer = window.setTimeout(() => {longPressTriggered = true;setLongPressActivated(true);+ void impactFeedback('medium');props().onLongPress?.(e as TouchEvent & { currentTarget: HTMLElement; target: Element });diff --git a/js/app/packages/core/mobile/focus-and-open-keyboard.ts b/js/app/packages/core/mobile/focus-and-open-keyboard.tsnew file mode 100644index 0000000000..18a7460374--- /dev/null+++ b/js/app/packages/core/mobile/focus-and-open-keyboard.ts@@ -0,0 +1,66 @@+// Source - adapted from https://stackoverflow.com/a/76838650++import { isMobile } from '@core/mobile/isMobile';++/**+ * iOS only: focuses a temporary input element to open the keyboard within the+ * user gesture, then transfers focus to the real target once it appears in the+ * DOM. Pass a lazy getter for the target element — it need not exist at call+ * time. `positionNear` positions the temp input to prevent cursor jumping.+ *+ * No-op on non-mobile platforms.+ */+export function focusAndOpenKeyboard(+ getEl: () => HTMLElement | null | undefined,+ positionNear?: HTMLElement | null+) {+ if (!isMobile()) return;++ const tempEl = document.createElement('input');+ let observer: MutationObserver | undefined;+ let timeoutId: ReturnType<typeof setTimeout> | undefined;++ function cleanup() {+ if (timeoutId !== undefined) clearTimeout(timeoutId);+ if (document.body.contains(tempEl)) document.body.removeChild(tempEl);+ observer?.disconnect();+ window.removeEventListener('beforeunload', cleanup);+ }++ function focusOnElementAndCleanup() {+ getEl()?.focus();+ cleanup();+ }++ function focusOnDummyElementToOpenIOSKeyboard() {+ tempEl.style.position = 'absolute';+ tempEl.style.top = `${(positionNear?.offsetTop ?? 0) + 7}px`;+ tempEl.style.left = `${positionNear?.offsetLeft ?? 0}px`;+ tempEl.style.height = '0';+ tempEl.style.opacity = '0';+ tempEl.style.fontSize = '16px';+ document.body.appendChild(tempEl);+ tempEl.focus();+ }++ const el = getEl();+ if (el && isVisible(el)) {+ el.focus();+ return;+ }++ focusOnDummyElementToOpenIOSKeyboard();++ observer = new MutationObserver(() => {+ const current = getEl();+ if (current && isVisible(current)) focusOnElementAndCleanup();+ });+ observer.observe(document.body, { childList: true, subtree: true });++ timeoutId = setTimeout(cleanup, 5000);+ window.addEventListener('beforeunload', cleanup, { once: true });+}++function isVisible(el: HTMLElement): boolean {+ return el.offsetParent !== null;+}