Fix unexpected any in SortableTable

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-12-03 12:20:44 +04:00
parent 85d52b0088
commit 21d2246f30
7 changed files with 20 additions and 9 deletions

View File

@@ -15,12 +15,16 @@ import {
useState,
type ComponentProps,
} from "react";
import type { LoadMoreFn } from "react-relay";
import type { OperationType } from "relay-runtime";
type Order = {
direction: string;
field: string;
};
const defaultPageSize = 50;
export const SortableContext = createContext({
order: {
direction: "DESC",
@@ -39,12 +43,14 @@ export function SortableTable({
hasNext,
loadNext,
isLoadingNext,
pageSize = defaultPageSize,
...props
}: ComponentProps<typeof Table> & {
refetch: (o: { order: Order }) => void;
hasNext?: boolean;
loadNext?: (...args: any[]) => void;
loadNext?: LoadMoreFn<OperationType>;
isLoadingNext?: boolean;
pageSize?: number;
}) {
const { __ } = useTranslate();
const [order, setOrder] = useState(defaultOrder);
@@ -61,7 +67,7 @@ export function SortableTable({
{hasNext && loadNext && (
<Button
variant="tertiary"
onClick={() => loadNext()}
onClick={() => loadNext(pageSize)}
className="mt-3 mx-auto"
disabled={isLoadingNext}
icon={isLoadingNext ? Spinner : IconChevronDown}

View File

@@ -25,7 +25,7 @@ export function ReadOnlyAssetsTable(props: Props) {
const { __ } = useTranslate();
return (
<SortableTable {...pagination}>
<SortableTable {...pagination} pageSize={10}>
<Thead>
<Tr>
<Th>{__("Name")}</Th>

View File

@@ -91,7 +91,7 @@ export function LinkedControlsCard<Params>(props: Props<Params>) {
};
return (
<SortableTable refetch={props.refetch as any}>
<SortableTable refetch={props.refetch}>
<Thead>
<Tr>
<SortableTh field="SECTION_TITLE">{__("Reference")}</SortableTh>

View File

@@ -115,7 +115,7 @@ export default function AuditsPage(props: Props) {
</CreateAuditDialog>
)}
</PageHeader>
<SortableTable {...pagination}>
<SortableTable {...pagination} pageSize={10}>
<Thead>
<Tr>
<Th>{__("Name")}</Th>

View File

@@ -153,6 +153,7 @@ export default function DataPage(props: Props) {
<SortableTable
{...pagination}
refetch={refetch}
pageSize={10}
>
<Thead>
<Tr>

View File

@@ -399,20 +399,22 @@ function DocumentRow({
);
const lastVersion = document.versions.edges?.[0]?.node;
const isDraft = lastVersion.status === "DRAFT";
const { __ } = useTranslate();
const [deleteDocument] = useDeleteDocumentMutation();
const confirm = useConfirm();
if (!lastVersion) {
return null;
}
const isDraft = lastVersion.status === "DRAFT";
const { __ } = useTranslate();
const signatures =
lastVersion.signatures?.edges?.map((edge) => edge?.node)?.filter(Boolean) ??
[];
const signedCount = signatures.filter(
(signature) => signature.state === "SIGNED"
).length;
const [deleteDocument] = useDeleteDocumentMutation();
const confirm = useConfirm();
const handleDelete = () => {
confirm(

View File

@@ -223,6 +223,7 @@ export default function MembersSettingsTab() {
}
});
}}
pageSize={20}
>
<Thead>
<Tr>
@@ -266,6 +267,7 @@ export default function MembersSettingsTab() {
}
});
}}
pageSize={20}
>
<Thead>
<Tr>