Browse Source

Optimise suppression mech

DricomDragon 7 months ago
parent
commit
4e568c3cc5
2 changed files with 4 additions and 5 deletions
  1. 3 4
      dev-front/src/mech/squad/Member.tsx
  2. 1 1
      dev-front/src/mech/squad/Squad.tsx

+ 3 - 4
dev-front/src/mech/squad/Member.tsx

@@ -4,11 +4,10 @@ import Mech from '../../Mech';
 
 type MemberProps = {
     mech: Mech;
-    remover: (index: number) => void;
-    index: number;
+    remover: () => void;
 };
 
-function Member({mech, remover, index} : MemberProps) {
+function Member({mech, remover} : MemberProps) {
     return (
         <div className='mech-member'>
             <h3>{mech.name}</h3>
@@ -19,7 +18,7 @@ function Member({mech, remover, index} : MemberProps) {
                     <li>Health : {mech.health}</li>
                 </ul>
             </div>
-            <button onClick={event => remover(index)}>Remove</button>
+            <button onClick={event => remover()}>Remove</button>
         </div>
     )
 }

+ 1 - 1
dev-front/src/mech/squad/Squad.tsx

@@ -31,7 +31,7 @@ function Squad() {
             <h2>Custom squad</h2>
             <div className='mech-members'>
                 {squadMechs.map((m, index) => (
-                    <Member mech={m} remover={removeFromSquad} index={index}/>
+                    <Member mech={m} remover={() => removeFromSquad(index)}/>
                 ))}
             </div>
             <div className='squad-description'>