Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Dictation: the warning that macOS Dictation is off can be dismissed

milind-sonief1152cc30be
diff --git a/src/components/CallView.tsx b/src/components/CallView.tsx
index 27b1ae01b0..b4dbb3c3ef 100644
--- a/src/components/CallView.tsx
+++ b/src/components/CallView.tsx
@@ -31,6 +31,7 @@ import { CALL_ENDPOINT_MS, callSpeechEndNote, listensHere, missingListenKey, spe
import { VoiceSetupDialog } from "./lazy-screens";
import { openBotSettings } from "./bot-panel/panel-link";
import { MENU_SHEET } from "./menu-recipe";
+import { DismissWarning } from "./DismissWarning";
type Phase = "listening" | "sending" | "working" | "speaking";
@@ -833,7 +834,7 @@ function Call({ bot }: { bot: Bot }) {
{note && (
<div className="flex max-w-[460px] flex-col items-center gap-2 text-center text-[13px] text-warning">
- <span>{note}</span>
+ <span className="flex items-start gap-1.5"><span className="min-w-0 break-words">{note}</span><DismissWarning onDismiss={() => setNote(null)} /></span>
<button
onClick={listen}
className="rounded-full border border-warning/40 px-3 py-1.5 text-[12px] hover:bg-warning/10"
diff --git a/src/components/Composer.tsx b/src/components/Composer.tsx
index 9c1d02b49f..de6781e952 100644
--- a/src/components/Composer.tsx
+++ b/src/components/Composer.tsx
@@ -1,6 +1,6 @@
import { directMessageSent, roomMessageSent } from "@/lib/product-events";
import { TeamAudienceLabel } from "./TeamSideSwitch";
-import { useComposerDictation } from "@/lib/use-composer-dictation"; import { isPlaceId } from "@/lib/place-chat";
+import { useComposerDictation } from "@/lib/use-composer-dictation"; import { DismissWarning } from "./DismissWarning"; import { isPlaceId } from "@/lib/place-chat";
import { ComposerForkError, useComposerFork } from "./ComposerFork";
import { isNewChatThread } from "@/state/new-chat";
import { useCallback, useEffect, useMemo, useRef, useState, type SetStateAction } from "react";
@@ -234,7 +234,7 @@ export function Composer({
},
[text, editText, editAttachments],
);
- const { recording, ready: micReady, speechError, toggle: toggleMic, stop: stopDictation } = useComposerDictation({ draftId, text, onText: editText });
+ const { recording, ready: micReady, speechError, dismissSpeechError, toggle: toggleMic, stop: stopDictation } = useComposerDictation({ draftId, text, onText: editText });
const fork = useComposerFork({ ownerId: forkOwnerId, kind: group ? "group" : "bot", threadId,
branchLeafId: group ? undefined : bot?.activeLeafId ?? undefined, draftId, text, editText, stopDictation });
const micShown = !locked && !busy && micReady;
@@ -726,11 +726,8 @@ export function Composer({
return (
<div className={cn("pointer-events-none relative px-4", simpleDock ? "pb-4" : "pb-3")}>
- {speechError && (
- <div className="pointer-events-auto mb-2 w-full rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-[12px] text-warning">
- {speechError}
- </div>
- )}
+ {speechError && <div className="pointer-events-auto mb-2 flex w-full items-start gap-2 rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-[12px] text-warning">
+ <span role="status" className="min-w-0 flex-1 break-words">{speechError}</span><DismissWarning onDismiss={() => { dismissSpeechError(); inputRef.current?.focus(); }} /></div>}
<div className="pointer-events-auto relative w-full">
{fork.error && <ComposerForkError message={fork.error} onRetry={() => { inputRef.current?.focus(); send(); }} />}
<ComposerFailedSends draftId={draftId} failedSends={failedSends} onRetry={retryFailedSend} />
diff --git a/src/components/DismissWarning.tsx b/src/components/DismissWarning.tsx
new file mode 100644
index 0000000000..917ced9990
--- /dev/null
+++ b/src/components/DismissWarning.tsx
@@ -0,0 +1,14 @@
+import { X } from "lucide-react";
+
+import { cn } from "@/lib/cn";
+import { t } from "@/lib/i18n";
+
+/** The × on a warning the person may close, such as the one that says macOS Dictation is off. */
+export function DismissWarning({ onDismiss, className }: { onDismiss: () => void; className?: string }) {
+ return (
+ <button type="button" onClick={onDismiss} aria-label={t("composer.notice.dismiss")} title={t("composer.notice.dismiss")}
+ className={cn("ui-icon-button -my-1 size-6 min-h-6 shrink-0 p-0 text-warning touch:size-10", className)}>
+ <X size={14} aria-hidden="true" />
+ </button>
+ );
+}
diff --git a/src/components/GroupCallView.tsx b/src/components/GroupCallView.tsx
index dc2df46592..9065e2aa4b 100644
--- a/src/components/GroupCallView.tsx
+++ b/src/components/GroupCallView.tsx
@@ -21,6 +21,7 @@ import { useDesktopCapabilities } from "./DesktopCapabilities";
import { isRoutineApproval, isSkillApproval, pendingApprovals, spokenApprovalPrompt } from "./PendingApproval";
import { titledCard } from "./ApprovalCard";
import { chineseConsent, NO, YES } from "../../shared/call-consent";
+import { DismissWarning } from "./DismissWarning";
type Phase = "listening" | "sending" | "working" | "speaking";
@@ -535,7 +536,7 @@ function GroupCall({ group, members }: { group: Group; members: Bot[] }) {
{note && (
<div className="flex max-w-[520px] flex-col items-center gap-2 text-center text-[13px] text-warning">
- <span>{note}</span>
+ <span className="flex items-start gap-1.5"><span className="min-w-0 break-words">{note}</span><DismissWarning onDismiss={() => setNote(null)} /></span>
<button
onClick={listen}
className="rounded-full border border-warning/40 px-3 py-1.5 text-[12px] hover:bg-warning/10"
diff --git a/src/lib/use-composer-dictation.ts b/src/lib/use-composer-dictation.ts
index 8ddd744f4a..aa6c7deece 100644
--- a/src/lib/use-composer-dictation.ts
+++ b/src/lib/use-composer-dictation.ts
@@ -99,5 +99,5 @@ export function useComposerDictation({ draftId, text, onText }: {
setRecording(true);
}
};
- return { recording, ready, speechError, toggle, stop };
+ return { recording, ready, speechError, dismissSpeechError: () => setSpeechError(null), toggle, stop };
}