import React from 'react'; import CardBox from '../CardBox'; import ImageField from '../ImageField'; import dataFormatter from '../../helpers/dataFormatter'; import {saveFile} from "../../helpers/fileSaver"; import ListActionsPopover from "../ListActionsPopover"; import {useAppSelector} from "../../stores/hooks"; import {Pagination} from "../Pagination"; import LoadingSpinner from "../LoadingSpinner"; import Link from 'next/link'; import {hasPermission} from "../../helpers/userPermissions"; type Props = { messages: any[]; loading: boolean; onDelete: (id: string) => void; currentPage: number; numPages: number; onPageChange: (page: number) => void; }; const ListMessages = ({ messages, loading, onDelete, currentPage, numPages, onPageChange }: Props) => { const currentUser = useAppSelector((state) => state.auth.currentUser); const hasUpdatePermission = hasPermission(currentUser, 'UPDATE_MESSAGES') const corners = useAppSelector((state) => state.style.corners); const bgColor = useAppSelector((state) => state.style.cardsColor); return ( <>
Chat
{ dataFormatter.chatsOneListFormatter(item.chat) }
Sender
{ dataFormatter.usersOneListFormatter(item.sender) }
MessageType
{ item.message_type }
TextBody
{ item.text_body }
ImageAttachments
FileAttachments
{dataFormatter.filesFormatter(item.file_attachments).map(link => ( ))}LinkURL
{ item.link_url }
SentAt
{ dataFormatter.dateTimeFormatter(item.sent_at) }
ReadAt
{ dataFormatter.dateTimeFormatter(item.read_at) }
No data to display