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.8 KB
Raw Blame
import React from 'react';
import { Clock4 } from 'lucide-react';
import { cn } from '@librechat/client';

export interface MentionItemProps {
  name: string;
  onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
  index: number;
  type?: 'prompt' | 'mention' | 'add-convo' | 'skill';
  icon?: React.ReactNode;
  isActive?: boolean;
  description?: string;
  style?: React.CSSProperties;
  /** `option` makes the row a listbox option the popover's input points at, out of the tab order. */
  role?: 'option';
}

export default function MentionItem({
  name,
  onClick,
  index,
  icon,
  isActive,
  description,
  style,
  role,
  type = 'mention',
}: MentionItemProps): React.JSX.Element {
  return (
    <button
      type="button"
      style={style}
      role={role}
      aria-selected={role === 'option' ? isActive === true : undefined}
      tabIndex={role === 'option' ? -1 : index}
      onClick={onClick}
      id={`${type}-item-${index}`}
      className="w-full touch-manipulation"
    >
      <div
        className={cn(
          'text-text-primary group hover:bg-surface-secondary active:bg-surface-active flex min-h-[2.75rem] items-center gap-2 rounded-lg px-2 text-sm font-medium',
          isActive === true ? 'bg-surface-active' : 'bg-transparent',
        )}
      >
        <div className="flex h-5 w-5 shrink-0 items-center justify-center">{icon}</div>
        <div className="flex min-w-0 grow items-center justify-between">
          <div className="truncate">
            <span className="font-medium">{name}</span>
            {description != null && description ? (
              <span className="text-text-tertiary ms-2 text-sm font-light">{description}</span>
            ) : null}
          </div>
          <Clock4 size={16} className="ms-2 shrink-0" />
        </div>
      </div>
    </button>
  );
}