diff --git a/client/src/pages/Join/states/Input/Input.jsx b/client/src/pages/Join/states/Input/Input.jsx new file mode 100644 index 0000000..5aeec0c --- /dev/null +++ b/client/src/pages/Join/states/Input/Input.jsx @@ -0,0 +1,52 @@ +import Button from "@/common/components/Button"; +import {faPaperPlane, faRightToBracket, faWarning} from "@fortawesome/free-solid-svg-icons"; +import {useEffect, useState} from "react"; +import {socket} from "@/common/utils/socket.js"; +import "./styles.sass"; +import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; + +export const Input = ({setState}) => { + + const [price, setPrice] = useState(1000); + const [amount, setAmount] = useState(10); + + const [error, setError] = useState(""); + + const submit = () => { + socket.emit("SUBMIT", {price, amount}, (data) => { + if (data) { + setState("waiting"); + } else { + setError("Inkorrekte Eingabe"); + } + }); + } + + useEffect(() => { + const timeout = setTimeout(() => { + setError(""); + }, 30000); + + return () => clearTimeout(timeout); + }, [error]); + + return ( + <> + {error &&
+ +

{error}

+
} +
+

Preis

+ setPrice(e.target.value)} value={price}/> +
+
+

Absatzmenge

+ setAmount(e.target.value)} value={amount}/> +
+