diff --git a/src/components/FajSelector.tsx b/src/components/FajSelector.tsx
new file mode 100644
index 0000000..028f1c9
--- /dev/null
+++ b/src/components/FajSelector.tsx
@@ -0,0 +1,31 @@
+import React from "react";
+import {Faj, FajLabel} from "../domain-models/faj";
+import {UseFormRegisterReturn} from "react-hook-form";
+
+function FajSelector(props: {register: () => UseFormRegisterReturn}) {
+ const {register} = props
+ return
+
+
+
+}
+
+export default FajSelector
\ No newline at end of file
diff --git a/src/components/TulajdonsagInput.tsx b/src/components/TulajdonsagInput.tsx
index 540cce4..557ecca 100644
--- a/src/components/TulajdonsagInput.tsx
+++ b/src/components/TulajdonsagInput.tsx
@@ -18,8 +18,18 @@ function TulajdonsagInput(props: {
fajiModosito: (faj: Faj) => number,
register: () => any,
getCurrentValue: () => number
+ tooLowError: string,
+ tooHighError: string
}) {
- const {tulajdonsag, register, currentFaj, getCurrentValue, fajiModosito} = props;
+ const {
+ tulajdonsag,
+ register,
+ currentFaj,
+ getCurrentValue,
+ fajiModosito,
+ tooLowError,
+ tooHighError,
+ } = props;
return (
@@ -35,9 +45,9 @@ function TulajdonsagInput(props: {
Módosító: { SignedNumberToText(Modifier(getCurrentValue() + fajiModosito(currentFaj()))) }
{getCurrentValue() < 3 && (
- Túl gyenge vagy, nem bírtad felemelni a kezed a jelentkezéshez!)}
+ {tooLowError})}
{getCurrentValue() > 18 && (
- Szét szakadtak az izmaid!)}
+ {tooHighError})}
)
}
diff --git a/src/components/Tulajdonsagok.tsx b/src/components/Tulajdonsagok.tsx
new file mode 100644
index 0000000..29b7689
--- /dev/null
+++ b/src/components/Tulajdonsagok.tsx
@@ -0,0 +1,87 @@
+import React from "react";
+import {RollAllAbilities, Tulajdonsag, TulajdonsagModositokFajokra} from "../domain-models/tulajdonsag";
+import TulajdonsagInput from "./TulajdonsagInput";
+import {Faj} from "../domain-models/faj";
+import {FieldValues, UseFormRegister} from "react-hook-form";
+
+const tulajdonsagDefaultOptions = {
+ required: true,
+ min: 3,
+ max: 18,
+};
+
+function Tulajdonsagok(props: {
+ currentFaj: () => Faj,
+ watch: (name: string, defaultValue: any) => any
+ setValue: (name: string, value: any) => void
+ register: UseFormRegister
+}) {
+ const {currentFaj, watch, setValue, register} = props
+ return <>
+
+
Tulajdonságok
+
+
+
+
+ Number(watch(Tulajdonsag.Ero, 10))}
+ currentFaj={currentFaj}
+ fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Ero)}
+ register={() => register(Tulajdonsag.Ero, tulajdonsagDefaultOptions)}
+ tooLowError='Túl gyenge vagy, nem bírtad felemelni a kezed a jelentkezéshez!'
+ tooHighError='Szét szakadtak az izmaid!'
+ />
+ Number(watch(Tulajdonsag.Ugyesseg, 10))}
+ currentFaj={currentFaj}
+ fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Ugyesseg)}
+ register={() => register(Tulajdonsag.Ugyesseg, tulajdonsagDefaultOptions)}
+ tooLowError='Orrabuktál jelentkezés helyett!'
+ tooHighError='Emberfeletti zsonglörködésedre záptojással válaszoltak a helyiek!'
+ />
+ Number(watch(Tulajdonsag.Egeszseg, 10))}
+ currentFaj={currentFaj}
+ fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Egeszseg)}
+ register={() => register(Tulajdonsag.Egeszseg, tulajdonsagDefaultOptions)}
+ tooLowError='Túl beteg vagy ahhoz, hogy kalandozni menj!'
+ tooHighError='Kicsattanó egészségedet csak a diambroid állíthatja meg, minő véletlen, hogy pont az arcodba robbant...'
+ />
+ Number(watch(Tulajdonsag.Intelligencia, 10))}
+ currentFaj={currentFaj}
+ fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Intelligencia)}
+ register={() => register(Tulajdonsag.Intelligencia, tulajdonsagDefaultOptions)}
+ tooLowError='Elfelejtetted, hogy mikor is kéne kalandozni indulni!'
+ tooHighError='Ilyen tudás és logika birtokában mi szükséged van új információkra? Mindent le tudsz vezetni a már meglévő ismereteidből, és ezt azonnal beláttad.'
+ />
+ Number(watch(Tulajdonsag.Bolcsesseg, 10))}
+ currentFaj={currentFaj}
+ fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Bolcsesseg)}
+ register={() => register(Tulajdonsag.Bolcsesseg, tulajdonsagDefaultOptions)}
+ tooLowError='Nem bírtál ellenállni a kíváncsiságodnak, hogy közelebbről is megvizsgáld a tőr hegyét. Nagyon közelről.'
+ tooHighError='Hatalmas bölcsességedben beláttad a kalandozás veszélyeit és inkább más tevékenységbe fogtál.'
+ />
+ Number(watch(Tulajdonsag.Karizma, 10))}
+ currentFaj={currentFaj}
+ fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Karizma)}
+ register={() => register(Tulajdonsag.Karizma, tulajdonsagDefaultOptions)}
+ tooLowError='Mintha taszítanád az embereket, sose sikerült kalandozó csapatot találnod.'
+ tooHighError='Az ellenkező nem tagjai nem engedték, hogy útnak indulj.'
+ />
+
+ >
+}
+
+export default Tulajdonsagok
\ No newline at end of file
diff --git a/src/pages/CreateCharacter.tsx b/src/pages/CreateCharacter.tsx
index 03c54c9..a6f9a66 100644
--- a/src/pages/CreateCharacter.tsx
+++ b/src/pages/CreateCharacter.tsx
@@ -2,7 +2,6 @@ import React from 'react';
import './CreateCharacter.css'
import {useForm} from "react-hook-form";
import {Faj, FajDescription, FajLabel, FajSpecials} from "../domain-models/faj";
-import {RollAllAbilities, Tulajdonsag, TulajdonsagModositokFajokra} from "../domain-models/tulajdonsag";
import {
Osztaly,
OsztalyDescription,
@@ -10,13 +9,8 @@ import {
OsztalyProperties,
OsztalySpecialSkills
} from "../domain-models/osztaly"
-import TulajdonsagInput from "../components/TulajdonsagInput";
-
-const tulajdonsagDefaultOptions = {
- required: true,
- min: 3,
- max: 18,
-};
+import FajSelector from "../components/FajSelector";
+import Tulajdonsagok from "../components/Tulajdonsagok";
function CreateCharacterPage() {
const {
@@ -48,28 +42,7 @@ function CreateCharacterPage() {
defaultValue='Névtelen Kalandozó' {...register('nev', {required: true})} />
{errors.nev && A karaktered nem mászkálhat névtelenül a világban!}
-
-
-
-
+ register('faj', {required: true})} />
@@ -82,56 +55,7 @@ function CreateCharacterPage() {
-
-
Tulajdonságok
-
-
-
-
- Number(watch(Tulajdonsag.Ero, 10))}
- currentFaj={currentFaj}
- fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Ero)}
- register={() => register(Tulajdonsag.Ero, tulajdonsagDefaultOptions)}
- />
- Number(watch(Tulajdonsag.Ugyesseg, 10))}
- currentFaj={currentFaj}
- fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Ugyesseg)}
- register={() => register(Tulajdonsag.Ugyesseg, tulajdonsagDefaultOptions)}
- />
- Number(watch(Tulajdonsag.Egeszseg, 10))}
- currentFaj={currentFaj}
- fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Egeszseg)}
- register={() => register(Tulajdonsag.Egeszseg, tulajdonsagDefaultOptions)}
- />
- Number(watch(Tulajdonsag.Intelligencia, 10))}
- currentFaj={currentFaj}
- fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Intelligencia)}
- register={() => register(Tulajdonsag.Intelligencia, tulajdonsagDefaultOptions)}
- />
- Number(watch(Tulajdonsag.Bolcsesseg, 10))}
- currentFaj={currentFaj}
- fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Bolcsesseg)}
- register={() => register(Tulajdonsag.Bolcsesseg, tulajdonsagDefaultOptions)}
- />
- Number(watch(Tulajdonsag.Karizma, 10))}
- currentFaj={currentFaj}
- fajiModosito={TulajdonsagModositokFajokra(Tulajdonsag.Karizma)}
- register={() => register(Tulajdonsag.Karizma, tulajdonsagDefaultOptions)}
- />
+
Tanult