fix(composer): keep message input visible after dictation (#2194)
The voice overlay transition could retain stale native opacity after the app was backgrounded, leaving the mounted composer transparent. Derive both surfaces directly from voice state so they cannot disagree after resume.
This commit is contained in:
@@ -3,6 +3,32 @@ import type { MessagePayload } from "@/composer/types";
|
||||
|
||||
export type SendBehavior = "interrupt" | "queue";
|
||||
|
||||
interface ComposerSurfaceState {
|
||||
opacity: 0 | 1;
|
||||
pointerEvents: "auto" | "none";
|
||||
}
|
||||
|
||||
export interface ComposerSurfacePresentation {
|
||||
input: ComposerSurfaceState;
|
||||
overlay: ComposerSurfaceState;
|
||||
}
|
||||
|
||||
const INPUT_PRESENTATION: ComposerSurfacePresentation = {
|
||||
input: { opacity: 1, pointerEvents: "auto" },
|
||||
overlay: { opacity: 0, pointerEvents: "none" },
|
||||
};
|
||||
|
||||
const OVERLAY_PRESENTATION: ComposerSurfacePresentation = {
|
||||
input: { opacity: 0, pointerEvents: "none" },
|
||||
overlay: { opacity: 1, pointerEvents: "auto" },
|
||||
};
|
||||
|
||||
export function resolveComposerSurfacePresentation(
|
||||
showOverlay: boolean,
|
||||
): ComposerSurfacePresentation {
|
||||
return showOverlay ? OVERLAY_PRESENTATION : INPUT_PRESENTATION;
|
||||
}
|
||||
|
||||
interface StopRealtimeVoiceContext {
|
||||
voice: { stopVoice: () => Promise<unknown> } | null | undefined;
|
||||
isRealtimeVoiceForCurrentAgent: boolean;
|
||||
|
||||
Reference in New Issue
Block a user