mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Working on the Portabase debug.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import {User, UserOrganization} from "@prisma/client";
|
||||
import {DataTableWithPagination} from "@/components/wrappers/common/table/data-table-with-pagination";
|
||||
import {usersColumns} from "@/components/wrappers/dashboard/settings/SettingsUsersTab/columns-users-settings";
|
||||
import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "@/components/ui/table";
|
||||
import {flexRender, Row} from "@tanstack/react-table";
|
||||
@@ -7,13 +5,13 @@ import {cn} from "@/lib/utils";
|
||||
|
||||
|
||||
export type SettingsUsersTabProps = {
|
||||
currentUser: User;
|
||||
users: UserOrganization[]
|
||||
// currentUser: User;
|
||||
// users: UserOrganization[]
|
||||
}
|
||||
|
||||
export const SettingsUsersTab = (props: SettingsUsersTabProps) => {
|
||||
|
||||
const {currentUser, users} = props;
|
||||
// const {currentUser, users} = props;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-full py-4">
|
||||
@@ -21,12 +19,12 @@ export const SettingsUsersTab = (props: SettingsUsersTabProps) => {
|
||||
<h1>List of organization's users</h1>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<DataTableWithPagination
|
||||
columns={usersColumns}
|
||||
data={users}
|
||||
DataTable={UsersDataTable}
|
||||
dataTableProps={{currentUser}}
|
||||
/>
|
||||
{/*<DataTableWithPagination*/}
|
||||
{/* columns={usersColumns}*/}
|
||||
{/* data={users}*/}
|
||||
{/* DataTable={UsersDataTable}*/}
|
||||
{/* dataTableProps={{currentUser}}*/}
|
||||
{/*/>*/}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -35,63 +33,65 @@ export const SettingsUsersTab = (props: SettingsUsersTabProps) => {
|
||||
|
||||
|
||||
export type usersDataTableProps = {
|
||||
currentUser: User;
|
||||
table: any,
|
||||
// currentUser: User;
|
||||
// table: any,
|
||||
}
|
||||
|
||||
export const UsersDataTable = ({currentUser, table}: usersDataTableProps) => {
|
||||
export const UsersDataTable = (
|
||||
// {currentUser, table}: usersDataTableProps
|
||||
) => {
|
||||
|
||||
return (
|
||||
<div className="rounded-md border w-full ">
|
||||
<Table className="w-full">
|
||||
<TableHeader>
|
||||
{table.getHeaderGroups().map((headerGroup) => (
|
||||
<TableRow key={headerGroup.id}>
|
||||
{headerGroup.headers.map((header) => {
|
||||
return (
|
||||
<TableHead key={header.id}>
|
||||
{header.isPlaceholder
|
||||
? null
|
||||
: flexRender(
|
||||
header.column.columnDef.header,
|
||||
header.getContext()
|
||||
)}
|
||||
</TableHead>
|
||||
)
|
||||
})}
|
||||
</TableRow>
|
||||
))}
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{table.getRowModel().rows?.length ? (
|
||||
table.getRowModel().rows.map((row: Row<UserOrganization>) => {
|
||||
return(
|
||||
<TableRow
|
||||
className={cn((row.original.userId) === currentUser.id ? "opacity-40 pointer-events-none" : "")}
|
||||
key={row.id}
|
||||
data-state={row.getIsSelected() && "selected"}
|
||||
>
|
||||
{row.getVisibleCells().map((cell) => (
|
||||
<TableCell key={cell.id}>
|
||||
{flexRender(
|
||||
cell.column.columnDef.cell,
|
||||
cell.getContext(),
|
||||
)}
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
)
|
||||
}
|
||||
{/*<Table className="w-full">*/}
|
||||
{/* <TableHeader>*/}
|
||||
{/* {table.getHeaderGroups().map((headerGroup) => (*/}
|
||||
{/* <TableRow key={headerGroup.id}>*/}
|
||||
{/* {headerGroup.headers.map((header) => {*/}
|
||||
{/* return (*/}
|
||||
{/* <TableHead key={header.id}>*/}
|
||||
{/* {header.isPlaceholder*/}
|
||||
{/* ? null*/}
|
||||
{/* : flexRender(*/}
|
||||
{/* header.column.columnDef.header,*/}
|
||||
{/* header.getContext()*/}
|
||||
{/* )}*/}
|
||||
{/* </TableHead>*/}
|
||||
{/* )*/}
|
||||
{/* })}*/}
|
||||
{/* </TableRow>*/}
|
||||
{/* ))}*/}
|
||||
{/* </TableHeader>*/}
|
||||
{/* <TableBody>*/}
|
||||
{/* {table.getRowModel().rows?.length ? (*/}
|
||||
{/* table.getRowModel().rows.map((row: Row<UserOrganization>) => {*/}
|
||||
{/* return(*/}
|
||||
{/* <TableRow*/}
|
||||
{/* className={cn((row.original.userId) === currentUser.id ? "opacity-40 pointer-events-none" : "")}*/}
|
||||
{/* key={row.id}*/}
|
||||
{/* data-state={row.getIsSelected() && "selected"}*/}
|
||||
{/* >*/}
|
||||
{/* {row.getVisibleCells().map((cell) => (*/}
|
||||
{/* <TableCell key={cell.id}>*/}
|
||||
{/* {flexRender(*/}
|
||||
{/* cell.column.columnDef.cell,*/}
|
||||
{/* cell.getContext(),*/}
|
||||
{/* )}*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* ))}*/}
|
||||
{/* </TableRow>*/}
|
||||
{/* )*/}
|
||||
{/* }*/}
|
||||
|
||||
)) : (
|
||||
<TableRow>
|
||||
<TableCell colSpan={table.getAllColumns().length} className="h-24 text-center">
|
||||
No results.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
{/* )) : (*/}
|
||||
{/* <TableRow>*/}
|
||||
{/* <TableCell colSpan={table.getAllColumns().length} className="h-24 text-center">*/}
|
||||
{/* No results.*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* </TableRow>*/}
|
||||
{/* )}*/}
|
||||
{/* </TableBody>*/}
|
||||
{/*</Table>*/}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user