import dayjs from "dayjs"; import renderContent from "./Message/renderContent"; import Avatar from "./Avatar"; import { useAppSelector } from "../../app/store"; import { FC } from "react"; import { PinnedMessage } from "../../types/channel"; import { normalizeFileMessage } from "../utils"; import { MessagePayload } from "../../app/slices/message"; interface Props { data: PinnedMessage } const PinnedMessageView: FC = ({ data }) => { const { usersData } = useAppSelector((store) => { return { usersData: store.users.byId }; }); const { created_by = 0 } = data; const normalized = normalizeFileMessage(data as MessagePayload) || {}; console.log("nnnn", normalized); const { created_at, content_type, content, properties, thumbnail = "" } = { ...data, ...normalized }; const { name, avatar } = usersData[created_by] ?? {}; return (
{name}
{renderContent({ content_type, content, thumbnail, from_uid: created_by, properties })}
); }; export default PinnedMessageView;