mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
* 🔧 refactor: Improve accessibility and styling in ChatGroupItem and FilterPrompts components * 🔧 fix: Add button type and keyboard accessibility to dropdown menu trigger in ChatGroupItem * 🔧 fix(757): Enhance accessibility by updating aria-labels and adding localization for prompt groups * 🔧 fix(618): Update version to 0.3.1 and enhance accessibility in InfoHoverCard component * 🔧 fix(618): Update aria-label in InfoHoverCard to use dynamic text prop for improved accessibility * 🔧 fix: Enhance accessibility by updating aria-labels and roles in Conversations components * 🔧 fix(620): Enhance accessibility by adding tabIndex to Tabs.Content components in ArtifactTabs, Settings, and Speech components * refactor: remove RevokeKeysButton component and update related components for accessibility - Deleted RevokeKeysButton component. - Updated SharedLinks and General components to use Label for accessibility. - Enhanced Personalization component with aria-labelledby and aria-describedby attributes. - Refactored ConversationModeSwitch to use ToggleSwitch for better state management. - Improved AutoSendTextSelector with local state management and accessibility attributes. - Replaced Switch components with ToggleSwitch in various Speech and TTS components for consistency. - Added aria-labelledby attributes to Dropdown components for better accessibility. - Updated translation.json to include new localization keys and improved existing ones. - Enhanced Slider component to support aria attributes for better accessibility. * 🔧 fix: Enhance user feedback for API key operations with success and error messages * 🔧 fix: Update aria-labels in Avatar component for improved localization and accessibility * 🔧 fix: Refactor handleFile and handleDrop functions for improved readability and maintainability
81 lines
3 KiB
TypeScript
81 lines
3 KiB
TypeScript
import { Plus } from 'lucide-react';
|
|
import { useNavigate } from 'react-router-dom';
|
|
import { Button, Skeleton } from '@librechat/client';
|
|
import { PermissionTypes, Permissions } from 'librechat-data-provider';
|
|
import type { TPromptGroup, TStartupConfig } from 'librechat-data-provider';
|
|
import DashGroupItem from '~/components/Prompts/Groups/DashGroupItem';
|
|
import ChatGroupItem from '~/components/Prompts/Groups/ChatGroupItem';
|
|
import { useGetStartupConfig } from '~/data-provider';
|
|
import { useLocalize, useHasAccess } from '~/hooks';
|
|
|
|
export default function List({
|
|
groups = [],
|
|
isChatRoute,
|
|
isLoading,
|
|
}: {
|
|
groups?: TPromptGroup[];
|
|
isChatRoute: boolean;
|
|
isLoading: boolean;
|
|
}) {
|
|
const navigate = useNavigate();
|
|
const localize = useLocalize();
|
|
const { data: startupConfig = {} as Partial<TStartupConfig> } = useGetStartupConfig();
|
|
const { instanceProjectId } = startupConfig;
|
|
const hasCreateAccess = useHasAccess({
|
|
permissionType: PermissionTypes.PROMPTS,
|
|
permission: Permissions.CREATE,
|
|
});
|
|
|
|
return (
|
|
<div className="flex h-full flex-col">
|
|
{hasCreateAccess && (
|
|
<div className="flex w-full justify-end">
|
|
<Button
|
|
variant="outline"
|
|
className={`w-full bg-transparent ${isChatRoute ? '' : 'mx-2'}`}
|
|
onClick={() => navigate('/d/prompts/new')}
|
|
>
|
|
<Plus className="size-4" aria-hidden />
|
|
{localize('com_ui_create_prompt')}
|
|
</Button>
|
|
</div>
|
|
)}
|
|
<div className="flex-grow overflow-y-auto" aria-label={localize('com_ui_prompt_groups')}>
|
|
<div className="overflow-y-auto overflow-x-hidden">
|
|
{isLoading && isChatRoute && (
|
|
<Skeleton className="my-2 flex h-[84px] w-full rounded-2xl border-0 px-3 pb-4 pt-3" />
|
|
)}
|
|
{isLoading &&
|
|
!isChatRoute &&
|
|
Array.from({ length: 10 }).map((_, index: number) => (
|
|
<Skeleton key={index} className="w-100 mx-2 my-2 flex h-14 rounded-lg border-0 p-4" />
|
|
))}
|
|
{!isLoading && groups.length === 0 && isChatRoute && (
|
|
<div className="my-2 flex h-[84px] w-full items-center justify-center rounded-2xl border border-border-light bg-transparent px-3 pb-4 pt-3 text-text-primary">
|
|
{localize('com_ui_nothing_found')}
|
|
</div>
|
|
)}
|
|
{!isLoading && groups.length === 0 && !isChatRoute && (
|
|
<div className="my-12 flex w-full items-center justify-center text-lg font-semibold text-text-primary">
|
|
{localize('com_ui_nothing_found')}
|
|
</div>
|
|
)}
|
|
{groups.map((group) => {
|
|
if (isChatRoute) {
|
|
return (
|
|
<ChatGroupItem
|
|
key={group._id}
|
|
group={group}
|
|
instanceProjectId={instanceProjectId}
|
|
/>
|
|
);
|
|
}
|
|
return (
|
|
<DashGroupItem key={group._id} group={group} instanceProjectId={instanceProjectId} />
|
|
);
|
|
})}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|