From a77ff1a638b97add631ea1187b48ec58870614ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:51:16 -0500 Subject: [PATCH] fix: pen 0 decimals --- src/app/tools/compare/page.tsx | 76 +++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/src/app/tools/compare/page.tsx b/src/app/tools/compare/page.tsx index 130c043e6..c796c222d 100644 --- a/src/app/tools/compare/page.tsx +++ b/src/app/tools/compare/page.tsx @@ -345,7 +345,7 @@ export default function Page() { - {members.map(({ equipmentMatrix, tank }) => { + {members.map(({ equipmentMatrix, tank }, index) => { const equipmentRows = awaitedEquipmentDefinitions.presets[tank.equipment]; @@ -430,21 +430,26 @@ export default function Page() { ] === -1 } onClick={() => { - // mutateDuel((draft) => { - // if ( - // equipmentMatrix[rowIndex][ - // columnIndex - // ] === -1 - // ) { - // draft.protagonist!.equipmentMatrix[ - // rowIndex - // ][columnIndex] = 0; - // } else { - // draft.protagonist!.equipmentMatrix[ - // rowIndex - // ][columnIndex] = -1; - // } - // }); + mutateCompareTemporary((draft) => { + if ( + draft.members[index] + .equipmentMatrix[rowIndex][ + columnIndex + ] === -1 + ) { + draft.members[ + index + ].equipmentMatrix[rowIndex][ + columnIndex + ] = 0; + } else { + draft.members[ + index + ].equipmentMatrix[rowIndex][ + columnIndex + ] = -1; + } + }); }} /> { - // mutateDuel((draft) => { - // if ( - // equipmentMatrix[rowIndex][ - // columnIndex - // ] === 1 - // ) { - // draft.protagonist!.equipmentMatrix[ - // rowIndex - // ][columnIndex] = 0; - // } else { - // draft.protagonist!.equipmentMatrix[ - // rowIndex - // ][columnIndex] = 1; - // } - // }); + mutateCompareTemporary((draft) => { + if ( + draft.members[index] + .equipmentMatrix[rowIndex][ + columnIndex + ] === 1 + ) { + draft.members[ + index + ].equipmentMatrix[rowIndex][ + columnIndex + ] = 0; + } else { + draft.members[ + index + ].equipmentMatrix[rowIndex][ + columnIndex + ] = 1; + } + }); }} /> @@ -516,8 +526,8 @@ export default function Page() { decimals={2} /> )} - - + +