@botonic/react
Version:
Build Chatbots using React
17 lines • 1.29 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useContext } from 'react';
import { SENDERS } from '../../index-types';
import { WebchatContext } from '../../webchat/context';
import { MessageFeedback } from './message-feedback';
import { MessageFooterContainer } from './styles';
import { MessageTimestamp, resolveMessageTimestamps } from './timestamps';
export const MessageFooter = ({ enabletimestamps, messageJSON, sentBy, feedbackEnabled, inferenceId, botInteractionId, }) => {
const { getThemeProperty } = useContext(WebchatContext);
const { timestampsEnabled, timestampStyle } = resolveMessageTimestamps(getThemeProperty, enabletimestamps);
const isSentByUser = sentBy === SENDERS.user;
const messageFooterClass = isSentByUser
? 'message-footer-user'
: 'message-footer-bot';
return (_jsxs(MessageFooterContainer, Object.assign({ className: messageFooterClass, isSentByUser: isSentByUser }, { children: [timestampsEnabled ? (_jsx(MessageTimestamp, { sentBy: sentBy, style: timestampStyle, timestamp: messageJSON.timestamp })) : null, feedbackEnabled ? (_jsx(MessageFeedback, { inferenceId: inferenceId, messageId: messageJSON.id, botInteractionId: botInteractionId })) : null] })));
};
//# sourceMappingURL=message-footer.js.map