Fix unexpected any in SortableTable
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -15,12 +15,16 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
type ComponentProps,
|
type ComponentProps,
|
||||||
} from "react";
|
} from "react";
|
||||||
|
import type { LoadMoreFn } from "react-relay";
|
||||||
|
import type { OperationType } from "relay-runtime";
|
||||||
|
|
||||||
type Order = {
|
type Order = {
|
||||||
direction: string;
|
direction: string;
|
||||||
field: string;
|
field: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const defaultPageSize = 50;
|
||||||
|
|
||||||
export const SortableContext = createContext({
|
export const SortableContext = createContext({
|
||||||
order: {
|
order: {
|
||||||
direction: "DESC",
|
direction: "DESC",
|
||||||
@@ -39,12 +43,14 @@ export function SortableTable({
|
|||||||
hasNext,
|
hasNext,
|
||||||
loadNext,
|
loadNext,
|
||||||
isLoadingNext,
|
isLoadingNext,
|
||||||
|
pageSize = defaultPageSize,
|
||||||
...props
|
...props
|
||||||
}: ComponentProps<typeof Table> & {
|
}: ComponentProps<typeof Table> & {
|
||||||
refetch: (o: { order: Order }) => void;
|
refetch: (o: { order: Order }) => void;
|
||||||
hasNext?: boolean;
|
hasNext?: boolean;
|
||||||
loadNext?: (...args: any[]) => void;
|
loadNext?: LoadMoreFn<OperationType>;
|
||||||
isLoadingNext?: boolean;
|
isLoadingNext?: boolean;
|
||||||
|
pageSize?: number;
|
||||||
}) {
|
}) {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const [order, setOrder] = useState(defaultOrder);
|
const [order, setOrder] = useState(defaultOrder);
|
||||||
@@ -61,7 +67,7 @@ export function SortableTable({
|
|||||||
{hasNext && loadNext && (
|
{hasNext && loadNext && (
|
||||||
<Button
|
<Button
|
||||||
variant="tertiary"
|
variant="tertiary"
|
||||||
onClick={() => loadNext()}
|
onClick={() => loadNext(pageSize)}
|
||||||
className="mt-3 mx-auto"
|
className="mt-3 mx-auto"
|
||||||
disabled={isLoadingNext}
|
disabled={isLoadingNext}
|
||||||
icon={isLoadingNext ? Spinner : IconChevronDown}
|
icon={isLoadingNext ? Spinner : IconChevronDown}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export function ReadOnlyAssetsTable(props: Props) {
|
|||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SortableTable {...pagination}>
|
<SortableTable {...pagination} pageSize={10}>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
<Th>{__("Name")}</Th>
|
<Th>{__("Name")}</Th>
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export function LinkedControlsCard<Params>(props: Props<Params>) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SortableTable refetch={props.refetch as any}>
|
<SortableTable refetch={props.refetch}>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
<SortableTh field="SECTION_TITLE">{__("Reference")}</SortableTh>
|
<SortableTh field="SECTION_TITLE">{__("Reference")}</SortableTh>
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export default function AuditsPage(props: Props) {
|
|||||||
</CreateAuditDialog>
|
</CreateAuditDialog>
|
||||||
)}
|
)}
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
<SortableTable {...pagination}>
|
<SortableTable {...pagination} pageSize={10}>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
<Th>{__("Name")}</Th>
|
<Th>{__("Name")}</Th>
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ export default function DataPage(props: Props) {
|
|||||||
<SortableTable
|
<SortableTable
|
||||||
{...pagination}
|
{...pagination}
|
||||||
refetch={refetch}
|
refetch={refetch}
|
||||||
|
pageSize={10}
|
||||||
>
|
>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
|
|||||||
@@ -399,20 +399,22 @@ function DocumentRow({
|
|||||||
);
|
);
|
||||||
const lastVersion = document.versions.edges?.[0]?.node;
|
const lastVersion = document.versions.edges?.[0]?.node;
|
||||||
|
|
||||||
|
const isDraft = lastVersion.status === "DRAFT";
|
||||||
|
const { __ } = useTranslate();
|
||||||
|
|
||||||
|
const [deleteDocument] = useDeleteDocumentMutation();
|
||||||
|
const confirm = useConfirm();
|
||||||
|
|
||||||
if (!lastVersion) {
|
if (!lastVersion) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDraft = lastVersion.status === "DRAFT";
|
|
||||||
const { __ } = useTranslate();
|
|
||||||
const signatures =
|
const signatures =
|
||||||
lastVersion.signatures?.edges?.map((edge) => edge?.node)?.filter(Boolean) ??
|
lastVersion.signatures?.edges?.map((edge) => edge?.node)?.filter(Boolean) ??
|
||||||
[];
|
[];
|
||||||
const signedCount = signatures.filter(
|
const signedCount = signatures.filter(
|
||||||
(signature) => signature.state === "SIGNED"
|
(signature) => signature.state === "SIGNED"
|
||||||
).length;
|
).length;
|
||||||
const [deleteDocument] = useDeleteDocumentMutation();
|
|
||||||
const confirm = useConfirm();
|
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
confirm(
|
confirm(
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ export default function MembersSettingsTab() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
pageSize={20}
|
||||||
>
|
>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
@@ -266,6 +267,7 @@ export default function MembersSettingsTab() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
pageSize={20}
|
||||||
>
|
>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user