Showing 11 of 11 total issues
Function LinkUserSheet
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function LinkUserSheet({ organizationId, open, setOpen, preSelectedUsername,
- Read upRead up
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
<div className="grid grid-cols-2 gap-4 pt-2 border-t border-gray-200"> <div> <span className="text-sm text-gray-500"> {t("username")} </span>
- Read upRead up
- Create a ticketCreate a ticket
Identical blocks of code found in 8 locations. Consider refactoring. Open
onError: (error) => { const errorData = error.cause as { errors: { msg: string }[] }; errorData.errors.forEach((er) => { toast.error(er.msg); });
- Read upRead up
- Create a ticketCreate a ticket
Identical blocks of code found in 2 locations. Consider refactoring. Open
<div className="w-3/4"> <p className="font-medium text-lg truncate"> {formatName(selectedUser)} </p> <span className="text-sm text-gray-500">
- Read upRead up
- Create a ticketCreate a ticket
Similar blocks of code found in 4 locations. Consider refactoring. Open
const { data: preSelectedUser } = useQuery({ queryKey: ["user", preSelectedUsername], queryFn: query(UserApi.get, { pathParams: { username: preSelectedUsername || "" }, }),
- Read upRead up
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
onSuccess: () => { queryClient.invalidateQueries({ queryKey: ["organizationUsers", organizationId], }); toast.success("User added to organization successfully");
- Read upRead up
- Create a ticketCreate a ticket
Similar blocks of code found in 3 locations. Consider refactoring. Open
const handleAddUser = () => { if (!selectedUser || !selectedRole) { toast.error("Please select both user and role"); return; }
- Read upRead up
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
<SheetTrigger asChild> <Button variant="primary_gradient"> <CareIcon icon="l-plus" className="mr-2 size-4" /> {t("link_user")} </Button>
- Read upRead up
- Create a ticketCreate a ticket
Similar blocks of code found in 14 locations. Consider refactoring. Open
<SheetHeader> <SheetTitle>{t("link_user_to_organization")}</SheetTitle> <SheetDescription> {t("link_user_to_organization_description")} </SheetDescription>
- Read upRead up
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
<Avatar name={`${selectedUser.first_name} ${selectedUser.last_name}`} imageUrl={selectedUser.profile_picture_url} className="size-12" />
- Read upRead up
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
<UserSelector selected={selectedUser} onChange={handleUserChange} placeholder={t("search_for_a_user")} noOptionsMessage={t("no_users_found")}
- Read upRead up
- Create a ticketCreate a ticket