From 043d4d4c488e470779126d0b3d83fe5b27a4f16c Mon Sep 17 00:00:00 2001 From: Giacomo Folli <119410424+giacomo-folli@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:25:23 +0200 Subject: [PATCH] fix errors --- .../src/components/messages/FileMessage.jsx | 85 +++++++++++++------ .../src/components/sidebar/SearchInput.jsx | 16 ---- frontend/src/context/SocketContext.jsx | 4 +- 3 files changed, 60 insertions(+), 45 deletions(-) diff --git a/frontend/src/components/messages/FileMessage.jsx b/frontend/src/components/messages/FileMessage.jsx index 41f895d..eb3778c 100644 --- a/frontend/src/components/messages/FileMessage.jsx +++ b/frontend/src/components/messages/FileMessage.jsx @@ -8,7 +8,64 @@ const FileMessage = ({ isGroup, fromMe, }) => { - return message.type.split("/")[0] == "image" ? ( + const messageType = message.type; + console.log(messageType); + return messageType == "audio/mpeg" ? ( + + ) : ( + + ); +}; + +const AudioFile = ({ message, isGroup, fromMe, chatClassName }) => { + return ( +
+
+
+ user avatar +
+
+
+ +
+ {extractTime(message.createdAt)} + + {isGroup && !fromMe ? message.senderId.fullName : ""} + +
+
+
+ ); +}; + +const ImageOrPDFFile = ({ + message, + isGroup, + fromMe, + chatClassName, + bubbleBgColor, +}) => { + return (
@@ -46,32 +103,6 @@ const FileMessage = ({
- ) : ( -
-
-
- user avatar -
-
-
- -
- {extractTime(message.createdAt)} - - {isGroup && !fromMe ? message.senderId.fullName : ""} - -
-
-
); }; diff --git a/frontend/src/components/sidebar/SearchInput.jsx b/frontend/src/components/sidebar/SearchInput.jsx index 35f6f13..7ed7652 100644 --- a/frontend/src/components/sidebar/SearchInput.jsx +++ b/frontend/src/components/sidebar/SearchInput.jsx @@ -1,5 +1,4 @@ import { useState } from "react"; -import { IoSearchSharp } from "react-icons/io5"; import { FaPlus } from "react-icons/fa6"; import { useAuthContext } from "../../context/AuthContext"; import useGetUsers from "../../hooks/useGetUsers"; @@ -39,21 +38,6 @@ const SearchInput = ({ dialogOpen, setDialogOpen }) => { return ( <>
-
- setSearch(e.target.value)} - /> - -