mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
fix: stale compare indices
This commit is contained in:
1 parent
a2abfa7f85
commit
22faa6d294
2 files changed
+17
-18
No files matched your search
@@ -105,13 +105,13 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
crewSkills[skill] === 0
|
||||
? Var("gray-11")
|
||||
: permanentSkills.includes(skill)
|
||||
? Var("crimson-11")
|
||||
: Var("amber-11"),
|
||||
? Var("crimson-11")
|
||||
: Var("amber-11"),
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</Flex>
|
||||
)
|
||||
),
|
||||
)}
|
||||
</Flex>
|
||||
</Button>
|
||||
@@ -173,19 +173,19 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
consumables,
|
||||
camouflage,
|
||||
},
|
||||
index
|
||||
index,
|
||||
) => {
|
||||
const equipmentPreset =
|
||||
equipmentDefinitions.presets[tank.equipment_preset];
|
||||
const provisionsList = availableProvisions(
|
||||
tank,
|
||||
gun,
|
||||
provisionDefinitions
|
||||
provisionDefinitions,
|
||||
);
|
||||
const consumablesList = Object.values(
|
||||
consumableDefinitions.consumables
|
||||
consumableDefinitions.consumables,
|
||||
).filter((consumable) =>
|
||||
checkConsumableProvisionInclusivity(consumable, tank, gun)
|
||||
checkConsumableProvisionInclusivity(consumable, tank, gun),
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -294,11 +294,11 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
<img
|
||||
alt={unwrap(
|
||||
provisionDefinitions.provisions[provision]
|
||||
.name
|
||||
.name,
|
||||
)}
|
||||
key={provision}
|
||||
src={asset(
|
||||
`/icons/provisions/${provision}.webp`
|
||||
`/icons/provisions/${provision}.webp`,
|
||||
)}
|
||||
style={{
|
||||
left: "50%",
|
||||
@@ -335,7 +335,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
<Popover.Content>
|
||||
<ProvisionsManager
|
||||
provisions={provisionsList.map(
|
||||
(provision) => provision.id
|
||||
(provision) => provision.id,
|
||||
)}
|
||||
selected={provisions}
|
||||
disabled={tank.max_provisions === provisions.length}
|
||||
@@ -452,7 +452,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
CompareEphemeral.mutate((draft) => {
|
||||
draft.members[index].equipmentMatrix = times(
|
||||
3,
|
||||
() => times(3, () => 0)
|
||||
() => times(3, () => 0),
|
||||
) as EquipmentMatrix;
|
||||
draft.sorting = undefined;
|
||||
});
|
||||
@@ -501,11 +501,11 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
alt={unwrap(
|
||||
consumableDefinitions.consumables[
|
||||
consumable
|
||||
].name
|
||||
].name,
|
||||
)}
|
||||
key={consumable}
|
||||
src={asset(
|
||||
`/icons/consumables/${consumable}.webp`
|
||||
`/icons/consumables/${consumable}.webp`,
|
||||
)}
|
||||
style={{
|
||||
left: "50%",
|
||||
@@ -610,7 +610,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
</Flex>
|
||||
</Table.Cell>
|
||||
);
|
||||
}
|
||||
},
|
||||
)}
|
||||
</Table.Row>
|
||||
</Table.Body>
|
||||
|
||||
@@ -55,7 +55,7 @@ export function TankCard({ index, tank }: TankCardProps) {
|
||||
};
|
||||
});
|
||||
const closest = distances.reduce((a, b) =>
|
||||
a.distance < b.distance ? a : b
|
||||
a.distance < b.distance ? a : b,
|
||||
);
|
||||
|
||||
dropIndex = closest.index;
|
||||
@@ -85,8 +85,8 @@ export function TankCard({ index, tank }: TankCardProps) {
|
||||
CompareEphemeral.mutate((draft) => {
|
||||
const fromIndex = index;
|
||||
const toIndex = dropIndex > index ? dropIndex - 1 : dropIndex;
|
||||
|
||||
const member = draft.members[fromIndex];
|
||||
|
||||
draft.members.splice(fromIndex, 1);
|
||||
draft.members.splice(toIndex, 0, member);
|
||||
});
|
||||
@@ -99,7 +99,7 @@ export function TankCard({ index, tank }: TankCardProps) {
|
||||
return () => {
|
||||
draggable.current?.removeEventListener("pointerdown", handlePointerDown);
|
||||
};
|
||||
}, []);
|
||||
}, [index]);
|
||||
|
||||
return (
|
||||
<StickyColumnHeaderCell width="0">
|
||||
@@ -141,7 +141,6 @@ export function TankCard({ index, tank }: TankCardProps) {
|
||||
</Text>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
<InsertionMarker index={index + 1} />
|
||||
</StickyColumnHeaderCell>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user