"use strict";

import React, { useState } from 'react';
import { LastRoomMessageContainer, LastRoomMessageName, LastRoomMessageText } from './StyledRoomComponents';
import { FileIcon } from '../../../assets/icons';
import { Image, View } from 'react-native';
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
const fallbackImage = 'https://as2.ftcdn.net/v2/jpg/02/51/95/53/1000_F_251955356_FAQH0U1y1TZw3ZcdPGybwUkH90a3VAhb.jpg';
const LastMessageFile = ({
  user,
  originalName,
  locationPreview
}) => {
  const [imgSrc, setImgSrc] = useState(locationPreview);
  return /*#__PURE__*/_jsxs(LastRoomMessageContainer, {
    children: [/*#__PURE__*/_jsxs(LastRoomMessageName, {
      children: [user?.name || '', ":"]
    }), /*#__PURE__*/_jsxs(View, {
      style: {
        display: 'flex',
        flexDirection: 'row',
        gap: '4px'
      },
      children: [imgSrc ? /*#__PURE__*/_jsx(Image, {
        source: {
          uri: imgSrc
        },
        style: {
          borderRadius: 16,
          width: 20,
          height: 20
        },
        onError: () => setImgSrc(fallbackImage)
      }) : /*#__PURE__*/_jsx(FileIcon, {
        style: {
          width: '20px',
          height: '20px'
        }
      }), /*#__PURE__*/_jsx(LastRoomMessageText, {
        children: originalName || 'file'
      })]
    })]
  });
};
export default LastMessageFile;
//# sourceMappingURL=LastMessageFile.js.map