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,k=function(r){var k=r.feedItem,x=r.currentUser,v=r.setOpenCommentInput,N=r.setOpenCommentList,b=r.openCommentInput,y=r.openCommentList,I=r.handleToggleLike,L=m(),j=C(),B=k.likes_count,U=k.comments.length,F=(k.likes||[]).find((function(e){var t;return(null===(t=e.user)||void 0===t?void 0:t.id)===x.id})),_=(k.likes||[]).map((function(e){return d.getUserFullName(e.user)})),P=n((k.comments||[]).map((function(e){return d.getUserFullName(e.user)}))),T=o((k.comments||[]).concat(k.likes||[]).map((function(e){return e.user})).sort((function(e){return i(e.created_at).unix()})),"id").slice(0,h),W=!b||!y;return f("div",{className:t(j.reactions,e({},j.reactionsNative,u)),children:g("div",{className:j.actions,children:[f(a,{"data-testid":"".concat("FeedPo","_likeButton"),"aria-label":"Like",onClick:I,className:j.reactionButton,children:f(s,{htmlColor:F?L.palette.primary.main:L.palette.grey[400]})}),f(a,{"data-testid":"".concat("FeedPo","_commentButton"),"aria-label":"Comment",onClick:function(){u?c(k.id):(v(W),N(W))},className:j.reactionButton,children:f(l,{htmlColor:L.palette.grey[400]})}),f(p,{likesCount:B,usersWhoLike:_,commentsCount:U,usersWhoCommented:P,activeUsersList:T,onCommentsClick:function(){return N(!y)},small:!0})]})})};export{k as default};
