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(dictation): stop the mic sliding, polish the panel on touch (#6881)

Wolf Mermelstein67ac381a61d3
diff --git a/apps/web/src/components/ui/components/CollapsedInput.tsx b/apps/web/src/components/ui/components/CollapsedInput.tsx
index 664e0d3a11..8dd7d55299 100644
--- a/apps/web/src/components/ui/components/CollapsedInput.tsx
+++ b/apps/web/src/components/ui/components/CollapsedInput.tsx
@@ -115,18 +115,20 @@ export function CollapsedInput(props: CollapsedInputProps) {
</Button>
</Show>
{props.trailingAction}
- <Show when={!isMobile() || !props.disabled}>
- <SendButton
- appearance="composer"
- pending={props.pending}
- disabled={props.disabled || props.pending}
- onPointerDown={(event) => {
- event.preventDefault();
- void props.onSend?.();
- }}
- data-collapsed-input-send
- />
- </Show>
+ {/* Fades out rather than unmounting, the way the expanded composer's
+ send action does: dropping it would slide the trailing action
+ across as soon as the draft emptied. */}
+ <SendButton
+ appearance="composer"
+ pending={props.pending}
+ hidden={isMobile() && props.disabled}
+ disabled={props.disabled || props.pending}
+ onPointerDown={(event) => {
+ event.preventDefault();
+ void props.onSend?.();
+ }}
+ data-collapsed-input-send
+ />
</ComposerSurface>
</Layer>
);
diff --git a/apps/web/src/components/ui/components/SendButton.tsx b/apps/web/src/components/ui/components/SendButton.tsx
index b59182fdcd..5bcf4e9409 100644
--- a/apps/web/src/components/ui/components/SendButton.tsx
+++ b/apps/web/src/components/ui/components/SendButton.tsx
@@ -8,7 +8,7 @@ export type SendButtonProps = Omit<ButtonProps, 'size' | 'variant'> & {
appearance?: 'default' | 'composer';
/** Show a spinner instead of the arrow (e.g. while a send mutation is in-flight). */
pending?: boolean;
- /** Fade the button to fully transparent — used to hide on mobile when the input is empty. */
+ /** Drop the button from the layout — used to hide on mobile when the input is empty. */
hidden?: boolean;
};
@@ -41,7 +41,10 @@ export function SendButton(props: SendButtonProps) {
'transition-transform ease-in-out duration-150',
'data-disabled:opacity-100 data-disabled:text-ink-extra-muted! data-disabled:bg-ink-muted/5',
'active:not-disabled:scale-95',
- local.hidden && 'opacity-0!',
+ // Out of the flow, not just invisible: a transparent send button
+ // holds its slot and strands whatever sits before it (the dictation
+ // button) well short of the composer's edge.
+ local.hidden && 'hidden',
local.class
)}
{...rest}
diff --git a/apps/web/src/features/dictation/components/dictation-controls.tsx b/apps/web/src/features/dictation/components/dictation-controls.tsx
index 6f14cdb5aa..24f1262715 100644
--- a/apps/web/src/features/dictation/components/dictation-controls.tsx
+++ b/apps/web/src/features/dictation/components/dictation-controls.tsx
@@ -33,7 +33,7 @@ export function DictationPanel(props: { dictation: DictationController }) {
return (
<Show when={props.dictation.active()}>
<div
- class="absolute inset-0 z-10 flex items-center gap-2 rounded-[inherit] bg-composer px-[9.375px] text-composer-ink touch:bg-chrome"
+ class="absolute inset-0 z-10 flex items-center gap-2 rounded-[inherit] bg-composer px-[9.375px] text-composer-ink touch:gap-1.5 touch:bg-chrome touch:pr-2 touch:pl-3"
role="group"
aria-label="Dictation"
onKeyDown={(event) => {
@@ -44,7 +44,7 @@ export function DictationPanel(props: { dictation: DictationController }) {
}
}}
>
- <div class="flex min-w-0 flex-1 items-center gap-3 px-2">
+ <div class="flex min-w-0 flex-1 items-center gap-3 px-2 touch:gap-2 touch:px-0">
<VolumeTimeline levels={props.dictation.volumeHistory()} />
<span
class="shrink-0 text-xs text-ink-muted"
@@ -61,7 +61,7 @@ export function DictationPanel(props: { dictation: DictationController }) {
<Button
variant="ghost"
size="icon-composer"
- class="rounded-full text-composer-ink"
+ class="rounded-full text-composer-ink touch:bg-ink/5 touch:text-ink-muted"
label="Cancel dictation"
ref={(element) =>
queueMicrotask(() => {
@@ -72,10 +72,12 @@ export function DictationPanel(props: { dictation: DictationController }) {
>
<XIcon />
</Button>
+ {/* Confirm is the composer's primary action while recording, so on
+ touch it borrows the send button's filled circle. */}
<Button
variant="ghost"
size="icon-composer"
- class="rounded-full text-composer-ink"
+ class="rounded-full text-composer-ink touch:bg-ink touch:text-surface-4"
label="Use dictation"
disabled={
props.dictation.phase() === 'starting' ||
diff --git a/apps/web/src/features/dictation/components/volume-timeline.tsx b/apps/web/src/features/dictation/components/volume-timeline.tsx
index cf5573ab81..890408ddea 100644
--- a/apps/web/src/features/dictation/components/volume-timeline.tsx
+++ b/apps/web/src/features/dictation/components/volume-timeline.tsx
@@ -39,7 +39,7 @@ export function VolumeTimeline(props: { levels: readonly number[] }) {
<div
ref={setContainer}
aria-hidden="true"
- class="relative h-8 min-w-0 flex-1 overflow-hidden"
+ class="relative h-8 min-w-0 flex-1 overflow-hidden touch:h-6"
>
<div
ref={strip}
@@ -49,8 +49,10 @@ export function VolumeTimeline(props: { levels: readonly number[] }) {
{(level) => (
<span
class="w-[3px] shrink-0 rounded-full bg-current"
+ // Heights are relative so the strip scales with the container,
+ // which is shorter on touch than it is on the desktop composer.
style={{
- height: `${3 + level() * 29}px`,
+ height: `${(3 + level() * 29) / 0.32}%`,
opacity: level() > 0 ? '0.65' : '0.3',
}}
/>