import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { useSelector } from 'react-redux'; import { injectIntl } from '@edx/frontend-platform/i18n'; import { logError } from '@edx/frontend-platform/logging'; import { Avatar, Icon, } from '@edx/paragon'; import { AvatarOutlineAndLabelColors, EndorsementStatus, ThreadType } from '../../../data/constants'; import { AuthorLabel } from '../../common'; import ActionsDropdown from '../../common/ActionsDropdown'; import { useAlertBannerVisible } from '../../data/hooks'; import { selectAuthorAvatars } from '../../posts/data/selectors'; import { useActions } from '../../utils'; import { commentShape } from './proptypes'; function CommentHeader({ comment, postType, actionHandlers, }) { const authorAvatars = useSelector(selectAuthorAvatars(comment.author)); const colorClass = AvatarOutlineAndLabelColors[comment.authorLabel]; const hasAnyAlert = useAlertBannerVisible(comment); const actions = useActions({ ...comment, postType, }); const actionIcons = actions.find(({ action }) => action === EndorsementStatus.ENDORSED); const handleIcons = (action) => { const actionFunction = actionHandlers[action]; if (actionFunction) { actionFunction(); } else { logError(`Unknown or unimplemented action ${action}`); } }; return (