diff --git a/package.json b/package.json index ea937ca0e..bdeea5211 100644 --- a/package.json +++ b/package.json @@ -42,10 +42,12 @@ "@fortawesome/free-regular-svg-icons": "^5.15.4", "@fortawesome/free-solid-svg-icons": "^5.15.4", "@fortawesome/react-fontawesome": "^0.1.16", + "@headlessui/react": "^1.5.0", "@heroicons/react": "^1.0.5", "@hot-loader/react-dom": "^16.14.0", "axios": "^0.21.4", "chart.js": "^2.9.4", + "classnames": "^2.3.1", "date-fns": "^2.25.0", "debounce": "^1.2.1", "deepmerge": "^4.2.2", diff --git a/resources/scripts/components/admin/users/UsersContainerV2.tsx b/resources/scripts/components/admin/users/UsersContainerV2.tsx new file mode 100644 index 000000000..96f57feca --- /dev/null +++ b/resources/scripts/components/admin/users/UsersContainerV2.tsx @@ -0,0 +1,144 @@ +import React, { useEffect, useState } from 'react'; +import http from '@/api/http'; +import { User } from '@/api/admin/user'; +import { AdminTransformers } from '@/api/admin/transformers'; +import { Dropdown } from '@/components/elements/dropdown'; +import { + BanIcon, + DotsVerticalIcon, + LockOpenIcon, + PencilIcon, + PlusIcon, + SupportIcon, + TrashIcon, +} from '@heroicons/react/solid'; +import { Button } from '@/components/elements/button/index'; +import { Dialog } from '@/components/elements/dialog'; +import { Checkbox, InputField } from '@/components/elements/inputs'; + +const UsersContainerV2 = () => { + const [ users, setUsers ] = useState([]); + useEffect(() => { + document.title = 'Admin | Users'; + }, []); + + const [ visible, setVisible ] = useState(false); + + useEffect(() => { + http.get('/api/application/users') + .then(({ data }) => { + setUsers(data.data.map(AdminTransformers.toUser)); + }) + .catch(console.error); + }, []); + + return ( +
+
+ +
+ setVisible(false)}> + + This account will be permanently deleted. + + setVisible(false)} + > + Cancel + + Delete + + +
+
+ +
+
+ +
+
+
+ +
+ + + + + + + + + +
+
+ + + + + + + + {users.map(user => ( + + + + + + + ))} + +
+ Email + +
+
+ +
+
+
+
+ {'User +
+
+

+ {user.email} +

+

+ {user.uuid} +

+
+
+
+ {user.isUsingTwoFactor && + + 2-FA Enabled + + } + + + + + + }>Edit + }>Reset Password + } disabled={!user.isUsingTwoFactor}> + Disable 2-FA + + }>Suspend + + } onClick={() => setVisible(true)} danger>Delete + Account + + +
+
+ ); +}; + +export default UsersContainerV2; diff --git a/resources/scripts/components/elements/button/Button.tsx b/resources/scripts/components/elements/button/Button.tsx new file mode 100644 index 000000000..f3238beac --- /dev/null +++ b/resources/scripts/components/elements/button/Button.tsx @@ -0,0 +1,36 @@ +import React, { forwardRef } from 'react'; +import classNames from 'classnames'; +import styles from './button.module.css'; + +export type ButtonProps = JSX.IntrinsicElements['button'] & { + square?: boolean; + small?: boolean; +} + +const Button = forwardRef( + ({ children, square, small, className, ...rest }, ref) => { + return ( + + ); + }, +); + +const TextButton = forwardRef(({ className, ...props }, ref) => ( + // @ts-expect-error +