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