mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-01 16:18:51 +01:00
* ✨ feat: Enhance Spinner component with customizable properties and improved animation * 🔧 fix: Replace Loader with Spinner in RunCode component and update FilePreview to use Spinner for progress indication * ✨ feat: Refactor icons in CodeProgress and CancelledIcon components; enhance animation and styling in ExecuteCode and ProgressText components * ✨ feat: Refactor attachment handling in ExecuteCode component; replace individual attachment rendering with AttachmentGroup for improved structure * ✨ feat: Refactor dialog components for improved accessibility and styling; integrate Skeleton loading state in Image component * ✨ feat: Refactor ToolCall component to use ToolCallInfo for better structure; replace ToolPopover with AttachmentGroup; enhance ProgressText with error handling and improved UI elements * 🔧 fix: Remove unnecessary whitespace in ProgressText * 🔧 fix: Remove unnecessary margin from AgentFooter and AgentPanel components; clean up SidePanel imports * ✨ feat: Enhance ToolCall and ToolCallInfo components with improved styling; update translations and add warning text color to Tailwind config * 🔧 fix: Update import statement for useLocalize in ToolCallInfo component; fix: chatform transition * ✨ feat: Refactor ToolCall and ToolCallInfo components for improved structure and styling; add optimized code block for better output display * ✨ feat: Implement OpenAI image generation component; add progress tracking and localization for user feedback * 🔧 fix: Adjust base duration values for image generation; optimize timing for quality settings * chore: remove unnecessary space * ✨ feat: Enhance OpenAI image generation with editing capabilities; update localization for progress feedback * ✨ feat: Add download functionality to images; enhance DialogImage component with download button * ✨ feat: Enhance image resizing functionality; support custom percentage and pixel dimensions in resizeImageBuffer
85 lines
2.3 KiB
TypeScript
85 lines
2.3 KiB
TypeScript
import * as Popover from '@radix-ui/react-popover';
|
|
import { ChevronDown, ChevronUp } from 'lucide-react';
|
|
import CancelledIcon from './CancelledIcon';
|
|
import FinishedIcon from './FinishedIcon';
|
|
import { Spinner } from '~/components';
|
|
import { cn } from '~/utils';
|
|
|
|
const wrapperClass =
|
|
'progress-text-wrapper text-token-text-secondary relative -mt-[0.75px] h-5 w-full leading-5';
|
|
|
|
const Wrapper = ({ popover, children }: { popover: boolean; children: React.ReactNode }) => {
|
|
if (popover) {
|
|
return (
|
|
<div className={wrapperClass}>
|
|
<Popover.Trigger asChild>
|
|
<div
|
|
className="progress-text-content absolute left-0 top-0 overflow-visible whitespace-nowrap"
|
|
style={{ opacity: 1, transform: 'none' }}
|
|
data-projection-id="78"
|
|
>
|
|
{children}
|
|
</div>
|
|
</Popover.Trigger>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className={wrapperClass}>
|
|
<div
|
|
className="progress-text-content absolute left-0 top-0 overflow-visible whitespace-nowrap"
|
|
style={{ opacity: 1, transform: 'none' }}
|
|
data-projection-id="78"
|
|
>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default function ProgressText({
|
|
progress,
|
|
onClick,
|
|
inProgressText,
|
|
finishedText,
|
|
authText,
|
|
hasInput = true,
|
|
popover = false,
|
|
isExpanded = false,
|
|
error = false,
|
|
}: {
|
|
progress: number;
|
|
onClick?: () => void;
|
|
inProgressText: string;
|
|
finishedText: string;
|
|
authText?: string;
|
|
hasInput?: boolean;
|
|
popover?: boolean;
|
|
isExpanded?: boolean;
|
|
error?: boolean;
|
|
}) {
|
|
const text = progress < 1 ? (authText ?? inProgressText) : finishedText;
|
|
return (
|
|
<Wrapper popover={popover}>
|
|
<button
|
|
type="button"
|
|
className={cn(
|
|
'inline-flex w-full items-center gap-2',
|
|
hasInput ? '' : 'pointer-events-none',
|
|
)}
|
|
disabled={!hasInput}
|
|
onClick={hasInput ? onClick : undefined}
|
|
>
|
|
{progress < 1 ? <Spinner /> : error ? <CancelledIcon /> : <FinishedIcon />}
|
|
<span className={`${progress < 1 ? 'shimmer' : ''}`}>{text}</span>
|
|
{hasInput &&
|
|
(isExpanded ? (
|
|
<ChevronUp className="size-4 translate-y-[1px]" />
|
|
) : (
|
|
<ChevronDown className="size-4 translate-y-[1px]" />
|
|
))}
|
|
</button>
|
|
</Wrapper>
|
|
);
|
|
}
|