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

🧹 refactor: Move Inline Styles to Classes Outside Chat and the Side Panel (#16871)

Marco Beretta0a3e9e0468c7
diff --git a/client/src/a11y/MessageBlock.tsx b/client/src/a11y/MessageBlock.tsx
index a99157b6bd..85485cd315 100644
--- a/client/src/a11y/MessageBlock.tsx
+++ b/client/src/a11y/MessageBlock.tsx
@@ -1,24 +1,12 @@
import React from 'react';
-const offScreenStyle: React.CSSProperties = {
- border: 0,
- clip: 'rect(0 0 0 0)',
- height: '1px',
- margin: '-1px',
- overflow: 'hidden',
- whiteSpace: 'nowrap',
- padding: 0,
- width: '1px',
- position: 'absolute',
-};
-
interface MessageBlockProps {
message: string;
'aria-live': 'polite' | 'assertive';
}
const MessageBlock: React.FC<MessageBlockProps> = ({ message, 'aria-live': ariaLive }) => (
- <div style={offScreenStyle} role="log" aria-live={ariaLive}>
+ <div className="sr-only" role="log" aria-live={ariaLive}>
{message}
</div>
);
diff --git a/client/src/components/Agents/AgentCard.tsx b/client/src/components/Agents/AgentCard.tsx
index 12c1b0d837..628d514088 100644
--- a/client/src/components/Agents/AgentCard.tsx
+++ b/client/src/components/Agents/AgentCard.tsx
@@ -93,11 +93,11 @@ const AgentCard = memo(
layoutId={agentMorphId('surface', agent.id)}
/* Promoted only while this card's surface is in flight; a grid of
permanently layered cards is a cost, not a saving. */
- style={{
- borderRadius: surfaceRadius,
- willChange: morphing ? 'transform' : undefined,
- }}
- className="rounded-theme-surface border-border-light bg-surface-card group-hover:border-border-medium group-hover:bg-surface-card-hover pointer-events-none absolute inset-0 z-0 border transition-colors duration-150"
+ style={{ borderRadius: surfaceRadius }}
+ className={cn(
+ morphing && 'will-change-transform',
+ 'rounded-theme-surface border-border-light bg-surface-card group-hover:border-border-medium group-hover:bg-surface-card-hover pointer-events-none absolute inset-0 z-0 border transition-colors duration-150',
+ )}
{...shared}
/>
@@ -170,8 +170,10 @@ const AgentCard = memo(
layout="position"
layoutId={agentMorphId('description', agent.id)}
id={descriptionId}
- style={{ willChange: morphing ? 'transform' : undefined }}
- className="text-text-secondary mt-2 mb-5 line-clamp-3 text-sm leading-6 break-words"
+ className={cn(
+ morphing && 'will-change-transform',
+ 'text-text-secondary mt-2 mb-5 line-clamp-3 text-sm leading-6 break-words',
+ )}
{...shared}
>
{description}
diff --git a/client/src/components/Agents/AgentDetailContent.tsx b/client/src/components/Agents/AgentDetailContent.tsx
index ea69703fef..50c0870799 100644
--- a/client/src/components/Agents/AgentDetailContent.tsx
+++ b/client/src/components/Agents/AgentDetailContent.tsx
@@ -167,9 +167,10 @@ const AgentDetailContent: React.FC<AgentDetailContentProps> = ({
const descriptionMotion = {
layout: 'position' as const,
layoutId: morphing ? agentMorphId('description', agent.id) : undefined,
- style: { willChange: morphing ? 'transform' : undefined },
- className:
+ className: cn(
+ morphing && 'will-change-transform',
'relative mt-3 whitespace-pre-wrap break-words text-sm leading-7 text-text-secondary sm:text-base',
+ ),
...shared,
};
useLayoutEffect(() => {
@@ -215,11 +216,11 @@ const AgentDetailContent: React.FC<AgentDetailContentProps> = ({
does not promote it on its own. The hint stands for as long as this
dialog shares the card's surface, and is never set on a dialog that
has no morph to run. */
- style={{
- borderRadius: surfaceRadius,
- willChange: morphing ? 'transform' : undefined,
- }}
- className="rounded-theme-surface bg-surface-dialog high-contrast:border high-contrast:border-solid high-contrast:border-border-medium high-contrast:shadow-none relative flex max-h-[88dvh] w-full flex-col overflow-hidden shadow-lg"
+ style={{ borderRadius: surfaceRadius }}
+ className={cn(
+ morphing && 'will-change-transform',
+ 'rounded-theme-surface bg-surface-dialog high-contrast:border high-contrast:border-solid high-contrast:border-border-medium high-contrast:shadow-none relative flex max-h-[88dvh] w-full flex-col overflow-hidden shadow-lg',
+ )}
{...shared}
>
{/* Card-coloured wash so the surface interpolates its fill and border
@@ -299,7 +300,7 @@ const AgentDetailContent: React.FC<AgentDetailContentProps> = ({
focusOutline="hidden"
ref={titleRef}
tabIndex={-1}
- className="text-text-primary text-2xl leading-tight font-semibold break-words sm:text-3xl"
+ className="text-2xl leading-tight font-semibold break-words sm:text-3xl"
>
{agent.name?.trim() || localize('com_ui_agent')}
</OGDialogTitle>
diff --git a/client/src/components/Agents/CategoryTabs.tsx b/client/src/components/Agents/CategoryTabs.tsx
index 196d526efe..dee47ee8c0 100644
--- a/client/src/components/Agents/CategoryTabs.tsx
+++ b/client/src/components/Agents/CategoryTabs.tsx
@@ -123,15 +123,6 @@ const CategoryTabs: React.FC<CategoryTabsProps> = ({
role="tablist"
aria-label={localize('com_agents_category_tabs_label')}
aria-orientation="horizontal"
- style={
- isSmallScreen
- ? {
- scrollbarWidth: 'none',
- msOverflowStyle: 'none',
- WebkitOverflowScrolling: 'touch',
- }
- : undefined
- }
>
{categories.map((category, index) => (
<button
diff --git a/client/src/components/Agents/VirtualizedAgentGrid.tsx b/client/src/components/Agents/VirtualizedAgentGrid.tsx
index 583cdfee3c..00135f3545 100644
--- a/client/src/components/Agents/VirtualizedAgentGrid.tsx
+++ b/client/src/components/Agents/VirtualizedAgentGrid.tsx
@@ -541,16 +541,18 @@ export default function VirtualizedAgentGrid({
ref={virtualizer.measureElement}
className={
windowed
- ? 'absolute top-0 left-0 grid w-full items-stretch gap-5'
- : 'relative col-span-full grid items-stretch gap-5'
+ ? 'absolute top-0 left-0 grid w-full grid-cols-(--agent-columns) items-stretch gap-5'
+ : 'relative col-span-full grid grid-cols-(--agent-columns) items-stretch gap-5'
+ }
+ style={
+ {
+ '--agent-columns': columns,
+ transform: windowed
+ ? `translateY(${row.start - layout.margin}px)`
+ : undefined,
+ zIndex: row.index === liftedRow ? LIFTED_ROW_Z_INDEX : undefined,
+ } as React.CSSProperties
}
- style={{
- gridTemplateColumns: columns,
- ...(windowed
- ? { transform: `translateY(${row.start - layout.margin}px)` }
- : {}),
- ...(row.index === liftedRow ? { zIndex: LIFTED_ROW_Z_INDEX } : {}),
- }}
>
{cards}
</div>
diff --git a/client/src/components/Artifacts/Artifacts.tsx b/client/src/components/Artifacts/Artifacts.tsx
index ecd828b702..39c6b94391 100644
--- a/client/src/components/Artifacts/Artifacts.tsx
+++ b/client/src/components/Artifacts/Artifacts.tsx
@@ -15,6 +15,7 @@ import {
X,
} from 'lucide-react';
import type { SandpackPreviewRef } from '@codesandbox/sandpack-react';
+import type { CSSProperties } from 'react';
import type { ProcessedMermaidSvg } from '~/utils/diagram/export';
import { TOOL_ARTIFACT_TYPES, isCodeOnlyArtifact, isPreviewOnlyArtifact } from '~/utils/artifacts';
import { copyWithinDocument, openUndockedWindow, prepareUndockedDocument } from './undockedWindow';
@@ -452,15 +453,16 @@ export default function Artifacts() {
className={cn(
'bg-surface-overlay fixed inset-0 z-[99] will-change-[opacity,backdrop-filter] motion-reduce:transition-none',
isVisible && !isClosing
- ? 'transition-all duration-300'
+ ? 'opacity-(--backdrop-opacity) backdrop-blur-(--backdrop-blur) transition-all duration-300'
: 'pointer-events-none opacity-0 backdrop-blur-none transition-opacity duration-150',
blurAmount < 8 && isVisible && !isClosing ? 'pointer-events-none' : '',
)}
- style={{
- opacity: isVisible && !isClosing ? backdropOpacity : 0,
- backdropFilter: isVisible && !isClosing ? `blur(${blurAmount}px)` : 'none',
- WebkitBackdropFilter: isVisible && !isClosing ? `blur(${blurAmount}px)` : 'none',
- }}
+ style={
+ {
+ '--backdrop-opacity': backdropOpacity,
+ '--backdrop-blur': `${blurAmount}px`,
+ } as CSSProperties
+ }
onClick={blurAmount >= 8 ? closeArtifacts : undefined}
aria-hidden="true"
/>
@@ -483,15 +485,13 @@ export default function Artifacts() {
isDragging ? '' : 'transition-all duration-300',
)
: cn(
- 'h-full shadow-2xl',
+ 'h-full overflow-hidden shadow-2xl',
isVisible && !isClosing
? 'translate-x-0 opacity-100 transition-all duration-150'
: 'translate-x-5 opacity-0 transition-all duration-300',
),
)}
- style={
- isMobile ? { height: isFullscreen ? '100%' : `${height}vh` } : { overflow: 'hidden' }
- }
+ style={isMobile ? { height: isFullscreen ? '100%' : `${height}vh` } : undefined}
>
{isMobile && !isFullscreen && (
<div
diff --git a/client/src/components/Audio/TTS.tsx b/client/src/components/Audio/TTS.tsx
index 51b0706b32..665424d097 100644
--- a/client/src/components/Audio/TTS.tsx
+++ b/client/src/components/Audio/TTS.tsx
@@ -82,13 +82,7 @@ export function BrowserTTS({
controls
preload="none"
controlsList="nodownload nofullscreen noremoteplayback"
- style={{
- position: 'absolute',
- overflow: 'hidden',
- display: 'none',
- height: '0px',
- width: '0px',
- }}
+ className="hidden"
src={audioRef.current?.src}
onError={(error) => {
logger.error('Error fetching audio:', error);
@@ -180,13 +174,7 @@ export function ExternalTTS({
controls
preload="none"
controlsList="nodownload nofullscreen noremoteplayback"
- style={{
- position: 'absolute',
- overflow: 'hidden',
- display: 'none',
- height: '0px',
- width: '0px',
- }}
+ className="hidden"
src={audioRef.current?.src}
onError={(error) => {
logger.error('Error fetching audio:', error);
diff --git a/client/src/components/Bookmarks/BookmarkItem.tsx b/client/src/components/Bookmarks/BookmarkItem.tsx
index ba85732326..16b1b64366 100644
--- a/client/src/components/Bookmarks/BookmarkItem.tsx
+++ b/client/src/components/Bookmarks/BookmarkItem.tsx
@@ -25,11 +25,6 @@ const BookmarkItem: FC<MenuItemProps> = ({ tag, selected, handleSubmit, icon, ..
setIsLoading(false);
};
- const breakWordStyle: React.CSSProperties = {
- wordBreak: 'break-word',
- overflowWrap: 'anywhere',
- };
-
const renderIcon = () => {
if (icon != null) {
return icon;
@@ -57,7 +52,7 @@ const BookmarkItem: FC<MenuItemProps> = ({ tag, selected, handleSubmit, icon, ..
<div className="flex grow items-center justify-between gap-2">
<div className="flex items-center gap-2">
{renderIcon()}
- <div style={breakWordStyle}>{tag}</div>
+ <div className="wrap-anywhere">{tag}</div>
</div>
</div>
</MenuItem>
diff --git a/client/src/components/Conversations/PinnedSection.tsx b/client/src/components/Conversations/PinnedSection.tsx
index a09c74c3e1..ea93a4450a 100644
--- a/client/src/components/Conversations/PinnedSection.tsx
+++ b/client/src/components/Conversations/PinnedSection.tsx
@@ -203,7 +203,7 @@ const DraggablePinnedRow = ({
return (
<div
ref={ref}
- style={{ opacity: isDragging ? 0 : 1 }}
+ className={isDragging ? 'opacity-0' : undefined}
data-handler-id={handlerId}
onKeyDown={handleKeyDown}
>
diff --git a/client/src/components/Messages/Content/Mermaid/Mermaid.tsx b/client/src/components/Messages/Content/Mermaid/Mermaid.tsx
index 1edb1bb718..45bdfa6a2e 100644
--- a/client/src/components/Messages/Content/Mermaid/Mermaid.tsx
+++ b/client/src/components/Messages/Content/Mermaid/Mermaid.tsx
@@ -457,10 +457,10 @@ export const MermaidRenderer = memo(function MermaidRenderer({
{localize('com_ui_mermaid_failed')}
</span>
<Button
- variant="ghost"
+ variant="quiet"
size="sm"
onClick={handleRetry}
- className="text-text-secondary h-auto gap-1 rounded px-2 py-1 text-xs"
+ className="h-auto gap-1 rounded px-2 py-1 text-xs"
>
<RefreshCw className="h-3 w-3" aria-hidden="true" />
{localize('com_ui_retry')}
diff --git a/client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx b/client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx
index 598f93d632..4218d0fa82 100644
--- a/client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx
+++ b/client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx
@@ -97,10 +97,10 @@ const MermaidDialog: React.FC<MermaidDialogProps> = memo(
/>
<Button
ref={showCodeButtonRef}
- variant="ghost"
+ variant="quiet"
size="sm"
aria-label={showCode ? localize('com_ui_hide_code') : localize('com_ui_show_code')}
- className="text-text-secondary focus-visible:ring-border-heavy size-8 min-w-0 gap-1 rounded-sm p-0 text-xs focus-visible:ring-offset-0 sm:h-auto sm:w-auto sm:min-w-[6rem] sm:px-1 sm:py-0"
+ className="focus-visible:ring-border-heavy size-8 min-w-0 gap-1 rounded-sm p-0 text-xs focus-visible:ring-offset-0 sm:h-auto sm:w-auto sm:min-w-[6rem] sm:px-1 sm:py-0"
onClick={handleToggleCode}
>
<MorphIcon icon={showCode ? ChevronUp : ChevronDown} className="h-4 w-4" />
@@ -110,10 +110,10 @@ const MermaidDialog: React.FC<MermaidDialogProps> = memo(
</Button>
<Button
ref={copyButtonRef}
- variant="ghost"
+ variant="quiet"
size="sm"
aria-label={localize('com_ui_copy_code')}
- className="text-text-secondary focus-visible:ring-border-heavy size-8 min-w-0 gap-1 rounded-sm p-0 text-xs focus-visible:ring-offset-0 sm:h-auto sm:w-auto sm:px-1 sm:py-0"
+ className="focus-visible:ring-border-heavy size-8 min-w-0 gap-1 rounded-sm p-0 text-xs focus-visible:ring-offset-0 sm:h-auto sm:w-auto sm:px-1 sm:py-0"
onClick={handleCopy}
>
<MorphIcon icon={isCopied ? Check : Copy} size="1.125rem" />
diff --git a/client/src/components/Plugins/Store/PluginPagination.tsx b/client/src/components/Plugins/Store/PluginPagination.tsx
index 449c03aa08..009e128cd8 100644
--- a/client/src/components/Plugins/Store/PluginPagination.tsx
+++ b/client/src/components/Plugins/Store/PluginPagination.tsx
@@ -23,7 +23,7 @@ const PluginPagination: React.FC<TPluginPaginationProps> = ({
};
return (
- <div className="flex gap-2 text-sm text-text-secondary">
+ <div className="text-text-secondary flex gap-2 text-sm">
<div
role="button"
tabIndex={0}
@@ -34,12 +34,11 @@ const PluginPagination: React.FC<TPluginPaginationProps> = ({
onChangePage(currentPage - 1);
}
}}
- className={`flex cursor-default items-center text-sm ${
+ className={`flex cursor-default items-center text-sm select-none ${
currentPage === 1
? 'text-text-secondary opacity-50'
: 'text-text-secondary hover:text-text-primary'
}`}
- style={{ userSelect: 'none' }}
>
<svg
stroke="currentColor"
@@ -62,12 +61,11 @@ const PluginPagination: React.FC<TPluginPaginationProps> = ({
role="button"
key={page}
tabIndex={0}
- className={`flex h-5 w-5 items-center justify-center text-sm ${
+ className={`flex h-5 w-5 items-center justify-center text-sm select-none ${
currentPage === page
? 'text-link hover:text-link'
: 'text-text-secondary hover:text-text-primary'
}`}
- style={{ userSelect: 'none' }}
onClick={() => onChangePage(page)}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
@@ -88,12 +86,11 @@ const PluginPagination: React.FC<TPluginPaginationProps> = ({
onChangePage(currentPage + 1);
}
}}
- className={`flex cursor-default items-center text-sm ${
+ className={`flex cursor-default items-center text-sm select-none ${
currentPage === maxPage
? 'text-text-secondary opacity-50'
: 'text-text-secondary hover:text-text-primary'
}`}
- style={{ userSelect: 'none' }}
>
{localize('com_ui_next')}
<svg
diff --git a/client/src/components/Projects/ProjectChatList.tsx b/client/src/components/Projects/ProjectChatList.tsx
index 9f3ae68a8c..eeedb52f32 100644
--- a/client/src/components/Projects/ProjectChatList.tsx
+++ b/client/src/components/Projects/ProjectChatList.tsx
@@ -279,8 +279,7 @@ const ProjectChatList = ({
deferredMeasurementCache={cache}
overscanRowCount={8}
onRowsRendered={handleRowsRendered}
- className="outline-hidden"
- style={{ outline: 'none' }}
+ className="outline-none"
/>
)}
</AutoSizer>
diff --git a/client/src/components/Share/MessagesView.tsx b/client/src/components/Share/MessagesView.tsx
index 26edd760bc..cbe14d1f50 100644
--- a/client/src/components/Share/MessagesView.tsx
+++ b/client/src/components/Share/MessagesView.tsx
@@ -15,13 +15,7 @@ export default function MessagesView({
return (
<div className="min-h-0 flex-1 overflow-hidden" data-testid="messages-view">
<div className="relative h-full">
- <div
- style={{
- height: '100%',
- overflowY: 'auto',
- width: '100%',
- }}
- >
+ <div className="h-full w-full overflow-y-auto">
<div className="flex flex-col pb-16 text-sm">
{(_messagesTree && _messagesTree.length === 0) || _messagesTree === null ? (
<div className="bg-surface-secondary text-text-tertiary flex w-full items-center justify-center gap-1 p-3 text-sm">
diff --git a/client/src/components/ui/CustomIcon.tsx b/client/src/components/ui/CustomIcon.tsx
index dd4ffdd823..6c8646398d 100644
--- a/client/src/components/ui/CustomIcon.tsx
+++ b/client/src/components/ui/CustomIcon.tsx
@@ -1,4 +1,4 @@
-import type { ReactEventHandler } from 'react';
+import type { CSSProperties, ReactEventHandler } from 'react';
import useAdaptiveIcon from '~/hooks/useAdaptiveIcon';
import { cn } from '~/utils';
@@ -29,24 +29,18 @@ export default function CustomIcon({
if (shouldTint) {
const maskUrl = `url("${src.replace(/["\\\n\r\f]/g, encodeURIComponent)}")`;
- const maskSize = /\bobject-cover\b/.test(className ?? '') ? 'cover' : 'contain';
+ const maskSize = /\bobject-cover\b/.test(className ?? '') ? 'mask-cover' : 'mask-contain';
return (
<span
role={decorative ? undefined : 'img'}
aria-label={decorative ? undefined : alt}
aria-hidden={decorative ? true : undefined}
- className={cn('custom-icon-tint inline-block', className)}
- style={{
- backgroundColor: 'currentColor',
- maskImage: maskUrl,
- WebkitMaskImage: maskUrl,
- maskRepeat: 'no-repeat',
- WebkitMaskRepeat: 'no-repeat',
- maskPosition: 'center',
- WebkitMaskPosition: 'center',
+ className={cn(
+ 'custom-icon-tint inline-block bg-current mask-(--custom-icon-mask) mask-center mask-no-repeat',
maskSize,
- WebkitMaskSize: maskSize,
- }}
+ className,
+ )}
+ style={{ '--custom-icon-mask': maskUrl } as CSSProperties}
>
{onError != null && (
<img src={src} alt="" aria-hidden="true" className="hidden" onError={onError} />
diff --git a/client/src/components/ui/__tests__/CustomIcon.test.tsx b/client/src/components/ui/__tests__/CustomIcon.test.tsx
index c4cc685143..32d6439d09 100644
--- a/client/src/components/ui/__tests__/CustomIcon.test.tsx
+++ b/client/src/components/ui/__tests__/CustomIcon.test.tsx
@@ -26,7 +26,7 @@ describe('CustomIcon', () => {
const el = screen.getByRole('img', { name: 'My Server' });
expect(el.tagName).toBe('SPAN');
expect(el).not.toHaveAttribute('aria-hidden');
- expect(el.style.backgroundColor).toBe('currentcolor');
+ expect(el).toHaveClass('bg-current');
expect(el).toHaveClass('custom-icon-tint');
});
@@ -43,14 +43,14 @@ describe('CustomIcon', () => {
const { container } = render(<CustomIcon src={'/a".svg'} alt="" monochrome />);
const span = container.querySelector('span');
- expect(span?.style.maskImage).toBe('url("/a%22.svg")');
+ expect(span?.style.getPropertyValue('--custom-icon-mask')).toBe('url("/a%22.svg")');
});
it('escapes backslashes and newlines in the mask URL', () => {
const { container } = render(<CustomIcon src={'/a\\b\nc.svg'} alt="" monochrome />);
const span = container.querySelector('span');
- expect(span?.style.maskImage).toBe('url("/a%5Cb%0Ac.svg")');
+ expect(span?.style.getPropertyValue('--custom-icon-mask')).toBe('url("/a%5Cb%0Ac.svg")');
});
it('letterboxes with mask-size contain by default', () => {
@@ -59,7 +59,7 @@ describe('CustomIcon', () => {
);
const span = container.querySelector('span');
- expect(span?.style.maskSize).toBe('contain');
+ expect(span).toHaveClass('mask-contain');
});
it('keeps object-cover sizing semantics via mask-size cover', () => {
@@ -68,7 +68,7 @@ describe('CustomIcon', () => {
);
const span = container.querySelector('span');
- expect(span?.style.maskSize).toBe('cover');
+ expect(span).toHaveClass('mask-cover');
});
it('does not render a probe image on the tinted path without an onError handler', () => {
diff --git a/client/src/routes/Search.tsx b/client/src/routes/Search.tsx
index 76e214f384..f25cae8113 100644
--- a/client/src/routes/Search.tsx
+++ b/client/src/routes/Search.tsx
@@ -291,7 +291,7 @@ export default function Search() {
const loadingSpinner = (
<div className="absolute inset-0 flex items-center justify-center">
- <Spinner className="text-text-primary" />
+ <Spinner tone="primary" />
</div>
);
@@ -361,15 +361,14 @@ export default function Search() {
overscanRowCount={10}
aria-label={localize('com_nav_search_placeholder')}
className={cn(
- 'focus-visible:ring-ring-primary outline-hidden focus-visible:ring-2 focus-visible:ring-inset',
+ 'focus-visible:ring-ring-primary outline-none focus-visible:ring-2 focus-visible:ring-inset',
showingStale && 'opacity-70',
)}
- style={{ outline: 'none' }}
/>
</div>
{isFetchingNextPage && (
<div className="pointer-events-none absolute right-0 bottom-0 left-0 flex justify-center py-4">
- <Spinner className="text-text-primary" />
+ <Spinner tone="primary" />
</div>
)}
<div className="from-surface-primary-alt pointer-events-none absolute right-0 bottom-0 left-0 h-[5%] bg-gradient-to-t to-transparent" />
diff --git a/client/src/style.css b/client/src/style.css
index c9b9496ea6..89ed621a19 100644
--- a/client/src/style.css
+++ b/client/src/style.css
@@ -348,8 +348,8 @@ html.high-contrast.dark .btn-neutral:hover {
width: 2rem;
}
-/* Forced-colors overrides the inline `background-color: currentColor` a masked
- * CustomIcon paints with; `!important` is needed to beat that inline style. */
+/* Forced-colors overrides the `background-color: currentColor` a masked CustomIcon
+ * paints with. */
@media (forced-colors: active) {
.custom-icon-tint {
background-color: CanvasText !important;
diff --git a/e2e/specs/mock/scenarios/agent-grid-columns.spec.ts b/e2e/specs/mock/scenarios/agent-grid-columns.spec.ts
new file mode 100644
index 0000000000..26f382b2ff
--- /dev/null
+++ b/e2e/specs/mock/scenarios/agent-grid-columns.spec.ts
@@ -0,0 +1,65 @@
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+import { cleanupAgent, uniqueAgentName, waitForPersistedAgent } from '../agents.helpers';
+import { getAccessToken, MOCK_ENDPOINTS, NEW_CHAT_PATH, requestJson } from '../helpers';
+
+type CreatedAgent = {
+ id: string;
+ name: string;
+};
+
+const createAgent = async (page: Page): Promise<CreatedAgent> => {
+ await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
+ const token = await getAccessToken(page);
+ const name = uniqueAgentName('E2E Grid Columns');
+ const description = 'A grid columns scenario description.';
+ const agent = await requestJson<CreatedAgent>(page, {
+ path: '/api/agents',
+ token,
+ method: 'POST',
+ body: {
+ name,
+ description,
+ instructions: 'Use the mock model and answer deterministically for this scenario.',
+ provider: MOCK_ENDPOINTS[0].label,
+ model: MOCK_ENDPOINTS[0].model,
+ model_parameters: {},
+ tools: [],
+ conversation_starters: [],
+ category: 'general',
+ },
+ });
+ await waitForPersistedAgent(page, name, description);
+ return { id: agent.id, name };
+};
+
+test.describe('agent grid columns', () => {
+ test('@scenario:agent-grid-columns-follow-layout marketplace rows lay out their cards from the columns variable', async ({
+ page,
+ }) => {
+ let agentId: string | undefined;
+
+ try {
+ const agent = await createAgent(page);
+ agentId = agent.id;
+ await page.goto(`/agents/all?q=${encodeURIComponent(agent.name)}`, { timeout: 10000 });
+ const card = page.getByRole('button', { name: agent.name, exact: true });
+ await expect(card).toBeVisible({ timeout: 30000 });
+
+ const row = page.locator('[role="presentation"][data-index]').filter({ has: card });
+ await expect(row).toHaveCount(1);
+ const layout = await row.evaluate((element) => ({
+ declared: (element as HTMLElement).style.getPropertyValue('--agent-columns'),
+ display: getComputedStyle(element).display,
+ tracks: getComputedStyle(element).gridTemplateColumns.split(' ').length,
+ }));
+
+ const declaredTracks = Number(layout.declared.match(/^repeat\((\d+),/)?.[1]);
+ expect(layout.display).toBe('grid');
+ expect(declaredTracks).toBeGreaterThanOrEqual(1);
+ expect(layout.tracks).toBe(declaredTracks);
+ } finally {
+ await cleanupAgent(page, agentId);
+ }
+ });
+});
diff --git a/e2e/specs/mock/scenarios/suppression-baseline.spec.ts b/e2e/specs/mock/scenarios/suppression-baseline.spec.ts
index 7ba759f8ce..dfd67542b0 100644
--- a/e2e/specs/mock/scenarios/suppression-baseline.spec.ts
+++ b/e2e/specs/mock/scenarios/suppression-baseline.spec.ts
@@ -163,8 +163,15 @@ test.describe('the recorded design-rule backlog', () => {
const baseline = readBaseline();
const recorded = Object.keys(baseline);
- const linted = recorded.find((path) => path.startsWith('client/src/a11y/')) ?? recorded[0];
- const directory = linted.slice(0, linted.lastIndexOf('/'));
+ const directoryOf = (path: string): string => path.slice(0, path.lastIndexOf('/'));
+ /** The prune lints the whole directory against a baseline holding only the
+ * fixture, so the directory must record exactly one file. */
+ const linted =
+ recorded.find(
+ (path) =>
+ recorded.filter((other) => other.startsWith(`${directoryOf(path)}/`)).length === 1,
+ ) ?? recorded[0];
+ const directory = directoryOf(linted);
const outside = recorded.find((path) => !path.startsWith(`${directory}/`));
if (!outside) {
throw new Error('the baseline records only one directory; pick another fixture');
diff --git a/eslint-suppressions.json b/eslint-suppressions.json
index 687bd62689..dbaf62979b 100644
--- a/eslint-suppressions.json
+++ b/eslint-suppressions.json
@@ -1,20 +1,15 @@
{
- "client/src/a11y/MessageBlock.tsx": {
- "shadcn/no-inline-styles": {
- "count": 7
- }
- },
"client/src/components/Agents/AgentCard.tsx": {
"shadcn/no-inline-styles": {
- "count": 3
+ "count": 1
}
},
"client/src/components/Agents/AgentDetailContent.tsx": {
"shadcn/no-inline-styles": {
- "count": 4
+ "count": 1
},
"shadcn/no-restyle": {
- "count": 11
+ "count": 10
}
},
"client/src/components/Agents/AgentGrid.tsx": {
@@ -22,11 +17,6 @@
"count": 1
}
},
- "client/src/components/Agents/CategoryTabs.tsx": {
- "shadcn/no-inline-styles": {
- "count": 3
- }
- },
"client/src/components/Agents/Marketplace.tsx": {
"shadcn/no-restyle": {
"count": 1
@@ -42,11 +32,6 @@
"count": 7
}
},
- "client/src/components/Agents/VirtualizedAgentGrid.tsx": {
- "shadcn/no-inline-styles": {
- "count": 3
- }
- },
"client/src/components/Artifacts/ArtifactCodeEditor.tsx": {
"shadcn/no-inline-styles": {
"count": 1
@@ -56,18 +41,10 @@
"shadcn/no-arbitrary-values": {
"count": 2
},
- "shadcn/no-inline-styles": {
- "count": 4
- },
"shadcn/no-restyle": {
"count": 2
}
},
- "client/src/components/Audio/TTS.tsx": {
- "shadcn/no-inline-styles": {
- "count": 6
- }
- },
"client/src/components/Auth/TwoFactorScreen.tsx": {
"shadcn/no-restyle": {
"count": 1
@@ -78,11 +55,6 @@
"count": 11
}
},
- "client/src/components/Bookmarks/BookmarkItem.tsx": {
- "shadcn/no-inline-styles": {
- "count": 2
- }
- },
"client/src/components/Bookmarks/DeleteBookmarkButton.tsx": {
"shadcn/no-restyle": {
"count": 1
@@ -609,11 +581,6 @@
"count": 2
}
},
- "client/src/components/Conversations/PinnedSection.tsx": {
- "shadcn/no-inline-styles": {
- "count": 1
- }
- },
"client/src/components/Conversations/ProjectsSection.tsx": {
"shadcn/no-restyle": {
"count": 9
@@ -770,7 +737,7 @@
"count": 2
},
"shadcn/no-restyle": {
- "count": 6
+ "count": 5
}
},
"client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx": {
@@ -778,7 +745,7 @@
"count": 1
},
"shadcn/no-restyle": {
- "count": 30
+ "count": 28
}
},
"client/src/components/Messages/Content/RunCode.tsx": {
@@ -897,16 +864,6 @@
"count": 9
}
},
- "client/src/components/Plugins/Store/PluginPagination.tsx": {
- "shadcn/no-inline-styles": {
- "count": 3
- }
- },
- "client/src/components/Projects/ProjectChatList.tsx": {
- "shadcn/no-inline-styles": {
- "count": 1
- }
- },
"client/src/components/Projects/ProjectChatOptions.tsx": {
"shadcn/no-restyle": {
"count": 1
@@ -1001,11 +958,6 @@
"count": 5
}
},
- "client/src/components/Share/MessagesView.tsx": {
- "shadcn/no-inline-styles": {
- "count": 1
- }
- },
"client/src/components/Share/ShareArtifacts.tsx": {
"shadcn/no-restyle": {
"count": 2
@@ -1428,11 +1380,6 @@
"count": 3
}
},
- "client/src/components/ui/CustomIcon.tsx": {
- "shadcn/no-inline-styles": {
- "count": 9
- }
- },
"client/src/components/ui/LocalizedDateRangePicker.tsx": {
"shadcn/no-restyle": {
"count": 1
@@ -1458,40 +1405,22 @@
"count": 3
}
},
- "client/src/routes/Search.tsx": {
- "shadcn/no-inline-styles": {
- "count": 1
- },
- "shadcn/no-restyle": {
- "count": 2
- }
- },
- "packages/client/src/components/Avatar.tsx": {
- "shadcn/no-inline-styles": {
- "count": 1
- }
- },
"packages/client/src/components/Combobox.tsx": {
"shadcn/no-inline-styles": {
- "count": 2
+ "count": 1
}
},
"packages/client/src/components/DataTable.tsx": {
"shadcn/no-inline-styles": {
- "count": 6
+ "count": 4
}
},
"packages/client/src/components/DataTable/DataTable.tsx": {
- "shadcn/no-inline-styles": {
- "count": 7
- }
- },
- "packages/client/src/components/DataTable/DataTableComponents.tsx": {
"shadcn/no-inline-styles": {
"count": 1
}
},
- "packages/client/src/components/FileUpload.tsx": {
+ "packages/client/src/components/DataTable/DataTableComponents.tsx": {
"shadcn/no-inline-styles": {
"count": 1
}
@@ -1501,11 +1430,6 @@
"count": 1
}
},
- "packages/client/src/components/PixelCard.tsx": {
- "shadcn/no-inline-styles": {
- "count": 1
- }
- },
"packages/client/src/components/Radio.tsx": {
"shadcn/no-inline-styles": {
"count": 1
@@ -1517,11 +1441,6 @@
}
},
"packages/client/src/components/SplitText.tsx": {
- "shadcn/no-inline-styles": {
- "count": 7
- }
- },
- "packages/client/src/components/Toast.tsx": {
"shadcn/no-inline-styles": {
"count": 1
}
@@ -1530,10 +1449,5 @@
"shadcn/no-inline-styles": {
"count": 2
}
- },
- "packages/client/src/svgs/SendMessageIcon.tsx": {
- "shadcn/no-inline-styles": {
- "count": 1
- }
}
-}
+}
\ No newline at end of file
diff --git a/packages/client/src/components/Avatar.tsx b/packages/client/src/components/Avatar.tsx
index 90c16b0550..f3582af8b4 100644
--- a/packages/client/src/components/Avatar.tsx
+++ b/packages/client/src/components/Avatar.tsx
@@ -82,9 +82,8 @@ const Avatar: React.FC<AvatarProps> = ({
style={{
width: pxToRem(size),
height: pxToRem(size),
- display: imageLoaded ? 'block' : 'none',
}}
- className={`rounded-full ${className}`}
+ className={`rounded-full ${imageLoaded ? 'block' : 'hidden'} ${className}`}
src={imageSrc}
alt={altText}
onLoad={handleImageLoad}
diff --git a/packages/client/src/components/Combobox.tsx b/packages/client/src/components/Combobox.tsx
index 7bd1ddac78..6d7ed7312f 100644
--- a/packages/client/src/components/Combobox.tsx
+++ b/packages/client/src/components/Combobox.tsx
@@ -91,10 +91,7 @@ export default function ComboboxComponent({
<div className="assistant-item flex items-center justify-center overflow-hidden rounded-full">
{SelectIcon ? SelectIcon : <ChevronDownIcon />}
</div>
- <span
- className={cn('ml-2', isCollapsed ? 'hidden' : '')}
- style={{ userSelect: 'none' }}
- >
+ <span className={cn('ml-2 select-none', isCollapsed ? 'hidden' : '')}>
{selectedValue
? (displayValue ?? selectedValue)
: selectPlaceholder && selectPlaceholder}
diff --git a/packages/client/src/components/DataTable.tsx b/packages/client/src/components/DataTable.tsx
index d92f1914c6..7d0013d77f 100644
--- a/packages/client/src/components/DataTable.tsx
+++ b/packages/client/src/components/DataTable.tsx
@@ -105,12 +105,16 @@ const TableRowComponent = <TData, TValue>({
ref={measureRef}
data-index={index}
data-state={row.getIsSelected() ? 'selected' : undefined}
- className="motion-safe:animate-fadeIn border-border-light hover:bg-surface-secondary border-b transition-all duration-300 ease-out"
- style={{
- animationDelay: `${index * 20}ms`,
- transform: `translateY(${isSearching ? '4px' : '0'})`,
- opacity: isSearching ? 0.5 : 1,
- }}
+ className={cn(
+ 'motion-safe:animate-fadeIn border-border-light hover:bg-surface-secondary border-b transition-all duration-300 ease-out [animation-delay:var(--row-delay)]',
+ isSearching && 'opacity-50',
+ )}
+ style={
+ {
+ '--row-delay': `${index * 20}ms`,
+ transform: `translateY(${isSearching ? '4px' : '0'})`,
+ } as React.CSSProperties
+ }
>
{row.getVisibleCells().map((cell) => {
if (cell.column.id === 'select') {
diff --git a/packages/client/src/components/DataTable/DataTable.tsx b/packages/client/src/components/DataTable/DataTable.tsx
index da877f0d04..eb2ca513e7 100644
--- a/packages/client/src/components/DataTable/DataTable.tsx
+++ b/packages/client/src/components/DataTable/DataTable.tsx
@@ -358,7 +358,8 @@ function DataTable<TData extends Record<string, unknown>, TValue>({
<TableRow aria-hidden="true">
<TableCell
colSpan={tableColumns.length}
- style={{ height: paddingTop, padding: 0, border: 0 }}
+ className="border-0 p-0"
+ style={{ height: paddingTop }}
/>
</TableRow>
)}
@@ -381,7 +382,8 @@ function DataTable<TData extends Record<string, unknown>, TValue>({
<TableRow aria-hidden="true">
<TableCell
colSpan={tableColumns.length}
- style={{ height: paddingBottom, padding: 0, border: 0 }}
+ className="border-0 p-0"
+ style={{ height: paddingBottom }}
/>
</TableRow>
)}
@@ -609,11 +611,9 @@ function DataTable<TData extends Record<string, unknown>, TValue>({
)}
<div
ref={tableContainerRef}
- className="relative flex min-h-0 flex-1 flex-col overflow-auto will-change-scroll"
+ className="relative flex min-h-0 flex-1 flex-col overflow-auto overscroll-contain will-change-scroll"
style={
{
- WebkitOverflowScrolling: 'touch',
- overscrollBehavior: 'contain',
/** Inherited by memoized cells and skeletons so one scaled breakpoint
* controls every table column without rebuilding the row model. */
'--data-table-desktop-display': isSmallScreen ? 'none' : 'table-cell',
diff --git a/packages/client/src/components/FileUpload.tsx b/packages/client/src/components/FileUpload.tsx
index c0cec6b032..0debc79ba5 100644
--- a/packages/client/src/components/FileUpload.tsx
+++ b/packages/client/src/components/FileUpload.tsx
@@ -13,13 +13,7 @@ const FileUpload: React.ForwardRefExoticComponent<
return (
<>
{children}
- <input
- ref={ref}
- multiple
- type="file"
- style={{ display: 'none' }}
- onChange={handleFileChange}
- />
+ <input ref={ref} multiple type="file" className="hidden" onChange={handleFileChange} />
</>
);
});
diff --git a/packages/client/src/components/PixelCard.tsx b/packages/client/src/components/PixelCard.tsx
index 78b4227a02..a06e892fa2 100644
--- a/packages/client/src/components/PixelCard.tsx
+++ b/packages/client/src/components/PixelCard.tsx
@@ -406,13 +406,12 @@ export default function PixelCard({
>
<div
className={cn(
- 'border-border-light relative isolate grid place-items-center overflow-hidden rounded-lg border shadow-md transition-colors duration-200 ease-in-out select-none',
+ 'border-border-light relative isolate grid place-items-center overflow-hidden rounded-lg border shadow-md transition-colors duration-200 ease-[cubic-bezier(0.5,1,0.89,1)] select-none',
className,
)}
style={{
width: '100%',
height: '100%',
- transitionTimingFunction: 'cubic-bezier(0.5, 1, 0.89, 1)',
}}
onMouseEnter={hoverIn}
onMouseLeave={hoverOut}
diff --git a/packages/client/src/components/SplitText.spec.tsx b/packages/client/src/components/SplitText.spec.tsx
index 376decbcda..795daa5883 100644
--- a/packages/client/src/components/SplitText.spec.tsx
+++ b/packages/client/src/components/SplitText.spec.tsx
@@ -54,7 +54,7 @@ describe('SplitText', () => {
for (const [index, box] of Array.from(wordBoxes).entries()) {
expect(box).toHaveAttribute('aria-hidden', 'true');
expect(
- Array.from(box.querySelectorAll('span.inline-block'))
+ Array.from(box.querySelectorAll('span.inline-block.will-change-transform'))
.map((span) => span.textContent)
.join(''),
).toBe(expectedWords[index]);
diff --git a/packages/client/src/components/SplitText.tsx b/packages/client/src/components/SplitText.tsx
index 22ebd2f611..b5b70ae9b3 100644
--- a/packages/client/src/components/SplitText.tsx
+++ b/packages/client/src/components/SplitText.tsx
@@ -2,6 +2,15 @@ import { useEffect, useMemo, useRef, useState } from 'react';
import { useSprings, animated, SpringConfig } from '@react-spring/web';
import useRemScale from '~/hooks/useRemScale';
+const TEXT_ALIGN: Record<NonNullable<SplitTextProps['textAlign']>, string> = {
+ left: 'text-left',
+ right: 'text-right',
+ center: 'text-center',
+ justify: 'text-justify',
+ start: 'text-start',
+ end: 'text-end',
+};
+
interface SegmenterOptions {
granularity?: 'grapheme' | 'word' | 'sentence';
localeMatcher?: 'lookup' | 'best fit';
@@ -153,8 +162,7 @@ const SplitText: React.FC<SplitTextProps> = ({
<p
ref={ref}
dir="auto"
- className={`split-parent inline overflow-hidden ${className}`}
- style={{ textAlign, whiteSpace: 'normal', wordWrap: 'break-word' }}
+ className={`split-parent inline overflow-hidden break-words whitespace-normal ${TEXT_ALIGN[textAlign]} ${className}`}
>
{/* The paragraph's auto direction ignores word boxes with their own dir. */}
<span className="sr-only">{text}</span>
@@ -163,7 +171,7 @@ const SplitText: React.FC<SplitTextProps> = ({
key={wordIndex}
dir="auto"
aria-hidden="true"
- style={{ display: 'inline-block', whiteSpace: 'nowrap' }}
+ className="inline-block whitespace-nowrap"
>
{word.map((letter, letterIndex) => {
const index = offsets[wordIndex] + letterIndex;
@@ -179,7 +187,9 @@ const SplitText: React.FC<SplitTextProps> = ({
);
})}
{wordIndex < words.length - 1 && (
- <span style={{ display: 'inline-block', width: '0.3em' }}>&nbsp;</span>
+ <span className="inline-block" style={{ width: '0.3em' }}>
+ &nbsp;
+ </span>
)}
</span>
))}
diff --git a/packages/client/src/components/Toast.tsx b/packages/client/src/components/Toast.tsx
index 8bdd1f9d36..d9e7bf85cd 100644
--- a/packages/client/src/components/Toast.tsx
+++ b/packages/client/src/components/Toast.tsx
@@ -44,11 +44,8 @@ export function Toast(): JSX.Element {
open={toast.open}
onOpenChange={(open) => onOpenChange(open, toast.id)}
duration={toast.duration}
- className="toast-root"
- style={{
- minHeight: '74px',
- marginBottom: '0px',
- }}
+ className="toast-root mb-0"
+ style={{ minHeight: '74px' }}
>
<div className="w-full p-1 text-center md:w-auto md:text-justify">
<div
diff --git a/packages/client/src/svgs/SendMessageIcon.tsx b/packages/client/src/svgs/SendMessageIcon.tsx
index 3aef3c976d..adcd81947f 100644
--- a/packages/client/src/svgs/SendMessageIcon.tsx
+++ b/packages/client/src/svgs/SendMessageIcon.tsx
@@ -7,8 +7,8 @@ export default function SendMessageIcon(): JSX.Element {
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
fill="none"
- className="icon-sm m-1 md:m-0"
- style={{ width: '1em', height: '1em', verticalAlign: 'middle' }}
+ className="icon-sm m-1 align-middle md:m-0"
+ style={{ width: '1em', height: '1em' }}
aria-hidden="true"
>
<path