import e from"@babel/runtime/helpers/defineProperty";import t from"classnames";import i from"moment";import{uniq as n,uniqBy as o}from"lodash";import{makeStyles as r,useTheme as m,IconButton as a}from"@material-ui/core";import s from"@material-ui/icons/ThumbUp";import l from"@material-ui/icons/Comment";import{notifyOpenFeedCommentInput as c}from"../../../utils/nativeMessages.js";import{isNativeDetected as u}from"../../../utils/mobileDetect.js";import p from"../../CommentsInfo/index.js";import d from"../../../utils/main.js";import{jsx as f,jsxs as g}from"react/jsx-runtime";var C=r({reactionButton:{padding:8},reactions:{minHeight:48,marginTop:5,display:"flex",alignItems:"center",padding:"8px 16px 8px 24px",flexWrap:"wrap"},reactionsNative:{padding:"0 16px"},actions:{display:"flex",marginRight:30,alignItems:"center"}}),h=u?2:3,x=function(r){var x=r.feedItem,k=r.currentUser,v=r.setOpenCommentInput,N=r.setOpenCommentList,b=r.openCommentInput,y=r.openCommentList,I=r.handleToggleLike,L=r.extraActions,j=m(),B=C(),U=x.likes_count,F=x.comments.length,_=(x.likes||[]).find((function(e){var t;return(null===(t=e.user)||void 0===t?void 0:t.id)===k.id})),P=(x.likes||[]).map((function(e){return d.getUserFullName(e.user)})),T=n((x.comments||[]).map((function(e){return d.getUserFullName(e.user)}))),W=o((x.comments||[]).concat(x.likes||[]).map((function(e){return e.user})).sort((function(e){return i(e.created_at).unix()})),"id").slice(0,h),O=!b||!y;return f("div",{className:t(B.reactions,e({},B.reactionsNative,u)),children:g("div",{className:B.actions,children:[f(a,{"data-testid":"".concat("FeedPo","_likeButton"),"aria-label":"Like",onClick:I,className:B.reactionButton,children:f(s,{htmlColor:_?j.palette.primary.main:j.palette.grey[400]})}),f(a,{"data-testid":"".concat("FeedPo","_commentButton"),"aria-label":"Comment",onClick:function(){u?c(x.id):(v(O),N(O))},className:B.reactionButton,children:f(l,{htmlColor:j.palette.grey[400]})}),L,f(p,{likesCount:U,usersWhoLike:P,commentsCount:F,usersWhoCommented:T,activeUsersList:W,onCommentsClick:function(){return N(!y)},small:!0})]})})};export{x as default};
//# sourceMappingURL=Reactions.js.map
