+ cool ultimate team tool
+
+
>
);
}
diff --git a/src/Chemistry.tsx b/src/Chemistry.tsx
index 01074d7..8562a2e 100644
--- a/src/Chemistry.tsx
+++ b/src/Chemistry.tsx
@@ -1,5 +1,5 @@
import { useState } from "react";
-import { ReactSortable, ReactSortableProps } from "react-sortablejs";
+import { ReactSortable, ReactSortableProps, Sortable } from "react-sortablejs";
import api from "./api";
interface Player {
@@ -42,7 +42,7 @@ function PlayerList(props: PlayerListProps) {
);
}
-export default function Chemistry() {
+export function Chemistry() {
const players = loadPlayers();
const [user, setUser] = useState([]);
const [playersLeft, setPlayersLeft] = useState([]);
@@ -70,13 +70,26 @@ export default function Chemistry() {
return (
<>
-
-
cutt
- cool ultimate team tool
-
your name?
- {user.length < 1 && (
- drag your name here:
+ your name?
+ {user.length < 1 ? (
+ <>
+ drag your name here
+ >
+ ) : (
+ <>
+ {
+ let newMiddle = user.concat(playersMiddle);
+ setPlayersMiddle(newMiddle);
+ setUser([]);
+ }}
+ >
+ {" "}
+ ⟳
+
+
+ >
)}
😬
{playersLeft.length < 1 && (
- drag people here that you'd rather not play with
+ drag people here that you'd rather not play with from worst to ...
+ ok
)}
😍
{playersRight.length < 1 && (
- drag people here that you love playing with
+ drag people here that you love playing with from best to ... ok
)}
{dialog}
-
+ >
+ );
+}
+
+export function MVP() {
+ const players = loadPlayers();
+ const [user, setUser] = useState([]);
+ const [availablePlayers, setAvailablePlayers] = useState(players);
+ const [rankedPlayers, setRankedPlayers] = useState([]);
+
+ const [dialog, setDialog] = useState("dialog");
+
+ async function handleSubmit() {
+ const dialog = document.querySelector("dialog");
+ dialog?.showModal();
+ if (user.length < 1) {
+ setDialog("who are you?");
+ } else {
+ setDialog("sending...");
+ let _user = user.map(({ name }) => name)[0];
+ let mvps = rankedPlayers.map(({ name }) => name);
+ const data = { user: _user, rankedPlayers: mvps };
+ const response = await api("mvp", data);
+ response.ok ? setDialog("success!") : setDialog("try sending again");
+ }
+ }
+
+ return (
+ <>
+
+ {rankedPlayers.length < 1 && (
+
+ carefully place the{" "}
+
+ Most Valued Player
+ {" "}
+ (according to your humble opinion) in this box
+
+ )}
+
+