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

3.0 KB
Raw Blame
import { disabledFillClasses } from './theme';
import { cn } from './utils';

/**
 * Shared composer-surface appearance: every input surface that should read as
 * "the composer" (main chat form, subagent control footer) draws its border,
 * background, and text colors from this one semantic decision. Layout, radius,
 * padding, and feature-specific overrides stay with each owner.
 */
export const composerSurfaceClasses = (): string =>
  cn(
    'border border-border-light bg-surface-composer text-text-primary transition-all duration-200',
  );

/** Elevation states for the composer surface. `within` is the CSS-only
 *  equivalent of the managed focused/blurred pair for surfaces that do not
 *  track focus in state. */
export const composerSurfaceShadow = {
  focused: 'shadow-lg',
  blurred: 'shadow-md',
  within: 'shadow-md focus-within:shadow-lg',
} as const;

/**
 * The composer's submit slot: send, stop, and the during-run send button that
 * takes their place while a run generates. One recipe because all three swap
 * into the same position and must be indistinguishable in everything but the
 * icon they carry.
 *
 * Wherever touch is reachable it is the row's one 44px target. `size-theme-control` is
 * 36px, which a thumb aimed at the bottom corner of a phone clips or misses
 * outright, and below `sm` the composer surface runs to the viewport floor by
 * design, so the target has to grow upward instead of gaining a band of padding
 * beneath it. Centering is `flex` rather than the icon's fit inside
 * `p-theme-compact`, which only held while the box was exactly icon-sized.
 */
export const composerSubmitClasses = (): string =>
  cn(
    'flex items-center justify-center',
    'size-theme-control touch:size-theme-control-touch',
    'rounded-theme-composer-action bg-surface-inverted p-theme-compact text-text-inverted',
    'outline-offset-4 transition-all duration-theme-normal',
    'disabled:cursor-not-allowed disabled:text-text-secondary disabled:opacity-10',
    disabledFillClasses,
  );

/**
 * Shared appearance for a labeled control in the composer's action row — the
 * capability checkboxes, the MCP selector, the code-approval selector. Border,
 * radius, height, spacing and elevation are one decision here so a row of them
 * reads as a single set of controls no matter which primitive each is built
 * from. Width, responsive label collapsing and selected/open fills stay with
 * each owner.
 */
export const composerControlClasses = (): string =>
  cn(
    'group relative inline-flex items-center justify-center gap-theme-control-gap',
    'h-theme-control rounded-theme-control-round border border-border-medium',
    'bg-transparent text-sm font-medium text-text-primary transition-all',
    /** No elevation: a row of raised pills inside the composer competes with the
     *  composer itself. The edge stays, because a fill alone against the composer
     *  surface is under 1.2:1 and would leave the control with no visible boundary. */
    'hover:bg-surface-hover',
  );