import React, { useEffect, useState } from "react"; import { connect } from "react-redux"; import { actionFullChatList, actionChatsCount } from "../actions"; import { backURL } from "../constants"; import { Link } from "react-router-dom"; import { AvatarStub, color } from "../components/AvatarStub"; const ChatsAside = ({ chats = [], auth, ownerChats }) => { const [chatBlock, setChatBlock] = useState(0); useEffect(() => { const userId = auth.payload?.sub?.id; if (userId) { ownerChats(userId); } return function cleanUp() {}; }, [chatBlock]); return ( <>
{chat.lastMessage?.text.length > parseInt("30") ? chat.lastMessage?.text.substr( 0, 30 ) + "..." : chat.lastMessage?.text.substr( 0, 30 )}