This commit is contained in:
louiscklaw
2025-06-08 19:08:45 +08:00
parent fca048074e
commit 84b223ff60
2 changed files with 17 additions and 15 deletions

View File

@@ -77,12 +77,12 @@ const Chat = () => {
const [toastMessage, setToastMessage] = useState("");
// Refs
const contentRef = useRef();
const contentRef = useRef(null);
const swiperRefs = useRef([]);
const textareaRef = useRef();
const sideRef = useRef();
const sendRef = useRef();
const replyToAnimationRef = useRef();
const textareaRef = useRef(null);
const sideRef = useRef(null);
const sendRef = useRef(null);
const replyToAnimationRef = useRef(null);
const actionSheetButtons = [
{
@@ -104,7 +104,7 @@ const Chat = () => {
icon: alertOutline,
handler: () =>
toaster(
"I haven't implemented unsend :) Simple store update though",
"I haven't implemented unsend :) Simple store update though"
),
},
{
@@ -165,11 +165,11 @@ const Chat = () => {
const chatMessageID = elementID.includes("chatText")
? parseInt(elementID.replace("chatText_", ""))
: elementID.includes("chatTime")
? parseInt(elementID.replace("chatTime_", ""))
: parseInt(elementID.replace("chatBubble_", ""));
? parseInt(elementID.replace("chatTime_", ""))
: parseInt(elementID.replace("chatBubble_", ""));
const chatMessage = chat.filter(
(message) => parseInt(message.id) === parseInt(chatMessageID),
(message) => parseInt(message.id) === parseInt(chatMessageID)
)[0];
setActionMessage(chatMessage);
@@ -278,7 +278,7 @@ const Chat = () => {
replyToMessage,
replyToMessage ? replyToMessage.id : false,
image,
imagePath,
imagePath
);
setMessage("");
@@ -329,7 +329,7 @@ const Chat = () => {
fill="clear"
onClick={() =>
toaster(
"As this is a UI only, video calling wouldn't work here.",
"As this is a UI only, video calling wouldn't work here."
)
}
>
@@ -352,7 +352,7 @@ const Chat = () => {
{chat.map((message, index) => {
const repliedMessage = chat.filter(
(subMessage) =>
parseInt(subMessage.id) === parseInt(message.replyID),
parseInt(subMessage.id) === parseInt(message.replyID)
)[0];
return (
@@ -360,7 +360,9 @@ const Chat = () => {
ref={(ref) => (swiperRefs.current[index] = ref)}
id={`chatBubble_${message.id}`}
key={index}
className={`chat-bubble ${message.sent ? "bubble-sent" : "bubble-received"}`}
className={`chat-bubble ${
message.sent ? "bubble-sent" : "bubble-received"
}`}
{...longPressEvent}
>
<div id={`chatText_${message.id}`}>

View File

@@ -22,7 +22,7 @@ import { useRef } from "react";
import ContactModal from "../components/ContactModal";
const Chats = () => {
const pageRef = useRef();
const pageRef = useRef(null);
const contacts = ContactStore.useState(getContacts);
const latestChats = ChatStore.useState(getChats);
@@ -43,7 +43,7 @@ const Chats = () => {
contacts
.filter((c) => c.id === chat.contact_id)[0]
.name.toLowerCase()
.includes(searchTermLower),
.includes(searchTermLower)
);
setResults(newResults);
} else {