"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[2539],{22539:(e,t,a)=>{a.r(t),a.d(t,{default:()=>M});var s=a(71633),n=a.n(s),r=a(36418),c=a.n(r),l=a(14778),o=a(37270),d=a(81911),i=a(65642),u=a(77440),m=a(73969),f=a(14776),b=a(26241),p=a(67173),h=a(45697),E=a(87131),C=a(78451);const S=(0,p.wV)(),k=c().createElement("i",{"data-testid":"scheduledPostIcon",className:"icon icon-draft-indicator icon-clock-send-outline"}),N=c().createElement("i",{"data-testid":"draftIcon",className:"icon icon-draft-indicator icon-pencil-outline"});function v(){const e=(0,o.useDispatch)(),t=(0,r.useRef)(!1),a=(0,o.useSelector)(u.LW),s=(0,o.useSelector)(S),p=(0,o.useSelector)(f.Sy),v=(0,o.useSelector)((e=>(0,m.cn)(e,p,!0))),M=(0,o.useSelector)(m.Ck),g=s>0||M&&v>0,L=(0,o.useSelector)((e=>(0,m.U)(e,p))),{url:_}=(0,d.useRouteMatch)(),w=(0,d.useRouteMatch)("/:team/drafts"),I=(0,d.useRouteMatch)("/:team/"+C.pj),P=Boolean(w||I),D=(0,r.useCallback)((()=>P),[P]);(0,r.useEffect)((()=>{a&&e((0,b.Vp)(p))}),[p,a,e]),(0,r.useEffect)((()=>{const a=!t.current;M&&e((0,i.cT)(p,a)),t.current=!0}),[e,M,p]);const A=M&&v>0,R=(0,r.useMemo)((()=>c().createElement(l.FormattedMessage,{id:"drafts.tooltipText",defaultMessage:"{draftCount, plural, =0 {} =1 {1 Draft} other {{draftCount} Drafts}} <br></br> {scheduledPostCount, plural, =0 {} other {{scheduledPostCount} Scheduled}}",values:{draftCount:s,scheduledPostCount:v,br:e=>s>0&&v>0?c().createElement(c().Fragment,null,c().createElement("br",null),e):null}})),[s,v]);return g||P?c().createElement("ul",{className:"SidebarDrafts NavGroupContent nav nav-pills__container"},c().createElement("li",{className:"SidebarChannel",tabIndex:-1,id:"sidebar-drafts-button"},c().createElement(d.NavLink,{to:`${_}/drafts`,id:"sidebarItem_drafts",activeClassName:"active",draggable:"false",className:"SidebarLink sidebar-item",tabIndex:0,isActive:D},c().createElement("i",{"data-testid":"sendPostIcon",className:"icon icon-send-post icon-send"}),c().createElement("div",{className:"SidebarChannelLinkLabel_wrapper"},c().createElement("span",{className:"SidebarChannelLinkLabel sidebar-item__name"},c().createElement(l.FormattedMessage,{id:"drafts.sidebarLink",defaultMessage:"Drafts"}))),c().createElement(E.A,{title:R},c().createElement("div",null,s>0&&c().createElement(h.A,{unreadMentions:s,icon:N}),A&&c().createElement(h.A,{unreadMentions:v,icon:k,className:n()("scheduledPostBadge",{persistent:L}),hasUrgent:L})))))):null}const M=(0,r.memo)(v)}}]);
//# sourceMappingURL=2539.e2f65412bfd299986188.js.map