Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

1.1 KB
Raw Blame
import { useContext } from 'react';
import type { ReactNode } from 'react';
import { LoneGroupContext, SoleToolContext } from '../../react/parts/disclosure';

/**
 * The settled outcome of a sole call, spoken after its row is gone. The row's
 * text changes from the running label to the finished one, but a row that
 * unmounts in the same render cannot announce that, and the group header keeps
 * the tool's name. This region mounts with the card and stays, so the text it
 * gains when the row leaves is announced; a card that mounts already settled
 * (a restored message) starts with the text in place and says nothing.
 *
 * Only a call that can drop its row renders it, so a card with a row of its
 * own never carries a second, empty live region.
 */
export default function BareStatus({ active, text }: { active: boolean; text: string }): ReactNode {
  const sole = useContext(SoleToolContext) === true;
  const lone = useContext(LoneGroupContext);
  if (!sole && !lone) {
    return null;
  }
  return (
    <span className="sr-only" role="status" aria-live="polite" aria-atomic="true">
      {active ? text : ''}
    </span>
  );
}