add users and fix modal

This commit is contained in:
2026-02-12 19:10:50 +01:00
parent 1a98957466
commit fe27595931
18 changed files with 482 additions and 88 deletions

View File

@@ -0,0 +1,52 @@
import { ActionIcon, Table, Tooltip } from "@mantine/core";
import { t } from "@/config/i18n";
import { IconEdit, IconX } from "@tabler/icons-react";
import { type User, type UserInputs } from "@/services/resources/users";
import { UserModal } from "@/components/Users/Modal";
import { deleteUser, getUser } from "@/services/api";
import { useNavigate } from "react-router";
export type UserRowProps = {
user: User;
}
export default function UserRow({
user,
}: UserRowProps) {
const deleteMutation = deleteUser();
const navigate = useNavigate();
return (
<Table.Tr key={user.id}>
<Table.Td>{user.name}</Table.Td>
<Table.Td>{user.email}</Table.Td>
<Table.Td>
<Tooltip label={t("edit user", {capfirst: true})}>
<ActionIcon
size="sm"
mr="5"
onClick={(e) => {
e.stopPropagation();
navigate(`/dashboard/users/${user.id}/edit`);
}}
>
<IconEdit/>
</ActionIcon>
</Tooltip>
<Tooltip label={t("remove user", {capfirst: true})}>
<ActionIcon
color="red"
size="sm"
mr="5"
onClick={() => {
deleteMutation.mutate(user.id);
}}
>
<IconX/>
</ActionIcon>
</Tooltip>
</Table.Td>
</Table.Tr>
);
}