import React, { useMemo } from "react"; import { useTheme } from "../../../theme"; import { useCompTheme } from "../../../theme/hook"; import { deepMerge } from "../../helper/helperFunctions"; import { Icon } from "../../icons/Icon"; import { ReceiptStyles } from "./style"; import { MessageReceipt } from "../../constants/UIKitConstants"; /** * Props for the CometChatReceipt component. * * CometChatReceipt is a component used to display the status of a message using a custom symbol. * It returns an appropriate symbol depending on the message status and can be customized via style. * */ export interface CometChatReceiptInterface { /** * The message receipt object representing the status of the message. */ receipt?: MessageReceipt; /** * Custom styles to override or extend the default receipt styles. */ style?: Partial; } export const CometChatReceipt = (props: CometChatReceiptInterface) => { const theme = useTheme(); const compTheme = useCompTheme(); const { receipt, style = {} } = props; const receiptStyles = useMemo(() => { return deepMerge(theme.receiptStyles, compTheme.receiptStyles ?? {}, style); }, [theme.receiptStyles, style, compTheme.receiptStyles]); switch (receipt) { case "SENT": return ( ); case "DELIVERED": return ( ); case "READ": return ( ); case "ERROR": return ( ); case "WAIT": return ( ); } return null; };