fix: Added resurce and dataProvider props to data-table, fixed UI
This commit is contained in:
parent
b646fc4887
commit
39a8789f95
|
@ -18,16 +18,21 @@ import { Skeleton } from "./ui/skeleton";
|
||||||
import { DataTablePagination } from "./table-pagination"
|
import { DataTablePagination } from "./table-pagination"
|
||||||
|
|
||||||
interface DataTableProps<TData extends BaseRecord = BaseRecord, TValue = unknown> {
|
interface DataTableProps<TData extends BaseRecord = BaseRecord, TValue = unknown> {
|
||||||
columns: ColumnDef<TData, TValue>[]
|
columns: ColumnDef<TData, TValue>[],
|
||||||
|
resource: string;
|
||||||
|
dataProviderName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DataTable<TData extends BaseRecord, TValue>({
|
export function DataTable<TData extends BaseRecord, TValue>({
|
||||||
columns,
|
columns,
|
||||||
|
resource,
|
||||||
|
dataProviderName
|
||||||
}: DataTableProps<TData, TValue>) {
|
}: DataTableProps<TData, TValue>) {
|
||||||
const table = useTable({
|
const table = useTable({
|
||||||
columns,
|
columns,
|
||||||
refineCoreProps: {
|
refineCoreProps: {
|
||||||
resource: "files"
|
resource,
|
||||||
|
dataProviderName: dataProviderName || "default"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ export const PinningNetworkBanner = () => {
|
||||||
<Accordion type="single" defaultValue="item-1" collapsible>
|
<Accordion type="single" defaultValue="item-1" collapsible>
|
||||||
<AccordionItem value="item-1">
|
<AccordionItem value="item-1">
|
||||||
<AccordionTrigger className="font-bold bg-primary px-4 rounded-tr-lg rounded-tl-lg">
|
<AccordionTrigger className="font-bold bg-primary px-4 rounded-tr-lg rounded-tl-lg">
|
||||||
{itemsLeft.length > 0 ? `${itemsLeft.length} left` : "Completed"}
|
{`${completedItems.length}/${cidList.length} items completed`}
|
||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent>
|
<AccordionContent>
|
||||||
<Tabs className="w-full" defaultValue="inProgress">
|
<Tabs className="w-full" defaultValue="inProgress">
|
||||||
|
|
|
@ -48,6 +48,7 @@ export default function App() {
|
||||||
notificationProvider={notificationProvider}
|
notificationProvider={notificationProvider}
|
||||||
dataProvider={{
|
dataProvider={{
|
||||||
default: providers.default,
|
default: providers.default,
|
||||||
|
files: providers.files,
|
||||||
pinning: providers.pinning
|
pinning: providers.pinning
|
||||||
}}
|
}}
|
||||||
resources={resources}
|
resources={resources}
|
||||||
|
|
|
@ -46,7 +46,7 @@ const CreatedOnCell = ({ row }: { row: Row<File> }) => {
|
||||||
onPin(row.getValue("cid"));
|
onPin(row.getValue("cid"));
|
||||||
}}>
|
}}>
|
||||||
<DrawingPinIcon className="mr-2" />
|
<DrawingPinIcon className="mr-2" />
|
||||||
Ping CID
|
Pin CID
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem variant="destructive">
|
<DropdownMenuItem variant="destructive">
|
||||||
|
|
|
@ -55,6 +55,8 @@ export default function FileManager() {
|
||||||
</div>
|
</div>
|
||||||
<DataTable
|
<DataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
resource="file"
|
||||||
|
dataProviderName="files"
|
||||||
/>
|
/>
|
||||||
</GeneralLayout>
|
</GeneralLayout>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue