diff --git a/view/src/pages/Meeting/index.jsx b/view/src/pages/Meeting/index.jsx index d806811..e7e875c 100644 --- a/view/src/pages/Meeting/index.jsx +++ b/view/src/pages/Meeting/index.jsx @@ -6,6 +6,9 @@ function Meeting() { const [meetings, setMeetings] = useState([]); const [showPopup, setShowPopup] = useState(false); const [currentMeetingIndex, setCurrentMeetingIndex] = useState(null); + const [link, setLink] = useState(''); + const [descricao, setDescricao] = useState(''); + const [links, setLinks] = useState([]); const handleAddMeeting = () => { const newMeeting = { @@ -18,6 +21,7 @@ function Meeting() { ] }; setMeetings([...meetings, newMeeting]); + setLinks([...links, []]); // Adiciona uma nova lista vazia de links para a nova reunião }; const handleImageClick = (index) => { @@ -30,25 +34,6 @@ function Meeting() { setCurrentMeetingIndex(null); }; - const handleFileChange = (e) => { - const updatedMeetings = [...meetings]; - updatedMeetings[currentMeetingIndex].file = e.target.files[0]; - updatedMeetings[currentMeetingIndex].fileName = e.target.files[0].name; - setMeetings(updatedMeetings); - }; - - const handleFileSubmit = (e) => { - e.preventDefault(); - const updatedMeetings = [...meetings]; - const currentMeeting = updatedMeetings[currentMeetingIndex]; - if (currentMeeting.file && currentMeeting.fileName.trim() !== '') { - const dateAdded = new Date().toLocaleDateString(); - currentMeeting.files.push({ file: currentMeeting.file, fileName: currentMeeting.fileName, dateAdded }); - } - setShowPopup(false); - setMeetings(updatedMeetings); - }; - const handleRemoveFile = (meetingIndex, fileIndex) => { const updatedMeetings = [...meetings]; updatedMeetings[meetingIndex].files.splice(fileIndex, 1); @@ -62,6 +47,32 @@ function Meeting() { setMeetings(updatedMeetings); }; + const handleLinkChange = (e) => { + setLink(e.target.value); + }; + + const handleDescricaoChange = (e) => { + setDescricao(e.target.value); + }; + + const handleSubmit = (e) => { + e.preventDefault(); + if (link.trim() !== '' && descricao.trim() !== '') { + const updatedLinks = [...links]; + updatedLinks[currentMeetingIndex] = [...updatedLinks[currentMeetingIndex], { descricao, link }]; + setLinks(updatedLinks); + } + setShowPopup(false); + setLink(''); + setDescricao(''); + }; + + const handleRemoveLink = (meetingIndex, linkIndex) => { + const updatedLinks = [...links]; + updatedLinks[meetingIndex].splice(linkIndex, 1); + setLinks(updatedLinks); + }; + return ( <> @@ -89,6 +100,21 @@ function Meeting() { ))} +
+ {links[meetingIndex] && links[meetingIndex].map((link, index) => ( +
+

+ img-trash handleRemoveLink(meetingIndex, index)} + /> + {link.descricao} +

+
+ ))} +
@@ -116,30 +142,26 @@ function Meeting() { ))} {showPopup && ( -
+
- × -
+ + × +