Commit 47d2ae3e authored by Balasuriya D.A.M.'s avatar Balasuriya D.A.M.

Send Message UI

parent a0d39bde
import { Box, IconButton, Text } from "@chakra-ui/react"; import { Box, FormControl, IconButton, Input, Spinner, Text } from "@chakra-ui/react";
import React from "react"; import React, { useState } from "react";
import { ChatState } from "../Context/ChatProvider"; import { ChatState } from "../Context/ChatProvider";
import { ArrowBackIcon } from "@chakra-ui/icons"; import { ArrowBackIcon } from "@chakra-ui/icons";
import { getSender, getSenderFull } from "../config/ChatLogics"; import { getSender, getSenderFull } from "../config/ChatLogics";
...@@ -9,8 +9,15 @@ import UpdateGroupChatModal from "./miscellaneous/UpdateGroupChatModal"; ...@@ -9,8 +9,15 @@ import UpdateGroupChatModal from "./miscellaneous/UpdateGroupChatModal";
const SingleChat = ({ fetchAgain, setFetchAgain }) => { const SingleChat = ({ fetchAgain, setFetchAgain }) => {
const [messages, setMessages] = useState([]);
const [loading, setLoading] = useState(false);
const [newMessage, setNewMessage] = useState();
const { user, selectedChat, setSelectedChat } = ChatState(); const { user, selectedChat, setSelectedChat } = ChatState();
const sendMessage = () => { };
const typingHandler = () => { };
return ( return (
<> <>
{selectedChat ? ( {selectedChat ? (
...@@ -56,7 +63,27 @@ const SingleChat = ({ fetchAgain, setFetchAgain }) => { ...@@ -56,7 +63,27 @@ const SingleChat = ({ fetchAgain, setFetchAgain }) => {
borderRadius="lg" borderRadius="lg"
overflowY="hidden" overflowY="hidden"
> >
{/* Messages Here */} {loading ? (
<Spinner
size="xl"
w={20}
h={20}
alignSelf="center"
margin="auto"
/>
) : (
<div>{/* Messages */ }</div>
)}
<FormControl onKeyDown={sendMessage} isRequired mt={3}>
<Input
variant="filled"
bg="E0E0E0"
placeholder="Enter a message.."
onChange={typingHandler}
value={newMessage}
/>
</FormControl>
</Box> </Box>
</> </>
) : ( ) : (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment