Skip to content

Commit

Permalink
fix : 직책관리페이지 정렬순서 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
oxomi committed May 23, 2024
1 parent d94b7ae commit 487fd39
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/pages/admin/DutyManage/Modal/ChangeRolePersonModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ const ChangeRolePersonModal = ({ open, toggleOpen, jobName, badgeImage }: Change

const options: { value: number; label: string; group: string }[] = [];
memberList?.forEach((data) => options.push({ value: data.memberId, label: data.realName, group: data.generation }));
const sortedOptions = options.sort((a, b) => (a.group > b.group ? 1 : -1));
const sortedOptions = options.sort((a, b) => {
const aGroup = parseFloat(a.group);
const bGroup = parseFloat(b.group);
if (aGroup !== bGroup) {
return aGroup - bGroup;
}
return a.label.localeCompare(b.label);
});

const [value, setValue] = useState<SingleAutoCompleteValue>(null);
const [prevInfo, setPrevInfo] = useState<{ value: number; label: string; group: string }>({
Expand Down

0 comments on commit 487fd39

Please sign in to comment.