From d94b7ae861f5ec18e7f4c5f52e8dac2fe733e252 Mon Sep 17 00:00:00 2001 From: oxomi Date: Fri, 24 May 2024 00:39:41 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix=20:=20=ED=99=9C=EB=8F=99=EC=9D=B8?= =?UTF-8?q?=EC=9B=90=EA=B4=80=EB=A6=AC=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC=EC=88=9C=EC=84=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActiveMemberManage/Input/MemberTypeChangeInput.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx b/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx index 5c72accec..66ac2250a 100644 --- a/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx +++ b/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx @@ -15,7 +15,14 @@ const MemberTypeChangeInput = ({ }: MemberTypeChangeInputProps) => { 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); + }); return ( Date: Fri, 24 May 2024 00:45:04 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix=20:=20=EC=A7=81=EC=B1=85=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=A0=95=EB=A0=AC?= =?UTF-8?q?=EC=88=9C=EC=84=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/DutyManage/Modal/ChangeRolePersonModal.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pages/admin/DutyManage/Modal/ChangeRolePersonModal.tsx b/src/pages/admin/DutyManage/Modal/ChangeRolePersonModal.tsx index fb131af25..560fab0c6 100644 --- a/src/pages/admin/DutyManage/Modal/ChangeRolePersonModal.tsx +++ b/src/pages/admin/DutyManage/Modal/ChangeRolePersonModal.tsx @@ -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(null); const [prevInfo, setPrevInfo] = useState<{ value: number; label: string; group: string }>({ From e3f3b740280f320beaec8a7a028da1ffa54f66f7 Mon Sep 17 00:00:00 2001 From: oxomi Date: Mon, 3 Jun 2024 15:33:18 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix=20:=20=EA=B2=80=EC=83=89=EC=B0=BD=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC=EC=88=9C=EC=84=9C=20=EB=8B=A8=EC=B6=95=20?= =?UTF-8?q?=ED=8F=89=EA=B0=80=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 정렬 로직을 단축 평가를 활용하여 단순화 하였습니다. --- .../Input/MemberTypeChangeInput.tsx | 11 +++-------- .../admin/DutyManage/Modal/ChangeRolePersonModal.tsx | 11 +++-------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx b/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx index 66ac2250a..63c3356c4 100644 --- a/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx +++ b/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx @@ -15,14 +15,9 @@ const MemberTypeChangeInput = ({ }: MemberTypeChangeInputProps) => { 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) => { - const aGroup = parseFloat(a.group); - const bGroup = parseFloat(b.group); - if (aGroup !== bGroup) { - return aGroup - bGroup; - } - return a.label.localeCompare(b.label); - }); + const sortedOptions = options.sort( + (a, b) => parseFloat(a.group) - parseFloat(b.group) || a.label.localeCompare(b.label), + ); return ( options.push({ value: data.memberId, label: data.realName, group: data.generation })); - 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 sortedOptions = options.sort( + (a, b) => parseFloat(a.group) - parseFloat(b.group) || a.label.localeCompare(b.label), + ); const [value, setValue] = useState(null); const [prevInfo, setPrevInfo] = useState<{ value: number; label: string; group: string }>({