diff --git a/containers/react/src/components/Messages/AddSelectTag.jsx b/containers/react/src/components/Messages/AddSelectTag.jsx
index 07f6c70e..320bd040 100644
--- a/containers/react/src/components/Messages/AddSelectTag.jsx
+++ b/containers/react/src/components/Messages/AddSelectTag.jsx
@@ -1,7 +1,8 @@
import React, { useState } from "react";
import { Rank } from "../../DataBase/DataRank";
+import { GrAdd } from "react-icons/gr";
-const AddSelectTag = () => {
+function AddSelectTag ({number, array, new_name}) {
// const [selectCount, setSelectCount] = useState(0);
// const [selectValues, setSelectValues] = useState([]);
@@ -9,7 +10,11 @@ const AddSelectTag = () => {
// setSelectCount((selectCount) => selectCount + 1);
// setSelectCount((selectValues) =>[...selectValues, `select${selectCount + 1}`] );
// };
-
+ // function insertInArray (number, array, new_name) {
+ // return (
+ // array[number] = new_name
+ // );
+ // };
return (
{/*
@@ -21,15 +26,25 @@ const AddSelectTag = () => {
))}
*/}
- */}
+ {/* }> */}
+
+
+ {/*
{new_name}
*/}
+
+ {/* {number != 0 ? (
+
+ ) : ("")} */}
)
}
diff --git a/containers/react/src/components/Messages/Modal.jsx b/containers/react/src/components/Messages/Modal.jsx
index 02293aa9..1af38a66 100644
--- a/containers/react/src/components/Messages/Modal.jsx
+++ b/containers/react/src/components/Messages/Modal.jsx
@@ -25,27 +25,26 @@ const dropIn = {
const Modal = ({handleClose, text}) => {
const [multi, setMulti] = useState(false);
- // const addButton = document.getElementById('addButton');
- // const selectContainer = document.getElementById('selectContainer');
- // let selectCount = 0;
- // function addSelectTag(){
- // selectCount++;
- // const select = document.createElement('select');
- // select.name = `select${selectCount}`;
+ const [selectTags, setSelectTag] = useState([{ id: 1, selectedOption: ''}]);
+ const [selectedOptionArray, setSelectedOptionArray] = useState([]);
- // const opt1 = document.createElement('option');
- // opt1.value = 'opt1';
- // opt1.text = 'opt1';
+ const handleOptionChange = (selectId, selectedOption) => {
+ setSelectTag((prevTags) =>
+ prevTags.map((tag) =>
+ tag.id === selectId ? { ...tag, selectedOption } : tag
+ )
+ );
+ };
- // const opt2 = document.createElement('option');
- // opt2.value = 'opt2';
- // opt2.text = 'opt2';
+ const addNewSelectedTag = () => {
+ const newSelectedId = Math.max (...selectTags.map((tag) => tag.id)) + 1;
+ setSelectTag([...selectTags, { id: newSelectedId, selectedOption: ''}]);
+ };
- // select.appendChild(opt1);
- // select.appendChild(opt2);
-
- // selectContainer.appendChild(select);
- // }
+ const saveSelectedOptions = () => {
+ const selectedOptions = selectTags.map((tag) => tag.selectedOption);
+ setSelectedOptionArray(selectedOptions);
+ }
function try_me()
{
@@ -54,6 +53,10 @@ const Modal = ({handleClose, text}) => {
AddSelectTag();
}
}
+ let new_name;
+ let number;
+ let array;
+ // const [nickname, setNickname] = useState("");
return (
{
{/* Second selection */}
+ {selectTags.map((selectTag) =>(
+
-
+ handleOptionChange(selectTag.id, a.target.value)}>
{Rank.map((item, index) => {
return (
-
+ <>
+
+
+ >
)
})}
-
- {/* */}
- {/* addButton.addEventListener('click', addSelectTag); */}
- (try_me())}>
- {multi === true ? : " "}
+
+
+ ))
+ }
+ {/*
+ */}
+
+
Selected Option:
+
+ {selectedOptionArray.map((option, index) => (
+ - {option}
+ ))}
+
+
+
+ {/*
nickname = "{new_name}"
*/}
+ {multi === true ? (
+ //
+ ) : " "}
- Submit
+ Submit
Cancel