AdminUserListHeader.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { AddButton } from "../../common/AddButton";
  2. import { TableCell, TableRow, TableSortLabel } from "@mui/material";
  3. import { useNavigate } from "react-router-dom";
  4. const AdminUserListHeader = ({ onSortChange, sort }) => {
  5. const navigate = useNavigate();
  6. return (
  7. <TableRow className="AdminUserListHeader">
  8. <TableCell scope="col">
  9. <TableSortLabel
  10. active={sort === "_id" || sort === "-_id"}
  11. direction={sort === "_id" ? "asc" : "desc"}
  12. onClick={() => onSortChange(sort === "_id" ? "-_id" : "_id")}
  13. >
  14. #
  15. </TableSortLabel>
  16. </TableCell>
  17. <TableCell scope="col">Аватар</TableCell>
  18. <TableCell scope="col">
  19. <TableSortLabel
  20. active={sort === "username" || sort === "-username"}
  21. direction={sort === "username" ? "asc" : "desc"}
  22. onClick={() => onSortChange(sort === "username" ? "-username" : "username")}
  23. >
  24. Username
  25. </TableSortLabel>
  26. </TableCell>
  27. <TableCell scope="col">
  28. <TableSortLabel
  29. active={sort === "is_active" || sort === "-is_active"}
  30. direction={sort === "is_active" ? "asc" : "desc"}
  31. onClick={() => onSortChange(sort === "is_active" ? "-is_active" : "is_active")}
  32. >
  33. Активний
  34. </TableSortLabel>
  35. </TableCell>
  36. <TableCell scope="col">
  37. <TableSortLabel
  38. active={sort === "is_superuser" || sort === "-is_superuser"}
  39. direction={sort === "is_superuser" ? "asc" : "desc"}
  40. onClick={() => onSortChange(sort === "is_superuser" ? "-is_superuser" : "is_superuser")}
  41. >
  42. Адміністратор
  43. </TableSortLabel>
  44. </TableCell>
  45. <TableCell scope="col">
  46. <AddButton
  47. onClick={() => {
  48. navigate("/admin/user/");
  49. }}
  50. />
  51. </TableCell>
  52. </TableRow>
  53. );
  54. };
  55. export { AdminUserListHeader };