mirror of
https://github.com/morbalint/kemkas.git
synced 2026-07-18 03:13:46 +00:00
[fe] [2e] add basic szintlepes
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import React from "react";
|
||||
import {GetFegyver} from "../domain-models/felszereles";
|
||||
import FegyverSelector from "./FegyverSelector";
|
||||
import {AllowedFegyver} from "../domain-models/allowed-fegyver";
|
||||
import {Osztaly2E} from "../domain-models/osztaly2E";
|
||||
|
||||
function HarcosFegyverSpecializacio(props: {
|
||||
specialization: string,
|
||||
existingSpecializations: (string | undefined)[],
|
||||
changeSpecialization: (specialization: string) => void
|
||||
szint: number
|
||||
}) {
|
||||
const {
|
||||
specialization,
|
||||
existingSpecializations,
|
||||
changeSpecialization,
|
||||
szint
|
||||
} = props
|
||||
const fegyver = GetFegyver(specialization)
|
||||
const availableFegyverek = AllowedFegyver(Osztaly2E.Harcos)
|
||||
const pickableFegyverek = availableFegyverek.filter(f => f.Id === specialization || existingSpecializations.filter(x => x === f.Id).length < (szint < 9 ? 1 : 2))
|
||||
|
||||
return <>
|
||||
<div className='row m-2'>
|
||||
<label className='col-md-2 col-sm-3 col-form-label' >Fegyver specializáció</label>
|
||||
<FegyverSelector fegyverek={pickableFegyverek} selectedId={specialization} onChange={changeSpecialization} />
|
||||
{fegyver == null && <span className='form-field-error'>Ismeretlen fegyver: {specialization}</span>}
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
|
||||
export default HarcosFegyverSpecializacio
|
||||
Reference in New Issue
Block a user