diff --git a/client/public/img/imagine26/activityImages/send.png b/client/public/img/imagine26/activityImages/send.png new file mode 100644 index 000000000..5fe69bbba Binary files /dev/null and b/client/public/img/imagine26/activityImages/send.png differ diff --git a/client/public/img/imagine26/activityImages/user-2.png b/client/public/img/imagine26/activityImages/user-2.png new file mode 100644 index 000000000..2be4f0354 Binary files /dev/null and b/client/public/img/imagine26/activityImages/user-2.png differ diff --git a/client/public/img/imagine26/activityImages/user.png b/client/public/img/imagine26/activityImages/user.png new file mode 100644 index 000000000..0bb0465af Binary files /dev/null and b/client/public/img/imagine26/activityImages/user.png differ diff --git a/client/src/components/all-components/imagine-components/Chat.js b/client/src/components/all-components/imagine-components/Chat.js new file mode 100644 index 000000000..774392889 --- /dev/null +++ b/client/src/components/all-components/imagine-components/Chat.js @@ -0,0 +1,104 @@ + +import React, { useState , useEffect} from "react"; +import PropTypes from "prop-types"; +import "./chatStyle.css" + +export const ChatComponent = (props) =>{ + const {onSubmit,height,width,teammateMessage} = props + const [reply,setReply] = useState("") + const [showReply,setShowReply] = useState(false) + const [isDisabled,setIsDisabled] = useState(false) + const [inputValue,setInputValue] = useState("") + const [time,setTime] = useState(new Date()) + + //logging the group to check that the correct chat is rendered + const onHandle = (e) =>{ + const value = e.target.value + setInputValue(value) + setShowReply(false) + } + + useEffect(()=>{ + const timer = setInterval(() => { + setTime(new Date()); + }, 1000); + return () => clearInterval(timer); + },[]) + + const submit = async (e) =>{ + e.preventDefault(); + if (inputValue.trim().length > 0) { + const reply = inputValue + setReply(reply) + setShowReply(true); + setIsDisabled(true) + setInputValue("") + await onSubmit(reply) + } + } + + const actualTime = time.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); + + + return ( + <> +
+
+
+
+ profile +
+
+ Teammate + {actualTime} +
+

+ {teammateMessage || "add a message"} +

+
+
+ + {showReply && ( +
+ profile +
+
+ You + {actualTime} +
+

{reply}

+
+
+ )} +
+
+
+ + +
+
+
+
+ +) +} + +ChatComponent.propTypes = { + onSubmit: PropTypes.func.isRequired, + width: PropTypes.string.isRequired, + height:PropTypes.string.isRequired, + teammateMessage: PropTypes.string.isRequired +}; + diff --git a/client/src/components/all-components/imagine-components/chatStyle.css b/client/src/components/all-components/imagine-components/chatStyle.css new file mode 100644 index 000000000..eb82c1956 --- /dev/null +++ b/client/src/components/all-components/imagine-components/chatStyle.css @@ -0,0 +1,125 @@ +.chat-container { + margin-left: auto; + margin-right: auto; + margin-top: 2.5rem; +} + +.inner-chat-container { + width: 100%; + height: 100%; + background-color: white; + border-style: solid; + border-width: 0.4rem; + border-top-color: #0d28bc; + border-right-color: #0d28bc; + border-bottom-color: #ffc334 ; + border-left-color: #ffc334; + border-radius: 0.5rem; + padding: 1rem; + display: flex; + flex-direction: column; +} + +.messages { + display: flex; + flex-direction: column; + overflow-y:auto; + flex:1; + padding-top: 1rem; +} + +.teammateMessagesContainer, +.userMessageContainer { + display: flex; + flex-direction: row; + align-items: flex-start; + padding: 0.75rem 1.5rem; + transition: background-color 0.2s; +} + + +.user-image { + width: 2.5rem; + height: 2.5rem; + display: flex; + align-items: center; + justify-content: center; +} + +.message-content{ + margin-left: 1rem; + display: flex; + flex-direction: column; + align-items: flex-start; +} + +.message-header { + display: flex; + align-items: baseline; + gap: 0.5rem; +} + +.username { + font-size: 0.875rem; + font-weight: 800; + color: #0d28bc; +} + +.time { + font-size: 10px; + color: #94a3b8; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; +} + +.message-text { + font-size: 1rem; + color: #334155; + font-weight: 500; + margin: 0; + text-align: left; +} + +.input-form { + left: 2rem; + right: 2rem; + padding-bottom: 1rem; +} + +.input-container { + position: relative; + display: flex; + align-items: center; +} + +.chat-input { + width: 100%; + border: 2px solid #e2e8f0; + border-radius: 0.5rem; + padding: 0.75rem; + padding-right: 3rem; + font-weight: 600; + overflow-y: auto; + resize: none; + height: 50px; +} + +.send-button { + position: absolute; + right: 0.5rem; + background: transparent; + border: none; + padding-right: 0.5rem; + cursor: pointer; +} + +.send-button:disabled { + opacity: 0.5; + cursor: not-allowed; +} + +.send-icon { + width: 1.75rem; + height: 1.75rem; +} \ No newline at end of file