App directory #4
This commit is contained in:
parent
69706053c6
commit
4d743c5e67
86 changed files with 223 additions and 107 deletions
|
|
@ -1,44 +0,0 @@
|
|||
import { FC } from "react";
|
||||
import {
|
||||
List,
|
||||
Datagrid,
|
||||
DateField,
|
||||
TextField,
|
||||
ReferenceField,
|
||||
DeleteButton,
|
||||
ListProps,
|
||||
} from "react-admin";
|
||||
import { useSession } from "next-auth/react";
|
||||
|
||||
type DeleteNotSelfButtonProps = {
|
||||
record?: any;
|
||||
};
|
||||
|
||||
const DeleteNotSelfButton: FC<DeleteNotSelfButtonProps> = (props: any) => {
|
||||
const { data: session } = useSession();
|
||||
return (
|
||||
// @ts-ignore
|
||||
<DeleteButton
|
||||
disabled={session?.user?.email === props.record.userId}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export const AccountList = (props: ListProps) => (
|
||||
<List {...props} exporter={false}>
|
||||
<Datagrid rowClick="edit">
|
||||
<ReferenceField source="userId" reference="users">
|
||||
<TextField source="email" />
|
||||
</ReferenceField>
|
||||
<TextField source="providerType" />
|
||||
<TextField source="providerId" />
|
||||
<TextField source="providerAccountId" />
|
||||
<DateField source="createdAt" />
|
||||
<DateField source="updatedAt" />
|
||||
<DeleteNotSelfButton />
|
||||
</Datagrid>
|
||||
</List>
|
||||
);
|
||||
|
||||
export default AccountList;
|
||||
Loading…
Add table
Add a link
Reference in a new issue