mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-10-20 17:13:44 +00:00
🔧 chore: Update ESLint config, Import Sorting script, Test Sharding, Bump @librechat/agents (#13552)
* 🔧 chore: Update ESLint config, add import sorting script, Test Sharding, Bump `@librechat/agents`
* Change 'no-nested-ternary' rule from 'warn' to 'error' in ESLint config
* Add new scripts for sorting imports in the project
* Update lint-staged configuration to include import sorting
* Modify GitHub Actions workflows to support sharding for unit tests
* chore: remove nested ternary expressions
* refactor: Extract scale multiplier logic into a separate function in CircleRender component
* refactor: Simplify auto-refill rendering logic in Balance component for better readability
* refactor: Improve width style handling in DataTable components for clarity and maintainability
* chore: remove CircleRender component
* delete: Remove CircleRender component as it is no longer needed in the project
* chore: Bump @librechat/agents to version 3.2.31 and update Node.js engine requirement
* Update @librechat/agents dependency from 3.2.2 to 3.2.31 in package-lock.json, api/package.json, and packages/api/package.json
* Change Node.js engine requirement from >=20.0.0 to >=24.0.0 in @librechat/agents
* chore: Add import sorting check to ESLint CI workflow
* Implement a new job in the GitHub Actions workflow to verify import ordering on changed files.
* The job checks for changes in specific file types and reports any import order drift, providing instructions for local fixes.
This commit is contained in:
parent
21607ba3d7
commit
bfb6b224d2
16 changed files with 396 additions and 114 deletions
|
|
@ -140,6 +140,10 @@ function DataTable<TData extends Record<string, unknown>, TValue>({
|
|||
}
|
||||
});
|
||||
return newVisibility;
|
||||
/* isSmallScreen is intentionally a dependency: it forces a fresh result
|
||||
reference when the viewport crosses the mobile breakpoint so the effect
|
||||
below re-applies column visibility, even though the body doesn't read it. */
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isSmallScreen, columns]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -510,15 +514,24 @@ function DataTable<TData extends Record<string, unknown>, TValue>({
|
|||
|
||||
const metaWidth = (header.column.columnDef.meta as { width?: number } | undefined)
|
||||
?.width;
|
||||
const widthStyle = isSelectHeader
|
||||
? { width: '32px', maxWidth: '32px', minWidth: '32px' }
|
||||
: metaWidth && metaWidth >= 1 && metaWidth <= 100
|
||||
? {
|
||||
width: `${metaWidth}%`,
|
||||
maxWidth: `${metaWidth}%`,
|
||||
minWidth: `${metaWidth}%`,
|
||||
}
|
||||
: {};
|
||||
let widthStyle: React.CSSProperties = {};
|
||||
if (isSelectHeader) {
|
||||
widthStyle = { width: '32px', maxWidth: '32px', minWidth: '32px' };
|
||||
} else if (metaWidth != null && metaWidth >= 1 && metaWidth <= 100) {
|
||||
widthStyle = {
|
||||
width: `${metaWidth}%`,
|
||||
maxWidth: `${metaWidth}%`,
|
||||
minWidth: `${metaWidth}%`,
|
||||
};
|
||||
}
|
||||
|
||||
const sortDirection = header.column.getIsSorted();
|
||||
let ariaSort: 'ascending' | 'descending' | undefined;
|
||||
if (sortDirection === 'asc') {
|
||||
ariaSort = 'ascending';
|
||||
} else if (sortDirection === 'desc') {
|
||||
ariaSort = 'descending';
|
||||
}
|
||||
return (
|
||||
<TableHead
|
||||
key={header.id}
|
||||
|
|
@ -537,13 +550,7 @@ function DataTable<TData extends Record<string, unknown>, TValue>({
|
|||
role={canSort ? 'button' : undefined}
|
||||
tabIndex={canSort ? 0 : undefined}
|
||||
aria-label={sortAriaLabel}
|
||||
aria-sort={
|
||||
header.column.getIsSorted() === 'asc'
|
||||
? 'ascending'
|
||||
: header.column.getIsSorted() === 'desc'
|
||||
? 'descending'
|
||||
: undefined
|
||||
}
|
||||
aria-sort={ariaSort}
|
||||
>
|
||||
{isSelectHeader ? (
|
||||
flexRender(header.column.columnDef.header, header.getContext())
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { memo, forwardRef } from 'react';
|
||||
import { flexRender } from '@tanstack/react-table';
|
||||
import type { TableColumn } from './DataTable.types';
|
||||
import type { Row } from '@tanstack/react-table';
|
||||
import type { TableColumn } from './DataTable.types';
|
||||
import { TableCell, TableRow, TableRowHeader } from '../Table';
|
||||
import { Checkbox } from '../Checkbox';
|
||||
import { Skeleton } from '../Skeleton';
|
||||
|
|
@ -70,16 +70,16 @@ const TableRowComponent = <TData extends Record<string, unknown>>(
|
|||
const isDesktopOnly = meta?.desktopOnly;
|
||||
const isRowHeader = meta?.isRowHeader;
|
||||
const percent = meta?.width;
|
||||
const widthStyle =
|
||||
cell.column.id === 'select'
|
||||
? { width: '32px', maxWidth: '32px', minWidth: '32px' }
|
||||
: percent
|
||||
? {
|
||||
width: `${percent}%`,
|
||||
maxWidth: `${percent}%`,
|
||||
minWidth: `${percent}%`, // Don't shrink on mobile
|
||||
}
|
||||
: undefined;
|
||||
let widthStyle: React.CSSProperties | undefined;
|
||||
if (cell.column.id === 'select') {
|
||||
widthStyle = { width: '32px', maxWidth: '32px', minWidth: '32px' };
|
||||
} else if (percent) {
|
||||
widthStyle = {
|
||||
width: `${percent}%`,
|
||||
maxWidth: `${percent}%`,
|
||||
minWidth: `${percent}%`, // Don't shrink on mobile
|
||||
};
|
||||
}
|
||||
|
||||
const CellComponent = isRowHeader ? TableRowHeader : TableCell;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue