fix: Added resurce and dataProvider props to data-table, fixed UI

This commit is contained in:
Tania Gutierrez 2024-03-21 10:56:08 -04:00
parent b646fc4887
commit 39a8789f95
Signed by: riobuenoDevelops
GPG Key ID: 53133EB28EB7E801
5 changed files with 12 additions and 4 deletions

View File

@ -18,16 +18,21 @@ import { Skeleton } from "./ui/skeleton";
import { DataTablePagination } from "./table-pagination"
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>({
columns,
resource,
dataProviderName
}: DataTableProps<TData, TValue>) {
const table = useTable({
columns,
refineCoreProps: {
resource: "files"
resource,
dataProviderName: dataProviderName || "default"
}
})

View File

@ -33,7 +33,7 @@ export const PinningNetworkBanner = () => {
<Accordion type="single" defaultValue="item-1" collapsible>
<AccordionItem value="item-1">
<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>
<AccordionContent>
<Tabs className="w-full" defaultValue="inProgress">

View File

@ -48,6 +48,7 @@ export default function App() {
notificationProvider={notificationProvider}
dataProvider={{
default: providers.default,
files: providers.files,
pinning: providers.pinning
}}
resources={resources}

View File

@ -46,7 +46,7 @@ const CreatedOnCell = ({ row }: { row: Row<File> }) => {
onPin(row.getValue("cid"));
}}>
<DrawingPinIcon className="mr-2" />
Ping CID
Pin CID
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem variant="destructive">

View File

@ -55,6 +55,8 @@ export default function FileManager() {
</div>
<DataTable
columns={columns}
resource="file"
dataProviderName="files"
/>
</GeneralLayout>
);