diff --git a/src/frontend/apps/desk/src/features/members/components/ChooseRole.tsx b/src/frontend/apps/desk/src/features/members/components/ChooseRole.tsx
new file mode 100644
index 0000000..e3be723
--- /dev/null
+++ b/src/frontend/apps/desk/src/features/members/components/ChooseRole.tsx
@@ -0,0 +1,49 @@
+import { Radio, RadioGroup } from '@openfun/cunningham-react';
+import { useTranslation } from 'react-i18next';
+
+import { Role } from '..';
+
+interface ChooseRoleProps {
+ currentRole: Role;
+ disabled: boolean;
+ defaultRole: Role;
+ setRole: (role: Role) => void;
+}
+
+export const ChooseRole = ({
+ defaultRole,
+ disabled,
+ currentRole,
+ setRole,
+}: ChooseRoleProps) => {
+ const { t } = useTranslation();
+
+ return (
+
+ setRole(evt.target.value as Role)}
+ defaultChecked={defaultRole === Role.ADMIN}
+ disabled={disabled}
+ />
+ setRole(evt.target.value as Role)}
+ defaultChecked={defaultRole === Role.MEMBER}
+ disabled={disabled}
+ />
+ setRole(evt.target.value as Role)}
+ defaultChecked={defaultRole === Role.OWNER}
+ disabled={disabled || currentRole !== Role.OWNER}
+ />
+
+ );
+};
diff --git a/src/frontend/apps/desk/src/features/members/components/ModalRole.tsx b/src/frontend/apps/desk/src/features/members/components/ModalRole.tsx
index ee23d14..8e7c051 100644
--- a/src/frontend/apps/desk/src/features/members/components/ModalRole.tsx
+++ b/src/frontend/apps/desk/src/features/members/components/ModalRole.tsx
@@ -2,13 +2,11 @@ import {
Button,
Modal,
ModalSize,
- Radio,
- RadioGroup,
VariantType,
useToastProvider,
} from '@openfun/cunningham-react';
-import { t } from 'i18next';
import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { Box, Text, TextErrors } from '@/components';
import { useAuthStore } from '@/features/auth';
@@ -16,6 +14,8 @@ import { useAuthStore } from '@/features/auth';
import { useUpdateTeamAccess } from '../api/useUpdateTeamAccess';
import { Access, Role } from '../types';
+import { ChooseRole } from './ChooseRole';
+
interface ModalRoleProps {
access: Access;
currentRole: Role;
@@ -29,6 +29,7 @@ export const ModalRole = ({
onClose,
teamId,
}: ModalRoleProps) => {
+ const { t } = useTranslation();
const [localRole, setLocalRole] = useState(access.role);
const { userData } = useAuthStore();
const { toast } = useToastProvider();
@@ -109,32 +110,12 @@ export const ModalRole = ({
)}
-
- setLocalRole(evt.target.value as Role)}
- defaultChecked={access.role === Role.ADMIN}
- disabled={isNotAllowed}
- />
- setLocalRole(evt.target.value as Role)}
- defaultChecked={access.role === Role.MEMBER}
- disabled={isNotAllowed}
- />
- setLocalRole(evt.target.value as Role)}
- defaultChecked={access.role === Role.OWNER}
- disabled={isNotAllowed || currentRole !== Role.OWNER}
- />
-
+
);