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.3 KB
Raw Blame
import { FileText } from 'lucide-react';
import { EmptyState } from '@librechat/client';
import { ResourceType } from 'librechat-data-provider';
import { useGetAllEffectivePermissionsQuery } from 'librechat-data-provider/react-query';
import type { TPromptGroup } from 'librechat-data-provider';
import ChatGroupItem from './ChatGroupItem';
import { useLocalize } from '~/hooks';

export default function List({
  groups = [],
  isChatRoute,
}: {
  groups?: TPromptGroup[];
  isChatRoute?: boolean;
}) {
  const localize = useLocalize();
  const { data: permissionsMap } = useGetAllEffectivePermissionsQuery(ResourceType.PROMPTGROUP, {
    enabled: groups.length > 0,
  });

  const renderContent = () => {
    if (groups.length === 0) {
      return (
        <EmptyState
          icon={FileText}
          title={localize('com_ui_no_prompts_title')}
          description={localize('com_ui_add_first_prompt')}
          className="my-2"
        />
      );
    }

    return groups.map((group) => (
      <ChatGroupItem
        key={group._id}
        group={group}
        isChatRoute={isChatRoute}
        permissionBits={group._id ? permissionsMap?.[group._id] : 0}
      />
    ));
  };

  return (
    <section className="grow" aria-label={localize('com_ui_prompt_groups')}>
      <div>{renderContent()}</div>
    </section>
  );
}