mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-17 05:20:55 +00:00
fix: Keep Running Chat Ring Centered at Any UI Scale (#16810)
This commit is contained in:
parent
2189d909b5
commit
71ad832cfb
2 changed files with 20 additions and 4 deletions
|
|
@ -390,7 +390,8 @@ function Conversation({
|
|||
describedBy={projectBadgeProjectId ? projectLabelId : undefined}
|
||||
>
|
||||
{/* Status sits on the avatar so the row's trailing edge stays free for its badges
|
||||
and menu. The ring is 34px around the 20px icon: offset by half the difference. */}
|
||||
and menu. The ring is 2.125rem around the 1.25rem icon: offset by half the
|
||||
difference. Both are rem so the ring follows the icon box at any UI scale. */}
|
||||
<span className="relative flex size-5 shrink-0 items-center justify-center">
|
||||
<ConversationEndpointIcon conversation={conversation} size={20} context="menu-item" />
|
||||
{isGenerating && (
|
||||
|
|
@ -398,7 +399,7 @@ function Conversation({
|
|||
size={34}
|
||||
strokeWidth={1.9}
|
||||
bgOpacity={0.14}
|
||||
className="pointer-events-none absolute -top-[7px] -left-[7px]"
|
||||
className="pointer-events-none absolute -top-[0.4375rem] -left-[0.4375rem] size-[2.125rem]"
|
||||
/>
|
||||
)}
|
||||
{isUnseen && !isGenerating && (
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ jest.mock('@librechat/client', () => ({
|
|||
useMediaQuery: () => false,
|
||||
useRemScale: () => 1,
|
||||
useToastContext: () => ({ showToast: jest.fn() }),
|
||||
Spinner: ({ className }: { className?: string }) => (
|
||||
<svg data-testid="status-ring" className={className} />
|
||||
Spinner: ({ className, size }: { className?: string; size?: string | number }) => (
|
||||
<svg data-testid="status-ring" className={className} data-size={size} />
|
||||
),
|
||||
Button: ({ children, ...props }: React.ComponentProps<'button'>) => (
|
||||
<button {...props}>{children}</button>
|
||||
|
|
@ -111,6 +111,21 @@ describe('Conversation row status', () => {
|
|||
expect(rowButton()).toContainElement(ring);
|
||||
});
|
||||
|
||||
it('sizes the ring in rem so it follows the avatar box at any UI scale', () => {
|
||||
renderRow({ isGenerating: true });
|
||||
|
||||
expect(screen.getByTestId('status-ring').getAttribute('class')).toContain('size-[2.125rem]');
|
||||
});
|
||||
|
||||
it('offsets the ring in rem so it stays centered on the avatar at any UI scale', () => {
|
||||
renderRow({ isGenerating: true });
|
||||
|
||||
const className = screen.getByTestId('status-ring').getAttribute('class') ?? '';
|
||||
expect(className).toContain('-top-[0.4375rem]');
|
||||
expect(className).toContain('-left-[0.4375rem]');
|
||||
expect(className).not.toMatch(/\[\d+px\]/);
|
||||
});
|
||||
|
||||
it('marks an unseen reply on the avatar and in the title weight', () => {
|
||||
mockIsUnseen = true;
|
||||
const { container } = renderRow();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue