diff --git a/frontend/src/components/AdminMemberManage/ProjectMemberManageForm.tsx b/frontend/src/components/AdminMemberManage/ProjectMemberManageForm.tsx index 443f3fb..c265792 100644 --- a/frontend/src/components/AdminMemberManage/ProjectMemberManageForm.tsx +++ b/frontend/src/components/AdminMemberManage/ProjectMemberManageForm.tsx @@ -1,9 +1,4 @@ import { useLocation } from 'react-router-dom'; -import { useForm } from 'react-hook-form'; -import { z } from 'zod'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { Form, FormControl, FormField, FormItem, FormMessage } from '../ui/form'; -import { Input } from '../ui/input'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select'; import useUpdateProjectMemberPrivilegeQuery from '@/queries/projects/useUpdateProjectMemberPrivilegeQuery'; import useRemoveProjectMemberQuery from '@/queries/projects/useRemoveProjectMemberQuery'; @@ -22,18 +17,6 @@ const roleToStr: { [key in Role]: string } = { NONE: '역할 없음', }; -const formSchema = z.object({ - members: z.array( - z.object({ - memberId: z.number(), - nickname: z.string().nonempty('닉네임을 입력하세요.'), - role: z.enum(roles as [Role, ...Role[]], { errorMap: () => ({ message: '역할을 선택해주세요.' }) }), - }) - ), -}); - -export type ProjectMemberManageFormValues = z.infer; - interface ProjectMemberManageFormProps { workspaceMembers: Array<{ memberId: number; nickname: string }>; } @@ -51,24 +34,6 @@ export default function ProjectMemberManageForm({ workspaceMembers }: ProjectMem const noRoleMembers = workspaceMembers.filter((wm) => !projectMembers.some((pm) => pm.memberId === wm.memberId)); - const form = useForm({ - resolver: zodResolver(formSchema), - defaultValues: { - members: [ - ...projectMembers.map((m) => ({ - memberId: m.memberId, - nickname: m.nickname, - role: m.privilegeType as Role, - })), - ...noRoleMembers.map((m) => ({ - memberId: m.memberId, - nickname: m.nickname, - role: 'NONE' as Role, - })), - ], - }, - }); - const handleRoleChange = (memberId: number, role: Role) => { if (role === 'NONE') { removeMember({ @@ -89,65 +54,36 @@ export default function ProjectMemberManageForm({ workspaceMembers }: ProjectMem }; return ( -
-
- {form.getValues('members').map((member, index) => ( -
- ( - - - - - - - )} - /> - - ( - - - - - - - )} - /> +
+ {[...projectMembers, ...noRoleMembers].map((member) => ( +
+ {member.nickname} +
+
- ))} -
- +
+ ))} +
); }