@@ -42,9 +42,9 @@ export function SortableTable({
|
|||||||
...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?: (...args: any[]) => void;
|
||||||
isLoadingNext: boolean;
|
isLoadingNext?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const [order, setOrder] = useState(defaultOrder);
|
const [order, setOrder] = useState(defaultOrder);
|
||||||
@@ -58,7 +58,7 @@ export function SortableTable({
|
|||||||
<SortableContext value={{ order, onOrderChange }}>
|
<SortableContext value={{ order, onOrderChange }}>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<Table {...props} />
|
<Table {...props} />
|
||||||
{hasNext && (
|
{hasNext && loadNext && (
|
||||||
<Button
|
<Button
|
||||||
variant="tertiary"
|
variant="tertiary"
|
||||||
onClick={() => loadNext()}
|
onClick={() => loadNext()}
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
import { graphql } from "relay-runtime";
|
import { graphql } from "relay-runtime";
|
||||||
import {
|
import { useMutation } from "react-relay";
|
||||||
useMutation,
|
|
||||||
usePreloadedQuery,
|
|
||||||
type PreloadedQuery,
|
|
||||||
} from "react-relay";
|
|
||||||
import { useConfirm } from "@probo/ui";
|
import { useConfirm } from "@probo/ui";
|
||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import { promisifyMutation, sprintf } from "@probo/helpers";
|
import { promisifyMutation, sprintf } from "@probo/helpers";
|
||||||
import { useMemo } from "react";
|
|
||||||
import type { AssetGraphListQuery } from "./__generated__/AssetGraphListQuery.graphql";
|
|
||||||
|
|
||||||
export const assetsQuery = graphql`
|
export const assetsQuery = graphql`
|
||||||
query AssetGraphListQuery($organizationId: ID!) {
|
query AssetGraphListQuery($organizationId: ID!) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
usePaginationFragment,
|
usePaginationFragment,
|
||||||
usePreloadedQuery,
|
usePreloadedQuery,
|
||||||
useRefetchableFragment,
|
|
||||||
type PreloadedQuery,
|
type PreloadedQuery,
|
||||||
} from "react-relay";
|
} from "react-relay";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import { usePageTitle } from "@probo/hooks";
|
import { usePageTitle } from "@probo/hooks";
|
||||||
import {
|
import {
|
||||||
|
graphql,
|
||||||
usePaginationFragment,
|
usePaginationFragment,
|
||||||
usePreloadedQuery,
|
usePreloadedQuery,
|
||||||
type PreloadedQuery,
|
type PreloadedQuery,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import {
|
import {
|
||||||
PageHeader,
|
PageHeader,
|
||||||
Table,
|
|
||||||
Tbody,
|
Tbody,
|
||||||
Thead,
|
Thead,
|
||||||
Tr,
|
Tr,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
IconPlusLarge,
|
IconPlusLarge,
|
||||||
PageHeader,
|
PageHeader,
|
||||||
Table,
|
|
||||||
Thead,
|
Thead,
|
||||||
Tbody,
|
Tbody,
|
||||||
Tr,
|
Tr,
|
||||||
@@ -31,14 +30,14 @@ import {
|
|||||||
useDeleteVendor,
|
useDeleteVendor,
|
||||||
vendorsQuery,
|
vendorsQuery,
|
||||||
} from "/hooks/graph/VendorGraph";
|
} from "/hooks/graph/VendorGraph";
|
||||||
|
import type { VendorGraphListQuery } from "/hooks/graph/__generated__/VendorGraphListQuery.graphql";
|
||||||
import type {
|
import type {
|
||||||
VendorGraphListQuery,
|
VendorGraphPaginatedFragment$data,
|
||||||
VendorGraphListQuery$data,
|
VendorGraphPaginatedFragment$key,
|
||||||
} from "/hooks/graph/__generated__/VendorGraphListQuery.graphql";
|
} from "/hooks/graph/__generated__/VendorGraphPaginatedFragment.graphql";
|
||||||
import type { VendorGraphPaginatedFragment$key } from "/hooks/graph/__generated__/VendorGraphPaginatedFragment.graphql";
|
|
||||||
import { SortableTable } from "/components/SortableTable";
|
import { SortableTable } from "/components/SortableTable";
|
||||||
|
|
||||||
type Vendor = NodeOf<VendorGraphListQuery$data["node"]["vendors"]>;
|
type Vendor = NodeOf<VendorGraphPaginatedFragment$data["vendors"]>;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
queryRef: PreloadedQuery<VendorGraphListQuery>;
|
queryRef: PreloadedQuery<VendorGraphListQuery>;
|
||||||
|
|||||||
Reference in New Issue
Block a user