Enhance team member role management and localization updates
- Added a new SQL field to indicate pending invitations for team members, improving role management logic. - Updated the settings drawer component to display tooltips for roles that cannot be changed, enhancing user experience. - Introduced new localization entries for pending invitations and role change restrictions in English, Spanish, and Portuguese, ensuring consistency across languages.
This commit is contained in:
@@ -29,5 +29,7 @@
|
||||
"role": "Role",
|
||||
"owner": "Owner",
|
||||
"admin": "Admin",
|
||||
"member": "Member"
|
||||
"member": "Member",
|
||||
"cannotChangeOwnerRole": "Owner role cannot be changed",
|
||||
"pendingInvitation": "Pending invitation"
|
||||
}
|
||||
|
||||
@@ -29,5 +29,7 @@
|
||||
"role": "Rol",
|
||||
"owner": "Propietario",
|
||||
"admin": "Administrador",
|
||||
"member": "Miembro"
|
||||
"member": "Miembro",
|
||||
"cannotChangeOwnerRole": "El rol de Propietario no puede ser cambiado",
|
||||
"pendingInvitation": "Invitación pendiente"
|
||||
}
|
||||
|
||||
@@ -29,5 +29,7 @@
|
||||
"role": "Rol",
|
||||
"owner": "Propietario",
|
||||
"admin": "Administrador",
|
||||
"member": "Miembro"
|
||||
"member": "Miembro",
|
||||
"cannotChangeOwnerRole": "A função de Proprietário não pode ser alterada",
|
||||
"pendingInvitation": "Convite pendente"
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
Table,
|
||||
TableProps,
|
||||
Typography,
|
||||
Tooltip,
|
||||
} from 'antd';
|
||||
import React, { useState } from 'react';
|
||||
import { useAppDispatch } from '@/hooks/useAppDispatch';
|
||||
@@ -22,8 +23,6 @@ import {
|
||||
} from '@/types/admin-center/admin-center.types';
|
||||
import SingleAvatar from '@/components/common/single-avatar/single-avatar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API_BASE_URL } from '@/shared/constants';
|
||||
import apiClient from '@/api/api-client';
|
||||
|
||||
interface SettingTeamDrawerProps {
|
||||
teamId: string;
|
||||
@@ -126,15 +125,32 @@ const SettingTeamDrawer: React.FC<SettingTeamDrawerProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
const isDisabled = record.role_name === 'Owner' || record.pending_invitation;
|
||||
const tooltipTitle = record.role_name === 'Owner'
|
||||
? t('cannotChangeOwnerRole')
|
||||
: record.pending_invitation
|
||||
? t('pendingInvitation')
|
||||
: '';
|
||||
|
||||
const selectComponent = (
|
||||
<Select
|
||||
style={{ width: '150px', height: '32px' }}
|
||||
options={roleOptions}
|
||||
defaultValue={record.role_name || ''}
|
||||
disabled={isDisabled}
|
||||
onChange={handleRoleChange}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
style={{ width: '150px', height: '32px' }}
|
||||
options={roleOptions}
|
||||
defaultValue={record.role_name || ''}
|
||||
disabled={record.role_name === 'Owner'}
|
||||
onChange={handleRoleChange}
|
||||
/>
|
||||
{isDisabled ? (
|
||||
<Tooltip title={tooltipTitle}>
|
||||
{selectComponent}
|
||||
</Tooltip>
|
||||
) : (
|
||||
selectComponent
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -35,6 +35,7 @@ export interface IOrganizationTeamMember {
|
||||
role_id?: string;
|
||||
role_name?: string;
|
||||
created_at?: string;
|
||||
pending_invitation?: boolean;
|
||||
}
|
||||
|
||||
export interface IOrganizationTeam {
|
||||
|
||||
Reference in New Issue
Block a user